DISTRIBUTION_ACCOUNT_ID is null in MMT?

Hi,
I need some help to figure out the root cause for an Internal Order whose dist acct id is null in MMT. Any help is really appreciate!
Thanks in Advance!

Find the following check points:
Bank Defnition in the Cash Management Resp
Branch Defnition
in the Bank account defnition> make sure the Owner is rightly assinged ur desired LE
Within the Access Options> the OU under LE(Owner) is given access to this bank account.
in the Cash account and cash clearing account are entered with correct combinations.
Save each page during defining and updating the values.
If needed map the bank account to the supplier in the supplier pages. Post 12.1.1 take care when assinging bank to supplier and supplier . that is not as simple as 12.0
Hope these things would help u choose corect bank acount and pay.

Similar Messages

  • 10gDB Performance:R12

    Hi,
    I found following activitoes on my ADDM report .. Plz advice
    FINDING 2: 73% impact (13482 seconds)
    SQL statements consuming significant database time were found.
    RECOMMENDATION 1: SQL Tuning, 25% benefit (4640 seconds)
    ACTION: Run SQL Tuning Advisor on the SQL statement with SQL_ID
    "8v8h41b8xypnr".
    RELEVANT OBJECT: SQL statement with SQL_ID 8v8h41b8xypnr and
    PLAN_HASH 3229043654
    SELECT /*+ NOREWRITE */
    DECODE(o310689.ORDER_NUMBER,2020090010,'Exclude',2020090011,'Exclude'
    ,2010090002,'Exclude',2020090012,'Exclude',2020090016,'Exclude',20100
    90006,'Exclude',2010090007,'Exclude',2010090009,'Exclude',2020090032,
    'Exclude',2010090015,'Exclude',2010090019,'Exclude',2020090037,'Exclu
    de',2020090039,'Exclude',2020090040,'Exclude',2010090026,'Exclude',20
    20090046,'Exclude',2010090027,'Exclude',2010090028,'Exclude',20200900
    51,'Exclude',2020090052,'Exclude',2020090060,'Exclude',2020090062,'Ex
    clude',2010090010,'Exclude',2020090036,'Exclude',2020090038,'Exclude'
    ,2020090045,'Exclude',2020090058,'Exclude',2010090033,'Exclude',946,'
    Exclude',91650015,'Exclude',91800718,'Exclude',91800727,'Exclude',918
    00728,'Exclude',91800729,'Exclude',91800733,'Exclude',94620320,'Exclu
    de',94620380,'Exclude',94620393,'Exclude',94620394,'Exclude',94620395
    ,'Exclude',94620400,'Exclude',94620402,'Exclude',94620403,'Exclude',9
    4801118,'Exclude',94801139,'Exclude',94801148,'Exclude',94801153,'Exc
    lude',94801156,'Exclude',94801163,'Exclude',94801164,'Exclude',948011
    74,'Exclude',94801175,'Exclude',94801177,'Exclude',94801178,'Exclude'
    ,94801184,'Exclude',94801185,'Exclude',94801192,'Exclude',94940009,'E
    xclude',99300565,'Exclude',99920099,'Exclude',99920101,'Exclude',9992
    0103,'Exclude',99920105,'Exclude','NULL') as
    C_1,NVL(o310689.SHIPPED_QUANTITY,0)-NVL(o310689.RMA_RECEIVED_QUANTITY
    ,0) as C_2,o310689.ORDER_TYPE as E310693,o310689.ORDERED_DATE as
    E310694,o310689.ORDER_NUMBER as E310695,o310689.ITEM_BRAND as
    E310696,o310689.ITEM_CODE as E310701,o310689.ORDERED_QUANTITY as
    E310702,o310689.SHIPPED_QUANTITY as E310703,o310689.RMA_QUANTITY as
    E310704,o310689.RMA_RECEIVED_QUANTITY as E310705,o310689.UNIT_COST as
    E310706,o310689.DEALER_NAME as E310707,o310689.AUTHORIZED_BY_EMPNO as
    E310708,o310689.AUTHORIZED_BY_NAME as E310709,o310689.RETURN_DAYS as
    E310710,o310689.REMARKS as E310711,o310689.SHIPPING_INSTRUCTIONS as
    E310712,o310689.DELIVERY_ORG as E310715,o310689.ITEM_DESCRIPTION as
    E310719,o310689.ORDER_LINE_STATUS as
    E310884,o310689.SOURCE_DOCUMENT_REF as E333596
    FROM ( select upper(xos1.ORDER_TYPE) ORDER_TYPE
    ,xos1.ORDERED_DATE
    ,xos1.ORDER_NUMBER
    ,xos1.ORDER_LINE_STATUS
    ,xos1.ITEM_BRAND
    ,xos1.ITEM_GROUP
    ,xos1.ITEM_SUB_GROUP
    ,xos1.ITEM_TYPE
    ,xos1.ITEM_SUB_TYPE
    ,xos1.ITEM_CODE
    ,xos1.ITEM_DESCRIPTION
    ,xos1.ORDERED_QUANTITY
    , -1*(select sum(mmts.PRIMARY_QUANTITY) from
    mtl_material_transactions mmts where
    mmts.TRX_SOURCE_LINE_ID=xos1.LINE_ID and
    mmts.TRANSACTION_TYPE_ID=33)SHIPPED_QUANTITY
    ,xos1.UNIT_COST
    ,xos1.HD_CUST_NAME dealer_name
    ,xos1.HD_CUST_ADDR authorized_by_empno
    ,(select full_name from per_all_people_f where
    employee_number=xos1.HD_CUST_ADDR) authorized_by_name
    ,xos1.HD_CUST_MOBNO return_days
    ,xos1.HD_CUST_CONTACT remarks
    ,xos1.SHIPPING_INSTRUCTIONS
    ,xos1.ORGANIZATION_CODE delivery_org
    ,xos1.SOURCE_DOCUMENT_REF
    ,xos2.RMA_quantity
    ,xos2.RMA_received_quantity
    from XXEROS_ONT_SALESORDER_V xos1,(select
    xos3.REFERENCE_HEADER_ID,xos3.REFERENCE_LINE_ID,sum(abs(xos3.ORDERED_
    QUANTITY)) RMA_quantity
    ,sum(abs(xos3.SHIPPED_QUANTITY)) RMA_received_quantity from
    XXEROS_ONT_SALESORDER_V xos3
    where abs(nvl(xos3.SHIPPED_QUANTITY,0))>0
    group by xos3.REFERENCE_HEADER_ID,xos3.REFERENCE_LINE_ID) xos2
    where xos1.HEADER_ID=xos2.REFERENCE_HEADER_ID (+)
    and xos1.LINE_ID=xos2.REFERENCE_LINE_ID (+)
    and (upper(xos1.ORDER_TYPE) like ('%ISSUE TO DEALER%')
    or upper(xos1.ORDER_TYPE) like ('%ISSUE TO SERVICE CENTER%')
    or upper(xos1.ORDER_TYPE) like ('%ISSUE TO SC%')
    or upper(xos1.ORDER_TYPE) like ('%MATERIAL ISSUE%')
    or upper(xos1.ORDER_TYPE) like ('%WAREHOUSE ISSUE%'))
    ) o310689
    WHERE (TRUNC(o310689.ORDERED_DATE) <=
    TO_DATE('20110321000000','YYYYMMDDHH24MISS'))
    AND (o310689.ITEM_CODE LIKE '%%')
    AND (o310689.ORDER_TYPE LIKE '%ISSUE TO DEALER%')
    AND (NVL(o310689.SHIPPED_QUANTITY,0) <>
    NVL(o310689.RMA_RECEIVED_QUANTITY,0))
    ORDER BY o310689.ORDERED_DATE ASC , o310689.ORDER_NUMBER ASC ,
    o310689.DELIVERY_ORG ASC
    RECOMMENDATION 2: SQL Tuning, 17% benefit (3160 seconds)
    ACTION: Tune the PL/SQL block with SQL_ID "d1swc9auhtxwd". Refer to the
    "Tuning PL/SQL Applications" chapter of Oracle's "PL/SQL User's Guide
    and Reference"
    RELEVANT OBJECT: SQL statement with SQL_ID d1swc9auhtxwd
    BEGIN WF_ENGINE.BACKGROUNDCONCURRENT(:errbuf,:rc,:A0,:A1,:A2,:A3,:A4,
    :A5); END;
    RATIONALE: SQL statement with SQL_ID "d1swc9auhtxwd" was executed 1
    times and had an average elapsed time of 3166 seconds.
    RECOMMENDATION 3: SQL Tuning, 17% benefit (3101 seconds)
    ACTION: Tune the PL/SQL block with SQL_ID "gksvm8wmzk8w0". Refer to the
    "Tuning PL/SQL Applications" chapter of Oracle's "PL/SQL User's Guide
    and Reference"
    RELEVANT OBJECT: SQL statement with SQL_ID gksvm8wmzk8w0
    begin OE_INVOICE_WF.INVOICE_INTERFACE (:v1, :v2, :v3, :v4, :v5); end;
    RATIONALE: SQL statement with SQL_ID "gksvm8wmzk8w0" was executed 461
    times and had an average elapsed time of 6.7 seconds.
    RECOMMENDATION 4: SQL Tuning, 15% benefit (2863 seconds)
    ACTION: Run SQL Tuning Advisor on the SQL statement with SQL_ID
    "67uwuf6a7a657".
    RELEVANT OBJECT: SQL statement with SQL_ID 67uwuf6a7a657 and
    PLAN_HASH 3622377863
    SELECT COUNT(1) FROM RA_CUSTOMER_TRX_LINES_ALL RCTL WHERE
    RCTL.INTERFACE_LINE_CONTEXT = 'ORDER ENTRY' AND RCTL.LINE_TYPE =
    'LINE' AND RCTL.INTERFACE_LINE_ATTRIBUTE6 = TO_CHAR(:B2 ) AND
    RCTL.SALES_ORDER = :B1 AND RCTL.SALES_ORDER_LINE IS NOT NULL
    RATIONALE: SQL statement with SQL_ID "67uwuf6a7a657" was executed 462
    times and had an average elapsed time of 4.3 seconds.
    RECOMMENDATION 5: SQL Tuning, 10% benefit (1867 seconds)
    ACTION: Run SQL Tuning Advisor on the SQL statement with SQL_ID
    "9kzwsazsktuzv".
    RELEVANT OBJECT: SQL statement with SQL_ID 9kzwsazsktuzv and
    PLAN_HASH 3342766736
    SELECT end_time, status FROM v$rman_backup_job_details WHERE end_time
    = (select max(end_time) from v$rman_backup_job_details)
    ACTION: Investigate the SQL statement with SQL_ID "9kzwsazsktuzv" for
    possible performance improvements.
    RELEVANT OBJECT: SQL statement with SQL_ID 9kzwsazsktuzv and
    PLAN_HASH 3342766736
    SELECT end_time, status FROM v$rman_backup_job_details WHERE end_time
    = (select max(end_time) from v$rman_backup_job_details)
    RATIONALE: SQL statement with SQL_ID "9kzwsazsktuzv" was executed 28
    times and had an average elapsed time of 64 seconds.
    Thanks

    FINDING 3: 38% impact (7137 seconds)
    Time spent on the CPU by the instance was responsible for a substantial part
    of database time.
    HI,
    ADDM Report-- plz advice ..
    RECOMMENDATION 1: SQL Tuning, 25% benefit (4640 seconds)
    ACTION: Run SQL Tuning Advisor on the SQL statement with SQL_ID
    "8v8h41b8xypnr".
    RELEVANT OBJECT: SQL statement with SQL_ID 8v8h41b8xypnr and
    PLAN_HASH 3229043654
    SELECT /*+ NOREWRITE */
    DECODE(o310689.ORDER_NUMBER,2020090010,'Exclude',2020090011,'Exclude'
    ,2010090002,'Exclude',2020090012,'Exclude',2020090016,'Exclude',20100
    90006,'Exclude',2010090007,'Exclude',2010090009,'Exclude',2020090032,
    'Exclude',2010090015,'Exclude',2010090019,'Exclude',2020090037,'Exclu
    de',2020090039,'Exclude',2020090040,'Exclude',2010090026,'Exclude',20
    20090046,'Exclude',2010090027,'Exclude',2010090028,'Exclude',20200900
    51,'Exclude',2020090052,'Exclude',2020090060,'Exclude',2020090062,'Ex
    clude',2010090010,'Exclude',2020090036,'Exclude',2020090038,'Exclude'
    ,2020090045,'Exclude',2020090058,'Exclude',2010090033,'Exclude',946,'
    Exclude',91650015,'Exclude',91800718,'Exclude',91800727,'Exclude',918
    00728,'Exclude',91800729,'Exclude',91800733,'Exclude',94620320,'Exclu
    de',94620380,'Exclude',94620393,'Exclude',94620394,'Exclude',94620395
    ,'Exclude',94620400,'Exclude',94620402,'Exclude',94620403,'Exclude',9
    4801118,'Exclude',94801139,'Exclude',94801148,'Exclude',94801153,'Exc
    lude',94801156,'Exclude',94801163,'Exclude',94801164,'Exclude',948011
    74,'Exclude',94801175,'Exclude',94801177,'Exclude',94801178,'Exclude'
    ,94801184,'Exclude',94801185,'Exclude',94801192,'Exclude',94940009,'E
    xclude',99300565,'Exclude',99920099,'Exclude',99920101,'Exclude',9992
    0103,'Exclude',99920105,'Exclude','NULL') as
    C_1,NVL(o310689.SHIPPED_QUANTITY,0)-NVL(o310689.RMA_RECEIVED_QUANTITY
    ,0) as C_2,o310689.ORDER_TYPE as E310693,o310689.ORDERED_DATE as
    E310694,o310689.ORDER_NUMBER as E310695,o310689.ITEM_BRAND as
    E310696,o310689.ITEM_CODE as E310701,o310689.ORDERED_QUANTITY as
    E310702,o310689.SHIPPED_QUANTITY as E310703,o310689.RMA_QUANTITY as
    E310704,o310689.RMA_RECEIVED_QUANTITY as E310705,o310689.UNIT_COST as
    E310706,o310689.DEALER_NAME as E310707,o310689.AUTHORIZED_BY_EMPNO as
    E310708,o310689.AUTHORIZED_BY_NAME as E310709,o310689.RETURN_DAYS as
    E310710,o310689.REMARKS as E310711,o310689.SHIPPING_INSTRUCTIONS as
    E310712,o310689.DELIVERY_ORG as E310715,o310689.ITEM_DESCRIPTION as
    E310719,o310689.ORDER_LINE_STATUS as
    E310884,o310689.SOURCE_DOCUMENT_REF as E333596
    FROM ( select upper(xos1.ORDER_TYPE) ORDER_TYPE
    ,xos1.ORDERED_DATE
    ,xos1.ORDER_NUMBER
    ,xos1.ORDER_LINE_STATUS
    ,xos1.ITEM_BRAND
    ,xos1.ITEM_GROUP
    ,xos1.ITEM_SUB_GROUP
    ,xos1.ITEM_TYPE
    ,xos1.ITEM_SUB_TYPE
    ,xos1.ITEM_CODE
    ,xos1.ITEM_DESCRIPTION
    ,xos1.ORDERED_QUANTITY
    , -1*(select sum(mmts.PRIMARY_QUANTITY) from
    mtl_material_transactions mmts where
    mmts.TRX_SOURCE_LINE_ID=xos1.LINE_ID and
    mmts.TRANSACTION_TYPE_ID=33)SHIPPED_QUANTITY
    ,xos1.UNIT_COST
    ,xos1.HD_CUST_NAME dealer_name
    ,xos1.HD_CUST_ADDR authorized_by_empno
    ,(select full_name from per_all_people_f where
    employee_number=xos1.HD_CUST_ADDR) authorized_by_name
    ,xos1.HD_CUST_MOBNO return_days
    ,xos1.HD_CUST_CONTACT remarks
    ,xos1.SHIPPING_INSTRUCTIONS
    ,xos1.ORGANIZATION_CODE delivery_org
    ,xos1.SOURCE_DOCUMENT_REF
    ,xos2.RMA_quantity
    ,xos2.RMA_received_quantity
    from XXEROS_ONT_SALESORDER_V xos1,(select
    xos3.REFERENCE_HEADER_ID,xos3.REFERENCE_LINE_ID,sum(abs(xos3.ORDERED_
    QUANTITY)) RMA_quantity
    ,sum(abs(xos3.SHIPPED_QUANTITY)) RMA_received_quantity from
    XXEROS_ONT_SALESORDER_V xos3
    where abs(nvl(xos3.SHIPPED_QUANTITY,0))>0
    group by xos3.REFERENCE_HEADER_ID,xos3.REFERENCE_LINE_ID) xos2
    where xos1.HEADER_ID=xos2.REFERENCE_HEADER_ID (+)
    and xos1.LINE_ID=xos2.REFERENCE_LINE_ID (+)
    and (upper(xos1.ORDER_TYPE) like ('%ISSUE TO DEALER%')
    or upper(xos1.ORDER_TYPE) like ('%ISSUE TO SERVICE CENTER%')
    or upper(xos1.ORDER_TYPE) like ('%ISSUE TO SC%')
    or upper(xos1.ORDER_TYPE) like ('%MATERIAL ISSUE%')
    or upper(xos1.ORDER_TYPE) like ('%WAREHOUSE ISSUE%'))
    ) o310689
    WHERE (TRUNC(o310689.ORDERED_DATE) <=
    TO_DATE('20110321000000','YYYYMMDDHH24MISS'))
    AND (o310689.ITEM_CODE LIKE '%%')
    AND (o310689.ORDER_TYPE LIKE '%ISSUE TO DEALER%')
    AND (NVL(o310689.SHIPPED_QUANTITY,0) <>
    NVL(o310689.RMA_RECEIVED_QUANTITY,0))
    ORDER BY o310689.ORDERED_DATE ASC , o310689.ORDER_NUMBER ASC ,
    o310689.DELIVERY_ORG ASC
    RECOMMENDATION 2: SQL Tuning, 17% benefit (3071 seconds)
    ACTION: Tune the PL/SQL block with SQL_ID "gksvm8wmzk8w0". Refer to the
    "Tuning PL/SQL Applications" chapter of Oracle's "PL/SQL User's Guide
    and Reference"
    RELEVANT OBJECT: SQL statement with SQL_ID gksvm8wmzk8w0
    begin OE_INVOICE_WF.INVOICE_INTERFACE (:v1, :v2, :v3, :v4, :v5); end;
    RATIONALE: SQL statement with SQL_ID "gksvm8wmzk8w0" was executed 461
    times and had an average elapsed time of 6.7 seconds.
    RATIONALE: Average CPU used per execution was 6.6 seconds.
    RECOMMENDATION 3: SQL Tuning, 10% benefit (1867 seconds)
    ACTION: Run SQL Tuning Advisor on the SQL statement with SQL_ID
    "9kzwsazsktuzv".
    RELEVANT OBJECT: SQL statement with SQL_ID 9kzwsazsktuzv and
    PLAN_HASH 3342766736
    SELECT end_time, status FROM v$rman_backup_job_details WHERE end_time
    = (select max(end_time) from v$rman_backup_job_details)
    ACTION: Investigate the SQL statement with SQL_ID "9kzwsazsktuzv" for
    possible performance improvements.
    RELEVANT OBJECT: SQL statement with SQL_ID 9kzwsazsktuzv and
    PLAN_HASH 3342766736
    SELECT end_time, status FROM v$rman_backup_job_details WHERE end_time
    = (select max(end_time) from v$rman_backup_job_details)
    RATIONALE: SQL statement with SQL_ID "9kzwsazsktuzv" was executed 28
    times and had an average elapsed time of 64 seconds.
    RATIONALE: Average CPU used per execution was 23 seconds.
    FINDING 4: 26% impact (4808 seconds)
    Individual database segments responsible for significant user I/O wait were
    found.
    RECOMMENDATION 1: Segment Tuning, 9.6% benefit (1776 seconds)
    ACTION: Investigate application logic involving I/O on TABLE
    "ONT.OE_ORDER_LINES_ALL" with object id 41455.
    RELEVANT OBJECT: database object with id 41455
    RATIONALE: The I/O usage statistics for the object are: 2 full object
    scans, 1348462 physical reads, 1574 physical writes and 0 direct
    reads.
    RATIONALE: The SQL statement with SQL_ID "avs0dw5k4jggq" spent
    significant time waiting for User I/O on the hot object.
    RELEVANT OBJECT: SQL statement with SQL_ID avs0dw5k4jggq
    select HLINE_ID from XXCOGNOS_SALES_ORDER_LIST_ALL
    RATIONALE: The SQL statement with SQL_ID "cajftann925ju" spent
    significant time waiting for User I/O on the hot object.
    RELEVANT OBJECT: SQL statement with SQL_ID cajftann925ju
    INSERT INTO XXCUST.XXWSH_DELIVERY_NOTE ( RECORD_IDENTIFIER ,
    ORDER_NUMBER , DELIVERY_ID , SHIP_TO_SITE_USE_ID , DELIVERY_NAME ,
    HEADER_ID , DEL_DATE , SALES_CHANNEL_CODE , INVENTORY_ITEM_ID ,
    ORDERED_ITEM , ITEM_DESCRIPTION , CUST_PO_NUMBER , SHIP_INS ,
    ORDERED_DATE , PRINT_STATUS , DELIVER_NUMBER , PICKED_QUANTITY ,
    BALANCE_QTY ) SELECT :b1 , OOH.ORDER_NUMBER , WDA.DELIVERY_ID ,
    WDD.SHIP_TO_SITE_USE_ID , WND.NAME , WDD.SOURCE_HEADER_ID , TO_DATE
    (WND.ATTRIBUTE12 ) DEL_DATE , OOH.SALES_CHANNEL_CODE ,
    WDD.INVENTORY_ITEM_ID , OOL.ORDERED_ITEM , WDD.ITEM_DESCRIPTION ,
    OOH.CUST_PO_NUMBER , ' ' || OOH.ATTRIBUTE1
    || '/ ' || OOH.ATTRIBUTE3 || '/ ' || OOH.ATTRIBUTE7 || '/ '
    || OOH.ATTRIBUTE6 || '/ ' || OOH.ATTRIBUTE2 || '/ ' ||
    OOH.ATTRIBUTE5 || '/ ' || OOH.SHIPPING_INSTRUCTIONS SHIPINS ,
    TRUNC (OOH.ORDERED_DATE ) ORDERED_DATE , WND.ATTRIBUTE14 ,
    WND.ATTRIBUTE13 , SUM (WDD.PICKED_QUANTITY) PICKED_QUANTITY , SUM
    (WDD.REQUESTED_QUANTITY - WDD.PICKED_QUANTITY ) BALANCE_QTY FROM
    OE_ORDER_HEADERS_ALL OOH , OE_ORDER_LINES_ALL OOL ,
    WSH_NEW_DELIVERIES WND , WSH_DELIVERY_ASSIGNMENTS WDA ,
    WSH_DELIVERY_DETAILS WDD WHERE WND.DELIVERY_ID = WDA.DELIVERY_ID
    AND WDA.DELIVERY_DETAIL_ID = WDD.DELIVERY_DETAIL_ID AND
    OOH.HEADER_ID = WDD.SOURCE_HEADER_ID AND OOL.LINE_ID =
    WDD.SOURCE_LINE_ID AND OOL.HEADER_ID = WDD.SOURCE_HEADER_ID AND
    OOH.HEADER_ID = OOL.HEADER_ID AND OOH.ORG_ID = OOL.ORG_ID AND
    WDD.SOURCE_CODE = 'OE' AND RELEASED_STATUS IN ( 'C' , 'I' , 'Y' )
    AND NVL(OOH.SALES_CHANNEL_CODE , 'DLY_NOTE' ) = 'DLY_NOTE' AND
    OOL.SHIP_FROM_ORG_ID = :b2 AND OOH.ORDER_NUMBER BETWEEN NVL(:b3 ,
    OOH.ORDER_NUMBER ) AND NVL(:b4 , OOH.ORDER_NUMBER ) AND
    WND.DELIVERY_ID IN (SELECT DELIVERY_ID FROM WSH_TRIP_STOPS STP ,
    WSH_DELIVERY_LEGS LEG , WSH_TRIPS WT WHERE LEG.PICK_UP_STOP_ID =
    STP.STOP_ID AND STP.TRIP_ID = WT.TRIP_ID AND WT.TRIP_ID = NVL(:b5
    , WT.TRIP_ID ) ) AND WND.ATTRIBUTE14 IS NULL GROUP BY
    OOH.ORDER_NUMBER , WDA.DELIVERY_ID , WDD.SHIP_TO_SITE_USE_ID ,
    WND.NAME , WDD.SOURCE_HEADER_ID , WND.ATTRIBUTE12 ,
    OOH.SALES_CHANNEL_CODE , WDD.INVENTORY_ITEM_ID , OOL.ORDERED_ITEM ,
    WDD.ITEM_DESCRIPTION , OOH.CUST_PO_NUMBER , '
    ' || OOH.ATTRIBUTE1 || '/ ' || OOH.ATTRIBUTE3 || '/ ' ||
    OOH.ATTRIBUTE7 || '/ ' || OOH.ATTRIBUTE6 || '/ ' ||
    OOH.ATTRIBUTE2 || '/ ' || OOH.ATTRIBUTE5 || '/ ' ||
    OOH.SHIPPING_INSTRUCTIONS , TRUNC (OOH.ORDERED_DATE ) ,
    WND.ATTRIBUTE14 , WND.ATTRIBUTE13
    RATIONALE: The SQL statement with SQL_ID "4m39p9a78z133" spent
    significant time waiting for User I/O on the hot object.
    RELEVANT OBJECT: SQL statement with SQL_ID 4m39p9a78z133
    SELECT OOD.OPERATING_UNIT ORG_ID, TRUNC (OOLV.CREATION_DATE)
    CREATED_DT, TRUNC (OOLV.LAST_UPDATE_DATE) UPDATED_DT, ABS
    (MMT.PRIMARY_QUANTITY) QTY, MMT.CREATED_BY CREATED_BY,
    MMT.LAST_UPDATED_BY UPDATED_BY, MMT.INVENTORY_ITEM_ID ITEM_NAME,
    MMT.TRANSACTION_UOM UOM, MMT.ACTUAL_COST COST1, 6717 DR_ACCOUNT_ID,
    MPS.MATERIAL_ACCOUNT CR_ACCOUNT_ID , TRUNC (MMT.TRANSACTION_DATE)
    TXN_DATE, MMT.SOURCE_LINE_ID LINE_ID, OOHA.ATTRIBUTE1 PRJ_NO, 'COST'
    TASK1, DECODE (OOHA.ORDER_TYPE_ID, 1042, 'Equipment', 1201,
    'Material', NULL ) EXP_TYPE, MMT.SOURCE_LINE_ID ORIG_TRANS_REF,
    OOLV.LINE_NUMBER REQUEST_NUMBER, NULL UNMATCHED_NEGATIVE_TXN_FLAG,
    MMT.DISTRIBUTION_ACCOUNT_ID, MMT.TRANSACTION_ID FROM
    OE_ORDER_LINES_ALL OOLV, OE_ORDER_HEADERS_ALL OOHA,
    MTL_MATERIAL_TRANSACTIONS MMT, MTL_TRANSACTION_TYPES MTT,
    ORG_ORGANIZATION_DEFINITIONS OOD, MTL_PARAMETERS MPS WHERE
    OOLV.LINE_ID = MMT.TRX_SOURCE_LINE_ID AND OOLV.HEADER_ID =
    OOHA.HEADER_ID AND MMT.TRANSACTION_TYPE_ID = MTT.TRANSACTION_TYPE_ID
    AND OOHA.CONTEXT = 'Project Transfer' AND OOHA.ATTRIBUTE1 IS NOT NULL
    AND NVL (MMT.ATTRIBUTE15, 'X') <> 'TRANSFERRED_TO_PROJECT' AND
    MTT.TRANSACTION_TYPE_ID = 33 AND OOD.ORGANIZATION_ID =
    MPS.ORGANIZATION_ID AND MMT.ORGANIZATION_ID = OOD.ORGANIZATION_ID AND
    OOHA.ORDER_TYPE_ID IN (1042, 1201) AND MMT.COSTED_FLAG IS NULL UNION
    ALL SELECT OOD.OPERATING_UNIT ORG_ID, TRUNC (OOLV.CREATION_DATE)
    CREATED_DT, TRUNC (OOLV.LAST_UPDATE_DATE) UPDATED_DT,
    (MMT.TRANSACTION_QUANTITY * -1 ) QTY, MMT.CREATED_BY CREATED_BY,
    MMT.LAST_UPDATED_BY UPDATED_BY, MMT.INVENTORY_ITEM_ID ITEM_NAME,
    MMT.TRANSACTION_UOM UOM, MMT.ACTUAL_COST COST1, MPS.MATERIAL_ACCOUNT
    DR_ACCOUNT_ID, 6717 CR_ACCOUNT_ID , TRUNC (MMT.TRANSACTION_DATE)
    TXN_DATE, MMT.SOURCE_LINE_ID LINE_ID, OOHA.ATTRIBUTE1 PRJ_NO, 'COST'
    TASK1, DECODE (OOHA.ORDER_TYPE_ID, 1042, 'Equipment', 1201,
    'Material', 1239, 'Equipment', 1240, 'Material', NULL ) EXP_TYPE,
    MMT.SOURCE_LINE_ID ORIG_TRANS_REF, OOLV.LINE_NUMBER REQUEST_NUMBER,
    'Y' UNMATCHED_NEGATIVE_TXN_FLAG, MMT.DISTRIBUTION_ACCOUNT_ID,
    MMT.TRANSACTION_ID FROM OE_ORDER_LINES_ALL OOLV, OE_ORDER_LINES_ALL
    OOLR, OE_ORDER_HEADERS_ALL OOHA, MTL_MATERIAL_TRANSACTIONS MMT,
    MTL_TRANSACTION_TYPES MTT, ORG_ORGANIZATION_DEFINITIONS OOD,
    MTL_PARAMETERS MPS WHERE MMT.TRX_SOURCE_LINE_ID = OOLV.LINE_ID AND
    OOLV.HEADER_ID = OOHA.HEADER_ID AND MMT.TRANSACTION_TYPE_ID =
    MTT.TRANSACTION_TYPE_ID AND OOHA.CONTEXT = 'Project Transfer' AND
    OOHA.ATTRIBUTE1 IS NOT NULL AND NVL (MMT.ATTRIBUTE15, 'X') <>
    'TRANSFERRED_TO_PROJECT' AND MTT.TRANSACTION_TYPE_ID = 15 AND
    OOD.ORGANIZATION_ID = MPS.ORGANIZATION_ID AND MMT.ORGANIZATION_ID =
    OOD.ORGANIZATION_ID AND OOLV.REFERENCE_HEADER_ID = OOLR.HEADER_ID AND
    OOLV.REFERENCE_LINE_ID = OOLR.LINE_ID AND OOHA.ORDER_TYPE_ID IN
    (1239, 1240) AND MMT.COSTED_FLAG IS NULL
    RATIONALE: The SQL statement with SQL_ID "8ms1bza9t8vww" spent
    significant time waiting for User I/O on the hot object.
    RELEVANT OBJECT: SQL statement with SQL_ID 8ms1bza9t8vww
    select TRX_LINE from XXCOGNOS_SO_INV_NEW_V
    RECOMMENDATION 2: Segment Tuning, 4.9% benefit (903 seconds)
    ACTION: Run "Segment Advisor" on TABLE "AR.RA_CUSTOMER_TRX_LINES_ALL"
    with object id 29149.
    RELEVANT OBJECT: database object with id 29149
    ACTION: Investigate application logic involving I/O on TABLE
    "AR.RA_CUSTOMER_TRX_LINES_ALL" with object id 29149.
    RELEVANT OBJECT: database object with id 29149
    RATIONALE: The I/O usage statistics for the object are: 486 full object
    scans, 64008942 physical reads, 63 physical writes and 0 direct
    reads.
    RATIONALE: The SQL statement with SQL_ID "gksvm8wmzk8w0" spent
    significant time waiting for User I/O on the hot object.
    RELEVANT OBJECT: SQL statement with SQL_ID gksvm8wmzk8w0
    begin OE_INVOICE_WF.INVOICE_INTERFACE (:v1, :v2, :v3, :v4, :v5); end;
    RECOMMENDATION 3: Segment Tuning, 4.5% benefit (831 seconds)
    ACTION: Investigate application logic involving I/O on TABLE
    "INV.MTL_MATERIAL_TRANSACTIONS" with object id 38612.
    RELEVANT OBJECT: database object with id 38612
    RATIONALE: The I/O usage statistics for the object are: 0 full object
    scans, 71252528 physical reads, 117 physical writes and 0 direct
    reads.
    RATIONALE: The SQL statement with SQL_ID "8v8h41b8xypnr" spent
    significant time waiting for User I/O on the hot object.
    RELEVANT OBJECT: SQL statement with SQL_ID 8v8h41b8xypnr
    SELECT /*+ NOREWRITE */
    DECODE(o310689.ORDER_NUMBER,2020090010,'Exclude',2020090011,'Exclude'
    ,2010090002,'Exclude',2020090012,'Exclude',2020090016,'Exclude',20100
    90006,'Exclude',2010090007,'Exclude',2010090009,'Exclude',2020090032,
    'Exclude',2010090015,'Exclude',2010090019,'Exclude',2020090037,'Exclu
    de',2020090039,'Exclude',2020090040,'Exclude',2010090026,'Exclude',20
    20090046,'Exclude',2010090027,'Exclude',2010090028,'Exclude',20200900
    51,'Exclude',2020090052,'Exclude',2020090060,'Exclude',2020090062,'Ex
    clude',2010090010,'Exclude',2020090036,'Exclude',2020090038,'Exclude'
    ,2020090045,'Exclude',2020090058,'Exclude',2010090033,'Exclude',946,'
    Exclude',91650015,'Exclude',91800718,'Exclude',91800727,'Exclude',918
    00728,'Exclude',91800729,'Exclude',91800733,'Exclude',94620320,'Exclu
    de',94620380,'Exclude',94620393,'Exclude',94620394,'Exclude',94620395
    ,'Exclude',94620400,'Exclude',94620402,'Exclude',94620403,'Exclude',9
    4801118,'Exclude',94801139,'Exclude',94801148,'Exclude',94801153,'Exc
    lude',94801156,'Exclude',94801163,'Exclude',94801164,'Exclude',948011
    74,'Exclude',94801175,'Exclude',94801177,'Exclude',94801178,'Exclude'
    ,94801184,'Exclude',94801185,'Exclude',94801192,'Exclude',94940009,'E
    xclude',99300565,'Exclude',99920099,'Exclude',99920101,'Exclude',9992
    0103,'Exclude',99920105,'Exclude','NULL') as
    C_1,NVL(o310689.SHIPPED_QUANTITY,0)-NVL(o310689.RMA_RECEIVED_QUANTITY
    ,0) as C_2,o310689.ORDER_TYPE as E310693,o310689.ORDERED_DATE as
    E310694,o310689.ORDER_NUMBER as E310695,o310689.ITEM_BRAND as
    E310696,o310689.ITEM_CODE as E310701,o310689.ORDERED_QUANTITY as
    E310702,o310689.SHIPPED_QUANTITY as E310703,o310689.RMA_QUANTITY as
    E310704,o310689.RMA_RECEIVED_QUANTITY as E310705,o310689.UNIT_COST as
    E310706,o310689.DEALER_NAME as E310707,o310689.AUTHORIZED_BY_EMPNO as
    E310708,o310689.AUTHORIZED_BY_NAME as E310709,o310689.RETURN_DAYS as
    E310710,o310689.REMARKS as E310711,o310689.SHIPPING_INSTRUCTIONS as
    E310712,o310689.DELIVERY_ORG as E310715,o310689.ITEM_DESCRIPTION as
    E310719,o310689.ORDER_LINE_STATUS as
    E310884,o310689.SOURCE_DOCUMENT_REF as E333596
    FROM ( select upper(xos1.ORDER_TYPE) ORDER_TYPE
    ,xos1.ORDERED_DATE
    ,xos1.ORDER_NUMBER
    ,xos1.ORDER_LINE_STATUS
    ,xos1.ITEM_BRAND
    ,xos1.ITEM_GROUP
    ,xos1.ITEM_SUB_GROUP
    ,xos1.ITEM_TYPE
    ,xos1.ITEM_SUB_TYPE
    ,xos1.ITEM_CODE
    ,xos1.ITEM_DESCRIPTION
    ,xos1.ORDERED_QUANTITY
    , -1*(select sum(mmts.PRIMARY_QUANTITY) from
    mtl_material_transactions mmts where
    mmts.TRX_SOURCE_LINE_ID=xos1.LINE_ID and
    mmts.TRANSACTION_TYPE_ID=33)SHIPPED_QUANTITY
    ,xos1.UNIT_COST
    ,xos1.HD_CUST_NAME dealer_name
    ,xos1.HD_CUST_ADDR authorized_by_empno
    ,(select full_name from per_all_people_f where
    employee_number=xos1.HD_CUST_ADDR) authorized_by_name
    ,xos1.HD_CUST_MOBNO return_days
    ,xos1.HD_CUST_CONTACT remarks
    ,xos1.SHIPPING_INSTRUCTIONS
    ,xos1.ORGANIZATION_CODE delivery_org
    ,xos1.SOURCE_DOCUMENT_REF
    ,xos2.RMA_quantity
    ,xos2.RMA_received_quantity
    from XXEROS_ONT_SALESORDER_V xos1,(select
    xos3.REFERENCE_HEADER_ID,xos3.REFERENCE_LINE_ID,sum(abs(xos3.ORDERED_
    QUANTITY)) RMA_quantity
    ,sum(abs(xos3.SHIPPED_QUANTITY)) RMA_received_quantity from
    XXEROS_ONT_SALESORDER_V xos3
    where abs(nvl(xos3.SHIPPED_QUANTITY,0))>0
    group by xos3.REFERENCE_HEADER_ID,xos3.REFERENCE_LINE_ID) xos2
    where xos1.HEADER_ID=xos2.REFERENCE_HEADER_ID (+)
    and xos1.LINE_ID=xos2.REFERENCE_LINE_ID (+)
    and (upper(xos1.ORDER_TYPE) like ('%ISSUE TO DEALER%')
    or upper(xos1.ORDER_TYPE) like ('%ISSUE TO SERVICE CENTER%')
    or upper(xos1.ORDER_TYPE) like ('%ISSUE TO SC%')
    or upper(xos1.ORDER_TYPE) like ('%MATERIAL ISSUE%')
    or upper(xos1.ORDER_TYPE) like ('%WAREHOUSE ISSUE%'))
    ) o310689
    WHERE (TRUNC(o310689.ORDERED_DATE) <=
    TO_DATE('20110321000000','YYYYMMDDHH24MISS'))
    AND (o310689.ITEM_CODE LIKE '%%')
    AND (o310689.ORDER_TYPE LIKE '%ISSUE TO DEALER%')
    AND (NVL(o310689.SHIPPED_QUANTITY,0) <>
    NVL(o310689.RMA_RECEIVED_QUANTITY,0))
    ORDER BY o310689.ORDERED_DATE ASC , o310689.ORDER_NUMBER ASC ,
    o310689.DELIVERY_ORG ASC
    RECOMMENDATION 4: Segment Tuning, 4.1% benefit (768 seconds)
    ACTION: Run "Segment Advisor" on TABLE "AR.RA_INTERFACE_LINES_ALL" with
    object id 28266.
    RELEVANT OBJECT: database object with id 28266
    ACTION: Investigate application logic involving I/O on TABLE
    "AR.RA_INTERFACE_LINES_ALL" with object id 28266.
    RELEVANT OBJECT: database object with id 28266
    RATIONALE: The I/O usage statistics for the object are: 49184 full
    object scans, 78734476 physical reads, 610 physical writes and
    36573343 direct reads.
    RATIONALE: The SQL statement with SQL_ID "gksvm8wmzk8w0" spent
    significant time waiting for User I/O on the hot object.
    RELEVANT OBJECT: SQL statement with SQL_ID gksvm8wmzk8w0
    begin OE_INVOICE_WF.INVOICE_INTERFACE (:v1, :v2, :v3, :v4, :v5); end;
    RECOMMENDATION 5: Segment Tuning, 2.9% benefit (530 seconds)
    ACTION: Investigate application logic involving I/O on TABLE
    "INV.MTL_SYSTEM_ITEMS_B" with object id 38489.
    RELEVANT OBJECT: database object with id 38489
    RATIONALE: The I/O usage statistics for the object are: 4 full object
    scans, 1288002 physical reads, 451 physical writes and 0 direct
    reads.
    RATIONALE: The SQL statement with SQL_ID "abwz9n6zhfau7" spent
    significant time waiting for User I/O on the hot object.
    RELEVANT OBJECT: SQL statement with SQL_ID abwz9n6zhfau7
    SELECT DISTINCT /*+ NOREWRITE */
    NVL(o253810.ATR,0)-NVL(o253810.UNRES_QTY,0) as C_1,o253810.WAREHOUSE
    as E253811,o253810.BRAND as E253812,o253810.GROUPCODE as
    E253813,o253810.SUBGROUP as E253814,o253810.TYPE as
    E253815,o253810.SUBTYPE as E253816,o253810.ITEM_CODE as
    E253817,o253810.ITEM_NAME as E253818,o253810.UNRES_QTY as
    E253819,o253810.STOCK as E253820,o253810.ATR as
    E253821,o253810.RESERVED as E253822,o253810.TOTAL as E253823
    FROM APPS.XX_STOCK_V o253810
    WHERE (o253810.ITEM_CODE LIKE '%%')
    ORDER BY o253810.ITEM_CODE ASC
    RATIONALE: The SQL statement with SQL_ID "5yvpw0g5cusff" spent
    significant time waiting for User I/O on the hot object.
    RELEVANT OBJECT: SQL statement with SQL_ID 5yvpw0g5cusff
    SELECT DISTINCT /*+ NOREWRITE */
    NVL(o253810.ATR,0)-NVL(o253810.UNRES_QTY,0) as C_1,o253810.WAREHOUSE
    as E253811,o253810.BRAND as E253812,o253810.GROUPCODE as
    E253813,o253810.SUBGROUP as E253814,o253810.ITEM_CODE as
    E253817,o253810.ITEM_NAME as E253818,o253810.UNRES_QTY as
    E253819,o253810.STOCK as E253820,o253810.ATR as
    E253821,o253810.RESERVED as E253822,o253810.TOTAL as
    E253823,o255805.PRICE as E255816
    FROM APPS.XX_STOCK_V o253810,
    ( SELECT CUSTOMER_ITEM_ID,product_attr_val_disp
    ITEM_CODE,PRODUCT_UOM_CODE,PRIMARY_UOM_FLAG,BREAK_UOM_CODE,BREAK_UOM_
    CONTEXT,OPERAND PRICE,START_DATE_ACTIVE,
    END_DATE_ACTIVE,MODIFIER_LEVEL_CODE,PRODUCT_PRECEDENCE,COMMENTS,REVIS
    ION,REVISION_DATE,REVISION_REASON_CODE,ROW_ID,PRODUCT_ATTRIBUTE_CONTE
    XT,
    PRODUCT_ATTRIBUTE,BREAK_UOM_ATTRIBUTE,PRODUCT_ATTR_VALUE,INCOMPATIBIL
    ITY_GRP_CODE,LIST_LINE_NO,PRICING_GROUP_SEQUENCE,ACCRUAL_FLAG,PRICING
    PHASEID,
    AUTOMATIC_FLAG,PRICE_BY_FORMULA_ID,INVENTORY_ITEM_ID,ORGANIZATION_ID,
    RELATED_ITEM_ID,RELATIONSHIP_TYPE_ID,SUBSTITUTION_CONTEXT,SUBSTITUTIO
    N_ATTRIBUTE,
    SUBSTITUTION_VALUE,CREATION_DATE,CREATED_BY,LAST_UPDATE_DATE,LAST_UPD
    ATED_BY,LAST_UPDATE_LOGIN,PROGRAM_APPLICATION_ID,PROGRAM_ID,PROGRAM_U
    PDATE_DATE,
    REQUEST_ID,LIST_HEADER_ID,LIST_LINE_ID,PRICE_BREAK_TYPE_CODE,NUMBER_E
    FFECTIVE_PERIODS,EFFECTIVE_PERIOD_UOM,OVERRIDE_FLAG,PRINT_ON_INVOICE_
    FLAG,
    REBATE_TRANSACTION_TYPE_CODE,BASE_QTY,BASE_UOM_CODE,ACCRUAL_QTY,ACCRU
    AL_UOM_CODE,ESTIM_ACCRUAL_RATE,GENERATE_USING_FORMULA_ID,REPRICE_FLAG
    ,CONTEXT,
    ATTRIBUTE1,ATTRIBUTE2,ATTRIBUTE3,ATTRIBUTE4,ATTRIBUTE5,ATTRIBUTE6,ATT
    RIBUTE7,ATTRIBUTE8,ATTRIBUTE9,ATTRIBUTE10,ATTRIBUTE11,ATTRIBUTE12,ATT
    RIBUTE13,
    ATTRIBUTE14,ATTRIBUTE15,PRICING_ATTRIBUTE_ID,PRICING_ATTRIBUTE_CONTEX
    T,PRICING_ATTRIBUTE,PRICING_ATTR_VALUE_FROM,PRICING_ATTR_VALUE_TO,PRO
    DUCT_ID,
    LIST_PRICE,PERCENT_PRICE,ARITHMETIC_OPERATOR,LIST_LINE_TYPE_CODE,prod
    uct_attribute_datatype,pricing_attribute_datatype,comparison_operator
    _code,
    ATTR_CONTEXT,ATTR_ATTRIBUTE1,ATTR_ATTRIBUTE2,ATTR_ATTRIBUTE3,ATTR_ATT
    RIBUTE4,ATTR_ATTRIBUTE5,ATTR_ATTRIBUTE6,ATTR_ATTRIBUTE7,ATTR_ATTRIBUT
    E8,
    ATTR_ATTRIBUTE9,ATTR_ATTRIBUTE10,ATTR_ATTRIBUTE11,ATTR_ATTRIBUTE12,AT
    TR_ATTRIBUTE13,ATTR_ATTRIBUTE14,ATTR_ATTRIBUTE15,ATTR_CREATION_DATE,
    ATTR_CREATED_BY,ATTR_LAST_UPDATE_DATE,ATTR_LAST_UPDATED_BY,ATTR_LAST_
    UPDATE_LOGIN,ATTR_PROGRAM_APPLICATION_ID,ATTR_PROGRAM_ID,ATTR_PROGRAM
    UPDATEDATE,
    ATTR_REQUEST_ID,PA_LIST_HEADER_ID,CONTINUOUS_PRICE_BREAK_FLAG FROM
    qp_list_lines_v WHERE PRODUCT_ATTRIBUTE_CONTEXT = 'ITEM'
    AND EXISTS (SELECT '1' FROM MTL_SYSTEM_ITEMS mtl WHERE
    product_attr_value = mtl.inventory_item_id AND mtl.organization_id =
    (SELECT qp_util.get_item_validation_org FROM Dual)
    AND product_attribute= 'PRICING_ATTRIBUTE1' UNION SELECT '1' FROM
    dual WHERE product_attribute != 'PRICING_ATTRIBUTE1')
    and (LIST_HEADER_ID=6016) and (PA_LIST_HEADER_ID='6016')
    ) o255805
    WHERE ( (o255805.ITEM_CODE = o253810.ITEM_CODE))
    AND (o253810.ITEM_CODE LIKE '%%')
    AND (o255805.END_DATE_ACTIVE IS NULL )
    ORDER BY o253810.ITEM_CODE ASC
    RATIONALE: The SQL statement with SQL_ID "8ms1bza9t8vww" spent
    significant time waiting for User I/O on the hot object.
    RELEVANT OBJECT: SQL statement with SQL_ID 8ms1bza9t8vww
    select TRX_LINE from XXCOGNOS_SO_INV_NEW_V
    SYMPTOMS THAT LED TO THE FINDING:
    SYMPTOM: Wait class "User I/O" was consuming significant database time.
    (43% impact [7964 seconds])

  • Why I am not getting the correct Account

    I want to get the account of an item from sales order. The account should be the one that from fnd_flex_values_vl with set name XX_ACCOUNT.
    This is my query:
    select
    ooh.transactional_curr_code,
    gcc.segment1, gcc.segment2, gcc.segment3, gcc.segment4, gcc.segment5 account,
    ooh.order_number so_number, ooh.header_id
    from
    mtl_parameters mp,
    gl_code_combinations gcc,
    mtl_transaction_types mtt,
    mtl_material_transactions mmt,
    mtl_system_items msi,
    ( select order_number, transactional_curr_code, ship_to_org_id, header_id from oe_order_headers_all where order_number = 12345678 ) ooh,
    oe_order_lines_all ool
    where 1=1
    and mmt.distribution_account_id = gcc.code_combination_id
    and mmt.transaction_type_id = mtt.transaction_type_id
    and mmt.organization_id = mp.organization_id
    and mmt.inventory_item_id = msi.inventory_item_id
    and mmt.organization_id = msi.organization_id
    and ooh.header_id = ool.header_id
    and mmt.trx_source_line_id = ool.line_id
    and mmt.inventory_item_id = ool.inventory_item_id

    Perhaps you mean the Sales Account defined in the item master?
    Example:
    select
    ooh.header_id,
    ooh.order_number so_number,
    ool.line_id,
    ool.line_number || '.' || ool.shipment_number as line_number,
    ooh.transactional_curr_code,
    msi.segment1 as item,
    gcc.concatenated_segments sales_account
    from
    oe_order_headers_all ooh,
    oe_order_lines_all ool,
    mtl_system_items msi,
    gl_code_combinations_kfv gcc
    where 1=1
    and ooh.header_id = ool.header_id
    and ool.inventory_item_id = msi.inventory_item_id
    and ool.ship_from_org_id = msi.organization_id
    and msi.sales_account = gcc.code_combination_id
    {code}
    I don't know what you mean with "Sales Order Account". I am not a financial specialist, but as far as I know OM does not do any accounting, just the other modules like inventory or AR. Inventory will do some "sales order issue" transaction on shipments which will get accounted (cost manager etc) and AR will generate accounts when the invoice gets created...
    And pay attention to the above query, as there might be order lines where ship_from_org_id is null, e.g. bill-only orders.
    regards,
    David.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • How to fetch records from query.....

    hii experts,
    How to fetch data from following query.... The query is depend on the Project_Id
    SELECT           'Plant Consumption' TYP,                                 -1*ROUND(SUM (MTA.BASE_TRANSACTION_VALUE)) S_VALUE,
    TO_CHAR (MMT.TRANSACTION_DATE, 'Mon-rrrr') MNTYR,
    TO_CHAR (MMT.TRANSACTION_DATE, 'rrrrmm') MNT,
                        TO_CHAR(MMT.TRANSACTION_REFERENCE) TRX_REF,
                        MMT.SOURCE_LINE_ID SRC_LIN,
                        TO_CHAR(MMT.SHIPMENT_NUMBER) SHP
    FROM (SELECT TO_CHAR( OLA.HEADER_ID) HDR1,
                        OLA.LINE_ID LINE1,
                                  OLA.PROJECT_ID ,
                                  TO_CHAR(OLA.SHIPMENT_NUMBER) SHP1
                             FROM OE_ORDER_HEADERS_ALL OHA,
                                  OE_ORDER_LINES_ALL OLA
                             WHERE OHA.HEADER_ID = OLA.HEADER_ID
                             AND OHA.ORG_ID = OLA.ORG_ID
                             AND OLA.PROJECT_ID = :P_PROJECT_ID
                             AND OLA.ORG_ID = :P_ORG_ID
                             AND OLA.FLOW_STATUS_CODE = 'CLOSED'
                             ) A,
                        MTL_MATERIAL_TRANSACTIONS MMT,
    MTL_TRANSACTION_ACCOUNTS MTA,
    GL_CODE_COMBINATIONS GCC
    WHERE MMT.TRANSACTION_ID = MTA.TRANSACTION_ID
    AND GCC.CODE_COMBINATION_ID      = MTA.REFERENCE_ACCOUNT
    AND MMT.TRANSACTION_TYPE_ID = 33
    AND GCC.SEGMENT1 = '11'
    AND GCC.SEGMENT2 = '13'
    AND GCC.SEGMENT3 = '34381'
    AND GCC.SEGMENT4 = '0000'
    AND                GCC.SEGMENT5                     =      '000000'
    AND MMT.SHIPMENT_NUMBER IS NOT NULL
    AND MMT.PROJECT_ID IS NULL
    AND           A.HDR1           = TO_CHAR(MMT.TRANSACTION_REFERENCE)
    AND                A.LINE1           = MMT.SOURCE_LINE_ID
    AND A.PROJECT_ID = :P_PROJECT_ID
    AND                A.SHP1           = TO_CHAR(MMT.SHIPMENT_NUMBER)
    GROUP BY TO_CHAR (MMT.TRANSACTION_DATE, 'rrrrmm'),
         TO_CHAR (MMT.TRANSACTION_DATE, 'Mon-rrrr'),MMT.TRANSACTION_REFERENCE,MMT.SOURCE_LINE_ID,MMT.SHIPMENT_NUMBER;
    -----

    hii
    The project_number is matching column in table mtl_material_transaction mmt and A (FROM CLAUSE query). But data retreive based on
    WHERE MMT.PROJECT_ID IS NULL
    AND A.PROJECT_ID = :P_PROJECT_ID
    PS

  • Strange explain plan

    I wrote a SQL in Oracle EBS, please see the following:
    SELECT msi.segment1 item_num, mmt.revision revision,
    msi.description description_en,
    msi_tl.long_description description_cn,
    mmt.transfer_organization_id mfg_org_id,
    xxuts_inv_trh_pkg.get_organization_name(mmt.transfer_organization_id),
    mmt.subinventory_code subinv, mmt.locator_id,
    mtln.lot_number lot_num, mmt.transaction_id txn_id,
    mmt.transfer_subinventory co_subinv, mmt.transfer_locator_id,
    mmt.transaction_date txn_date, fn.user_name user_name,
    mts.transaction_source_type_name txn_source_type,
    wie.wip_entity_name order_num,
    xxuts_inv_trh_pkg.get_qty_before (mmt.organization_id,
    mmt.inventory_item_id,
    mmt.revision,
    mmt.subinventory_code,
    mmt.transaction_id,
    mmt.transaction_date
    DECODE (msi.lot_control_code,
    2, mtln.transaction_quantity,
    mmt.transaction_quantity
    ) txn_qty,
    mtt.transaction_type_name txn_type, mmt.actual_cost item_cost,
    DECODE (msi.lot_control_code,
    2, mtln.transaction_quantity,
    mmt.transaction_quantity
    * mmt.actual_cost amount,
    mtln.primary_quantity primary_qty,
    NVL
    (mtr.reason_name,
    (SELECT mtrh.attribute1 || mtrh.attribute2 || mtrh.attribute3
    FROM mtl_txn_request_headers mtrh
    WHERE EXISTS (
    SELECT 'X'
    FROM mtl_txn_request_lines mtrl
    WHERE mtrh.header_id = mtrl.header_id
    AND mtrl.transaction_header_id =
    mmt.transaction_set_id
    AND mtrl.txn_source_id = mmt.transaction_source_id
    AND mtrl.line_id = mmt.source_line_id))
    ) reason,
    mmt.transaction_reference REFERENCE
    FROM mtl_system_items_b msi --250,
    mtl_system_items_tl msi_tl --500,
    mtl_transaction_lot_numbers mtln -210,
    mtl_material_transactions mmt -333,
    mtl_transaction_types mtt,
    mtl_txn_source_types mts,
    mtl_item_categories mic -800,
    mtl_transaction_reasons mtr,
    fnd_user fn,
    wip_entities wie --5
    WHERE msi.inventory_item_id = mmt.inventory_item_id
    AND msi.inventory_item_id = msi_tl.inventory_item_id
    AND msi.organization_id = msi_tl.organization_id
    AND mtr.reason_id(+) = mmt.reason_id
    AND msi_tl.LANGUAGE = USERENV ('LANG')
    AND mmt.transaction_id = mtln.transaction_id(+)
    AND mic.inventory_item_id = mmt.inventory_item_id
    AND mic.organization_id = mmt.organization_id
    AND mic.category_set_id = :b15
    AND mmt.transaction_type_id = mtt.transaction_type_id
    AND mmt.transaction_source_type_id = mts.transaction_source_type_id
    AND msi.organization_id = mmt.organization_id
    AND mmt.transaction_source_id = wie.wip_entity_id
    AND mmt.transaction_source_type_id IN (5)
    AND fn.user_id = mmt.created_by
    AND mmt.organization_id = :b14
    AND msi.segment1 >= NVL (:b13, msi.segment1)
    AND msi.segment1 <= NVL (:b12, msi.segment1)
    AND NVL (mmt.revision, '-99') = NVL (NVL (:b11, mmt.revision), '-99')
    AND mmt.subinventory_code >= NVL (:b10, mmt.subinventory_code)
    AND mmt.subinventory_code <= NVL (:b9, mmt.subinventory_code)
    AND mmt.transaction_date BETWEEN :b8 AND :b7
    AND mmt.creation_date BETWEEN :b6 AND :b5
    AND mmt.transaction_type_id = NVL (:b4, mmt.transaction_type_id)
    AND mmt.transaction_source_type_id = NVL (:b3, mmt.transaction_source_type_id)
    AND mmt.transaction_id = NVL (:b2, mmt.transaction_id)
    AND fn.user_id = NVL (:b1, fn.user_id)
    It's explain plan is:
    | Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
    | 0 | INSERT STATEMENT | | | | 33 (100)| |
    | 1 | CONCATENATION | | | | | |
    |* 2 | FILTER | | | | | |
    | 3 | NESTED LOOPS | | 1 | 312 | 17 (0)| 00:00:01 |
    | 4 | NESTED LOOPS | | 1 | 297 | 15 (0)| 00:00:01 |
    | 5 | NESTED LOOPS OUTER | | 1 | 282 | 13 (0)| 00:00:01 |
    | 6 | NESTED LOOPS | | 1 | 257 | 10 (0)| 00:00:01 |
    | 7 | NESTED LOOPS | | 1 | 188 | 8 (0)| 00:00:01 |
    | 8 | NESTED LOOPS | | 1 | 174 | 7 (0)| 00:00:01 |
    | 9 | NESTED LOOPS | | 1 | 148 | 6 (0)| 00:00:01 |
    | 10 | NESTED LOOPS OUTER | | 1 | 128 | 5 (0)| 00:00:01 |
    | 11 | NESTED LOOPS | | 1 | 108 | 4 (0)| 00:00:01 |
    | 12 | TABLE ACCESS BY INDEX ROWID| MTL_TXN_SOURCE_TYPES | 1 | 18 | 1 (0)| 00:00:01 |
    |* 13 | INDEX UNIQUE SCAN | MTL_TXN_SOURCE_TYPES_U1 | 1 | | 0 (0)| |
    |* 14 | TABLE ACCESS BY INDEX ROWID| MTL_MATERIAL_TRANSACTIONS | 1 | 90 | 3 (0)| 00:00:01 |
    |* 15 | INDEX RANGE SCAN | MTL_MATERIAL_TRANSACTIONS_N8 | 1 | | 2 (0)| 00:00:01 |
    | 16 | TABLE ACCESS BY INDEX ROWID | MTL_TRANSACTION_REASONS | 1 | 20 | 1 (0)| 00:00:01 |
    |* 17 | INDEX UNIQUE SCAN | MTL_TRANSACTION_REASONS_U1 | 1 | | 0 (0)| |
    | 18 | TABLE ACCESS BY INDEX ROWID | WIP_ENTITIES | 1 | 20 | 1 (0)| 00:00:01 |
    |* 19 | INDEX UNIQUE SCAN | WIP_ENTITIES_U1 | 1 | | 0 (0)| |
    | 20 | TABLE ACCESS BY INDEX ROWID | MTL_TRANSACTION_TYPES | 1 | 26 | 1 (0)| 00:00:01 |
    |* 21 | INDEX UNIQUE SCAN | MTL_TRANSACTION_TYPES_U1 | 1 | | 0 (0)| |
    | 22 | TABLE ACCESS BY INDEX ROWID | FND_USER | 1 | 14 | 1 (0)| 00:00:01 |
    |* 23 | INDEX UNIQUE SCAN | FND_USER_U1 | 1 | | 0 (0)| |
    |* 24 | TABLE ACCESS BY INDEX ROWID | MTL_SYSTEM_ITEMS_B | 1 | 69 | 2 (0)| 00:00:01 |
    |* 25 | INDEX UNIQUE SCAN | MTL_SYSTEM_ITEMS_B_U1 | 1 | | 1 (0)| 00:00:01 |
    | 26 | TABLE ACCESS BY INDEX ROWID | MTL_TRANSACTION_LOT_NUMBERS | 1 | 25 | 3 (0)| 00:00:01 |
    |* 27 | INDEX RANGE SCAN | MTL_TRANSACTION_LOT_NUMBERS_N1 | 1 | | 2 (0)| 00:00:01 |
    |* 28 | INDEX RANGE SCAN | MTL_ITEM_CATEGORIES_U1 | 1 | 15 | 2 (0)| 00:00:01 |
    | 29 | TABLE ACCESS BY INDEX ROWID | MTL_SYSTEM_ITEMS_TL | 1 | 15 | 2 (0)| 00:00:01 |
    |* 30 | INDEX UNIQUE SCAN | MTL_SYSTEM_ITEMS_TL_U1 | 1 | | 1 (0)| 00:00:01 |
    |* 31 | FILTER | | | | | |
    | 32 | NESTED LOOPS OUTER | | 1 | 312 | 16 (0)| 00:00:01 |
    | 33 | NESTED LOOPS | | 1 | 287 | 13 (0)| 00:00:01 |
    | 34 | NESTED LOOPS | | 1 | 272 | 11 (0)| 00:00:01 |
    | 35 | NESTED LOOPS | | 1 | 257 | 9 (0)| 00:00:01 |
    | 36 | NESTED LOOPS | | 1 | 188 | 7 (0)| 00:00:01 |
    | 37 | NESTED LOOPS OUTER | | 1 | 162 | 6 (0)| 00:00:01 |
    | 38 | NESTED LOOPS | | 1 | 142 | 5 (0)| 00:00:01 |
    | 39 | NESTED LOOPS | | 1 | 128 | 4 (0)| 00:00:01 |
    | 40 | NESTED LOOPS | | 1 | 108 | 3 (0)| 00:00:01 |
    | 41 | TABLE ACCESS BY INDEX ROWID| MTL_TXN_SOURCE_TYPES | 1 | 18 | 1 (0)| 00:00:01 |
    |* 42 | INDEX UNIQUE SCAN | MTL_TXN_SOURCE_TYPES_U1 | 1 | | 0 (0)| |
    |* 43 | TABLE ACCESS BY INDEX ROWID| MTL_MATERIAL_TRANSACTIONS | 1 | 90 | 2 (0)| 00:00:01 |
    |* 44 | INDEX UNIQUE SCAN | MTL_MATERIAL_TRANSACTIONS_U1 | 1 | | 1 (0)| 00:00:01 |
    | 45 | TABLE ACCESS BY INDEX ROWID | WIP_ENTITIES | 48143 | 940K| 1 (0)| 00:00:01 |
    |* 46 | INDEX UNIQUE SCAN | WIP_ENTITIES_U1 | 1 | | 0 (0)| |
    | 47 | TABLE ACCESS BY INDEX ROWID | FND_USER | 1 | 14 | 1 (0)| 00:00:01 |
    |* 48 | INDEX UNIQUE SCAN | FND_USER_U1 | 1 | | 0 (0)| |
    | 49 | TABLE ACCESS BY INDEX ROWID | MTL_TRANSACTION_REASONS | 36 | 720 | 1 (0)| 00:00:01 |
    |* 50 | INDEX UNIQUE SCAN | MTL_TRANSACTION_REASONS_U1 | 1 | | 0 (0)| |
    | 51 | TABLE ACCESS BY INDEX ROWID | MTL_TRANSACTION_TYPES | 98 | 2548 | 1 (0)| 00:00:01 |
    |* 52 | INDEX UNIQUE SCAN | MTL_TRANSACTION_TYPES_U1 | 1 | | 0 (0)| |
    |* 53 | TABLE ACCESS BY INDEX ROWID | MTL_SYSTEM_ITEMS_B | 297 | 20493 | 2 (0)| 00:00:01 |
    |* 54 | INDEX UNIQUE SCAN | MTL_SYSTEM_ITEMS_B_U1 | 1 | | 1 (0)| 00:00:01 |
    | 55 | TABLE ACCESS BY INDEX ROWID | MTL_SYSTEM_ITEMS_TL | 96026 | 1406K| 2 (0)| 00:00:01 |
    |* 56 | INDEX UNIQUE SCAN | MTL_SYSTEM_ITEMS_TL_U1 | 1 | | 1 (0)| 00:00:01 |
    |* 57 | INDEX RANGE SCAN | MTL_ITEM_CATEGORIES_U1 | 1 | 15 | 2 (0)| 00:00:01 |
    | 58 | TABLE ACCESS BY INDEX ROWID | MTL_TRANSACTION_LOT_NUMBERS | 1 | 25 | 3 (0)| 00:00:01 |
    |* 59 | INDEX RANGE SCAN | MTL_TRANSACTION_LOT_NUMBERS_N1 | 1 | | 2 (0)| 00:00:01 |
    Predicate Information (identified by operation id):
    2 - filter((:B6<=:B5 AND :B8<=:B7 AND :B2 IS NULL))
    13 - access("MTS"."TRANSACTION_SOURCE_TYPE_ID"=5)
    14 - filter(("MMT"."TRANSACTION_SOURCE_ID" IS NOT NULL AND
    "MMT"."TRANSACTION_TYPE_ID"=NVL(:B4,"MMT"."TRANSACTION_TYPE_ID") AND
    "MMT"."SUBINVENTORY_CODE">=NVL(:B10,"MMT"."SUBINVENTORY_CODE") AND
    "MMT"."SUBINVENTORY_CODE"<=NVL(:B9,"MMT"."SUBINVENTORY_CODE") AND
    NVL("MMT"."REVISION",'-99')=NVL(NVL(:B11,"MMT"."REVISION"),'-99') AND "MMT"."TRANSACTION_ID" IS NOT NULL AND
    "MMT"."CREATION_DATE">=:B6 AND "MMT"."CREATION_DATE"<=:B5))
    15 - access("MMT"."TRANSACTION_SOURCE_TYPE_ID"=5 AND "MMT"."ORGANIZATION_ID"=:B14 AND
    "MMT"."TRANSACTION_DATE">=:B8 AND "MMT"."TRANSACTION_DATE"<=:B7)
    filter(NVL(:B3,"MMT"."TRANSACTION_SOURCE_TYPE_ID")=5)
    17 - access("MTR"."REASON_ID"="MMT"."REASON_ID")
    19 - access("MMT"."TRANSACTION_SOURCE_ID"="WIE"."WIP_ENTITY_ID")
    21 - access("MMT"."TRANSACTION_TYPE_ID"="MTT"."TRANSACTION_TYPE_ID")
    23 - access("FN"."USER_ID"="MMT"."CREATED_BY")
    filter("FN"."USER_ID"=NVL(:B1,"FN"."USER_ID"))
    24 - filter(("MSI"."SEGMENT1">=NVL(:B13,"MSI"."SEGMENT1") AND "MSI"."SEGMENT1"<=NVL(:B12,"MSI"."SEGMENT1")))
    25 - access("MSI"."INVENTORY_ITEM_ID"="MMT"."INVENTORY_ITEM_ID" AND "MSI"."ORGANIZATION_ID"=:B14)
    27 - access("MMT"."TRANSACTION_ID"="MTLN"."TRANSACTION_ID")
    28 - access("MIC"."ORGANIZATION_ID"=:B14 AND "MIC"."INVENTORY_ITEM_ID"="MMT"."INVENTORY_ITEM_ID" AND
    "MIC"."CATEGORY_SET_ID"=:B15)
    30 - access("MSI"."INVENTORY_ITEM_ID"="MSI_TL"."INVENTORY_ITEM_ID" AND "MSI_TL"."ORGANIZATION_ID"=:B14 AND
    "MSI_TL"."LANGUAGE"=USERENV('LANG'))
    31 - filter((:B6<=:B5 AND :B8<=:B7 AND :B2 IS NOT NULL))
    42 - access("MTS"."TRANSACTION_SOURCE_TYPE_ID"=5)
    43 - filter(("MMT"."TRANSACTION_SOURCE_ID" IS NOT NULL AND "MMT"."TRANSACTION_DATE">=:B8 AND
    "MMT"."ORGANIZATION_ID"=:B14 AND "MMT"."TRANSACTION_SOURCE_TYPE_ID"=5 AND
    NVL(:B3,"MMT"."TRANSACTION_SOURCE_TYPE_ID")=5 AND "MMT"."TRANSACTION_TYPE_ID"=NVL(:B4,"MMT"."TRANSACTION_TYPE_ID"
    ) AND "MMT"."SUBINVENTORY_CODE">=NVL(:B10,"MMT"."SUBINVENTORY_CODE") AND
    "MMT"."SUBINVENTORY_CODE"<=NVL(:B9,"MMT"."SUBINVENTORY_CODE") AND
    NVL("MMT"."REVISION",'-99')=NVL(NVL(:B11,"MMT"."REVISION"),'-99') AND "MMT"."TRANSACTION_DATE"<=:B7 AND
    "MMT"."CREATION_DATE">=:B6 AND "MMT"."CREATION_DATE"<=:B5))
    44 - access("MMT"."TRANSACTION_ID"=:B2)
    46 - access("MMT"."TRANSACTION_SOURCE_ID"="WIE"."WIP_ENTITY_ID")
    48 - access("FN"."USER_ID"="MMT"."CREATED_BY")
    filter("FN"."USER_ID"=NVL(:B1,"FN"."USER_ID"))
    50 - access("MTR"."REASON_ID"="MMT"."REASON_ID")
    52 - access("MMT"."TRANSACTION_TYPE_ID"="MTT"."TRANSACTION_TYPE_ID")
    53 - filter(("MSI"."SEGMENT1">=NVL(:B13,"MSI"."SEGMENT1") AND "MSI"."SEGMENT1"<=NVL(:B12,"MSI"."SEGMENT1")))
    54 - access("MSI"."INVENTORY_ITEM_ID"="MMT"."INVENTORY_ITEM_ID" AND "MSI"."ORGANIZATION_ID"=:B14)
    56 - access("MSI"."INVENTORY_ITEM_ID"="MSI_TL"."INVENTORY_ITEM_ID" AND "MSI_TL"."ORGANIZATION_ID"=:B14 AND
    "MSI_TL"."LANGUAGE"=USERENV('LANG'))
    57 - access("MIC"."ORGANIZATION_ID"=:B14 AND "MIC"."INVENTORY_ITEM_ID"="MMT"."INVENTORY_ITEM_ID" AND
    "MIC"."CATEGORY_SET_ID"=:B15)
    59 - access("MMT"."TRANSACTION_ID"="MTLN"."TRANSACTION_ID")
    I am doubt why to perform two times explain plan(Predicate -2 and 31).
    Thanks

    Tom.lai wrote:
    I wrote a SQL in Oracle EBS, please see the following:
    AND msi.segment1 >= NVL (:b13, msi.segment1)
    AND msi.segment1 <= NVL (:b12, msi.segment1)
    AND NVL (mmt.revision, '-99') = NVL (NVL (:b11, mmt.revision), '-99')
    AND mmt.subinventory_code >= NVL (:b10, mmt.subinventory_code)
    AND mmt.subinventory_code <= NVL (:b9, mmt.subinventory_code)
    AND mmt.transaction_date BETWEEN :b8 AND :b7
    AND mmt.creation_date BETWEEN :b6 AND :b5
    AND mmt.transaction_type_id = NVL (:b4, mmt.transaction_type_id)
    AND mmt.transaction_source_type_id = NVL (:b3, mmt.transaction_source_type_id)
    AND mmt.transaction_id = NVL (:b2, mmt.transaction_id)
    AND fn.user_id = NVL (:b1, fn.user_id)I am doubt why to perform two times explain plan(Predicate -2 and 31).Using your NVL expressions above you've hit a special implementation for this particular construct in the Oracle optimizer, for more information, see here:
    http://jonathanlewis.wordpress.com/2007/01/09/conditional-sql/
    http://jonathanlewis.wordpress.com/2007/02/14/conditional-sql-2/
    This splits your plan into two plans for the two cases possible, and depending on if the value passed is NULL or not only one of the branches will actually get executed.
    Regards,
    Randolf
    Oracle related stuff blog:
    http://oracle-randolf.blogspot.com/
    SQLTools++ for Oracle (Open source Oracle GUI for Windows):
    http://www.sqltools-plusplus.org:7676/
    http://sourceforge.net/projects/sqlt-pp/

  • Procedure problem in summing

    Hi
    working on EBS 11.5.10.2
    this is the procedure for customer wise gross margin report.
    i am trying to sum this inv_amount in the query, but it showing the wrong figure. but
    the same when i take in detail it is showing the correct inv_amount.
    i need some help, how to the sum the amount
    CREATE OR REPLACE PROCEDURE slc_cust_wise_gros_margn_proc(errbuf OUT VARCHAR2,retcode OUT NUMBER,
    p_from_date IN VARCHAR2,p_to_date IN VARCHAR2) IS
    CURSOR c_credit_hold_cust_dtls(c_from_date VARCHAR2,c_to_date VARCHAR2)
    IS
    select rc.customer_number
    ,rc.customer_name cust_name
    ,rctl.extended_amount inv_amount
    ,sum(cid.base_transaction_value) distribution_val
    from mtl_material_transactions mmt
    ,ra_customer_trx_all rct
    ,ra_customer_trx_lines_all rctl
    ,mtl_system_items_b msi
    ,mtl_item_categories mic
    ,mtl_categories mc
    ,mtl_category_sets mcs
    ,ra_customers rc
    ,jtf_rs_salesreps rs
    ,gl_code_combinations gcc
    ,gl_code_combinations gcc1
    ,gl_code_combinations gcc2
    ,cst_item_costs cic1
    ,cst_item_costs cic2
    ,cst_item_costs cic3
    ,cst_inv_distribution_v cid
    where mmt.transaction_type_id in(15,33)
    and mmt.transaction_date between nvl(to_date(c_from_date,'RRRR/MM/DD HH24:MI:SS'),mmt.transaction_date) and nvl(to_date(c_to_date,'RRRR/MM/DD HH24:MI:SS'),mmt.transaction_date)
    and mmt.trx_source_line_id = rctl.interface_line_attribute6(+)
    and rct.customer_trx_id(+) = rctl.customer_trx_id
    and mmt.inventory_item_id = rctl.inventory_item_id(+)
    and mmt.inventory_item_id = msi.inventory_item_id
    and mmt.organization_id = msi.organization_id
    and mmt.inventory_item_id = mic.inventory_item_id
    and mmt.organization_id = mic.organization_id
    and mic.category_set_id = mcs.category_set_id
    and mc.category_id= mic.category_id
    and mcs.category_set_name = 'Costing_CS'
    and rct.sold_to_customer_id = rc.customer_id(+)
    and rct.primary_salesrep_id = rs.salesrep_id(+)
    and gcc.code_combination_id = msi.sales_account
    and gcc1.code_combination_id = msi.cost_of_sales_account
    and mmt.distribution_account_id = gcc2.code_combination_id
    and mmt.inventory_item_id = cic1.inventory_item_id(+)
    and cic1.cost_type_id(+) = 1007
    and mmt.inventory_item_id = cic2.inventory_item_id(+)
    and cic2.cost_type_id(+) = 1151
    and mmt.inventory_item_id = cic3.inventory_item_id
    and cic3.cost_type_id(+) = 1
    and mmt.inventory_item_id = cid.inventory_item_id --in(89882,102626 )
    and mmt.organization_id = cid.organization_id
    and mmt.transaction_source_id = cid.transaction_source_id
    and mmt.transaction_id = cid.transaction_id
    and mmt.transaction_type_id = cid.transaction_type_id
    and mmt.transaction_date = cid.transaction_date
    and cid.line_type_name = 'Account'
    and gcc2.segment4 = 900
    and rct.cust_trx_type_id in(1002,1587)
    --and rownum <= 10
    group by
    rct.trx_number
    ,rct.trx_date
    ,rct.attribute1
    ,rct.interface_header_attribute2
    ,rct.interface_header_attribute1
    ,rctl.extended_amount
    ,rctl.sales_order_line
    ,rctl.sales_order
    ,rctl.quantity_invoiced
    ,rctl.unit_standard_price
    ,msi.segment1
    ,msi.description
    ,rctl.quantity_invoiced * slc_standard_cost1(msi.inventory_item_id)
    ,rctl.quantity_credited
    ,mc.segment1
    ,mc.segment2
    ,rc.customer_number
    ,rc.customer_name
    ,rs.name
    ,gcc.segment2
    ,gcc.segment5
    ,gcc1.segment5
    -- ,gcc2.segment1||'.'||gcc2.segment2||'.'||gcc2.segment3||'.'||gcc2.segment4||'.'||gcc2.segment5||'.'||gcc2.segment6||'.'||gcc2.segment7
    ,slc_branch_margn(gcc2.segment3)
    ,cic1.item_cost
    ,cic2.item_cost
    ,slc_standard_cost1(mmt.inventory_item_id)
    ,mmt.transaction_date
    , cic1.material_cost
    , cic1.resource_cost
    , cic1.overhead_cost
    ,cic2.material_cost
    ,cic2.resource_cost
    ,cic2.overhead_cost
    ,cic3.material_cost
    ,cic3.resource_cost
    ,cic3.overhead_cost
    order by
    rctl.extended_amount desc;
    v_header_dtls varchar2(20000);
    v_credit_hold_cust_dtls varchar2(20000);
    k_inv_amt number(25);
    l_gros_margin number;
    begin
    v_header_dtls := 'Customer Name'||chr(9)||'Customer Number'||chr(9)||'Invoice Amount'||chr(9)||'Distribution Value';
    fnd_file.put_line(fnd_file.output,v_header_dtls);
    for k in c_credit_hold_cust_dtls(p_from_date,p_to_date) loop
    -- k_inv_amt := sum(k.extended_amount);
    if k.inv_amount = 0 then
    l_gros_margin := 0;
    else
    l_gros_margin := ((k.inv_amount-k.distribution_val)/k.inv_amount)*100;
    end if;
    v_credit_hold_cust_dtls := k.customer_number||chr(9)||k.cust_name||chr(9)||k.inv_amount||chr(9)||l_gros_margin;
    fnd_file.put_line(fnd_file.output,v_credit_hold_cust_dtls);
    end loop;
    end slc_cust_wise_gros_margn_proc;
    Thanks and Regards

    Hi...,
    These no.of rows depends on the fields on which you have put the SUM option as X...
    IF a field has the option DO_SUM = 'X', whenever its value changes it prints the sum for all the numeric fields...
    If u put X for two fields then Whenever one of those fields value changes it calculates the Sum and Prints it....
    After that it prints the Grand total for all these individual sums...
    First Try with MENGE  with DO_SUM = 'X'. see how the sums are evaluated !!
    Next try the same for KWERT field only...
    Now check for both fields.....
    Thn u will come to know...
    regards,
    sai ramesh

  • ESYU: MMT,MMTT,MTI (Sales Orders/Internal Orders)에 중복된 record 확인

    Purpose
    Oracle Inventory Management - Version: 11.5.4 to 11.5.10
    Information in this document applies to any platform.
    이 문서는 여러 errors 때문에 pending transactions(MMTT)이나 open interface(MTI)에 존재하는
    중복된 records를 찾는데 도움을 줄 것이다.
    Error를 분석하기 전에 어떤 duplicates record가 있는지 확인하는 작업을 할 수 있다.
    이 script는 Sales Orders/ Interface Sales Order transactions에 대해 사용된다.
    Solution
    A. 우선 WSHDDSHB.pls, TrxProcessor.java and BaseTransaction.java file version을 확인한다.
    이를 확인하기 위해 아래 command를 사용한다.
    strings -a $WSH_TOP/patch/115/sql/WSHDDSHB.pls |grep '$Header'
    그리고 java files version 확인을 위해 SQL에서 아래 command를 이용한다.
    set serveroutput on
    exec
    fnd_aolj_util.getclassversionfromdb('oracle.apps.inv.transaction.server.TrxProcessor');
    exec
    fnd_aolj_util.getclassversionfromdb('oracle.apps.inv.transaction.server.BaseTransaction');
    Note:
    1. Duplicate shipping transactions을 정정하기 위한 11.5.8 과 11.5.9 version 위에 적용해야 하는
    patches가 존재한다. 11.5.10 version에는 shipping transaction issue가 이미 포함되어져 있다.
    아래는 11.5.8과 11.5.9 를 위한 patches이다.
    11.5.8 - Patch 3211801 supplies WSHDDSHB.pls 115.229.1158.19
    11.5.9 - Patch 3259613 supplies WSHDDSHB.pls 115.258.1159.3
    2. 11.5.9 와 11.5.10에서 interface errors에 의해 duplicate가 생성되는것을 방지하는 patches가
    존재한다.
    11.5.9 - Patch 5859839 supplies
    TrxProcessor.java 115.103.11590.58
    BaseTransaction.java 115.170.11590.113
    11.5.10 - Patch 5710072 superseded by Patch 5935177 supplies
    TrxProcessor.java 115.130.115100.31
    BaseTransaction.java 115.235.115100.36
    INVTXMGB.pls 115.107.115100.18
    INVTRXWB.pls 115.256.115100.37
    B. 3개의 views를 생성하는 scripts를 실행
    1. MMTT와 MTI 사이에 중복되는 record가 있는지 확인하는 View
    create or replace view mmtt_mti_records_v as
    select a.transaction_interface_id ,
    a.picking_line_id from
    mtl_material_transactions_temp b, mtl_transactions_interface a
    where a.picking_line_id = b.picking_line_id
    and a.trx_source_line_id = b.trx_source_line_id
    and a.inventory_item_id = b.inventory_item_id
    and b.transaction_type_id = a.transaction_type_id
    and b.transaction_source_type_id in (2,8)
    and b.picking_line_id is not null ;
    2. MMT와 MMTT 사이에 중복되는 record가 있는지 확인하는 View
    create or replace view mmt_mmtt_records_v as
    select a.transaction_temp_id,
    a.picking_line_id from
    mtl_material_transactions b, mtl_material_transactions_temp a
    where a.picking_line_id = b.picking_line_id
    and a.trx_source_line_id = b.trx_source_line_id
    and a.inventory_item_id = b.inventory_item_id
    and b.transaction_type_id = a.transaction_type_id
    and b.transaction_source_type_id in ( 2,8)
    and b.picking_line_id is not null;
    3. MMT와 MTI 사이에 중복되는 record가 있는지 확인하는 View
    create or replace view mmt_mti_records_v as
    select a.transaction_interface_id ,
    a.picking_line_id from
    mtl_material_transactions b, mtl_transactions_interface a
    where a.picking_line_id = b.picking_line_id
    and a.trx_source_line_id = b.trx_source_line_id
    and a.inventory_item_id = b.inventory_item_id
    and b.transaction_type_id = a.transaction_type_id
    and b.transaction_source_type_id in (2,8)
    and b.picking_line_id is not null ;
    Views를 생성한 후 duplicate record가 있는지 count 확인:
    select count(*) from mmt_mmtt_records_v;
    select count(*) from mmtt_mti_records_v;
    select count(*) from mmt_mti_records_v;
    Notes:
    1. No Views
    View를 생성하지 않고 비슷한 SQL을 직접 실행할 수도 있다.
    select count(*)
    from mtl_material_transactions b, mtl_transactions_interface a
    where a.picking_line_id = b.picking_line_id
    and a.trx_source_line_id = b.trx_source_line_id
    and a.inventory_item_id = b.inventory_item_id
    and b.transaction_type_id = a.transaction_type_id
    and b.transaction_source_type_id in (2,8)
    and b.picking_line_id is not null ;
    2. 원인....
    중복 rows에 대한 원인은 매우 다양하다. 여러개의 common 한 patch list는 위에 update 되어 있고,
    mode 8의 transaction에 대한 정보는 Note 294391.1에서 볼 수있다.
    만일 위 3개의 view를 생성하여 그 count가 return 되는 경우 중복된 data가 있다는 의미이다.
    이 중복된 data는 data fix를 통해 처리해야 하므로 SR을 open 하여 Oracle Support 의 지원을
    받도록 한다.
    Reference
    Note 268973.1

  • COGS Value showing as null for Projects

    Hi All,
    We have a report called Revenue Report. In this report we track the revenue and cogs value for both OM orders and Projects. We are able to see th cogs value for OM order(i.e. sales order)but not for projects. We are using OOTB out of box mapping(i.e.SDE_ORA_GLCOGS) for populating cogs value.So we have approached oracle team to address this issue. Please find the below reply from Oracle. Can somebody help me how to calculate COGS value for projects.
    BIApps 7.9.6.x do not support the integration of Project and COGS out of the box. If you have cogs trx from Projects and would like to extract these trx, you can customize the SDE sql.
    [OOTB sql in SDE_ORA_GLCOGS]
    WHERE
    MMT.TRANSACTION_TYPE_ID IN (15, 33, 10008) AND
    (MMT.TRANSACTION_ACTION_ID,MTA.ACCOUNTING_LINE_TYPE ) IN
    ((27, 2), (1, 36), (36, 35))
    MMT : MTL_MATERIAL_TRANSACTIONS
    MTA : MTL_TRANSACTION_ACCOUNTS
    15 = RMA Receipt (Return Material Authorization)
    33 = Sales order issue (Ship Confirm external Sales Order)
    10008 = COGS Recognition
    (27, 2) = (Receipt into stores, Account)
    (1, 36) = (Issue from stores, Deferred Cost of Goods Sold)
    (36, 35) = (COGS Recognition, Cost of Goods Sold)
    These are OOTB default values to extract the cogs trx for sales order etc. These are configurable. You can add/modify these values as needed. You can check the OLTP MTL module for the meaning of each values

    Please do not post duplicates -- COGS Value showing up as null Projects

  • Null And " "

    What is the difference between these two lines of codes?
    String currentFile = null;
    String currentFile = "";
    Edited by: AMARSHI on Jul 10, 2008 7:07 AM

    The reference variable itself, takes up the same amount of space, of course, as all references are the same size. Now, the object on the heap is a different story. With null there isn't one, of course (or if there is there is only one for the entire VM), and for the second a String object will be created in the String pool (once again, only one for the entire VM that every = "" assignment will use). But really, what difference does it make? If there is a difference, it is on the order of a few bytes (at max) for the entire VM, and if this is a concern, your probably doing something else greviously wrong. This miniscule difference should not concern you.
    Edit: And "nulling" variables to "save" memory is also not something you should be concerned with. Either the variable will go out of scope and the object garbage collected anyway, or it's in constant use and so will not be taking up any extraneous heap space. If one of those is not the case, you are, once again, doing something greviously wrong.

  • AND/OR + some nulls in filter

    I'm running into another problem with the AND/OR filter.
    The filter for selecting from object "a" and joining to objects b, c & d
    is:
    (b.theid==2 || c.theid==2 || d.theid==3) && active=="Y"
    The SQL that gets generated is:
    SELECT <...>
    FROM b t1, d t3, a t0, c t2
    WHERE ((((t1.theid = 2 AND t0.bid = t1.id) OR (t2.theid = 2 AND t0.cid
    = t2.id)) OR (t3.theid = 3 AND t0.did = t3.id)) AND t0.active = 'Y')
    This returns a number of instances of the same a object when some of the
    OR clauses do not match. For example, if there's no record
    with d.theid=3, then it will do a full join on table d.
    Do I need to specify something else to flag these as potentially null
    fields so that the filter parser adds that check in? The following SQL
    query works
    ok if I add some checks for NULL on those join fields:
    SELECT <...>
    FROM b t1, d t3, a t0, c t2
    WHERE ((((t1.theid = 2 AND t0.bid = t1.id OR t0.bid IS NULL) OR
    (t2.theid = 2 AND t0.cid = t2.id OR t0.cid IS NULL)) OR (t3.theid = 3
    AND t0.did = t3.id OR t0.did IS NULL)) AND t0.active = 'Y')
    Thanks,
    -Mike
    Mike Bridge

    Hi D,
    Thank you for your answer.
    I have seriously thought about that solution; but I don't think it's a smart way to do it.
    If i do it like that, i need to copy the whole table and paste it inside the if statements.
    I have two xml elements that I need to make the decisions on. POH_PO_TYPE & CP_RELEASE_NUM.
    POH_PO_TYPE can be: STANDARD, RELEASE or BLANKET.
    CP_RELEASE_NUM can be: '' or N
    If POH_PO_TYPE is RELEASE AND CP_RELEASE_NUM is not ''
    OR POH_PO_TYPE is STANDARD
    OR POH_PO_TYPE is BLANKET AND CP_RELEASE_NUM is ''
    THEN show table (which contains the whole PO).
    It shall show the content of the PO in any of these cases.
    BR Kenneth

  • Unit Testing, Null, and Warnings

    I have a Unit Test that includes the following lines:
    Dim nullarray As Integer()()
    Assert.AreEqual(nullarray.ToString(False), "Nothing")
    The variable "nullarray" will obviously be null when ToString is called (ToString is an extension method, which is the one I am testing). This is by design, because the purpose of this specific unit test is to make sure that my ToString extension
    method handles null values the way I expect. The test runs fine, but Visual Studio 2013 gives includes the following warning:
    Variable 'nullarray' is used before it has been assigned a value. A null reference exception could result at runtime.
    This warning is to be expected, and I don't want to stop Visual Studio 2013 from showing this warning or any other warnings, just this specific case (and several others that involve similar scenarios). Is there any way to mark a line or segment
    of code so that it is not checked for warnings? Otherwise, I will end up with lots of warnings for things that I am perfectly aware of and don't plan on changing.
    Nathan Sokalski [email protected] http://www.nathansokalski.com/

    Hi Nathan Sokalski,
    Variable 'nullarray' is used before it has been assigned a value. A null reference exception could result at runtime.
    Whether the warning above was thrown when you built the test project but the test run successfully? I assume Yes.
    Is there any way to mark a line or segment of code so that it is not checked for warnings?
    There is no built-in way to make some code snippet or a code line not be checked during compiling, but we can configure some specific warnings not to be warned during compiling in Visual Basic through project Properties->Compile
    tab->warning configurations box.
    For detailed information, please see: Configuring Warnings in Visual Basic
    Another way is to correct your code logic and make sure the code will not generate warning at runtime.
    If I misunderstood you, please tell us what code you want it not to be checked for warnings with a sample so that we can further look at your issue.
    Thanks,
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Enlarging Null and Cam

    Hey guys, just experimenting and remembering how to work with nulls to control cams.
    I noticed when I enlarge the null in one dimension, the camera's view also seems to widen.  What's happening here?  What is that and what am I doing that is causing the camera to "see" differently? I thought the whole point of a null was that it didn't have a physical dimension and was really only about orientation and position?

    Woahhh hold your horses! 
    I'm trying to understand the program, not trying to criticize it.  I love Adobe and AE.  Did it sound like I was trying to pick it apart?
    What I'm trying to understand is why when I resize it horizontally, it changes the camera view...and therefore understand how it's changing the camera view.  This is an important concept for me to get about this.  It's not something I have been able to find in literature or other boards.  That's all I'm trying to ask.  I'm not trying to argue with it or point out a flaw or something like that, I just don't understand what's going on.  Is the camera changing and how when I enlarge the null?

  • Using NULL and NOT NULL in prompted filters

    Dear all,
    While trying to grap the concept of prompted filters in sap bo web intelligence, I had a question whether why we cannot use NULL and NOT NULL while creating a prompted filters in our report.

    HI,
    'Is Null' and 'Not Null' are the predefined functions in webi which only eliminate the null values or considering only null values.
    'Is Null' and 'Not Null' are itself predefined functions that why you are not getting  prompts.
    Null values are standard across the databases so this is defined  as a function in webi to specific eliminate the null values.
    If something is not standard then there is option in the webi to use different operator with static values or with prompts.
    More more information on Null see the Null wiki page.
    Null (SQL) - Wikipedia, the free encyclopedia
    Amit

  • Not null and enable or disable  column in tabular form

    Hi,
    Using apex version 4.1 and working on tabular form.
    ACT_COA_SEGMENT_MAS is Master table
    and
    ACT_SEGMENT_VALUES_MAS is detail table
    I have entered 8 rows in master table and PARENT_SEGMENT_ID is column in master table which is null able. If i specified PARENT_SEGMENT_ID with value in master table then in detail table there is column PARENT_ID that should not be null and enable.
    How i can enable or disable column when in master table PARENT_SEGMENT_ID column is null then in detail table PARENT_ID column should disable and vice versa.
    I have created tabular form on Detail table. before insert into the tabular form Check in master table in first entry if PARENT_SEGMENT_ID is not null in first row of master table then in tabular form PARENT_ID should enable and not null able in corresponding to this first row id's lines in tabular form.
    Same should check for second row in master table if PARENT_SEGMENT_ID is not null then entered rows with PARENT_ID into tabular form corresponding to 2nd id in master table should not nullable and column should enable in tabular form.
    Thanks & Regards
    Vedant
    Edited by: Vedant on Jan 9, 2013 9:12 PM

    Vedant,
    You need to create you own manual tabular form and not use the wizard.
    Using APEX_ITEM api you should be build you own form and you will be able to control how you wan to display the rows. (See Link [Apex Item Help|http://docs.oracle.com/cd/E37097_01/doc/doc.42/e35127/apex_item.htm#CACEEEJE] )
    select case when PRIMARY_TABLE_COLUMN is null then APEX_ITEM.DISPLAY_AND_SAVE(3 , DETAIL_COLUMN ) else APEX_ITEM.TEXT(2,detail_column) end "ALIAS" from detail table
    Hope that help.
    Vivek

  • Checking null and not null values

    Hi!
    We have a job schedule table that has a column for each day.
    JOB_ID, TIME_ID, MO, TU, WE, TH, FR, SA, SU
    1                 1        X
    1                 2                        XSince the same job can be on different days and times, we need to check all the instances of
    that job.
    Sorry for the formatting - the X is an indicator; i.e. Wednesday and Saturday.
    How can we solve this?
    Thanks!

    Your requirements are not really clear.
    Perhaps this query could help:
    -- Your Data:
    with yourtable as
      select 1 job_id, 1 time_id, null mo, null tu, 'X' we, null th, null fr, null sa, null su from dual union all
      select 1 job_id, 2 time_id, null mo, null tu, null  we, null th, null fr, null sa, 'X' su from dual
    -- Query:
    select job_id, time_id, 'mo' day from yourtable where to_char(mo)='X' union all
    select job_id, time_id, 'tu' day from yourtable where to_char(tu)='X' union all
    select job_id, time_id, 'we' day from yourtable where to_char(we)='X' union all
    select job_id, time_id, 'th' day from yourtable where to_char(th)='X' union all
    select job_id, time_id, 'fr' day from yourtable where to_char(fr)='X' union all
    select job_id, time_id, 'sa' day from yourtable where to_char(sa)='X' union all
    select job_id, time_id, 'su' day from yourtable where to_char(su)='X'Edited by: hm on 29.07.2011 01:40
    Edited by: hm on 29.07.2011 01:41

Maybe you are looking for

  • Photoshop CS2 crashes at launch

    My Photoshop CS2 and Illustrator will not launch. Everytime I try to open it says unexpectedly quit. Help!

  • Numbers: how can i set an alias to a file in icloud?

    Hi, I moved a table into the iCloud so I can sync it across my devices. That works just fine. BUT: Since I work with this file quite frequently, I would like to place an alias on my desktop. I am absolutely clueless on how to do this....any suggestio

  • Re: How do I turn off the auto keypad lock ?

    Hi,i just got zis phone nokia asha 300.i really need to remove zis auto key lot.its just a headache.i want to use the key lock manually.please help

  • Learning Shake. Video tutorial advice from a new user...

    I am brand new to Shake and compositing. I've used Final Cut Pro for a few years and done simple compositing after doing FCP tutorials. Shake is tougher to learn thank FCP, so I've purchased some videos from Gnomon workshop and cmiVFX. I wouldn't con

  • Expanding/Enhancing a table cell contents

    I have a search utility that shows my database query results in a read-only table. Say this table T has columns C1-C5 and rows R1-R5. Data returned in column C3 has a VARCHAR count between 2000-4000. Currently the table only displays somewhere in the