SORT_ORDER in OE_ORDER_LINES_ALL

Hi,
Could you please tell me what is SORT_ORDER column in oe_order_lines_all table?
where it is used?
And how its values are populated.
Thanks,
Anupam

In an order what is the condition for that the value of the SORT_ORDER will be same for two different lines?
Answer: SORT_ORDER can be same for two different sales ordders. It can be same within an order also. Example: Sales order#1 , Line#1 for KIT_A, Line#2 for KIT_A. So if same KIT is entered as two different line then SORT_ORDER will be same for KIT header as well as KIT component (same item description).
Or for the same item description of two different lines will SORT_ORDER be same??
Answer: Yes this will be same
item sort_order line no shiment no component num
RPK820G01     0000001     1     1     
4157T85G01     00000010000001     1     1     1
J643P04C     00000010000002     1     1     2
4150T57P01     00000010000003     1     1     3
4180T11P01     00000010000004     1     1     4
4180T12P01     00000010000005     1     1     5
4157T82G01     00000010000006     1     1     6
4157T84G01     00000010000007     1     1     7
RPK820G01     0000001     2     1     
4157T85G01     00000010000001     2     1     1
J643P04C     00000010000002     2     1     2
4150T57P01     00000010000003     2     1     3
4180T11P01     00000010000004     2     1     4
4180T12P01     00000010000005     2     1     5
4157T82G01     00000010000006     2     1     6
4157T84G01     00000010000007     2     1     7
Thanks
Vikrant Kumar

Similar Messages

  • MRP_SCHEDULE_DATES.RESERVATION_ID not populating OE_ORDER_LINES_ALL.LINE_ID

    Hi all
    I am trying to populate the value of MRP_SCHEDULE_DATES.RESERVATION_ID with the value of
    OE_ORDER_LINES_ALL.LINE_ID while running the Load MDS Program under Manufacturing Scheduler Responsibility.
    The Program runs normal but does not populate the value under the MRP_SCHEDULE_DATES.RESERVATION_ID
    Please help me.
    Regards
    Nakul.V

    what is the status of SO and SO line ?
    Have you manually check the line_id and source_line_id from backend using select statement ?

  • How MFG_LEAD_TIME in OE_ORDER_LINES_ALL is populated?

    How MFG_LEAD_TIME in OE_ORDER_LINES_ALL is populated?

    Calculate Manufacturing Lead Times populate the lead for all routing item and form uses the value of the lead time.
    Regards
    Prashant Pathak

  • Order Booking value from OE_ORDER_LINES_ALL

    Can you send me a query to exactly get booking amount from OE_ORDER_LINES_ALL for a particular period
    Edited by: user12254360 on Jun 8, 2010 9:04 AM

    Any update on this?? bit urgent

  • Report performance issue in oracle database 10g to 11g

    Hi All,
    We have one test instance for database 10g where the report is working fine below is the plan for report.
    SELECT STATEMENT
    VIEW APPS
    SORT UNIQUE
    UNION-ALL
    HASH JOIN
    TABLE ACCESS BY INDEX ROWID INV.MTL_SYSTEM_ITEMS_B
    NESTED LOOPS
    MERGE JOIN CARTESIAN
    TABLE ACCESS FULL INV.MTL_PARAMETERS
    BUFFER SORT
    TABLE ACCESS BY INDEX ROWID APPLSYS.FND_LOOKUP_VALUES
    INDEX RANGE SCAN APPLSYS.FND_LOOKUP_VALUES_U2
    INDEX RANGE SCAN INV.MTL_SYSTEM_ITEMS_B_XX1
    TABLE ACCESS FULL ONT.OE_ORDER_LINES_ALL
    NESTED LOOPS ANTI
    HASH JOIN
    TABLE ACCESS BY INDEX ROWID MRP.MRP_GROSS_REQUIREMENTS
    INDEX SKIP SCAN MRP.MRP_GROSS_REQUIREMENTS_N2
    TABLE ACCESS BY INDEX ROWID INV.MTL_SYSTEM_ITEMS_B
    NESTED LOOPS
    MERGE JOIN CARTESIAN
    TABLE ACCESS FULL INV.MTL_PARAMETERS
    BUFFER SORT
    TABLE ACCESS BY INDEX ROWID APPLSYS.FND_LOOKUP_VALUES
    INDEX RANGE SCAN APPLSYS.FND_LOOKUP_VALUES_U2
    INDEX RANGE SCAN INV.MTL_SYSTEM_ITEMS_B_XX1
    TABLE ACCESS BY INDEX ROWID ONT.OE_ORDER_LINES_ALL
    INDEX RANGE SCAN ONT.OE_ORDER_LINES_N3
    We have one more instance whose database is 11g and the same report is migrated but it is taking too long time to execute the report output. Please advise why it is happening even why the plan is difference.
    SELECT STATEMENT
    VIEW APPS
    SORT UNIQUE
    UNION-ALL
    NESTED LOOPS
    NESTED LOOPS
    NESTED LOOPS
    NESTED LOOPS
    NESTED LOOPS
    INDEX RANGE SCAN INV.MTL_ITEM_CATEGORIES_U1
    INDEX UNIQUE SCAN INV.MTL_CATEGORY_SETS_B_U1
    TABLE ACCESS BY INDEX ROWID INV.MTL_CATEGORIES_B
    INDEX UNIQUE SCAN INV.MTL_CATEGORIES_B_U1
    INDEX UNIQUE SCAN INV.MTL_CATEGORIES_TL_U1
    INDEX UNIQUE SCAN INV.MTL_CATEGORY_SETS_TL_U1
    TABLE ACCESS BY INDEX ROWID INV.MTL_CATEGORY_SETS_TL
    SORT AGGREGATE
    TABLE ACCESS BY INDEX ROWID BOM.BOM_STRUCTURES_B
    INDEX RANGE SCAN BOM.BOM_STRUCTURES_B_N2
    SORT AGGREGATE
    INDEX RANGE SCAN BOM.BOM_OPERATIONAL_ROUTINGS_U2
    SORT AGGREGATE
    TABLE ACCESS BY INDEX ROWID BOM.CST_ITEM_COSTS
    INDEX UNIQUE SCAN BOM.CST_ITEM_COSTS_U1
    SORT AGGREGATE
    TABLE ACCESS BY INDEX ROWID BOM.CST_ITEM_COSTS
    INDEX UNIQUE SCAN BOM.CST_ITEM_COSTS_U1
    SORT AGGREGATE
    FILTER
    NESTED LOOPS
    NESTED LOOPS
    MERGE JOIN CARTESIAN
    NESTED LOOPS
    NESTED LOOPS
    TABLE ACCESS BY INDEX ROWID QP.QP_LIST_HEADERS_TL
    INDEX RANGE SCAN QP.QP_LIST_HEADERS_TL_U1
    INDEX UNIQUE SCAN QP.QP_LIST_HEADERS_B_PK
    TABLE ACCESS BY INDEX ROWID QP.QP_LIST_HEADERS_B
    BUFFER SORT
    TABLE ACCESS BY INDEX ROWID QP.QP_PRICING_ATTRIBUTES
    INDEX SKIP SCAN QP.QP_PRICING_ATTRIBUTES_N11
    INDEX UNIQUE SCAN QP.QP_LIST_LINES_PK
    TABLE ACCESS BY INDEX ROWID QP.QP_LIST_LINES
    TABLE ACCESS BY INDEX ROWID QP.QP_PRICING_ATTRIBUTES
    INDEX RANGE SCAN QP.QP_PRICING_ATTRIBUTES_N3
    TABLE ACCESS BY INDEX ROWID QP.QP_PRICING_ATTRIBUTES
    INDEX RANGE SCAN QP.QP_PRICING_ATTRIBUTES_N3
    TABLE ACCESS BY INDEX ROWID QP.QP_PRICING_ATTRIBUTES
    INDEX RANGE SCAN QP.QP_PRICING_ATTRIBUTES_N3
    SORT AGGREGATE
    FILTER
    NESTED LOOPS
    NESTED LOOPS
    MERGE JOIN CARTESIAN
    NESTED LOOPS
    NESTED LOOPS
    TABLE ACCESS BY INDEX ROWID QP.QP_LIST_HEADERS_TL
    INDEX RANGE SCAN QP.QP_LIST_HEADERS_TL_U1
    INDEX UNIQUE SCAN QP.QP_LIST_HEADERS_B_PK
    TABLE ACCESS BY INDEX ROWID QP.QP_LIST_HEADERS_B
    BUFFER SORT
    TABLE ACCESS BY INDEX ROWID QP.QP_PRICING_ATTRIBUTES
    INDEX SKIP SCAN QP.QP_PRICING_ATTRIBUTES_N11
    INDEX UNIQUE SCAN QP.QP_LIST_LINES_PK
    TABLE ACCESS BY INDEX ROWID QP.QP_LIST_LINES
    TABLE ACCESS BY INDEX ROWID QP.QP_PRICING_ATTRIBUTES
    INDEX RANGE SCAN QP.QP_PRICING_ATTRIBUTES_N3
    TABLE ACCESS BY INDEX ROWID QP.QP_PRICING_ATTRIBUTES
    INDEX RANGE SCAN QP.QP_PRICING_ATTRIBUTES_N3
    TABLE ACCESS BY INDEX ROWID QP.QP_PRICING_ATTRIBUTES
    INDEX RANGE SCAN QP.QP_PRICING_ATTRIBUTES_N3
    SORT AGGREGATE
    NESTED LOOPS
    TABLE ACCESS BY INDEX ROWID MRP.MRP_ASSIGNMENT_SETS
    INDEX UNIQUE SCAN MRP.MRP_ASSIGNMENT_SETS_U2
    INDEX RANGE SCAN MRP.MRP_SR_ASSIGNMENTS_N3
    SORT AGGREGATE
    TABLE ACCESS BY INDEX ROWID PO.PO_APPROVED_SUPPLIER_LIST
    INDEX RANGE SCAN PO.PO_APPROVED_SUPPLIER_LIST_N1
    SORT AGGREGATE
    TABLE ACCESS BY INDEX ROWID INV.MTL_ONHAND_QUANTITIES_DETAIL
    INDEX RANGE SCAN INV.MTL_ONHAND_QUANTITIES_N6
    SORT AGGREGATE
    TABLE ACCESS BY INDEX ROWID INV.MTL_ONHAND_QUANTITIES_DETAIL
    INDEX RANGE SCAN INV.MTL_ONHAND_QUANTITIES_N6
    SORT AGGREGATE
    TABLE ACCESS BY INDEX ROWID ONT.OE_ORDER_LINES_ALL
    INDEX RANGE SCAN ONT.OE_ORDER_LINES_N3
    SORT AGGREGATE
    TABLE ACCESS BY INDEX ROWID ONT.OE_ORDER_LINES_ALL
    INDEX RANGE SCAN ONT.OE_ORDER_LINES_N3
    NESTED LOOPS
    NESTED LOOPS
    NESTED LOOPS
    INDEX RANGE SCAN INV.MTL_ITEM_CATEGORIES_U1
    TABLE ACCESS BY INDEX ROWID INV.MTL_CATEGORIES_B
    INDEX UNIQUE SCAN INV.MTL_CATEGORIES_B_U1
    INDEX UNIQUE SCAN INV.MTL_CATEGORY_SETS_TL_U1
    TABLE ACCESS BY INDEX ROWID INV.MTL_CATEGORY_SETS_TL
    HASH JOIN
    NESTED LOOPS
    NESTED LOOPS
    MERGE JOIN CARTESIAN
    TABLE ACCESS FULL INV.MTL_PARAMETERS
    BUFFER SORT
    TABLE ACCESS BY INDEX ROWID APPLSYS.FND_LOOKUP_VALUES
    INDEX RANGE SCAN APPLSYS.FND_LOOKUP_VALUES_U2
    INDEX RANGE SCAN INV.MTL_SYSTEM_ITEMS_B_XX1
    TABLE ACCESS BY INDEX ROWID INV.MTL_SYSTEM_ITEMS_B
    TABLE ACCESS FULL ONT.OE_ORDER_LINES_ALL
    NESTED LOOPS
    NESTED LOOPS
    NESTED LOOPS
    NESTED LOOPS
    NESTED LOOPS
    INDEX RANGE SCAN INV.MTL_ITEM_CATEGORIES_U1
    INDEX UNIQUE SCAN INV.MTL_CATEGORY_SETS_B_U1
    TABLE ACCESS BY INDEX ROWID INV.MTL_CATEGORIES_B
    INDEX UNIQUE SCAN INV.MTL_CATEGORIES_B_U1
    INDEX UNIQUE SCAN INV.MTL_CATEGORIES_TL_U1
    INDEX UNIQUE SCAN INV.MTL_CATEGORY_SETS_TL_U1
    TABLE ACCESS BY INDEX ROWID INV.MTL_CATEGORY_SETS_TL
    TABLE ACCESS BY INDEX ROWID BOM.BOM_STRUCTURES_B
    INDEX RANGE SCAN BOM.BOM_STRUCTURES_B_N2
    INDEX RANGE SCAN BOM.BOM_OPERATIONAL_ROUTINGS_U2
    TABLE ACCESS BY INDEX ROWID BOM.CST_ITEM_COSTS
    INDEX UNIQUE SCAN BOM.CST_ITEM_COSTS_U1
    TABLE ACCESS BY INDEX ROWID BOM.CST_ITEM_COSTS
    INDEX UNIQUE SCAN BOM.CST_ITEM_COSTS_U1
    FILTER
    NESTED LOOPS
    NESTED LOOPS
    MERGE JOIN CARTESIAN
    NESTED LOOPS
    NESTED LOOPS
    TABLE ACCESS BY INDEX ROWID QP.QP_LIST_HEADERS_TL
    INDEX RANGE SCAN QP.QP_LIST_HEADERS_TL_U1
    INDEX UNIQUE SCAN QP.QP_LIST_HEADERS_B_PK
    TABLE ACCESS BY INDEX ROWID QP.QP_LIST_HEADERS_B
    BUFFER SORT
    TABLE ACCESS BY INDEX ROWID QP.QP_PRICING_ATTRIBUTES
    INDEX SKIP SCAN QP.QP_PRICING_ATTRIBUTES_N11
    INDEX UNIQUE SCAN QP.QP_LIST_LINES_PK
    TABLE ACCESS BY INDEX ROWID QP.QP_LIST_LINES
    TABLE ACCESS BY INDEX ROWID QP.QP_PRICING_ATTRIBUTES
    INDEX RANGE SCAN QP.QP_PRICING_ATTRIBUTES_N3
    TABLE ACCESS BY INDEX ROWID QP.QP_PRICING_ATTRIBUTES
    INDEX RANGE SCAN QP.QP_PRICING_ATTRIBUTES_N3
    TABLE ACCESS BY INDEX ROWID QP.QP_PRICING_ATTRIBUTES
    INDEX RANGE SCAN QP.QP_PRICING_ATTRIBUTES_N3
    FILTER
    NESTED LOOPS
    NESTED LOOPS
    MERGE JOIN CARTESIAN
    NESTED LOOPS
    NESTED LOOPS
    TABLE ACCESS BY INDEX ROWID QP.QP_LIST_HEADERS_TL
    INDEX RANGE SCAN QP.QP_LIST_HEADERS_TL_U1
    INDEX UNIQUE SCAN QP.QP_LIST_HEADERS_B_PK
    TABLE ACCESS BY INDEX ROWID QP.QP_LIST_HEADERS_B
    BUFFER SORT
    TABLE ACCESS BY INDEX ROWID QP.QP_PRICING_ATTRIBUTES
    INDEX SKIP SCAN QP.QP_PRICING_ATTRIBUTES_N11
    INDEX UNIQUE SCAN QP.QP_LIST_LINES_PK
    TABLE ACCESS BY INDEX ROWID QP.QP_LIST_LINES
    TABLE ACCESS BY INDEX ROWID QP.QP_PRICING_ATTRIBUTES
    INDEX RANGE SCAN QP.QP_PRICING_ATTRIBUTES_N3
    TABLE ACCESS BY INDEX ROWID QP.QP_PRICING_ATTRIBUTES
    INDEX RANGE SCAN QP.QP_PRICING_ATTRIBUTES_N3
    TABLE ACCESS BY INDEX ROWID QP.QP_PRICING_ATTRIBUTES
    INDEX RANGE SCAN QP.QP_PRICING_ATTRIBUTES_N3
    SORT UNIQUE NOSORT
    NESTED LOOPS
    TABLE ACCESS BY INDEX ROWID MRP.MRP_ASSIGNMENT_SETS
    INDEX UNIQUE SCAN MRP.MRP_ASSIGNMENT_SETS_U2
    INDEX RANGE SCAN MRP.MRP_SR_ASSIGNMENTS_N3
    SORT UNIQUE NOSORT
    TABLE ACCESS BY INDEX ROWID PO.PO_APPROVED_SUPPLIER_LIST
    INDEX RANGE SCAN PO.PO_APPROVED_SUPPLIER_LIST_N1
    SORT AGGREGATE
    TABLE ACCESS BY INDEX ROWID INV.MTL_ONHAND_QUANTITIES_DETAIL
    INDEX RANGE SCAN INV.MTL_ONHAND_QUANTITIES_N6
    SORT AGGREGATE
    TABLE ACCESS BY INDEX ROWID INV.MTL_ONHAND_QUANTITIES_DETAIL
    INDEX RANGE SCAN INV.MTL_ONHAND_QUANTITIES_N6
    SORT AGGREGATE
    INDEX RANGE SCAN MRP.MRP_GROSS_REQUIREMENTS_N1
    SORT AGGREGATE
    INDEX RANGE SCAN MRP.MRP_GROSS_REQUIREMENTS_N1
    NESTED LOOPS
    NESTED LOOPS
    NESTED LOOPS
    INDEX RANGE SCAN INV.MTL_ITEM_CATEGORIES_U1
    TABLE ACCESS BY INDEX ROWID INV.MTL_CATEGORIES_B
    INDEX UNIQUE SCAN INV.MTL_CATEGORIES_B_U1
    INDEX UNIQUE SCAN INV.MTL_CATEGORY_SETS_TL_U1
    TABLE ACCESS BY INDEX ROWID INV.MTL_CATEGORY_SETS_TL
    NESTED LOOPS ANTI
    HASH JOIN
    TABLE ACCESS BY INDEX ROWID MRP.MRP_GROSS_REQUIREMENTS
    INDEX SKIP SCAN MRP.MRP_GROSS_REQUIREMENTS_N2
    NESTED LOOPS
    NESTED LOOPS
    MERGE JOIN CARTESIAN
    TABLE ACCESS FULL INV.MTL_PARAMETERS
    BUFFER SORT
    TABLE ACCESS BY INDEX ROWID APPLSYS.FND_LOOKUP_VALUES
    INDEX RANGE SCAN APPLSYS.FND_LOOKUP_VALUES_U2
    INDEX RANGE SCAN INV.MTL_SYSTEM_ITEMS_B_XX1
    TABLE ACCESS BY INDEX ROWID INV.MTL_SYSTEM_ITEMS_B
    TABLE ACCESS BY INDEX ROWID ONT.OE_ORDER_LINES_ALL
    INDEX RANGE SCAN ONT.OE_ORDER_LINES_N3
    }

    Hi All,
    We have one test instance for database 10g where the report is working fine below is the plan for report.
    SELECT STATEMENT
    VIEW APPS
    SORT UNIQUE
    UNION-ALL
    HASH JOIN
    TABLE ACCESS BY INDEX ROWID INV.MTL_SYSTEM_ITEMS_B
    NESTED LOOPS
    MERGE JOIN CARTESIAN
    TABLE ACCESS FULL INV.MTL_PARAMETERS
    BUFFER SORT
    TABLE ACCESS BY INDEX ROWID APPLSYS.FND_LOOKUP_VALUES
    INDEX RANGE SCAN APPLSYS.FND_LOOKUP_VALUES_U2
    INDEX RANGE SCAN INV.MTL_SYSTEM_ITEMS_B_XX1
    TABLE ACCESS FULL ONT.OE_ORDER_LINES_ALL
    NESTED LOOPS ANTI
    HASH JOIN
    TABLE ACCESS BY INDEX ROWID MRP.MRP_GROSS_REQUIREMENTS
    INDEX SKIP SCAN MRP.MRP_GROSS_REQUIREMENTS_N2
    TABLE ACCESS BY INDEX ROWID INV.MTL_SYSTEM_ITEMS_B
    NESTED LOOPS
    MERGE JOIN CARTESIAN
    TABLE ACCESS FULL INV.MTL_PARAMETERS
    BUFFER SORT
    TABLE ACCESS BY INDEX ROWID APPLSYS.FND_LOOKUP_VALUES
    INDEX RANGE SCAN APPLSYS.FND_LOOKUP_VALUES_U2
    INDEX RANGE SCAN INV.MTL_SYSTEM_ITEMS_B_XX1
    TABLE ACCESS BY INDEX ROWID ONT.OE_ORDER_LINES_ALL
    INDEX RANGE SCAN ONT.OE_ORDER_LINES_N3
    We have one more instance whose database is 11g and the same report is migrated but it is taking too long time to execute the report output. Please advise why it is happening even why the plan is difference.
    SELECT STATEMENT
    VIEW APPS
    SORT UNIQUE
    UNION-ALL
    NESTED LOOPS
    NESTED LOOPS
    NESTED LOOPS
    NESTED LOOPS
    NESTED LOOPS
    INDEX RANGE SCAN INV.MTL_ITEM_CATEGORIES_U1
    INDEX UNIQUE SCAN INV.MTL_CATEGORY_SETS_B_U1
    TABLE ACCESS BY INDEX ROWID INV.MTL_CATEGORIES_B
    INDEX UNIQUE SCAN INV.MTL_CATEGORIES_B_U1
    INDEX UNIQUE SCAN INV.MTL_CATEGORIES_TL_U1
    INDEX UNIQUE SCAN INV.MTL_CATEGORY_SETS_TL_U1
    TABLE ACCESS BY INDEX ROWID INV.MTL_CATEGORY_SETS_TL
    SORT AGGREGATE
    TABLE ACCESS BY INDEX ROWID BOM.BOM_STRUCTURES_B
    INDEX RANGE SCAN BOM.BOM_STRUCTURES_B_N2
    SORT AGGREGATE
    INDEX RANGE SCAN BOM.BOM_OPERATIONAL_ROUTINGS_U2
    SORT AGGREGATE
    TABLE ACCESS BY INDEX ROWID BOM.CST_ITEM_COSTS
    INDEX UNIQUE SCAN BOM.CST_ITEM_COSTS_U1
    SORT AGGREGATE
    TABLE ACCESS BY INDEX ROWID BOM.CST_ITEM_COSTS
    INDEX UNIQUE SCAN BOM.CST_ITEM_COSTS_U1
    SORT AGGREGATE
    FILTER
    NESTED LOOPS
    NESTED LOOPS
    MERGE JOIN CARTESIAN
    NESTED LOOPS
    NESTED LOOPS
    TABLE ACCESS BY INDEX ROWID QP.QP_LIST_HEADERS_TL
    INDEX RANGE SCAN QP.QP_LIST_HEADERS_TL_U1
    INDEX UNIQUE SCAN QP.QP_LIST_HEADERS_B_PK
    TABLE ACCESS BY INDEX ROWID QP.QP_LIST_HEADERS_B
    BUFFER SORT
    TABLE ACCESS BY INDEX ROWID QP.QP_PRICING_ATTRIBUTES
    INDEX SKIP SCAN QP.QP_PRICING_ATTRIBUTES_N11
    INDEX UNIQUE SCAN QP.QP_LIST_LINES_PK
    TABLE ACCESS BY INDEX ROWID QP.QP_LIST_LINES
    TABLE ACCESS BY INDEX ROWID QP.QP_PRICING_ATTRIBUTES
    INDEX RANGE SCAN QP.QP_PRICING_ATTRIBUTES_N3
    TABLE ACCESS BY INDEX ROWID QP.QP_PRICING_ATTRIBUTES
    INDEX RANGE SCAN QP.QP_PRICING_ATTRIBUTES_N3
    TABLE ACCESS BY INDEX ROWID QP.QP_PRICING_ATTRIBUTES
    INDEX RANGE SCAN QP.QP_PRICING_ATTRIBUTES_N3
    SORT AGGREGATE
    FILTER
    NESTED LOOPS
    NESTED LOOPS
    MERGE JOIN CARTESIAN
    NESTED LOOPS
    NESTED LOOPS
    TABLE ACCESS BY INDEX ROWID QP.QP_LIST_HEADERS_TL
    INDEX RANGE SCAN QP.QP_LIST_HEADERS_TL_U1
    INDEX UNIQUE SCAN QP.QP_LIST_HEADERS_B_PK
    TABLE ACCESS BY INDEX ROWID QP.QP_LIST_HEADERS_B
    BUFFER SORT
    TABLE ACCESS BY INDEX ROWID QP.QP_PRICING_ATTRIBUTES
    INDEX SKIP SCAN QP.QP_PRICING_ATTRIBUTES_N11
    INDEX UNIQUE SCAN QP.QP_LIST_LINES_PK
    TABLE ACCESS BY INDEX ROWID QP.QP_LIST_LINES
    TABLE ACCESS BY INDEX ROWID QP.QP_PRICING_ATTRIBUTES
    INDEX RANGE SCAN QP.QP_PRICING_ATTRIBUTES_N3
    TABLE ACCESS BY INDEX ROWID QP.QP_PRICING_ATTRIBUTES
    INDEX RANGE SCAN QP.QP_PRICING_ATTRIBUTES_N3
    TABLE ACCESS BY INDEX ROWID QP.QP_PRICING_ATTRIBUTES
    INDEX RANGE SCAN QP.QP_PRICING_ATTRIBUTES_N3
    SORT AGGREGATE
    NESTED LOOPS
    TABLE ACCESS BY INDEX ROWID MRP.MRP_ASSIGNMENT_SETS
    INDEX UNIQUE SCAN MRP.MRP_ASSIGNMENT_SETS_U2
    INDEX RANGE SCAN MRP.MRP_SR_ASSIGNMENTS_N3
    SORT AGGREGATE
    TABLE ACCESS BY INDEX ROWID PO.PO_APPROVED_SUPPLIER_LIST
    INDEX RANGE SCAN PO.PO_APPROVED_SUPPLIER_LIST_N1
    SORT AGGREGATE
    TABLE ACCESS BY INDEX ROWID INV.MTL_ONHAND_QUANTITIES_DETAIL
    INDEX RANGE SCAN INV.MTL_ONHAND_QUANTITIES_N6
    SORT AGGREGATE
    TABLE ACCESS BY INDEX ROWID INV.MTL_ONHAND_QUANTITIES_DETAIL
    INDEX RANGE SCAN INV.MTL_ONHAND_QUANTITIES_N6
    SORT AGGREGATE
    TABLE ACCESS BY INDEX ROWID ONT.OE_ORDER_LINES_ALL
    INDEX RANGE SCAN ONT.OE_ORDER_LINES_N3
    SORT AGGREGATE
    TABLE ACCESS BY INDEX ROWID ONT.OE_ORDER_LINES_ALL
    INDEX RANGE SCAN ONT.OE_ORDER_LINES_N3
    NESTED LOOPS
    NESTED LOOPS
    NESTED LOOPS
    INDEX RANGE SCAN INV.MTL_ITEM_CATEGORIES_U1
    TABLE ACCESS BY INDEX ROWID INV.MTL_CATEGORIES_B
    INDEX UNIQUE SCAN INV.MTL_CATEGORIES_B_U1
    INDEX UNIQUE SCAN INV.MTL_CATEGORY_SETS_TL_U1
    TABLE ACCESS BY INDEX ROWID INV.MTL_CATEGORY_SETS_TL
    HASH JOIN
    NESTED LOOPS
    NESTED LOOPS
    MERGE JOIN CARTESIAN
    TABLE ACCESS FULL INV.MTL_PARAMETERS
    BUFFER SORT
    TABLE ACCESS BY INDEX ROWID APPLSYS.FND_LOOKUP_VALUES
    INDEX RANGE SCAN APPLSYS.FND_LOOKUP_VALUES_U2
    INDEX RANGE SCAN INV.MTL_SYSTEM_ITEMS_B_XX1
    TABLE ACCESS BY INDEX ROWID INV.MTL_SYSTEM_ITEMS_B
    TABLE ACCESS FULL ONT.OE_ORDER_LINES_ALL
    NESTED LOOPS
    NESTED LOOPS
    NESTED LOOPS
    NESTED LOOPS
    NESTED LOOPS
    INDEX RANGE SCAN INV.MTL_ITEM_CATEGORIES_U1
    INDEX UNIQUE SCAN INV.MTL_CATEGORY_SETS_B_U1
    TABLE ACCESS BY INDEX ROWID INV.MTL_CATEGORIES_B
    INDEX UNIQUE SCAN INV.MTL_CATEGORIES_B_U1
    INDEX UNIQUE SCAN INV.MTL_CATEGORIES_TL_U1
    INDEX UNIQUE SCAN INV.MTL_CATEGORY_SETS_TL_U1
    TABLE ACCESS BY INDEX ROWID INV.MTL_CATEGORY_SETS_TL
    TABLE ACCESS BY INDEX ROWID BOM.BOM_STRUCTURES_B
    INDEX RANGE SCAN BOM.BOM_STRUCTURES_B_N2
    INDEX RANGE SCAN BOM.BOM_OPERATIONAL_ROUTINGS_U2
    TABLE ACCESS BY INDEX ROWID BOM.CST_ITEM_COSTS
    INDEX UNIQUE SCAN BOM.CST_ITEM_COSTS_U1
    TABLE ACCESS BY INDEX ROWID BOM.CST_ITEM_COSTS
    INDEX UNIQUE SCAN BOM.CST_ITEM_COSTS_U1
    FILTER
    NESTED LOOPS
    NESTED LOOPS
    MERGE JOIN CARTESIAN
    NESTED LOOPS
    NESTED LOOPS
    TABLE ACCESS BY INDEX ROWID QP.QP_LIST_HEADERS_TL
    INDEX RANGE SCAN QP.QP_LIST_HEADERS_TL_U1
    INDEX UNIQUE SCAN QP.QP_LIST_HEADERS_B_PK
    TABLE ACCESS BY INDEX ROWID QP.QP_LIST_HEADERS_B
    BUFFER SORT
    TABLE ACCESS BY INDEX ROWID QP.QP_PRICING_ATTRIBUTES
    INDEX SKIP SCAN QP.QP_PRICING_ATTRIBUTES_N11
    INDEX UNIQUE SCAN QP.QP_LIST_LINES_PK
    TABLE ACCESS BY INDEX ROWID QP.QP_LIST_LINES
    TABLE ACCESS BY INDEX ROWID QP.QP_PRICING_ATTRIBUTES
    INDEX RANGE SCAN QP.QP_PRICING_ATTRIBUTES_N3
    TABLE ACCESS BY INDEX ROWID QP.QP_PRICING_ATTRIBUTES
    INDEX RANGE SCAN QP.QP_PRICING_ATTRIBUTES_N3
    TABLE ACCESS BY INDEX ROWID QP.QP_PRICING_ATTRIBUTES
    INDEX RANGE SCAN QP.QP_PRICING_ATTRIBUTES_N3
    FILTER
    NESTED LOOPS
    NESTED LOOPS
    MERGE JOIN CARTESIAN
    NESTED LOOPS
    NESTED LOOPS
    TABLE ACCESS BY INDEX ROWID QP.QP_LIST_HEADERS_TL
    INDEX RANGE SCAN QP.QP_LIST_HEADERS_TL_U1
    INDEX UNIQUE SCAN QP.QP_LIST_HEADERS_B_PK
    TABLE ACCESS BY INDEX ROWID QP.QP_LIST_HEADERS_B
    BUFFER SORT
    TABLE ACCESS BY INDEX ROWID QP.QP_PRICING_ATTRIBUTES
    INDEX SKIP SCAN QP.QP_PRICING_ATTRIBUTES_N11
    INDEX UNIQUE SCAN QP.QP_LIST_LINES_PK
    TABLE ACCESS BY INDEX ROWID QP.QP_LIST_LINES
    TABLE ACCESS BY INDEX ROWID QP.QP_PRICING_ATTRIBUTES
    INDEX RANGE SCAN QP.QP_PRICING_ATTRIBUTES_N3
    TABLE ACCESS BY INDEX ROWID QP.QP_PRICING_ATTRIBUTES
    INDEX RANGE SCAN QP.QP_PRICING_ATTRIBUTES_N3
    TABLE ACCESS BY INDEX ROWID QP.QP_PRICING_ATTRIBUTES
    INDEX RANGE SCAN QP.QP_PRICING_ATTRIBUTES_N3
    SORT UNIQUE NOSORT
    NESTED LOOPS
    TABLE ACCESS BY INDEX ROWID MRP.MRP_ASSIGNMENT_SETS
    INDEX UNIQUE SCAN MRP.MRP_ASSIGNMENT_SETS_U2
    INDEX RANGE SCAN MRP.MRP_SR_ASSIGNMENTS_N3
    SORT UNIQUE NOSORT
    TABLE ACCESS BY INDEX ROWID PO.PO_APPROVED_SUPPLIER_LIST
    INDEX RANGE SCAN PO.PO_APPROVED_SUPPLIER_LIST_N1
    SORT AGGREGATE
    TABLE ACCESS BY INDEX ROWID INV.MTL_ONHAND_QUANTITIES_DETAIL
    INDEX RANGE SCAN INV.MTL_ONHAND_QUANTITIES_N6
    SORT AGGREGATE
    TABLE ACCESS BY INDEX ROWID INV.MTL_ONHAND_QUANTITIES_DETAIL
    INDEX RANGE SCAN INV.MTL_ONHAND_QUANTITIES_N6
    SORT AGGREGATE
    INDEX RANGE SCAN MRP.MRP_GROSS_REQUIREMENTS_N1
    SORT AGGREGATE
    INDEX RANGE SCAN MRP.MRP_GROSS_REQUIREMENTS_N1
    NESTED LOOPS
    NESTED LOOPS
    NESTED LOOPS
    INDEX RANGE SCAN INV.MTL_ITEM_CATEGORIES_U1
    TABLE ACCESS BY INDEX ROWID INV.MTL_CATEGORIES_B
    INDEX UNIQUE SCAN INV.MTL_CATEGORIES_B_U1
    INDEX UNIQUE SCAN INV.MTL_CATEGORY_SETS_TL_U1
    TABLE ACCESS BY INDEX ROWID INV.MTL_CATEGORY_SETS_TL
    NESTED LOOPS ANTI
    HASH JOIN
    TABLE ACCESS BY INDEX ROWID MRP.MRP_GROSS_REQUIREMENTS
    INDEX SKIP SCAN MRP.MRP_GROSS_REQUIREMENTS_N2
    NESTED LOOPS
    NESTED LOOPS
    MERGE JOIN CARTESIAN
    TABLE ACCESS FULL INV.MTL_PARAMETERS
    BUFFER SORT
    TABLE ACCESS BY INDEX ROWID APPLSYS.FND_LOOKUP_VALUES
    INDEX RANGE SCAN APPLSYS.FND_LOOKUP_VALUES_U2
    INDEX RANGE SCAN INV.MTL_SYSTEM_ITEMS_B_XX1
    TABLE ACCESS BY INDEX ROWID INV.MTL_SYSTEM_ITEMS_B
    TABLE ACCESS BY INDEX ROWID ONT.OE_ORDER_LINES_ALL
    INDEX RANGE SCAN ONT.OE_ORDER_LINES_N3
    }

  • Edit an OS Commerce template in dreamweaver

    Hi
    I downloaded an os commerece template for my first e commerce store and everything is set up ok, just need to edit the whole template to my products and colours. I am trying to remove the stamp at the bottom that says designed by monstertemplate, with their website links at the bottom but not having any luck. I can see the the links code when I turn on the live code view in dreamweaver but cant see it when I go to codes to try and edit it. Maybe I am missing something and would appricate any help. This is the website:
    http://creativeinky.com/site/index.php - The links I want to remove are at the footer of the website. This has not been edited yet and the store is not functional.
    This is what I see in codes:( I have tried to remove oscommerce at the top but that does not help). Which code is for the stamp at the bottom links as I cannot see it in this code view where I can edit it. Please help.
    <?php
      $Id: index.php 1739 2007-12-20 00:52:16Z hpdl $
      osCommerce, Open Source E-Commerce Solutions
      http://www.oscommerce.com
      Copyright (c) 2003 osCommerce
      Released under the GNU General Public License
      require('includes/application_top.php');
    // the following cPath references come from application_top.php
      $category_depth = 'top';
      if (isset($cPath) && tep_not_null($cPath)) {
        $categories_products_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_TO_CATEGORIES . " where categories_id = '" . (int)$current_category_id . "'");
        $cateqories_products = tep_db_fetch_array($categories_products_query);
        if ($cateqories_products['total'] > 0) {
          $category_depth = 'products'; // display products
        } else {
          $category_parent_query = tep_db_query("select count(*) as total from " . TABLE_CATEGORIES . " where parent_id = '" . (int)$current_category_id . "'");
          $category_parent = tep_db_fetch_array($category_parent_query);
          if ($category_parent['total'] > 0) {
            $category_depth = 'nested'; // navigate through the categories
          } else {
            $category_depth = 'products'; // category has no products, but display the 'no products' message
      require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_DEFAULT);
    ?>
    <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html <?php echo HTML_PARAMS; ?>>
    <head>
    <?php require(DIR_WS_INCLUDES . 'header_includes.php'); ?>
    </head>
    <?php
      if ($category_depth == 'nested') {
        $category_query = tep_db_query("select cd.categories_name, c.categories_image from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = '" . (int)$current_category_id . "' and cd.categories_id = '" . (int)$current_category_id . "' and cd.language_id = '" . (int)$languages_id . "'");
        $category = tep_db_fetch_array($category_query);
    ?>
    <body>
    <!-- header //-->
    <?php $tab_sel = 2; ?>
    <?php require(DIR_WS_INCLUDES . 'header.php'); ?>
    <!-- header_eof //-->
    <!-- body //-->
    <table border="0" class="<?php echo MAIN_TABLE; ?>" cellspacing="0" cellpadding="0">
    <tr>
        <td class="<?php echo BOX_WIDTH_TD_LEFT; ?>"><table border="0" class="<?php echo BOX_WIDTH_LEFT; ?>" cellspacing="0" cellpadding="0">
    <!-- left_navigation //-->
    <?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
    <!-- left_navigation_eof //-->
        </table></td>
    <!-- body_text //-->
        <td class="<?php echo CONTENT_WIDTH_TD; ?>"><?php include(DIR_WS_BOXES . 'panel_top.php');?>
    <?php echo tep_draw_top();?>
                                            <?php new contentBoxHeading_ProdNew($info_box_contents);?>
    <?php echo tep_draw3_top();?>
                        <table border="0" width="100%" cellspacing="0" cellpadding="0" class="main sub_category">
                  <tr>
    <?php
        if (isset($cPath) && strpos('_', $cPath)) {
    // check to see if there are deeper categories within the current category
          $category_links = array_reverse($cPath_array);
          for($i=0, $n=sizeof($category_links); $i<$n; $i++) {
            $categories_query = tep_db_query("select count(*) as total from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$category_links[$i] . "' and c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "'");
            $categories = tep_db_fetch_array($categories_query);
            if ($categories['total'] < 1) {
              // do nothing, go through the loop
            } else {
              $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.categories_image, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$category_links[$i] . "' and c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' order by sort_order, cd.categories_name");
              break; // we've found the deepest category the customer is in
        } else {
          $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.categories_image, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$current_category_id . "' and c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' order by sort_order, cd.categories_name");
        $number_of_categories = tep_db_num_rows($categories_query);
        $rows = 0;
        while ($categories = tep_db_fetch_array($categories_query)) {
          $rows++;
          $cPath_new = tep_get_path($categories['categories_id']);
    $p_pic_sub = '<a href="' . tep_href_link(FILENAME_DEFAULT, $cPath_new) . '">' . tep_image(DIR_WS_IMAGES . $categories['categories_image'], $categories['categories_name'], SUBCATEGORY_IMAGE_WIDTH, SUBCATEGORY_IMAGE_HEIGHT) . '</a>';
    $p_name_sub = '<b><a href="' . tep_href_link(FILENAME_DEFAULT, $cPath_new) . '">' . $categories['categories_name'] . '</a></b>';
                $width = (int)(100 / (MAX_DISPLAY_CATEGORIES_PER_ROW-0)) . '%';
                echo '<td align="center" width="' . $width . '">'.tep_draw_prod2_top().'
                                            <table cellpadding="0" cellspacing="0" border="0" class="wrapper_box">
                                                      <tr><td class="pic4_padd">'.tep_draw_prod_pic_top().''.$p_pic_sub.''.tep_draw_prod_pic_bottom().' </td></tr>
                                                      <tr><td class="name name4_padd">'.$p_name_sub.'</td></tr>
                                            </table>'.tep_draw_prod2_bottom().'
                                  </td>'."\n";
                          if ($col!=(MAX_DISPLAY_CATEGORIES_PER_ROW-1)){
                          echo '
                                            <td>'.tep_draw_separator('spacer.gif', '1', '1').'</td>
                          }else{
                          if ((($rows / MAX_DISPLAY_CATEGORIES_PER_ROW) == floor($rows / MAX_DISPLAY_CATEGORIES_PER_ROW)) && ($rows != $number_of_categories)) {
                                  echo '             
                        </tr><tr><td class="prod_line_x" colspan="'.(MAX_DISPLAY_CATEGORIES_PER_ROW + MAX_DISPLAY_CATEGORIES_PER_ROW -1).'">'.tep_draw_separator('spacer.gif', '1', '18').'</td></tr>' . "\n";
                                  echo '<tr>' . "\n";
              if ($col==MAX_DISPLAY_CATEGORIES_PER_ROW-1){
              $col=0;
              }else{
              $col++;
    // needed for the new products module shown below
        $new_products_category_id = $current_category_id;
    ?>
                  </tr>
                </table>
    <?php echo tep_draw3_bottom();?>
    <?php echo tep_draw_bottom();?>
    <?php echo tep_draw_top();?>
                                            <?php new contentBoxHeading_WHATS_NEW($info_box_contents, true, false);?>
    <?php echo tep_draw3_top();?>
                                            <?php include(DIR_WS_MODULES . FILENAME_NEW_PRODUCTS); ?>
    <?php echo tep_draw3_bottom();?>
    <?php echo tep_draw_bottom();?>
              </td>
    <!-- body_text_eof //-->
              <td class="<?php echo BOX_WIDTH_TD_RIGHT; ?>"><table border="0" class="<?php echo BOX_WIDTH_RIGHT; ?>" cellspacing="0" cellpadding="0">
    <!-- right_navigation //-->
    <?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>
    <!-- right_navigation_eof //-->
        </table></td>
      </tr>
    </table>
    <!-- body_eof //-->
    <!-- footer //-->
    <?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
    <!-- footer_eof //-->
    </body>
    <?php
      } elseif ($category_depth == 'products' || isset($HTTP_GET_VARS['manufacturers_id'])) {
    // create column list
        $define_list = array('PRODUCT_LIST_MODEL' => PRODUCT_LIST_MODEL,
                             'PRODUCT_LIST_NAME' => PRODUCT_LIST_NAME,
                             'PRODUCT_LIST_MANUFACTURER' => PRODUCT_LIST_MANUFACTURER,
                             'PRODUCT_LIST_PRICE' => PRODUCT_LIST_PRICE,
                             'PRODUCT_LIST_QUANTITY' => PRODUCT_LIST_QUANTITY,
                             'PRODUCT_LIST_WEIGHT' => PRODUCT_LIST_WEIGHT,
                             'PRODUCT_LIST_IMAGE' => PRODUCT_LIST_IMAGE,
                             'PRODUCT_LIST_BUY_NOW' => PRODUCT_LIST_BUY_NOW);
        asort($define_list);
        $column_list = array();
        reset($define_list);
        while (list($key, $value) = each($define_list)) {
          if ($value > 0) $column_list[] = $key;
        $select_column_list = '';
        for ($i=0, $n=sizeof($column_list); $i<$n; $i++) {
          switch ($column_list[$i]) {
            case 'PRODUCT_LIST_MODEL':
              $select_column_list .= 'p.products_model, ';
              break;
            case 'PRODUCT_LIST_NAME':
              $select_column_list .= 'pd.products_name, ';
              break;
            case 'PRODUCT_LIST_MANUFACTURER':
              $select_column_list .= 'm.manufacturers_name, ';
              break;
            case 'PRODUCT_LIST_QUANTITY':
              $select_column_list .= 'p.products_quantity, ';
              break;
            case 'PRODUCT_LIST_IMAGE':
              $select_column_list .= 'p.products_image, ';
              break;
            case 'PRODUCT_LIST_WEIGHT':
              $select_column_list .= 'p.products_weight, ';
              break;
    // show the products of a specified manufacturer
        if (isset($HTTP_GET_VARS['manufacturers_id'])) {
          if (isset($HTTP_GET_VARS['filter_id']) && tep_not_null($HTTP_GET_VARS['filter_id'])) {
    // We are asked to show only a specific category
            $listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "'";
          } else {
    // We show them all
            $listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m where p.products_status = '1' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'";
        } else {
    // show the products in a given categorie
          if (isset($HTTP_GET_VARS['filter_id']) && tep_not_null($HTTP_GET_VARS['filter_id'])) {
    // We are asked to show only specific catgeory
            $listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'";
          } else {
    // We show them all
            $listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'";
        if ( (!isset($HTTP_GET_VARS['sort'])) || (!ereg('^[1-8][ad]$', $HTTP_GET_VARS['sort'])) || (substr($HTTP_GET_VARS['sort'], 0, 1) > sizeof($column_list)) ) {
          for ($i=0, $n=sizeof($column_list); $i<$n; $i++) {
            if ($column_list[$i] == 'PRODUCT_LIST_NAME') {
              $HTTP_GET_VARS['sort'] = $i+1 . 'a';
              $listing_sql .= " order by pd.products_name";
              break;
        } else {
          $sort_col = substr($HTTP_GET_VARS['sort'], 0 , 1);
          $sort_order = substr($HTTP_GET_VARS['sort'], 1);
          switch ($column_list[$sort_col-1]) {
            case 'PRODUCT_LIST_MODEL':
              $listing_sql .= " order by p.products_model " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
              break;
            case 'PRODUCT_LIST_NAME':
              $listing_sql .= " order by pd.products_name " . ($sort_order == 'd' ? 'desc' : '');
              break;
            case 'PRODUCT_LIST_MANUFACTURER':
              $listing_sql .= " order by m.manufacturers_name " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
              break;
            case 'PRODUCT_LIST_QUANTITY':
              $listing_sql .= " order by p.products_quantity " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
              break;
            case 'PRODUCT_LIST_IMAGE':
              $listing_sql .= " order by pd.products_name";
              break;
            case 'PRODUCT_LIST_WEIGHT':
              $listing_sql .= " order by p.products_weight " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
              break;
            case 'PRODUCT_LIST_PRICE':
              $listing_sql .= " order by final_price " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
              break;
    ?>
    <body>
    <!-- header //-->
    <?php $tab_sel = 2; ?>
    <?php require(DIR_WS_INCLUDES . 'header.php'); ?>
    <!-- header_eof //-->
    <!-- body //-->
    <table border="0" class="<?php echo MAIN_TABLE; ?>" cellspacing="0" cellpadding="0">
    <tr>
        <td class="<?php echo BOX_WIDTH_TD_LEFT; ?>"><table border="0" class="<?php echo BOX_WIDTH_LEFT; ?>" cellspacing="0" cellpadding="0">
    <!-- left_navigation //-->
    <?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
    <!-- left_navigation_eof //-->
        </table></td>
    <!-- body_text //-->
        <td class="<?php echo CONTENT_WIDTH_TD; ?>"><?php include(DIR_WS_BOXES . 'panel_top.php');?>
    <?php echo tep_draw_top();?>
    <?php
    // optional Product List Filter
              if (PRODUCT_LIST_FILTER > 0) {
          if (isset($HTTP_GET_VARS['manufacturers_id'])) {
            $filterlist_sql = "select distinct c.categories_id as id, cd.categories_name as name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where p.products_status = '1' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and p2c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' and p.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "' order by cd.categories_name";
          } else {
            $filterlist_sql= "select distinct m.manufacturers_id as id, m.manufacturers_name as name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_MANUFACTURERS . " m where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and p.products_id = p2c.products_id and p2c.categories_id = '" . (int)$current_category_id . "' order by m.manufacturers_name";
          $filterlist_query = tep_db_query($filterlist_sql);
          if (tep_db_num_rows($filterlist_query) > 1) {
                          echo tep_draw_side_top();
            echo '
                        <table cellpadding="0" cellspacing="0" border="0" class="select2">
                                  <tr><td align="right" class="main">' . tep_draw_form('filter', FILENAME_DEFAULT, 'get') . '<b>'.TEXT_SHOW . '</b>  ';
            if (isset($HTTP_GET_VARS['manufacturers_id'])) {
              echo tep_draw_hidden_field('manufacturers_id', $HTTP_GET_VARS['manufacturers_id']);
              $options = array(array('id' => '', 'text' => TEXT_ALL_CATEGORIES));
            } else {
              echo tep_draw_hidden_field('cPath', $cPath);
              $options = array(array('id' => '', 'text' => TEXT_ALL_MANUFACTURERS));
            echo tep_draw_hidden_field('sort', $HTTP_GET_VARS['sort']);
            while ($filterlist = tep_db_fetch_array($filterlist_query)) {
              $options[] = array('id' => $filterlist['id'], 'text' => $filterlist['name']);
            echo tep_draw_pull_down_menu('filter_id', $options, (isset($HTTP_GET_VARS['filter_id']) ? $HTTP_GET_VARS['filter_id'] : ''), 'onchange="this.form.submit()"');
            echo tep_hide_session_id() . '</form></td></tr>
                        </table>' . "\n";
                        echo tep_draw_side_bottom();
    // Get the right image for the top-right
        $image = DIR_WS_IMAGES . 'table_background_list.gif';
        if (isset($HTTP_GET_VARS['manufacturers_id'])) {
          $image = tep_db_query("select manufacturers_image from " . TABLE_MANUFACTURERS . " where manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'");
          $image = tep_db_fetch_array($image);
          $image = $image['manufacturers_image'];
        } elseif ($current_category_id) {
          $image = tep_db_query("select categories_image from " . TABLE_CATEGORIES . " where categories_id = '" . (int)$current_category_id . "'");
          $image = tep_db_fetch_array($image);
          $image = $image['categories_image'];
    ?>
                                            <?php include(DIR_WS_MODULES . FILENAME_PRODUCT_LISTING); ?>
    <?php echo tep_draw_bottom();?>
              </td>
    <!-- body_text_eof //-->
              <td class="<?php echo BOX_WIDTH_TD_RIGHT; ?>"><table border="0" class="<?php echo BOX_WIDTH_RIGHT; ?>" cellspacing="0" cellpadding="0">
    <!-- right_navigation //-->
    <?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>
    <!-- right_navigation_eof //-->
        </table></td>
      </tr>
    </table>
    <!-- body_eof //-->
    <!-- footer //-->
    <?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
    <!-- footer_eof //-->
    </body>
    <?php
      } else { // default page
    ?>
    <body>
    <!-- header //-->
    <?php $tab_sel = 222; ?>
    <?php require(DIR_WS_INCLUDES . 'header.php'); ?>
    <!-- header_eof //-->
    <!-- body //-->
    <table border="0" class="<?php echo MAIN_TABLE; ?>" cellspacing="0" cellpadding="0">
    <tr>
    <?php
              if           ($tab_sel == 222)          {
    ?>
       <td class="<?php echo BOX_WIDTH_TD_LEFT; ?>"><table border="0" class="<?php echo BOX_WIDTH_LEFT; ?>" cellspacing="0" cellpadding="0">
    <!-- right_navigation //-->
                                            <tr><td><?php require(DIR_WS_INCLUDES . 'column_left.php'); ?></td></tr>
    <!-- right_navigation_eof //-->
                            </table></td>
    <?php
    ?>
    <!-- body_text //-->
        <td class="<?php echo CONTENT_WIDTH_TD; ?>"><?php include(DIR_WS_BOXES . 'panel_top.php');?>
    <?php echo tep_draw_top();?>
    <!-- Welcome_box_start -->
    <?php /*  tep_draw_heading_top();  */?>
    <?php /*  tep_draw_heading_top_3();  */?>
    <?php   /*  echo tep_draw_prod_top();  */  ?>
         <!--   <table border="0" width="100%" cellspacing="0" cellpadding="0">
              <tr><td class="main"><?php /*  echo tep_customer_greeting();  */    ?></td></tr>
              <tr><td><?php    /*  echo tep_draw_separator('pixel_trans.gif', '100%', '10');  */   ?></td></tr>
              <tr><td class="main"><?php    /*   echo TEXT_MAIN;  */    ?></td></tr>
            </table>  -->
    <?php   /*  echo tep_draw_prod_bottom();  */   ?>
    <?php /*  tep_draw_heading_bottom_3();  */?>
    <?php  /*   echo tep_draw_separate();    */   ?>
    <!-- Welcome_box_end -->
                                            <?php  new contentBoxHeading_ProdNew($info_box_contents);?>
    <?php  echo tep_draw3_top();
              $sum2 = 4;
    ?>
                                            <?php include(DIR_WS_MODULES . FILENAME_NEW_PRODUCTS);?>
    <?php  echo tep_draw3_bottom();?>
                                            <?php include(DIR_WS_MODULES . FILENAME_UPCOMING_PRODUCTS); ?>
    <?php echo tep_draw_bottom();?>
              </td>
    <!-- body_text_eof //-->
              <td class="<?php echo BOX_WIDTH_TD_RIGHT; ?>"><table border="0" class="<?php echo BOX_WIDTH_RIGHT; ?>" cellspacing="0" cellpadding="0">
    <!-- right_navigation //-->
    <?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>
    <!-- right_navigation_eof //-->
        </table></td>
      </tr>
    </table>
    <!-- body_eof //-->
    <!-- footer //-->
    <?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
    <!-- footer_eof //-->
    <?php
    ?>
    </body>
    <?php require(DIR_WS_INCLUDES . 'footer_includes.php'); ?>
    </html>
    <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

    Obviousy this is not as plain saliling as I thought. Being as though its OScommerce you probably have to jump through hiops to get to what you need.
    Try:
    includes/configure.php
    or
    admin/includes/configure.php

  • Help with AP_Invoice Tables in SQL

    Hi Gurus,
    I am working on a report where i created a view. This query pulls data from SO,PO,ITEMS,AP and AR tables. The problem I am having is when I add a AP tables or a field from that table some of the Order Numbers are disappearing. Could someone please shed some light this. Here is the query
    SELECT DISTINCT trxl.CUSTOMER_TRX_LINE_ID,
    pv.vendor_name,
    api.invoice_num AP_Invoice_Num,
    trx.trx_date AR_Invoice_Date,
    trx.trx_number AR_Invoice_Number,
    pll.quantity_received,
    pll.quantity_billed,
    ool.shipped_quantity,
    mtlb.segment1 NSN,
    poh.closed_date po_close_date,
    gl.gl_date
    FROM apps.oe_order_headers_all ooh,
    apps.oe_order_lines_all ool,
    apps.oe_drop_ship_sources odss,
    apps.po_headers_all poh,
    apps.po_lines_all pol,
    apps.po_line_locations_all pll,
    apps.po_vendors pv,
    inv.mtl_system_items_b mtlb,
    ar.Ra_customer_trx_all trx,
    ar.ra_customer_trx_lines_all trxl,
    ar.hz_parties hzp,
    ar.hz_cust_accounts hzc,
    ap.ap_invoices_all api,
    ap.ap_invoice_lines_all apl,
    apps.RA_CUST_TRX_LINE_GL_DIST_ALL gl
    WHERE odss.header_id = ooh.header_id
    AND odss.line_id = ool.line_id
    AND odss.po_header_id = poh.po_header_id
    AND odss.po_line_id = pol.po_line_id
    AND odss.line_location_id = pll.line_location_id
    AND pv.vendor_id = poh.vendor_id
    AND mtlb.inventory_item_id = ool.inventory_item_id
    AND trxl.customer_trx_id = trx.customer_trx_id
    AND trxl.inventory_item_id = mtlb.inventory_item_id
    AND hzc.cust_account_id = ooh.sold_to_org_id
    AND hzc.party_id = hzp.party_id
    AND apl.invoice_id = api.invoice_id
    AND apl.po_header_id = poh.po_header_id
    AND apl.inventory_item_id = mtlb.inventory_item_id
    AND api.vendor_id = poh.vendor_id
    AND ool.line_id = trxl.interface_line_attribute6
    AND to_char(ooh.order_number)= trx.interface_header_attribute1
    AND trxl.CUSTOMER_TRX_LINE_ID = gl.CUSTOMER_TRX_LINE_ID
    AND gl.gl_date IS NOT NULL
    ORDER BY trxl.CUSTOMER_TRX_LINE_ID DESC;
    Really appreciate your help
    Thank You,

    Hi ,
    Need to place outer join for AP Tables .
    Regards
    Muthu

  • Query for Sales order and corr.AR Invoice Info

    Hi,
    I need to write a query which gives the flollowing sales order info along with the coressponding AR invoices info
    Sales Order columns reqd:
    OPERATING_UNIT
    ORDER_NUMBER
    CUSTOMER_NUM
    CUSTOMER_NAME
    ORDERED_DATE
    FLOW_STATUS_CODE
    TOTAL_ORDER_AMOUNT
    AR invoice columns reqd for the sales orders:
    Invoice number,
    Invoice date,
    Invoice Total.
    Can anyone help me out with this?
    Thanks,
    Ash

    Hi Ash,
    There are some issues that must be defined before you have the exact query.
    Do you have freight charges or non-inclusive tax? If you have, freight charges and tax amounts must be included?
    Depending on you grouping rule, you can have lines from more than one order in a single invoice. In this case, as invoice amount you want the sum of all lines, or only the lines from that order?
    Below is an example using two views. It assumes that grouping rules split lines from different order into different invoices.
    Hope it helps,
    Ketter Ohnes
    create or replace view order_summary as
    select oh.org_id,
    oh.ORDER_NUMBER,
    oh.header_id,
    ott.name tt_name,
    ca.account_number,
    p.party_name,
    oh.ordered_date,
    oh.flow_status_code,
    sum(ol.ordered_quantity*ol.unit_selling_price) total,
    sum(ol.tax_value) tax,
    (select sum(operand)
    from OE_PRICE_ADJUSTMENTS_v x
    where x.header_id = oh.header_id
    and x.adjustment_type_code='FREIGHT_CHARGE') freight_charge
    from oe_order_headers_all oh,
    oe_order_lines_all ol,
    hz_cust_accounts ca,
    hz_parties p,
    oe_transaction_types_tl ott
    where ol.header_id=oh.header_id
    and oh.sold_to_org_id = ca.cust_account_id
    and ca.party_id = p.party_id
    and oh.order_type_id = ott.transaction_type_id
    and ott.language =
    (select language_code
    from fnd_languages
    where installed_flag = 'B')
    group by oh.org_id,
    oh.header_id,
    oh.ORDER_NUMBER ,
    ott.name,
    ca.account_number,
    p.party_name,
    oh.ordered_date,
    oh.flow_status_code;
    create or replace view invoice_summary as
    select a.interface_header_context,
    a.trx_date,
    a.trx_number,
    b.interface_line_attribute1,
    b.interface_line_attribute2 tt_name,
    a.customer_trx_id,
    sum(b.extended_amount) invoice_total
    from ra_customer_trx_all a,
    ra_customer_trx_lines_all b
    where a.customer_trx_id = b.customer_trx_id
    and b.interface_line_context = 'ORDER ENTRY'
    and b.line_type in ('LINE','FREIGHT')
    group by a.interface_header_context,
    a.trx_date, a.trx_number,
    b.interface_line_attribute1,
    b.interface_line_attribute2,
    a.customer_trx_id;
    select *
    from order_summary o,
    invoice_summary i
    where o.order_number between :1 and :2
    and o.order_number = i.interface_line_attribute1
    and o.tt_name = i.tt_name;

  • Query for Sales Order and AR Invoice Information

    Hi,
    I need to write a query which gives the flollowing sales order info along with the coressponding AR invoices info
    Sales Order columns reqd:
    OPERATING_UNIT     
    ORDER_NUMBER     
    CUSTOMER_NUM     
    CUSTOMER_NAME     
    ORDERED_DATE     
    FLOW_STATUS_CODE     
    TOTAL_ORDER_AMOUNT
    AR invoice columns reqd for the sales orders:
    Invoice number,
    Invoice date,
    Invoice Total.
    Can anyone help me out with this?
    Thanks,
    Ash

    Hi Ash,
    Table RA_CUSTOMER_TRX_ALL can be joined to RA_CUSTOMER_TRX_LINES_ALL table through CUSTOMER_TRX_ID column. The table RA_CUSTOMER_TRX_LINES_ALL.INTERFACE_LINE_ATTRIBUTE6 = OE_ORDER_LINES_ALL.LINE_ID. And from the LineId, you can get the HeaderId os the OE_ORDER_HEADERS_ALL table.
    You must have visualized the query by now.
    Thanks
    Sumit

  • I have to insert lookup values into parent table remaining items in chiled table can you please any one explain the logic

    CREATE OR REPLACE
    PACKAGE BODY xxcsi_ib_data_ob_ecs_pkg
      v_update_date DATE := SYSDATE;
    PROCEDURE print_log(
        i_message IN VARCHAR2)
    IS
    BEGIN
      -- dbms_output.put_line('Log '||TO_CHAR(sysdate,'DD-MON-YYYY HH24:MI:SS :')||i_message);
      fnd_file.put_line(fnd_file.LOG,'Log '||TO_CHAR(SYSDATE,'DD-MON-YYYY HH24:MI:SS :')||i_message);
    EXCEPTION
    WHEN no_data_found THEN
      NULL;
    WHEN OTHERS THEN
      NULL;
    END;
    PROCEDURE main_prc(
        o_chr_errbuff OUT VARCHAR2 ,
        o_num_retcode OUT NUMBER ,
        i_org_id IN NUMBER)
    IS
      CURSOR cur_get_parent_ib_rec(c_from DATE ,c_to DATE)
      IS
        SELECT
          /*+ index(a CSI_ITEM_INSTANCES_X3)*/
          ---CREATE MODE ITEM
          A.creation_date ,
          A.last_update_date ,
          A.last_oe_order_line_id line_id ,
          A.inventory_item_id ,
          A.instance_id ,
          A.instance_type_code ,
          msib.segment1
        FROM csi_item_instances A ,
          mtl_system_items_b msib
        WHERE 1=1
          --      AND a.instance_id = 33371916
          --AND a.instance_id in (33371920,33371921,33371922,33371923,33371924,33371925,33371926,33371927,33371928,33371929,33371930)
        AND msib.inventory_item_id=A.inventory_item_id
        AND msib.organization_id  =
          (SELECT mp.organization_id
          FROM mtl_parameters mp
          WHERE mp.organization_code = 'IMO'
        -- AND msib.organization_id = 85
        -- and msib.segment1 like '475%'
        --AND msib.segment1 like 'TREX%'
      AND EXISTS
        (SELECT 1
        FROM fnd_lookup_values
        WHERE lookup_type = 'EMR CSI OUTBOUND INTERFACE PSG'
        AND language      = 'US'
        AND lookup_code   = msib.segment1
        --and DESCRIPTION = 'Items to be Interfaced from Oracle EBS to ECS'
      AND A.last_update_date BETWEEN NVL(c_from ,to_date('07-AUG-2014 00:00:00','DD-MON-YYYY HH24:MI:SS')) AND NVL(c_to ,to_date('22-AUG-2014 00:00:00','DD-MON-YYYY HH24:MI:SS'))
      UNION
      SELECT
        /*+ index(a CSI_ITEM_INSTANCES_X3)*/
        ---CREATE MODE SEARCH
        A.creation_date ,
        A.last_update_date ,
        A.last_oe_order_line_id line_id ,
        A.inventory_item_id ,
        A.instance_id ,
        A.instance_type_code ,
        msib.segment1
      FROM csi_item_instances A ,
        mtl_system_items_b msib
      WHERE 1=1
        --AND a.instance_id = 33371916
        --AND a.instance_id in (33371920,33371921,33371922,33371923,33371924,33371925,33371926,33371927,33371928,33371929,33371930)
      AND msib.inventory_item_id=A.inventory_item_id
      AND msib.organization_id  =
        (SELECT mp.organization_id
        FROM mtl_parameters mp
        WHERE mp.organization_code = 'IMO'
        -- AND msib.organization_id = 85
        -- and msib.segment1 like '475%'
        --AND msib.segment1 like 'TREX%'
      AND EXISTS
        (SELECT 1
        FROM fnd_lookup_values
        WHERE lookup_type           = 'EMR CSI OUTBOUND INTERFACE PSG'
        AND language                = 'US'
        AND tag                     ='ALL TREX ITEMS'
        AND SUBSTR(lookup_code,1,4) = SUBSTR(msib.segment1,1,4)
        --and DESCRIPTION = 'Items to be Interfaced from Oracle EBS to ECS'
      AND A.last_update_date BETWEEN NVL(c_from ,to_date('07-AUG-2014 00:00:00','DD-MON-YYYY HH24:MI:SS')) AND NVL(c_to ,to_date('22-AUG-2014 00:00:00','DD-MON-YYYY HH24:MI:SS'))
      UNION
      SELECT
        /*+ index(a CSI_ITEM_INSTANCES_X3)*/
        ---UPDATE MODE ITEM
        A.creation_date ,
        A.last_update_date ,
        A.last_oe_order_line_id line_id ,
        A.inventory_item_id ,
        A.instance_id ,
        A.instance_type_code ,
        msib.segment1
      FROM csi_item_instances A ,
        mtl_system_items_b msib
      WHERE 1=1
        --AND a.instance_id = 33371916
        --AND a.instance_id in (33371920,33371921,33371922,33371923,33371924,33371925,33371926,33371927,33371928,33371929,33371930)
      AND msib.inventory_item_id=A.inventory_item_id
      AND msib.organization_id  =
        (SELECT mp.organization_id
        FROM mtl_parameters mp
        WHERE mp.organization_code = 'IMO'
        -- AND msib.organization_id = 85
        -- and msib.segment1 like '475%'
        --AND msib.segment1 like 'TREX%'
      AND EXISTS
        (SELECT 1
        FROM fnd_lookup_values
        WHERE lookup_type = 'EMR CSI OUTBOUND INTERFACE PSG'
        AND language      = 'US'
        AND lookup_code   = msib.segment1
        --and DESCRIPTION = 'Items to be Interfaced from Oracle EBS to ECS'
      AND A.last_update_date BETWEEN NVL(c_from ,to_date('07-AUG-2014 00:00:00','DD-MON-YYYY HH24:MI:SS')) AND NVL(c_to ,to_date('22-AUG-2014 00:00:00','DD-MON-YYYY HH24:MI:SS'))
      AND EXISTS
        (SELECT
          /*+ index(ct CSI_TRANSACTIONS_U01)*/
          1
        FROM csi_item_instances_h h ,
          csi_transactions ct
        WHERE 1                     =1
        AND ct.transaction_type_id IN (1)
        AND ct.transaction_id       = h.transaction_id
        AND ct.last_update_date BETWEEN NVL(c_from ,to_date('07-AUG-2014 00:00:00','DD-MON-YYYY HH24:MI:SS')) AND NVL(c_to ,to_date('22-AUG-2014 00:00:00','DD-MON-YYYY HH24:MI:SS'))
        AND A.instance_id =h.instance_id
      UNION
      SELECT
        /*+ index(a CSI_ITEM_INSTANCES_X3)*/
        ---UPDATE MODE SEARCH
        A.creation_date ,
        A.last_update_date ,
        A.last_oe_order_line_id line_id ,
        A.inventory_item_id ,
        A.instance_id ,
        A.instance_type_code ,
        msib.segment1
      FROM csi_item_instances A ,
        mtl_system_items_b msib
      WHERE 1=1
        --AND a.instance_id = 33371916
        --AND a.instance_id in (33371920,33371921,33371922,33371923,33371924,33371925,33371926,33371927,33371928,33371929,33371930)
      AND msib.inventory_item_id=A.inventory_item_id
      AND msib.organization_id  =
        (SELECT mp.organization_id
        FROM mtl_parameters mp
        WHERE mp.organization_code = 'IMO'
        -- AND msib.organization_id = 85
        -- and msib.segment1 like '475%'
        --AND msib.segment1 like 'TREX%'
      AND EXISTS
        (SELECT 1
        FROM fnd_lookup_values
        WHERE lookup_type           = 'EMR CSI OUTBOUND INTERFACE PSG'
        AND language                = 'US'
        AND tag                     ='ALL TREX ITEMS'
        AND SUBSTR(lookup_code,1,4) = SUBSTR(msib.segment1,1,4)
        --and DESCRIPTION = 'Items to be Interfaced from Oracle EBS to ECS'
      AND A.last_update_date BETWEEN NVL(c_from ,to_date('07-AUG-2014 00:00:00','DD-MON-YYYY HH24:MI:SS')) AND NVL(c_to ,to_date('22-AUG-2014 00:00:00','DD-MON-YYYY HH24:MI:SS'))
      AND EXISTS
        (SELECT
          /*+ index(ct CSI_TRANSACTIONS_U01)*/
          1
        FROM csi_item_instances_h h ,
          csi_transactions ct
        WHERE 1                     =1
        AND ct.transaction_type_id IN (1)
        AND ct.transaction_id       = h.transaction_id
        AND ct.last_update_date BETWEEN NVL(c_from ,to_date('07-AUG-2014 00:00:00','DD-MON-YYYY HH24:MI:SS')) AND NVL(c_to ,to_date('22-AUG-2014 00:00:00','DD-MON-YYYY HH24:MI:SS'))
        AND A.instance_id =h.instance_id
      ORDER BY 1 DESC,
        2 ;
      CURSOR cur_get_child_ib_rec(c_instance_id NUMBER)
      IS
        SELECT cir.subject_id
        FROM csi.csi_ii_relationships cir
        WHERE cir.object_id = c_instance_id;
      CURSOR cur_get_outbound_data(c_instance_id NUMBER)
      IS
        SELECT cii.instance_id instance_id,
          cii.instance_number instance_number,
          cii.inventory_item_id inventory_item_id,
          msi.segment1 segment1,       --CONCATENATED_SEGMENTS,
          msi.description description, --DESCRIPTION,
          cii.inv_master_organization_id master_organization_id,
          cii.serial_number serial_number,
          cii.system_id system_id,
          cst.NAME system_name,
          cii.quantity quantity,
          cii.unit_of_measure uom,
          cii.active_start_date active_start_date,
          cii.active_end_date active_end_date,
          cii.install_date install_date,
          cii.object_version_number object_version_number,
          cii.last_vld_organization_id,
          hou.NAME pre_registration_location,
          looh.header_id last_header_id,
          looh.order_number emerson_order_number,
          cii.last_oe_order_line_id order_line_id,
          NVL(lool.actual_shipment_date, lool.fulfillment_date) actual_shipment_date,
          (SELECT DISTINCT pap.email_address
          FROM fnd_user fu ,
            per_all_people_f pap
          WHERE fu.employee_id = pap.person_id
          and sysdate between pap.effective_start_date and nvl(pap.effective_end_date, sysdate)
          AND fu.user_id       = NVL(wdd.created_by,lool.created_by)
          ) email_address,
        (SELECT DISTINCT hp.party_name
        FROM hz_parties hp,
          hz_party_sites hps ,
          hz_party_site_uses hpsu ,
          hz_locations hl
        WHERE hp.party_id     = hps.party_id
        AND hps.location_id   = hl.location_id
        AND hps.party_site_id = hpsu.party_site_id(+)
        AND hps.party_site_id =
          (SELECT hcasa.party_site_id
          FROM apps.hz_cust_acct_sites hcasa
          WHERE hcasa.cust_acct_site_id =
            (SELECT hcsua.cust_acct_site_id
            FROM apps.hz_cust_site_uses hcsua
            WHERE cia.bill_to_address = hcsua.site_use_id
        ) AS "Bill_To_company_name",--------------------------CH-ID-1.1 STARTS-----------
        (SELECT DISTINCT hps.party_site_id
        FROM hz_parties hp,
          hz_party_sites hps ,
          hz_party_site_uses hpsu ,
          hz_locations hl
        WHERE hp.party_id     = hps.party_id
        AND hps.location_id   = hl.location_id
        AND hps.party_site_id = hpsu.party_site_id(+)
        AND hps.party_site_id =
          (SELECT hcasa.party_site_id
          FROM apps.hz_cust_acct_sites hcasa
          WHERE hcasa.cust_acct_site_id =
            (SELECT hcsua.cust_acct_site_id
            FROM apps.hz_cust_site_uses hcsua
            WHERE cia.bill_to_address = hcsua.site_use_id
        ) AS "BILL_TO_party_SITE_ID",
        (SELECT DISTINCT hl.state
        FROM hz_parties hp,
          hz_party_sites hps ,
          hz_party_site_uses hpsu ,
          hz_locations hl
        WHERE hp.party_id     = hps.party_id
        AND hps.location_id   = hl.location_id
        AND hps.party_site_id = hpsu.party_site_id(+)
        AND hps.party_site_id =
          (SELECT hcasa.party_site_id
          FROM apps.hz_cust_acct_sites hcasa
          WHERE hcasa.cust_acct_site_id =
            (SELECT hcsua.cust_acct_site_id
            FROM apps.hz_cust_site_uses hcsua
            WHERE cia.bill_to_address = hcsua.site_use_id
        ) AS "BILL_TO_STATE",
        (SELECT DISTINCT hl.country
        FROM hz_parties hp,
          hz_party_sites hps ,
          hz_party_site_uses hpsu ,
          hz_locations hl
        WHERE hp.party_id     = hps.party_id
        AND hps.location_id   = hl.location_id
        AND hps.party_site_id = hpsu.party_site_id(+)
        AND hps.party_site_id =
          (SELECT hcasa.party_site_id
          FROM apps.hz_cust_acct_sites hcasa
          WHERE hcasa.cust_acct_site_id =
            (SELECT hcsua.cust_acct_site_id
            FROM apps.hz_cust_site_uses hcsua
            WHERE cia.bill_to_address = hcsua.site_use_id
        ) AS "BILL_TO_COUNTRY",
        (SELECT DISTINCT hl.city
        FROM hz_parties hp,
          hz_party_sites hps ,
          hz_party_site_uses hpsu ,
          hz_locations hl
        WHERE hp.party_id     = hps.party_id
        AND hps.location_id   = hl.location_id
        AND hps.party_site_id = hpsu.party_site_id(+)
        AND hps.party_site_id =
          (SELECT hcasa.party_site_id
          FROM apps.hz_cust_acct_sites hcasa
          WHERE hcasa.cust_acct_site_id =
            (SELECT hcsua.cust_acct_site_id
            FROM apps.hz_cust_site_uses hcsua
            WHERE cia.bill_to_address = hcsua.site_use_id
        ) AS "BILL_TO_CITY",
        (SELECT DISTINCT hl.address1
        FROM hz_parties hp,
          hz_party_sites hps ,
          hz_party_site_uses hpsu ,
          hz_locations hl
        WHERE hp.party_id     = hps.party_id
        AND hps.location_id   = hl.location_id
        AND hps.party_site_id = hpsu.party_site_id(+)
        AND hps.party_site_id =
          (SELECT hcasa.party_site_id
          FROM apps.hz_cust_acct_sites hcasa
          WHERE hcasa.cust_acct_site_id =
            (SELECT hcsua.cust_acct_site_id
            FROM apps.hz_cust_site_uses hcsua
            WHERE cia.bill_to_address = hcsua.site_use_id
        ) AS "BILL_TO_LOCATION",
        (SELECT DISTINCT hp.party_name
        FROM hz_parties hp,
          hz_party_sites hps,
          hz_party_site_uses hpsu,
          hz_locations hl
        WHERE hp.party_id     = hps.party_id
        AND hps.location_id   = hl.location_id
        AND hps.party_site_id = hpsu.party_site_id(+)
        AND hps.party_site_id =
          (SELECT hcasa.party_site_id
          FROM apps.hz_cust_acct_sites hcasa
          WHERE hcasa.cust_acct_site_id =
            (SELECT hcsua.cust_acct_site_id
            FROM apps.hz_cust_site_uses hcsua
            WHERE cia.ship_to_address = hcsua.site_use_id
        ) AS "Ship_to_company_name",
        (SELECT DISTINCT hps.party_site_id
        FROM hz_parties hp,
          hz_party_sites hps ,
          hz_party_site_uses hpsu ,
          hz_locations hl
        WHERE hp.party_id     = hps.party_id
        AND hps.location_id   = hl.location_id
        AND hps.party_site_id = hpsu.party_site_id(+)
        AND hps.party_site_id =
          (SELECT hcasa.party_site_id
          FROM apps.hz_cust_acct_sites hcasa
          WHERE hcasa.cust_acct_site_id =
            (SELECT hcsua.cust_acct_site_id
            FROM apps.hz_cust_site_uses hcsua
            WHERE cia.bill_to_address = hcsua.site_use_id
        ) AS "SHIP_TO_party_SITE_ID",
        (SELECT DISTINCT hl.state
        FROM hz_parties hp,
          hz_party_sites hps ,
          hz_party_site_uses hpsu ,
          hz_locations hl
        WHERE hp.party_id     = hps.party_id
        AND hps.location_id   = hl.location_id
        AND hps.party_site_id = hpsu.party_site_id(+)
        AND hps.party_site_id =
          (SELECT hcasa.party_site_id
          FROM apps.hz_cust_acct_sites hcasa
          WHERE hcasa.cust_acct_site_id =
            (SELECT hcsua.cust_acct_site_id
            FROM apps.hz_cust_site_uses hcsua
            WHERE cia.bill_to_address = hcsua.site_use_id
        ) AS "SHIP_TO_STATE",
        (SELECT DISTINCT hl.country
        FROM hz_parties hp,
          hz_party_sites hps ,
          hz_party_site_uses hpsu ,
          hz_locations hl
        WHERE hp.party_id     = hps.party_id
        AND hps.location_id   = hl.location_id
        AND hps.party_site_id = hpsu.party_site_id(+)
        AND hps.party_site_id =
          (SELECT hcasa.party_site_id
          FROM apps.hz_cust_acct_sites hcasa
          WHERE hcasa.cust_acct_site_id =
            (SELECT hcsua.cust_acct_site_id
            FROM apps.hz_cust_site_uses hcsua
            WHERE cia.bill_to_address = hcsua.site_use_id
        ) AS "SHIP_TO_COUNTRY",
        (SELECT DISTINCT hl.city
        FROM hz_parties hp,
          hz_party_sites hps ,
          hz_party_site_uses hpsu ,
          hz_locations hl
        WHERE hp.party_id     = hps.party_id
        AND hps.location_id   = hl.location_id
        AND hps.party_site_id = hpsu.party_site_id(+)
        AND hps.party_site_id =
          (SELECT hcasa.party_site_id
          FROM apps.hz_cust_acct_sites hcasa
          WHERE hcasa.cust_acct_site_id =
            (SELECT hcsua.cust_acct_site_id
            FROM apps.hz_cust_site_uses hcsua
            WHERE cia.bill_to_address = hcsua.site_use_id
        ) AS "SHIP_TO_CITY",
        (SELECT DISTINCT hl.address1
        FROM hz_parties hp,
          hz_party_sites hps ,
          hz_party_site_uses hpsu ,
          hz_locations hl
        WHERE hp.party_id     = hps.party_id
        AND hps.location_id   = hl.location_id
        AND hps.party_site_id = hpsu.party_site_id(+)
        AND hps.party_site_id =
          (SELECT hcasa.party_site_id
          FROM apps.hz_cust_acct_sites hcasa
          WHERE hcasa.cust_acct_site_id =
            (SELECT hcsua.cust_acct_site_id
            FROM apps.hz_cust_site_uses hcsua
            WHERE cia.bill_to_address = hcsua.site_use_id
        ) AS "SHIP_TO_LOCATION",
        (SELECT DISTINCT hl.postal_code
        FROM hz_parties hp,
          hz_party_sites hps ,
          hz_party_site_uses hpsu ,
          hz_locations hl
        WHERE hp.party_id     = hps.party_id
        AND hps.location_id   = hl.location_id
        AND hps.party_site_id = hpsu.party_site_id(+)
        AND hps.party_site_id =
          (SELECT hcasa.party_site_id
          FROM apps.hz_cust_acct_sites hcasa
          WHERE hcasa.cust_acct_site_id =
            (SELECT hcsua.cust_acct_site_id
            FROM apps.hz_cust_site_uses hcsua
            WHERE cia.bill_to_address = hcsua.site_use_id
        ) AS "SHIP_TO_PIN_CODE",
        (SELECT DISTINCT hl.postal_code
        FROM hz_parties hp,
          hz_party_sites hps ,
          hz_party_site_uses hpsu ,
          hz_locations hl
        WHERE hp.party_id     = hps.party_id
        AND hps.location_id   = hl.location_id
        AND hps.party_site_id = hpsu.party_site_id(+)
        AND hps.party_site_id =
          (SELECT hcasa.party_site_id
          FROM apps.hz_cust_acct_sites hcasa
          WHERE hcasa.cust_acct_site_id =
            (SELECT hcsua.cust_acct_site_id
            FROM apps.hz_cust_site_uses hcsua
            WHERE cia.bill_to_address = hcsua.site_use_id
        ) AS "BILL_TO_PIN_CODE",
        (SELECT hcsua.LOCATION
        FROM apps.hz_cust_site_uses_all hcsua
        WHERE cia.ship_to_address = hcsua.site_use_id
        ) "SHIP_TO_NUMBER",
        (SELECT hcsua.LOCATION
        FROM apps.hz_cust_site_uses_all hcsua
        WHERE cia.bill_to_address = hcsua.site_use_id
        ) "BILL_TO_NUMBER",
        (SELECT DISTINCT hca.account_number
        FROM hz_cust_accounts hca
        WHERE hca.cust_account_id =
          (SELECT hcasa.cust_account_id
          FROM apps.hz_cust_acct_sites hcasa
          WHERE hcasa.cust_acct_site_id =
            (SELECT hcsua.cust_acct_site_id
            FROM apps.hz_cust_site_uses hcsua
            WHERE cia.bill_to_address = hcsua.site_use_id
        )AS "CUSTOMER_NUMBER", --------------------------CH-ID-1.1 ENDS -----------
        (SELECT civ.attribute_value
        FROM csi_iea_values civ,
          csi_i_extended_attribs ciea
        WHERE civ.attribute_id  = ciea.attribute_id
        AND ciea.attribute_code = '011 LICENSE NUMBER'
        AND civ.instance_id     = cii.instance_id
        ) AS "EA_LICENSE_NUMBER",
        (SELECT civ.attribute_value
        FROM csi_iea_values civ,
          csi_i_extended_attribs ciea
        WHERE civ.attribute_id  = ciea.attribute_id
        AND ciea.attribute_code = 'VA_SALES_ORDER_NUMBER'
        AND civ.instance_id     = cii.instance_id
        ) AS "EA_VA_SALES_ORDER_NUM",
        (SELECT NAME
        FROM hr_all_organization_units
        WHERE organization_id = cii.inv_master_organization_id
        ) master_organization_name
      FROM csi_item_instances cii,
        csi_systems_tl cst,
        --    MTL_SYSTEM_ITEMS_VL MSIKFV,
        --    MTL_SYSTEM_ITEMS MSI,
        mtl_system_items_b msi,
        hr_all_organization_units hou,
        oe_order_lines lool,
        oe_order_headers looh,
        wsh_delivery_details wdd,
        csi_i_parties cip,
        csi_ip_accounts cia
      WHERE cii.last_vld_organization_id = msi.organization_id
      AND cii.inventory_item_id          = msi.inventory_item_id
        --  AND CII.LAST_VLD_ORGANIZATION_ID   = MSIKFV.ORGANIZATION_ID
        --  AND CII.INVENTORY_ITEM_ID          = MSIKFV.INVENTORY_ITEM_ID
      AND hou.organization_id(+)    = cii.last_vld_organization_id
      AND cii.last_oe_order_line_id = lool.line_id
      AND lool.header_id            = looh.header_id
      AND cii.last_oe_order_line_id = wdd.source_line_id
        --      AND WDD.SOURCE_LINE_ID             = LOOL.LINE_ID
        --      AND WDD.SOURCE_HEADER_ID           = LOOH.HEADER_ID
      AND cii.instance_id               = cip.instance_id
      AND cii.system_id                 = cst.system_id(+)
      AND cip.party_source_table        = 'HZ_PARTIES'
      AND cip.relationship_type_code    = 'OWNER'
      AND cip.instance_party_id         = cia.instance_party_id
      AND cia.relationship_type_code(+) = 'OWNER'
      AND cii.instance_status_id        = 1052
      AND cst.language(+)               = 'US'
      AND cii.instance_id               = c_instance_id;
      CURSOR cur_get_ib_warranty (c_instance_id NUMBER)
      IS
        SELECT kh.contract_number,
          kh.scs_code,
          kh.start_date,
          kh.end_date,
          (kh.end_date-kh.start_date) duration,
          clet.NAME coverage_name,
          clet.item_description coverage_desc,
          b.segment1 service_name,
          t.description service_desc
        FROM okc_k_headers_b kh,
          okc_k_lines_b kl,
          okc_k_items ki,
          csi_item_instances c,
          mtl_system_items_b i,
          okc_k_lines_b cleb,
          okc_k_lines_tl clet,
          okc_k_items ki1,
          mtl_system_items_b_kfv b,
          mtl_system_items_tl t
        WHERE kh.contract_number_modifier IS NULL
        AND kh.ID                          = kl.dnz_chr_id
        AND kh.ID                          = ki.dnz_chr_id
        AND kl.ID                          = ki.cle_id
        AND ki.jtot_object1_code          IN ('OKX_CUSTPROD')
        AND c.last_vld_organization_id     = i.organization_id
        AND ki.object1_id1                 = TO_CHAR(c.instance_id)
        AND c.inventory_item_id            = i.inventory_item_id
        AND kl.cle_id                      = cleb.cle_id
        AND cleb.ID                        = clet.ID
        AND clet.language               = userenv('LANG')
        AND cleb.lse_id                   IN (2,15,20)
        AND cleb.cle_id                    = ki1.cle_id
        AND b.inventory_item_id            = t.inventory_item_id
        AND b.organization_id              = t.organization_id
        AND t.language                     = userenv('LANG')
        AND to_number(ki1.object1_id1)     = b.inventory_item_id
        AND to_number(ki1.object1_id2)     = b.organization_id
        AND c.instance_id                  = c_instance_id;
      --v1.2 comment ends
      CURSOR cur_get_to_date( c_req_id NUMBER,c_conc_prog_id NUMBER)
      IS
        SELECT requested_start_date
        FROM fnd_concurrent_requests
        WHERE request_id          = c_req_id
        AND concurrent_program_id = c_conc_prog_id;
      /*Record Type Declaration*/
    TYPE ib_ecs_dat_record
    IS
      record
        instance_id csi_item_instances.instance_id%TYPE,
        instance_number csi_item_instances.instance_number%TYPE,
        inventory_item_id csi_item_instances.inventory_item_id%TYPE,
        segment1 mtl_system_items_b.segment1%TYPE,
        description mtl_system_items_b.description%TYPE,
        master_organization_id csi_item_instances.inv_master_organization_id%TYPE,
        serial_number csi_item_instances.serial_number%TYPE,
        system_id csi_item_instances.system_id%TYPE,
        system_name csi_systems_tl.NAME%TYPE,
        quantity csi_item_instances.quantity%TYPE,
        uom csi_item_instances.unit_of_measure%TYPE,
        active_start_date csi_item_instances.active_start_date%TYPE,
        active_end_date csi_item_instances.active_end_date%TYPE,
        install_date csi_item_instances.install_date%TYPE,
        obj_version_num csi_item_instances.object_version_number%TYPE,
        last_vld_organization_id csi_item_instances.last_vld_organization_id%TYPE,
        pre_registration_location VARCHAR2(500),
        order_header_id oe_order_headers_all.header_id%TYPE,
        order_number oe_order_headers_all.order_number%TYPE,
        order_line_id csi_item_instances.last_oe_order_line_id%TYPE,
        actual_shipment_date oe_order_lines_all.actual_shipment_date%TYPE,
        email_address per_all_people_f.email_address%TYPE,
        bill_to_company_name hz_parties.party_name%TYPE,
        bill_to_site_id hz_party_sites.party_site_id%TYPE,
        bill_to_state hz_locations.state%TYPE,
        bill_to_country hz_locations.country%TYPE,
        bill_to_city hz_locations.city%TYPE,
        bill_to_location hz_locations.address1%TYPE,
        ship_to_company_name hz_parties.party_name%TYPE,
        ship_to_site_id hz_party_sites.party_site_id%TYPE,
        ship_to_state hz_locations.state%TYPE,
        ship_to_country hz_locations.country%TYPE,
        ship_to_city hz_locations.city%TYPE,
        ship_to_location hz_locations.address1%TYPE,
        ship_to_pin_code hz_locations.postal_code%TYPE,
        bill_to_pin_code hz_locations.postal_code%TYPE,
        ship_to_number hz_cust_site_uses_all.LOCATION%TYPE,
        bill_to_number hz_cust_site_uses_all.LOCATION%TYPE,
        customer_number hz_cust_accounts.account_number%TYPE,
        ea_license_number csi_iea_values.attribute_value%TYPE,
        ea_va_sales_order_num csi_iea_values.attribute_value%TYPE,
        master_organization_name hr_all_organization_units.NAME%TYPE );
    TYPE tab_typ_ib_ecs_dat
    IS
      TABLE OF ib_ecs_dat_record INDEX BY binary_integer;
    TYPE ib_parent_dat_record
    IS
      record
        creation_date DATE,
        last_update_date DATE,
        order_line_id csi_item_instances.last_oe_order_line_id%TYPE,
        inventory_item_id csi_item_instances.inventory_item_id%TYPE,
        instance_id csi_item_instances.instance_id%TYPE,
        instance_type_code csi_item_instances.instance_type_code%TYPE,
        segment1 mtl_system_items_b.segment1%TYPE );
    TYPE tab_typ_ib_parent_dat
    IS
      TABLE OF ib_parent_dat_record INDEX BY binary_integer;
      --/*Record Type Declaration*/
      --      TYPE parent_ib_record IS RECORD (
      --         creation_date           csi_item_instances.creation_date%TYPE,
      --         last_update_date        csi_item_instances.last_update_date%TYPE,
      --         inventory_item_id       csi_item_instances.inventory_item_id%TYPE,
      --         instance_id             csi_item_instances.instance_id%TYPE,
      --         instance_type_code      csi_item_instances.instance_type_code%TYPE,
      --         segment1                mtl_system_items_b.segment1%type
      --      TYPE tab_typ_par_ib_collection IS TABLE OF parent_ib_record
      --         INDEX BY BINARY_INTEGER;
      --      tab_par_ib_rec                   tab_typ_par_ib_collection;
      v_segment1 mtl_system_items_b.segment1%TYPE;
      v_request_id        NUMBER := fnd_global.conc_request_id;
      v_conc_prog_id      NUMBER := fnd_global.conc_program_id;
      v_created_by        NUMBER := fnd_profile.VALUE('USER_ID');
      v_last_update_login NUMBER := fnd_global.login_id;
      v_to DATE                  := SYSDATE;
      v_from DATE                := SYSDATE-100;
      v_count NUMBER             := NULL;
      --       v_header_id                        NUMBER := NULL;
      --       v_line_id                          NUMBER := NULL;
      --       v_org_id                           NUMBER := NULL;
      --       v_ship_from_org_id                 NUMBER := NULL;
      --v1.2 begin
      --       v_master_org_id                    NUMBER := NULL;
      --       v_item_type                        VARCHAR2(100) := null;
      --       v_top_model_line_id                NUMBER := NULL;
      --       v_serial_tag_number                VARCHAR2(100) := null;
    TYPE tbl_req_start_date_type
    IS
      TABLE OF DATE INDEX BY pls_integer;
      tbl_req_start_date tbl_req_start_date_type;
      --v1.2 ends
      --v1.3 starts
      --      v_flow_status_code                  VARCHAR2(100) := null;
      --      v_line_number                       NUMBER        := NULL;
      --      v_shipment_number                   NUMBER        := NULL;
      --      v_option_number                     NUMBER        := NULL;
      --      v_component_number                  NUMBER        := NULL;
      --      v_service_number                    NUMBER       := NULL;
      --v1.3 ends
      --      v_model_string                      VARCHAR2(100) := NULL;
      --      v_end_cust                          NUMBER := NULL;
      --      v_end_cust_site_id                  NUMBER := NULL;
      --      v_location_type_code                VARCHAR2(100) := null;
      --      v_location_id                       NUMBER := NULL;
      --      v_tag                               VARCHAR2(100) := NULL;
      --      v_inventory_item_status             VARCHAR2(100) := NULL;
      --      v_serial_number                     VARCHAR2(100) := NULL;
      --      v_serial_return                     VARCHAR2(200) := NULL;
      --rec_ext_attr      Rec_Ext_Attr_type ;
      v_ret_error_message VARCHAR2(2000):= NULL;
      v_ret_error_flag    VARCHAR2(1)   := NULL;
      v_error_message     VARCHAR2(2000):= NULL;
      v_error_flag        VARCHAR2(1)   := NULL;
      v_error_at          VARCHAR2(100) := NULL;
      --        v_to1                               DATE   := sysdate;
      --        v_from1                             DATE   := sysdate-45;
      tab_ib_parent_dat tab_typ_ib_parent_dat;
      tab_ib_ecs_dat tab_typ_ib_ecs_dat;
      tab_ib_ecs_dat_c tab_typ_ib_ecs_dat;
    BEGIN
      print_log('*********************************************************************');
      print_log('print log message 01');
      print_log('Process Starts... : '||to_date(SYSDATE,'DD-MON-YYYY HH24:MI:SS'));
      v_error_at := 'Start of the process';
      fnd_client_info.set_org_context(i_org_id);
      --  v1.2 begins, to get from date ----==----
      BEGIN
        print_log('print log message 02');
        --OPEN  get_from_date( v_request_id,v_conc_prog_id);
        --FETCH get_from_date INTO   v_from;
        --CLOSE get_from_date;
        v_error_at := 'main Process/ before from ';
        --        v_from := Sysdate-15;
        v_from := SYSDATE-45;
        --Added v1.4 ,AND    ARGUMENT1 = i_org_id
        SELECT
          /*+ index(a FND_CONCURRENT_REQUESTS_N6) index(a FND_CONCURRENT_REQUESTS_N7)*/
          requested_start_date BULK COLLECT
        INTO tbl_req_start_date
        FROM fnd_concurrent_requests
        WHERE request_id            < v_request_id
        AND concurrent_program_id   = v_conc_prog_id
        AND argument1               = i_org_id
        AND status_code             ='C'
        AND phase_code              ='C';
        v_error_at                 := 'main Process/ after from selection ';
        IF tbl_req_start_date.count >0 THEN
          FOR i                    IN tbl_req_start_date.FIRST .. tbl_req_start_date.LAST
          LOOP
            IF v_from < tbl_req_start_date(i) THEN
              v_from := tbl_req_start_date(i);
              print_log( 'Tabel Req StartDate : '||tbl_req_start_date(i));
              print_log( 'In the Loop VFrom : '||v_from);
            END IF;
          END LOOP;
        END IF;
        v_error_at := 'main Process/ after from Loop ';
        print_log( 'Out the loop v_from is : '||v_from);
      EXCEPTION
      WHEN no_data_found THEN
        print_log('Error in  from_date process exception : '||sqlerrm);
        print_log('Error at : '||v_error_at);
        v_from := NULL;
      WHEN OTHERS THEN
        print_log('Error in  from_date process exception : '||sqlerrm);
        print_log('Error at : '||v_error_at);
        v_from := NULL;
      END;
      -- v1.2 ends---==----
      print_log('print log message 03');
      BEGIN
        OPEN cur_get_to_date ( v_request_id,v_conc_prog_id);
        FETCH cur_get_to_date INTO v_to;
        CLOSE cur_get_to_date;
        --v1.3 starts
        v_update_date := v_to -(1/86400);
        --v1.3 ends
        v_error_at := 'main Process/ after from and to date';
        print_log('v_from1... : '||TO_CHAR(v_from,'DD-MON-YYYY HH24:MI:SS'));
        print_log('v_to1  ... : '||TO_CHAR(v_to ,'DD-MON-YYYY HH24:MI:SS'));
        --v1.3 starts
        print_log('Updated v_to  ... : '||TO_CHAR(v_update_date ,'DD-MON-YYYY HH24:MI:SS'));
        --v1.3 ends
      EXCEPTION
      WHEN no_data_found THEN
        print_log('Error in  main process1 : '||sqlerrm);
        print_log('Error at : '||v_error_at);
      WHEN OTHERS THEN
        print_log('Error in  main process1 : '||sqlerrm);
        print_log('Error at : '||v_error_at);
      END;
      BEGIN
        print_log('print log message 04');
        OPEN cur_get_parent_ib_rec(v_from ,v_to);
        LOOP
          print_log('After Loop Get Records v_from... : '||TO_CHAR(v_from,'DD-MON-YYYY HH24:MI:SS'));
          print_log('After Loop Get Records v_to  ... : '||TO_CHAR(v_to ,'DD-MON-YYYY HH24:MI:SS'));
          FETCH cur_get_parent_ib_rec BULK COLLECT INTO tab_ib_parent_dat;
          print_log('Parent Instance first : ');
          --  FOR i IN 1 .. tab_ib_parent_dat.COUNT
          print_log('print log message 05');
          FOR i IN tab_ib_parent_dat.FIRST .. tab_ib_parent_dat.LAST
          LOOP
            BEGIN
              print_log('Parent Instance : '||tab_ib_parent_dat(i).instance_id);
              print_log('====================================================================');
              v_error_at       := 'main Process/ start of the loop';
              v_ret_error_flag := NULL;
              v_segment1       := NULL;
            EXCEPTION
            WHEN no_data_found THEN
              print_log('Error in  main process exception1 : '||sqlerrm);
              print_log('Error at : '||v_error_at);
            WHEN OTHERS THEN
              print_log('Error in  main process exception1 : '||sqlerrm);
              print_log('Error at : '||v_error_at);
            END;
            OPEN cur_get_outbound_data(tab_ib_parent_dat(i).instance_id);
            LOOP
              FETCH cur_get_outbound_data BULK COLLECT INTO tab_ib_ecs_dat;
              --FOR j IN 1 .. tab_ib_ecs_dat.COUNT
              FOR j IN tab_ib_ecs_dat.FIRST .. tab_ib_ecs_dat.LAST
              LOOP
                BEGIN
                BEGIN
                     SELECT COUNT(1)
                      INTO v_count
                      FROM apps.xxcsi_trex_ob_ecs_mhm
                      WHERE instance_id  = NVL(tab_ib_ecs_dat_c(j).instance_id,'');
                    EXCEPTION
                    WHEN OTHERS THEN
                      v_count := 0;
                    END;
                    print_log('v_count : '||v_count);
                    IF v_count = 0 THEN
                  --        print_log('PARENT_DAT: '||NVL(tab_ib_ecs_dat(j).instance_id);
            print_log('print log message 06');
                  INSERT
                  INTO xxcsi_trex_ob_ecs_mhm
                      instance_id,
                      instance_number,
                      inventory_item_id,
                      unit,
                      unit_name,
                      master_organization_id,
                      serial_number,
                      quantity,
                      uom,
                      active_start_date,
                      active_end_date,
                      install_date,
                      object_version_number,
                      last_vld_organization_id,
                      pre_registration_location,
                      order_header_id,
                      order_number,
                      order_line_id,
                      pre_registration_date,
                      pre_registration_operator,
                      bill_to_customer_name,
                      bill_to_site_id ,
                      bill_to_state ,
                      bill_to_country ,
                      bill_to_city ,
                      bill_to_location ,
                      ship_to_customer_name,
                      ship_to_site_id ,
                      ship_to_state ,
                      ship_to_country ,
                      ship_to_city ,
                      ship_to_location,
                      ship_to_pin_code,
                      bill_to_pin_code,
                      ship_to_number,
                      bill_to_number,
                      customer_number,
                      ea_license_number,
                      ea_va_sales_order_number,
                      parent_instance_id,
                      parent_y_n,
                      process_flag,
                      error_code,
                      error_details,
                      request_id,
                      created_by,
                      creation_date,
                      last_updated_by,
                      last_update_date,
                      last_update_login,
                      eai_process_flag,
                      master_organization_name,
                      system_id,
                      system_name
                    VALUES
                      NVL(tab_ib_ecs_dat(j).instance_id,''),
                      NVL(tab_ib_ecs_dat(j).instance_number,''),
                      NVL(tab_ib_ecs_dat(j).inventory_item_id,''),
                      NVL(tab_ib_ecs_dat(j).segment1,''),
                      NVL(tab_ib_ecs_dat(j).description,''),
                      NVL(tab_ib_ecs_dat(j).master_organization_id,''),
                      NVL(tab_ib_ecs_dat(j).serial_number,''),
                      NVL(tab_ib_ecs_dat(j).quantity,''),
                      NVL(tab_ib_ecs_dat(j).uom,''),
                      NVL(tab_ib_ecs_dat(j).active_start_date,''),
                      NVL(tab_ib_ecs_dat(j).active_end_date,''),
                      NVL(tab_ib_ecs_dat(j).install_date,''),
                      NVL(tab_ib_ecs_dat(j).obj_version_num,''),
                      NVL(tab_ib_ecs_dat(j).last_vld_organization_id,''),
                      NVL(tab_ib_ecs_dat(j).pre_registration_location,''),
                      NVL(tab_ib_ecs_dat(j).order_header_id,''),
                      NVL(tab_ib_ecs_dat(j).order_number,''),
                      NVL(tab_ib_ecs_dat(j).order_line_id,''),
                      NVL(tab_ib_ecs_dat(j).actual_shipment_date,''),
                      NVL(tab_ib_ecs_dat(j).email_address,''),
                      NVL(tab_ib_ecs_dat(j).bill_to_company_name,''),
                      NVL(tab_ib_ecs_dat(j).bill_to_site_id,''),
                      NVL(tab_ib_ecs_dat(j).bill_to_state,''),
                      NVL(tab_ib_ecs_dat(j).bill_to_country,''),
                      NVL(tab_ib_ecs_dat(j).bill_to_city,''),
                      NVL(tab_ib_ecs_dat(j).bill_to_location,''),
                      NVL(tab_ib_ecs_dat(j).ship_to_company_name,''),
                      NVL(tab_ib_ecs_dat(j).ship_to_site_id,''),
                      NVL(tab_ib_ecs_dat(j).ship_to_state,''),
                      NVL(tab_ib_ecs_dat(j).ship_to_country,''),
                      NVL(tab_ib_ecs_dat(j).ship_to_city,''),
                      NVL(tab_ib_ecs_dat(j).ship_to_location,''),
                      NVL(tab_ib_ecs_dat(j).ship_to_pin_code,''),
                      NVL(tab_ib_ecs_dat(j).bill_to_pin_code,''),
                      NVL(tab_ib_ecs_dat(j).ship_to_number,''),
                      NVL(tab_ib_ecs_dat(j).bill_to_number,''),
                      NVL(tab_ib_ecs_dat(j).customer_number,''),
                      NVL(tab_ib_ecs_dat(j).ea_license_number,''),
                      NVL(tab_ib_ecs_dat(j).ea_va_sales_order_num,''),
                      NULL,
                      'P',
                      'N',
                      NULL,
                      NULL,
                      v_request_id,
                      v_created_by,
                      SYSDATE,
                      v_created_by,
                      SYSDATE,
                      v_last_update_login,
                      'N',
                      NVL(tab_ib_ecs_dat(j).master_organization_name,''),
                      NVL(tab_ib_ecs_dat(j).system_id,''),
                      NVL(tab_ib_ecs_dat(j).system_name,'')
    ELSE
    Update apps.xxcsi_trex_ob_ecs_mhm set 
                    instance_id=NVL(tab_ib_ecs_dat_c(j).instance_id,''),
      instance_number= NVL(tab_ib_ecs_dat_c(j).instance_number,''),
                    inventory_item_id= NVL(tab_ib_ecs_dat_c(j).inventory_item_id,''),
                    unit      = NVL(tab_ib_ecs_dat_c(j).segment1,''),
                    unit_name =  NVL(tab_ib_ecs_dat_c(j).description,''),
                    master_organization_id=NVL(tab_ib_ecs_dat_c(j).master_organization_id,''),
                    --serial_number=NVL(tab_ib_ecs_dat_c(j).serial_number,''),
                    quantity= NVL(tab_ib_ecs_dat_c(j).quantity,''),
                    uom=NVL(tab_ib_ecs_dat_c(j).uom,''),
                    active_start_date= NVL(tab_ib_ecs_dat_c(j).active_start_date,''),
                    active_end_date= NVL(tab_ib_ecs_dat_c(j).active_end_date,''),
                    install_date= NVL(tab_ib_ecs_dat_c(j).install_date,''),
                    object_version_number=NVL(tab_ib_ecs_dat_c(j).obj_version_num,''),
                    last_vld_organization_id= NVL(tab_ib_ecs_dat_c(j).last_vld_organization_id,''),
                    pre_registration_location=NVL(tab_ib_ecs_dat_c(j).pre_registration_location,''),
                    order_header_id=NVL(tab_ib_ecs_dat_c(j).order_header_id,''),
                    order_number= NVL(tab_ib_ecs_dat_c(j).order_number,''),
                    order_line_id=NVL(tab_ib_ecs_dat_c(j).order_line_id,''),
                    pre_registration_date= NVL(tab_ib_ecs_dat_c(j).actual_shipment_date,''),
                    pre_registration_operator= NVL(tab_ib_ecs_dat_c(j).email_address,''),
                    bill_to_customer_name=NVL(tab_ib_ecs_dat_c(j).bill_to_company_name,''),
                    bill_to_site_id = NVL(tab_ib_ecs_dat_c(j).bill_to_site_id,''),
                    bill_to_state = NVL(tab_ib_ecs_dat_c(j).bill_to_state,''),
                    bill_to_country =NVL(tab_ib_ecs_dat_c(j).bill_to_country,''),
                    bill_to_city = NVL(tab_ib_ecs_dat_c(j).bill_to_city,''),
                    bill_to_location =  NVL(tab_ib_ecs_dat_c(j).bill_to_location,''),
                    ship_to_customer_name=NVL(tab_ib_ecs_dat_c(j).ship_to_company_name,''),
                    ship_to_site_id = NVL(tab_ib_ecs_dat_c(j).ship_to_site_id,''),
                    ship_to_state =NVL(tab_ib_ecs_dat_c(j).ship_to_state,''),
                    ship_to_country=NVL(tab_ib_ecs_dat_c(j).ship_to_country,''),
                    ship_to_city =NVL(tab_ib_ecs_dat_c(j).ship_to_city,''),
                    ship_to_location= NVL(tab_ib_ecs_dat_c(j).ship_to_location,''),
      ship_to_pin_code= NVL(tab_ib_ecs_dat_c(j).ship_to_pin_code,''),
      bill_to_pin_code=NVL(tab_ib_ecs_dat_c(j).bill_to_pin_code,''),
      ship_to_number=NVL(tab_ib_ecs_dat_c(j).ship_to_number,''),
      bill_to_number= NVL(tab_ib_ecs_dat_c(j).bill_to_number,''),
      customer_number= NVL(tab_ib_ecs_dat_c(j).customer_number,''),
      ea_license_number= NVL(tab_ib_ecs_dat_c(j).ea_license_number,''),
      ea_va_sales_order_number= NVL(tab_ib_ecs_dat_c(j).ea_va_sales_order_num,''),
      parent_instance_id=NVL(tab_ib_parent_dat(i).instance_id,''),
      parent_y_n='C',
      process_flag='N',
      error_code= NULL,
      error_details= NULL,
      request_id=v_request_id,
      created_by=v_created_by,
      creation_date= SYSDATE,
      last_updated_by=v_created_by,
      last_update_date=SYSDATE,
      last_update_login= v_last_update_login,
      eai_process_flag='Y',
      master_organization_name=NVL(tab_ib_ecs_dat_c(j).master_organization_name,''),
      system_id= NVL(tab_ib_ecs_dat_c(j).system_id,''),
      system_name= NVL(tab_ib_ecs_dat_c(j).system_name,'')
      WHERE instance_id  = NVL(tab_ib_ecs_dat_c(j).instance_id,'');
      END IF; --V_COUNT
                EXCEPTION
                WHEN no_data_found THEN
                  print_log('Error in inserting Parent Instance : '||tab_ib_ecs_dat(j).instance_id||': '||sqlerrm);
                WHEN OTHERS THEN
                  print_log('Error in inserting Parent Instance : '||tab_ib_ecs_dat(j).instance_id||': '||sqlerrm);
                END;
                --      END LOOP;
              END LOOP;
              EXIT
            WHEN cur_get_outbound_data%notfound;
            END LOOP;
            CLOSE cur_get_outbound_data;
            print_log('print log message 07');
            BEGIN
              FOR rec_get_child_ib_rec IN cur_get_child_ib_rec
                tab_ib_parent_dat(i).instance_id
              LOOP
                print_log
                  'cur_get_child_ib_rec : '||tab_ib_parent_dat(i).instance_id
                OPEN cur_get_outbound_data(rec_get_child_ib_rec.subject_id);
                LOOP
                  FETCH cur_get_outbound_data BULK COLLECT INTO tab_ib_ecs_dat_c;
                  --            tab_ib_ecs_dat_c1 := tab_ib_ecs_dat_c;
                  --            FOR k IN 1 .. tab_ib_ecs_dat_c.COUNT
                  FOR k IN tab_ib_ecs_dat_c.FIRST .. tab_ib_ecs_dat_c.LAST
                  LOOP
                    print_log('Child Instance : '||tab_ib_ecs_dat_c(k).instance_id);
                    --        BEGIN
                    BEGIN
                      SELECT COUNT(1)
                      INTO v_count
                      FROM apps.xxcsi_trex_ob_ecs_mhm
                      WHERE instance_id  = NVL(tab_ib_ecs_dat_c(k).instance_id,'');
                    EXCEPTION
                    WHEN OTHERS THEN
                      v_count := 0;
                    END;
                    print_log('v_count : '||v_count);
                    IF v_count = 0 THEN
                      BEGIN
                        INSERT
                        INTO xxcsi_trex_ob_ecs_mhm
                            instance_id,
                            instance_number,
                            inventory_item_id,
                            unit,
                            unit_name,
                            master_organization_id,
                            serial_number,
                            quantity,
                            uom,
                            active_start_date,
                            active_end_date,
                            install_date,
                            object_version_number,
                            last_vld_organization_id,
                            pre_registration_location,
                            order_header_id,
                            order_number,
                            order_line_id,
                            pre_registration_date,
                            pre_registration_operator,
                            bill_to_customer_name,
                            bill_to_site_id ,
                            bill_to_state ,
                            bill_to_country ,
                            bill_to_city ,
                            bill_to_location ,
                            ship_to_customer_name,
                            ship_to_site_id ,
                            ship_to_state ,
                            ship_to_country ,
                            ship_to_city ,
                            ship_to_location ,
                            ship_to_pin_code,
                            bill_to_pin_code,
                            ship_to_number,
                            bill_to_number,
                            customer_number,
                            ea_license_number,
                            ea_va_sales_order_number,
                            parent_instance_id,
                            parent_y_n,
                            process_flag,
                            error_code,
                            error_details,
                            request_id,
                            created_by,
                            creation_date,
                            last_updated_by,
                            last_update_date,
                            last_update_login,
                            eai_process_flag,
                            master_organization_name,
                            system_id,
                            system_name
                          VALUES
                            NVL(tab_ib_ecs_dat_c(k).instance_id,''),
                            NVL(tab_ib_ecs_dat_c(k).instance_number,''),
                            NVL(tab_ib_ecs_dat_c(k).inventory_item_id,''),
                            NVL(tab_ib_ecs_dat_c(k).segment1,''),
                            NVL(tab_ib_ecs_dat_c(k).description,''),
                            NVL(tab_ib_ecs_dat_c(k).master_organization_id,''),
                            NVL(tab_ib_ecs_dat_c(k).serial_number,''),
                            NVL(tab_ib_ecs_dat_c(k).quantity,''),
                            NVL(tab_ib_ecs_dat_c(k).uom,''),
                            NVL(tab_ib_ecs_dat_c(k).active_start_date,''),
                            NVL(tab_ib_ecs_dat_c(k).active_end_date,''),
                            NVL(tab_ib_ecs_dat_c(k).install_date,''),
                            NVL(tab_ib_ecs_dat_c(k).obj_version_num,''),
                            NVL(tab_ib_ecs_dat_c(k).last_vld_organization_id,''),
                            NVL(tab_ib_ecs_dat_c(k).pre_registration_location,''),
                            NVL(tab_ib_ecs_dat_c(k).order_header_id,''),
                            NVL(tab_ib_ecs_dat_c(k).order_number,''),
                            NVL(tab_ib_ecs_dat_c(k).order_line_id,''),
                            NVL(tab_ib_ecs_dat_c(k).actual_shipment_date,''),
                            NVL(tab_ib_ecs_dat_c(k).email_address,''),
                            NVL(tab_ib_ecs_dat_c(k).bill_to_company_name,''),
                            NVL(tab_ib_ecs_dat_c(k).bill_to_site_id,''),
                            NVL(tab_ib_ecs_dat_c(k).bill_to_state,''),
                            NVL(tab_ib_ecs_dat_c(k).bill_to_coun

    The logic is:
    1. Create any new lookup table rows that may be needed
    2. Create new data rows that reference the lookup table
    All you did was post a buch of code. You didn't post ANYTHING that shows how you executed that code or what the result was.
    You need to SHOW US (not tell us):
    1. WHAT you do
    2. HOW you do it
    3. WHAT results you get
    4. WHAT results you expected to get
    The code you posted has some SERIOUS ISSUES. Here are just three of them
    1. You are using BULK COLLECT without a LIMIT clause
    2. You are using unnecessary IF . . .COUNT statements to test collections for values. The FOR clause will simply NOT execute if the collection is empty so the IF statements add unnecessary clutter.
    3. The first loop iterates a collection but sets a single SCALAR value - making that loop totally USELESS
    LOOP
            IF v_from < tbl_req_start_date(i) THEN
              v_from := tbl_req_start_date(i);
              print_log( 'Tabel Req StartDate : '||tbl_req_start_date(i));
              print_log( 'In the Loop VFrom : '||v_from);
            END IF;
          END LOOP;
    That checks EVERY row in the collection and appears to save the MAX value of 'tbl_req_state_date' into the 'v_from' variable.
    What is the point of that?

  • SO line Update

    Hi all,
    I am trying to update a line information in OE_ORDER_LINES ALL using apps adapter from SOA SUITE to EBIZ. I already used a PL/SQL API "UPDATELINE" under OE_ORDER_PUB which is not helping since the values not really matching with the fields in OE_ORDER_LINES_ALL.
    Can any body tel how can i update SO line information using any API through apps adapter?
    Thanks
    Anand.U

    Hi;
    All APIs are listed in Oracle Integration Repository
    http://irep.oracle.com/index.html
    API User Notes - HTML Format [ID 236937.1]
    R12.0.[3-4] : Oracle Install Base Api / Open Interface Setup Test [ID 427566.1]
    Oracle Trading Community Architecture API User Notes, June 2003 [ID 241320.1]
    Technical Uses of Customer Interface and TCA-API [ID 269121.1]
    Pelase also check below:
    Api's in EBS
    Re: Api's in EBS
    http://sairamgoudmalla.blogspot.com/2009/05/script-to-find-oracle-apis-for-any.html
    API
    Fixed Asset API
    List of API
    Re: List of APIs
    Oracle Common Application Components API Reference Guide
    download.oracle.com/docs/cd/B25284_01/current/acrobat/jta115api.pdf
    List of APIs and open interface R12
    Re: List of APIs and open interface R12
    Regard
    Helios

  • Require fields at time of booking (not before)

    I have a requirement to require certain fields before a sales order can be booked. However, my client does not want the fields required in order to just save an entered order.
    Does anyone have any ideas of how to accomplish this without customizing the form?
    I know I can get close with a form personalization with a condition of the order being booked. However, upon booking the order, the record is not booked and therefore, would only raise an error if the user requeried the order after it is booked.
    Thanks,
    Laura

    I was able to get the exact functionality in a form personalization using the OM_PRE_BOOK_EVENT as the trigger event and the following condition:
    :ORDER.BOOKED_FLAG = 'N'
    AND (${item.order.freight_terms.value} is null
    OR ${item.order.shipping_method.value} is null
    OR EXISTS (select 1 from oe_order_lines_all where header_id = :ORDER.HEADER_ID and (project_id is null OR task_id is null)))
    The action is type of message with a message type of Error.

  • Help with SQL

    Hi Gurus,
    I am working on a report where i created a view. This query pulls data from SO,PO,ITEMS,AP and AR tables. The problem I am having is when I add a AP tables or a field from that table some of the Order Numbers are disappearing. Could someone please shed some light this. Here is the query
    SELECT DISTINCT trxl.CUSTOMER_TRX_LINE_ID,
    pv.vendor_name,
    api.invoice_num AP_Invoice_Num,
    trx.trx_date AR_Invoice_Date,
    trx.trx_number AR_Invoice_Number,
    pll.quantity_received,
    pll.quantity_billed,
    ool.shipped_quantity,
    mtlb.segment1 NSN,
    poh.closed_date po_close_date,
    gl.gl_date
    FROM apps.oe_order_headers_all ooh,
    apps.oe_order_lines_all ool,
    apps.oe_drop_ship_sources odss,
    apps.po_headers_all poh,
    apps.po_lines_all pol,
    apps.po_line_locations_all pll,
    apps.po_vendors pv,
    inv.mtl_system_items_b mtlb,
    ar.Ra_customer_trx_all trx,
    ar.ra_customer_trx_lines_all trxl,
    ar.hz_parties hzp,
    ar.hz_cust_accounts hzc,
    ap.ap_invoices_all api,
    ap.ap_invoice_lines_all apl,
    apps.RA_CUST_TRX_LINE_GL_DIST_ALL gl
    WHERE odss.header_id = ooh.header_id
    AND odss.line_id = ool.line_id
    AND odss.po_header_id = poh.po_header_id
    AND odss.po_line_id = pol.po_line_id
    AND odss.line_location_id = pll.line_location_id
    AND pv.vendor_id = poh.vendor_id
    AND mtlb.inventory_item_id = ool.inventory_item_id
    AND trxl.customer_trx_id = trx.customer_trx_id
    AND trxl.inventory_item_id = mtlb.inventory_item_id
    AND hzc.cust_account_id = ooh.sold_to_org_id
    AND hzc.party_id = hzp.party_id
    AND apl.invoice_id = api.invoice_id
    AND apl.po_header_id = poh.po_header_id
    AND apl.inventory_item_id = mtlb.inventory_item_id
    AND api.vendor_id = poh.vendor_id
    AND ool.line_id = trxl.interface_line_attribute6
    AND to_char(ooh.order_number)= trx.interface_header_attribute1
    AND trxl.CUSTOMER_TRX_LINE_ID = gl.CUSTOMER_TRX_LINE_ID
    AND gl.gl_date IS NOT NULL
    ORDER BY trxl.CUSTOMER_TRX_LINE_ID DESC;
    Really appreciate your help
    Thank You,
    Edited by: 792011 on Feb 16, 2012 11:43 AM
    Edited by: 792011 on Feb 16, 2012 11:44 AM

    Try this,
    1 select col1
    2 ,Substr(col1,1,Instr(col1,',')-1)
    3 ,Substr(col1,1,Instr(col1,',')-4) || Substr(col1, Instr(col1,',')+1, 3)
    4 ,Substr(col1,1,Instr(col1,',')-4) || Substr(col1, -3)
    5* from test
    NewDev>/
    COL1
    SUBSTR(COL1,1,INSTR(COL1,',')-1)
    SUBSTR(COL1,1,INSTR(COL1,',')-4)||SUBSTR(COL1,INSTR(COL1,',')+1,3)
    SUBSTR(COL1,1,INSTR(COL1,',')-4)||SUBSTR(COL1,-3)
    200602/48/02/00229,226,223
    200602/48/02/00229
    200602/48/02/00226
    200602/48/02/00223
    Shailender

  • Performance issue in Report.

    Hello DBAs,
    We have a report which usually takes around 2 hours to complete in our instances "A" and "B".
    We created an index (CREATE INDEX xxexh_order_lines_n2 ON oe_order_lines_all (TRUNC(last_update_date));
    ) in instance A and the report now takes only 10 minutes to complete.
    We created the same index in instance B but the problem is still the same.
    Please provide your feedback as to what do I need to check/compare between the 2 instances to find out the the failure of the index in the latter one.
    Thanks in advance,
    Vijay
    Edited by: user12092839 on Oct 13, 2010 4:37 AM

    Pl post details of OS, database and EBS versions.
    Is one instance cloned from the other ? Pl trace the concurrent program on both instances and post the tkprof output that includes the explain plan.
    MOS Doc 453527.1 - How To Trace a Concurrent Request And Generate TKPROF File
    HTH
    Srini

  • After 10gto11g upgd, 'Planning Data Pull Worker'  perf is very slow

    Hi all,
    We upgraded database from 10g to 11gR2. We have 3 prod instances , they work together. They are ebiz, planning, and configurator. Some of you might be familiar with this kind of setup.
    We are running 'Planning Data Pull Worker' in APS instance (planning) instance. This program "SELECTs" (and gets data) from EBIZ instance and "INSERTS" into planning instance.
    But after upgrade, this works fine in one instance (PERF6) (half hr), and takes very long like 6+ hrs in another instacen ARCH6.
    We figured where the problem is. A select statement.
    "select count(1) from apps.MRP_AP3_SALES_ORDERS_V ;"
    Eventhough this is not exactly the select been used. We simplified by just trying "count(1)" of the main view which as the culprit.
    I am pasting trace of both instance where working fine (PERF6) and where it is taking too long (ARCH6).
    Please have a look and help. We opened a sev-1 tar as well , still problem persists.
    Thanks,
    Gopal

    =======================================
    ___PERF6 instance trace; Where it works fine._
    =======================================
    SQL> SELECT * FROM table(DBMS_XPLAN.DISPLAY_AWR(('87dtkqstb5adq'),'961766442',null,'ADVANCED'));
    PLAN_TABLE_OUTPUT
    SQL_ID 87dtkqstb5adq
    select count(1) from apps.MRP_AP3_SALES_ORDERS_V
    Plan hash value: 961766442
    | Id | Operation | Name | Row
    s | Bytes | Cost (%CPU)| Time |
    PLAN_TABLE_OUTPUT
    | 0 | SELECT STATEMENT | |
    | | 29253 (100)| |
    | 1 | SORT AGGREGATE | |
    1 | 189 | | |
    | 2 | NESTED LOOPS | |
    PLAN_TABLE_OUTPUT
    1 | 189 | 29253 (1)| 00:05:52 |
    | 3 | HASH JOIN | |
    1 | 185 | 29253 (1)| 00:05:52 |
    | 4 | NESTED LOOPS OUTER | |
    1 | 176 | 29246 (1)| 00:05:51 |
    | 5 | NESTED LOOPS OUTER | |
    1 | 170 | 29245 (1)| 00:05:51 |
    PLAN_TABLE_OUTPUT
    | 6 | NESTED LOOPS | |
    1 | 161 | 29245 (1)| 00:05:51 |
    | 7 | HASH JOIN | | 60
    90 | 654K| 19090 (1)| 00:03:50 |
    | 8 | TABLE ACCESS BY INDEX ROWID | FND_LANGUAGES |
    20 | 100 | 2 (0)| 00:00:01 |
    | 9 | INDEX RANGE SCAN | FND_LANGUAGES_N1 |
    20 | | 1 (0)| 00:00:01 |
    PLAN_TABLE_OUTPUT
    | 10 | HASH JOIN | | 62
    46 | 640K| 19088 (1)| 00:03:50 |
    | 11 | TABLE ACCESS FULL | OE_TRANSACTION_TYPES_TL | 12
    97 | 37613 | 10 (0)| 00:00:01 |
    | 12 | NESTED LOOPS | |
    | | | |
    | 13 | NESTED LOOPS | | 41
    PLAN_TABLE_OUTPUT
    03 | 304K| 19077 (1)| 00:03:49 |
    | 14 | NESTED LOOPS | | 41
    03 | 220K| 14517 (1)| 00:02:55 |
    | 15 | HASH JOIN | | 41
    00 | 104K| 9959 (1)| 00:02:00 |
    | 16 | TABLE ACCESS FULL | MRP_DERIVED_SO_DEMANDS | 41
    00 | 65600 | 17 (0)| 00:00:01 |
    PLAN_TABLE_OUTPUT
    | 17 | INDEX FAST FULL SCAN | MTL_SYS_ITEMS_SN_N2 | 15
    59K| 14M| 1184 (1)| 00:00:15 |
    | 18 | TABLE ACCESS BY INDEX ROWID| OE_ORDER_LINES_ALL |
    1 | 29 | 2 (0)| 00:00:01 |
    | 19 | INDEX UNIQUE SCAN | OE_ORDER_LINES_U1 |
    1 | | 1 (0)| 00:00:01 |
    | 20 | INDEX UNIQUE SCAN | OE_ORDER_HEADERS_U1 |
    1 | | 1 (0)| 00:00:01 |
    PLAN_TABLE_OUTPUT
    | 21 | TABLE ACCESS BY INDEX ROWID | OE_ORDER_HEADERS_ALL |
    1 | 21 | 2 (0)| 00:00:01 |
    | 22 | TABLE ACCESS BY INDEX ROWID | MTL_SALES_ORDERS |
    1 | 51 | 3 (0)| 00:00:01 |
    | 23 | INDEX RANGE SCAN | MTL_SALES_ORDERS_N1 |
    1 | | 2 (0)| 00:00:01 |
    | 24 | INDEX UNIQUE SCAN | PJM_PROJECT_PARAMETERS_U1 |
    PLAN_TABLE_OUTPUT
    1 | 9 | 0 (0)| |
    | 25 | INDEX RANGE SCAN | OE_ODR_LINES_SN_N2 |
    1 | 6 | 2 (0)| 00:00:01 |
    | 26 | TABLE ACCESS FULL | AR_SYSTEM_PARAMETERS_ALL |
    43 | 387 | 6 (0)| 00:00:01 |
    | 27 | INDEX UNIQUE SCAN | GL_SETS_OF_BOOKS_U2 |
    1 | 4 | 0 (0)| |
    PLAN_TABLE_OUTPUT
    Query Block Name / Object Alias (identified by operation id):
    1 - SEL$15993197
    8 - SEL$15993197 / FNL@SEL$2
    9 - SEL$15993197 / FNL@SEL$2
    11 - SEL$15993197 / OTTL@SEL$2
    PLAN_TABLE_OUTPUT
    16 - SEL$15993197 / MDSD@SEL$2
    17 - SEL$15993197 / MSIK@SEL$2
    18 - SEL$15993197 / OOL@SEL$2
    19 - SEL$15993197 / OOL@SEL$2
    20 - SEL$15993197 / OOHA@SEL$2
    21 - SEL$15993197 / OOHA@SEL$2
    22 - SEL$15993197 / MSO@SEL$2
    23 - SEL$15993197 / MSO@SEL$2
    24 - SEL$15993197 / MPP@SEL$2
    25 - SEL$15993197 / OOL1@SEL$2
    26 - SEL$15993197 / ASPA@SEL$2
    PLAN_TABLE_OUTPUT
    27 - SEL$15993197 / GSB@SEL$2
    Outline Data
    /*+
    BEGIN_OUTLINE_DATA
    IGNORE_OPTIM_EMBEDDED_HINTS
    OPTIMIZER_FEATURES_ENABLE('11.2.0.2')
    DB_VERSION('11.2.0.2')
    OPT_PARAM('optimizer_dynamic_sampling' 6)
    PLAN_TABLE_OUTPUT
    ALL_ROWS
    OUTLINE_LEAF(@"SEL$15993197")
    ELIMINATE_JOIN(@"SEL$5C160134" "MTL_SALES_ORDERS"@"SEL$3")
    OUTLINE(@"SEL$5C160134")
    MERGE(@"SEL$335DD26A")
    OUTLINE(@"SEL$1")
    OUTLINE(@"SEL$335DD26A")
    MERGE(@"SEL$3")
    OUTLINE(@"SEL$2")
    OUTLINE(@"SEL$3")
    INDEX_FFS(@"SEL$15993197" "MSIK"@"SEL$2" ("MRP_SN_SYS_ITEMS"."INVENTORY_IT
    PLAN_TABLE_OUTPUT
    EM_ID"
    "MRP_SN_SYS_ITEMS"."ORGANIZATION_ID"))
    FULL(@"SEL$15993197" "MDSD"@"SEL$2")
    INDEX_RS_ASC(@"SEL$15993197" "OOL"@"SEL$2" ("OE_ORDER_LINES_ALL"."LINE_ID"
    INDEX(@"SEL$15993197" "OOHA"@"SEL$2" ("OE_ORDER_HEADERS_ALL"."HEADER_ID"))
    FULL(@"SEL$15993197" "OTTL"@"SEL$2")
    INDEX_RS_ASC(@"SEL$15993197" "FNL"@"SEL$2" ("FND_LANGUAGES"."INSTALLED_FLA
    G"))
    PLAN_TABLE_OUTPUT
    INDEX_RS_ASC(@"SEL$15993197" "MSO"@"SEL$2" ("MTL_SALES_ORDERS"."SEGMENT1")
    INDEX(@"SEL$15993197" "MPP"@"SEL$2" ("PJM_PROJECT_PARAMETERS"."PROJECT_ID"
    "PJM_PROJECT_PARAMETERS"."ORGANIZATION_ID"))
    INDEX(@"SEL$15993197" "OOL1"@"SEL$2" ("MRP_SN_ODR_LINES"."LINE_ID"))
    FULL(@"SEL$15993197" "ASPA"@"SEL$2")
    INDEX(@"SEL$15993197" "GSB"@"SEL$2" ("GL_SETS_OF_BOOKS"."SET_OF_BOOKS_ID")
    PLAN_TABLE_OUTPUT
    LEADING(@"SEL$15993197" "MSIK"@"SEL$2" "MDSD"@"SEL$2" "OOL"@"SEL$2" "OOHA"
    @"SEL$2" "OTTL"@"SEL$2"
    "FNL"@"SEL$2" "MSO"@"SEL$2" "MPP"@"SEL$2" "OOL1"@"SEL$2" "ASPA"@"S
    EL$2" "GSB"@"SEL$2")
    USE_HASH(@"SEL$15993197" "MDSD"@"SEL$2")
    USE_NL(@"SEL$15993197" "OOL"@"SEL$2")
    USE_NL(@"SEL$15993197" "OOHA"@"SEL$2")
    PLAN_TABLE_OUTPUT
    NLJ_BATCHING(@"SEL$15993197" "OOHA"@"SEL$2")
    USE_HASH(@"SEL$15993197" "OTTL"@"SEL$2")
    USE_HASH(@"SEL$15993197" "FNL"@"SEL$2")
    USE_NL(@"SEL$15993197" "MSO"@"SEL$2")
    USE_NL(@"SEL$15993197" "MPP"@"SEL$2")
    USE_NL(@"SEL$15993197" "OOL1"@"SEL$2")
    USE_HASH(@"SEL$15993197" "ASPA"@"SEL$2")
    USE_NL(@"SEL$15993197" "GSB"@"SEL$2")
    SWAP_JOIN_INPUTS(@"SEL$15993197" "MDSD"@"SEL$2")
    SWAP_JOIN_INPUTS(@"SEL$15993197" "OTTL"@"SEL$2")
    SWAP_JOIN_INPUTS(@"SEL$15993197" "FNL"@"SEL$2")
    PLAN_TABLE_OUTPUT
    END_OUTLINE_DATA
    110 rows selected.
    SQL> spool off

Maybe you are looking for