INV Material account distribution detail

Description
Categories: BI Publisher, Logistics
Application: Inventory
Source: Material account distribution detail (XML)
Short Name: INVTRDST_XML
DB package: INV_INVTRDST_XMLP_PKG
select  To_Char(mta.transaction_date,'DD-MON-RRRR')                   Txn_date,
        &P_acct_flex                           C_acct_flex0,       
        &P_item_flex                           C_item_flex0,  
        msi.description                        Description,
        &C_type_option                         Type,
        mta.transaction_source_type_id         Type_id, 
 decode(mta.transaction_source_type_id, 
                1,to_char(mmt.transaction_source_id), 
                4,to_char(mmt.transaction_source_id),
                5,to_char(mmt.transaction_source_id), 
                7,to_char(mmt.transaction_source_id), 
                9,to_char(mmt.transaction_source_id), 
                10,to_char(mmt.transaction_source_id), 
                11,to_char(mmt.transaction_source_id), 
                NVL(mmt.transaction_source_name, to_char(mmt.transaction_source_id))
                )  Source,
             decode(mmt.transaction_action_id,
			                 3,
                decode(mmt.organization_id,mta.organization_id,mmt.subinventory_code,
                              mmt.transfer_subinventory),
							  2,
                   decode(sign(mta.primary_quantity),-1,mmt.subinventory_code,1,
                             mmt.transfer_subinventory,mmt.subinventory_code),
							 28,
                   decode(sign(mta.primary_quantity),-1,mmt.subinventory_code,1,
                             mmt.transfer_subinventory,mmt.subinventory_code),
                             5,
                             mmt.SUBINVENTORY_CODE,
                             mmt.subinventory_code)  SubInv,
        decode(mta.transaction_source_type_id,
	     11,mmt.quantity_adjusted,
	         mta.primary_quantity )          Quantity,
        msi.primary_uom_code