I have to add support company column to the query based on city,location id,country can you please any one help me on this

select fu.user_id,
      fu.user_name,
      hcp_phone1.phone_number primary_phone_number ,
      hcp_phone1.last_update_date cnts_last_update_date,
      fu.last_update_date user_last_update_date,
      (select hcp_phone2.phone_number
      from ar.hz_contact_points hcp_phone2
      where hcp_phone2.contact_point_type(+) = 'PHONE'
      and hcp_phone2.status(+)               = 'A'
      and hp.party_id                        =hcp_phone2.owner_table_id(+)
      and hcp_phone2.owner_table_name(+)     ='HZ_PARTIES'
      and hcp_phone2.primary_flag            = 'N'
      and rownum                             = 1
      ) secondary_phone_number,
    (select hcp_email.email_address
    from ar.hz_contact_points hcp_email
    where hcp_email.contact_point_type(+) = 'EMAIL'
    and hcp_email.status(+)               = 'A'
    and hp.party_id                       =hcp_email.owner_table_id(+)
    and hcp_email.owner_table_name(+)     ='HZ_PARTIES'
    and hcp_email.primary_flag            = 'Y'
    ) email_address,
    hp.person_first_name ,
    hp.person_middle_name ,
    hp.person_last_name ,
    hp.party_name,
    hp.person_title ,(
  nvl(hp.address1,' ') ||
  nvl(hp.address2,' ') ||
  nvl(hp.address3,' ') ||
  nvl(hp.address4,' ')
) address1,
   hp.city,
    hp.state ,
    hp.country ,
    hp.postal_code,
  ' ' industry_group,
    from fnd_user fu,
    ar.hz_parties hp,
    fnd_user_resp_groups furg,
    fnd_responsibility_tl frt,
    ar.hz_contact_points hcp_phone1
  where hp.party_id                      =fu.person_party_id
  and furg.user_id                       =fu.user_id
-- and ( to_date(fu.last_update_date,'dd-mm-yyyy') > to_date(nvl(p_in_date,sysdate),'dd-mm-yyyy')
-- or to_date(hcp_phone1.last_update_date,'dd-mm-yyyy')> to_date(nvl(p_in_date,sysdate),'dd-mm-yyyy') 
  and furg.responsibility_id             = frt.responsibility_id
  and frt.responsibility_name            = 'EMR IBE Customer PSG US'
  and frt.language                       = 'US'
  and hcp_phone1.contact_point_type(+)   = 'PHONE'
  and hcp_phone1.status(+)               = 'A'
  and hp.party_id                        =hcp_phone1.owner_table_id(+)
  and hcp_phone1.owner_table_name(+)     ='HZ_PARTIES'
  and hcp_phone1.primary_flag            = 'Y';

SELECT d.NAME
      FROM
        (SELECT jta.NAME
          FROM apps.jtf_terr_values_all jtva,
          apps.jtf_terr_qual_all jtqa,
          apps.jtf_terr_all jta ,
          apps.hz_party_sites ps,
          apps.hz_locations hl
        WHERE jtva.terr_qual_id     = jtqa.terr_qual_id
        AND jtqa.terr_id            = jta.terr_id
        AND jtva.low_value_char     = hl.postal_code
        AND jtqa.org_id             = jtva.org_id
        AND jta.org_id              = jtqa.org_id
        AND ps.location_id          = hl.location_id
        AND hl.country             in( 'CA', 'US')) D;
        UNION
        SELECT jta.NAME
          FROM apps.jtf_terr_values_all jtva,
          apps.jtf_terr_qual_all jtqa,
          apps.jtf_terr_all jta,
          apps.hz_party_sites ps,
          apps.hz_locations hl
        WHERE jtva.terr_qual_id     = jtqa.terr_qual_id
        AND jtqa.terr_id            = jta.terr_id
        AND ps.location_id          = hl.location_id
        AND jtqa.org_id             = jtva.org_id
        AND jta.org_id              = jtqa.org_id
        AND hl.country              = 'US'
        AND hl.postal_code BETWEEN jtva.low_value_char AND jtva.high_value_char
        )d;

Similar Messages

  • Add a flag column in the Query based on Cancel date

    hi Guys,
    I have a Characterstic object 0canceldate and it gets the cancellation date of the sales order. Based on that date i need to add a column in the report like if 0canceldate has ahappened or populate then show Yes or No in the coumn like a flag.
    Can anybody help me how i can do that?

    SELECT d.NAME
          FROM
            (SELECT jta.NAME
              FROM apps.jtf_terr_values_all jtva,
              apps.jtf_terr_qual_all jtqa,
              apps.jtf_terr_all jta ,
              apps.hz_party_sites ps,
              apps.hz_locations hl
            WHERE jtva.terr_qual_id     = jtqa.terr_qual_id
            AND jtqa.terr_id            = jta.terr_id
            AND jtva.low_value_char     = hl.postal_code
            AND jtqa.org_id             = jtva.org_id
            AND jta.org_id              = jtqa.org_id
            AND ps.location_id          = hl.location_id
            AND hl.country             in( 'CA', 'US')) D;
            UNION
            SELECT jta.NAME
              FROM apps.jtf_terr_values_all jtva,
              apps.jtf_terr_qual_all jtqa,
              apps.jtf_terr_all jta,
              apps.hz_party_sites ps,
              apps.hz_locations hl
            WHERE jtva.terr_qual_id     = jtqa.terr_qual_id
            AND jtqa.terr_id            = jta.terr_id
            AND ps.location_id          = hl.location_id
            AND jtqa.org_id             = jtva.org_id
            AND jta.org_id              = jtqa.org_id
            AND hl.country              = 'US'
            AND hl.postal_code BETWEEN jtva.low_value_char AND jtva.high_value_char
            )d;

  • 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?

  • I bought an iphone5 from saudi arabia,can i use it in india?is there any requirements i have to take?many one are saying i need to unlock it,please any one help me,i did'nt activate my phone yet.

    i bought an iphone5 from saudi arabia,can i use it in india?is there any requirements i have to take?many one are saying i need to unlock it,please any one help me,i did'nt activate my phone yet.

    If the phone is unlocked then you can use it in India.
    If your phone is locked, then the only way to get the phone unlocked is to contact your phone company/carrier. The person that sold you the phone in Saudi should have told you whether it was locked or unlocked.  Contact them to check and then contact the carrier to have it unlocked if it is locked.
    Other than that there is not a lot that you can do - perhaps it was unwise to purchase a phone in Saudi - it won't have Facetime on it if you got it there.

  • HT1918 I have been trying to update my payment information and I am unable to do so, can you please assist?

    Can you help me update my payment information in itunes

    You should be able to update your payment info as described on the page that you posted from e.g. by logging into your account via the Store > View Account menu option on your computer's iTunes. If that isn't working, then are you getting any error messages, and what are you trying to change your payment method to e.g. debit or credit card ?
    If it's a debit card then I don't think that they are still accepted as a valid payment method - they are not listed on this page and there have been a number of posts recently about them being declined
    If it's a credit card then is it registered to exactly the same name and address (including format and spacing etc) that you have on your iTunes account, it was issued by a bank in your country and you are currently in that country ? If it is and if it's being declined then you could check with the card issuer to see if it's them that are declining it, and if not then try contacting iTunes support and see if they know why it's being declined : http://www.apple.com/support/itunes/contact/ - click on Contact iTunes Store Support on the right-hand side of the page, then Account Management

  • After my last download I now have video adds that show up in the broswer from time to time. How can I get rid of them.

    on my last down load of firefox, I not have two issues that occur, One every once and awhile I get a video ad that shows up in the lower left corn of the browser. I have uninstalled your software and reinstalled and it is still there. Also I get a web site of inksr.com that my trend micro blocks everytime I go to a new web site within firefox. Both of these have started after I was told to redownload your software in order to get the updates to work and not be blocked.

    You probably have malware or adware installed on your computer.
    I note from your system information you have ''TopArcadeHits 1.0 '' <br /> That is something a lot of users complain about.
    Because some of this sort of software is sometimes installed intentionally it is often not detected by malware scans.
    Please be aware that this sort of adware is not provided by or downloaded with Mozilla Firefox software.
    Sometimes a problem with Firefox may be a result of malware installed on your computer, that you may not be aware of.
    You can try these free programs to scan for malware, which work with your existing antivirus software:
    * [http://www.microsoft.com/security/scanner/default.aspx Microsoft Safety Scanner]
    * [http://www.malwarebytes.org/products/malwarebytes_free/ MalwareBytes' Anti-Malware]
    * [http://support.kaspersky.com/faq/?qid=208283363 TDSSKiller - AntiRootkit Utility]
    * [http://www.surfright.nl/en/hitmanpro/ Hitman Pro]
    * [http://www.eset.com/us/online-scanner/ ESET Online Scanner]
    * [http://www.bleepingcomputer.com/download/adwcleaner/ AdwCleaner: (for adware)]
    * [http://www.kaspersky.com/security-scan Kaspersky Free security scan]
    You need to use multiple and up-to-date tools as they will not all pick up the same things.
    [http://windows.microsoft.com/MSE Microsoft Security Essentials] is a good FREE permanent antivirus for Windows 7/Vista/XP if you don't already have one.
    Further information can be found in the [[Troubleshoot Firefox issues caused by malware]] article.
    Did this fix your problems? Please report back to us!

  • I HAVE MISTAKENLY BLOCKED ALL MY PHOTOS ON FACEBOOK USING FIREFOX AND CANT ACCESS IT AGAIN.CAN YOU PLEASE HELP ME TO SORT THIS OUT?

    I have just mistakenly blocked my photos on facebook.com using Mozilla.I write clicked one of my photos and the was a portion that says blocked photos.I clicked that and tried to undo but could not work and now i cant see my profile picture and other pictures on facebook.

    With Facebook on display, click on the site identity button (for details on what that is see the [[site identity button]] article) and then on More Information. This will open up the page info dialog.
    First select the Permissions panel, make sure that "Load Images" is set to allow (selecting Use Default should also work)
    Next select the Media panel, then click on the first item in the list. Use the down arrow key to scroll through the list. If any item has the option "Block images from (domain name)" selected, de-select the option.
    This should hopefully resolve your issue, but also see [[Images or animations do not show]].
    Some add-ons can also block images, for example if you have AdBlock Plus installed, make sure that you have not accidentally created a filter to block the images.

  • I have 2 Bookmark Toolbar Icons that are the same for 2 different locations. How can I change an Icon to avoid confusion?

    First location.
    https://www.blogger.com/blogin.g?blogspotURL=http%3A%2F%2Fmtbeautyband.blogspot.com%2F
    Second location.
    http://www.google.com.au/firefox?client=firefox-a&rls=org.mozilla:en-GB:official
    BOTH HAVE THE SAME ICON!

    Some extensions that you can look at:
    *Favicon Picker 2: https://addons.mozilla.org/firefox/addon/3176
    *Favicon Picker 3: https://addons.mozilla.org/firefox/addon/7849

  • I deleted injustice from my ipad, and I'm trying to reinstall it, but it doesn't for some reason. I have lots of memory left but it still doesn't work for some reason. Can you please help ?

    I tried reinstalling injustice on my ipad, but it doesn't work.

    Hi Somehunk,
    Welcome to the Support Communities!
    The first thing I would suggest is to quit the iTunes Store app and sign out of your iTunes Store account on your iPhone.
    Then restart / reset the device.
    When you sign back in, you should be able to re-initiate the download.
    The following articles will explain these steps in more detail:
    iOS: Force an app to close
    http://support.apple.com/kb/ht5137
    iOS: Changing the signed-in iTunes Store Apple ID account
    http://support.apple.com/kb/HT1311?viewlocale=en_US
    iOS: Turning off and on (restarting) and resetting
    http://support.apple.com/kb/HT1430
    Downloading past purchases from the iTunes Store, App Store, and iBooks Store
    http://support.apple.com/kb/HT2519
    Cheers,
    Judy

  • HT204302 i get a message when I plug in my ipod to my laptop saying "cannot use this ipod because apple mobile device is not started" can any one help me with this...I have never had this happen before

    Hello anyone
    I get a message when i plug in my ipod touch saying "cannot use this ipod because apple mobile service is not started" can anyone please help me with this problem...I had this message once before but I forgot how to correct it

    From the More Like This section on the right:
    I get error message when I plug in iPhone 4s saying "This iPhone cannot be used because the Apple Mobile Device service is not started"
    can't get my ipod to connect to tunes error message "cannot be used because the apple mobile device service is not started"  fixes? Using Win XP
    im trying to connect my ipod to itunes and its saying it cannot connect because the "Apple Mobile Device is not started" help
    Or see: iPhone, iPad, iPod touch: How to restart the Apple Mobile Device Service (AMDS) on Windows

  • I have bought new apple iPad but I don't know how to verify my Apple ID can you please help me

    I Have bought new apple I pad but I don't know how to verify it can you please help me

    When you create an iTunes account you should receive an email to the primary email address that you put on the account - that email should have a 'verify now' link in it which you need to click on and which will open a browser for you to log into your account from.
    From Frequently asked questions about Apple ID :
    How do I verify my Apple ID by email?
    Simply follow the link in the verification email that says "Verify Now." Sign in with your current Apple ID and password, then click Verify Address. You can also verify by signing in at My Apple ID. You'll receive an email prompting you to verify.
    (For info these are user-to-user forums, you are not talking to iTunes Support nor Apple, nor is it 'live chat' - a fellow user will reply when they see a question and they know the answer.)

  • I have MAC OSX 10.5.8 and need to install adobe illustrator. I checked the compatibility and found that CS5 will work.Can any one help where i can find it. The trail version is fine with me.

    I have MAC OSX 10.5.8 and need to install adobe illustrator. I checked the compatibility and found that CS5 will work.Can any one help where i can find it. The trail version is fine with me as i just have to use it for couple of days till i get my mac book back from service. Can any one help me on this.

    You are welcome, ameronweb.
    To elaborate a bit, you may come across offers of a new/unopened/unregistered version, which is the simplest case (you would need a guarantee). Other cases require much detailed information (and a guarantee).
    If upgrading to 10.6.8 or higher is an option, you could use CS6.

  • Need to add a new column in the extended VO

    Hi
    I have an urgent requirement like i need to add a new column in one of the extended VO.Can anyone give the procedure to do that..
    Please do the needful.
    Thanks
    Preeti

    Hi Gaurav,
    For example...
    Consider seeded VO is XXXVO and we added a new column to the XXX by extending XXCHRXXXVO(extended VO).and the we gone thru the full substitution process..
    Now new requirement came as add a new column to extended VO - XXCHRXXXVO.Can you please tell in this example scenario? It will be good if you provide the inputs...
    Thanks
    Preeti

  • How to add a Description Column in the Content Panel (Bridge CS5)

    Hi,
    Is it possible to add a Description Column in the Content Panel. If so, how?
    I'm talking about the Description from the IPTC Core data and I'm using Bridge CS5.
    Thanks in advance,
    Frank

    This is the screenshot of the Metadata Workspace with the Content Panel (not Metadata Panel). As you can see it shows Name, Label, Keywords etc. but it's not possible to show Description in that list as a column.
    I still agree that it would be a big bonus if you could alter this workspace with description field (even with more lines etc) but what Curt shows you might be an alternative. I couldn't help noticing that you have not created your own custom workspaces.
    Try and play with this. You have the option to divide the window in 3 columns max but you can create different panels as a row in 1 column.
    Grabbing a tab and move it to a new location until a single blue line appears (between the borders, a bit tricky). A vertical blue line means as a column and a horizontal line means a row. A surrounding blue line means same panel but adding as a tab. You can rearrange the tabs by dragging to left or right. under the menu window you can select which panels are visible or use right mouse click menu on top of a panel to choose.
    Sadly enough only 3 columns and only one panel of it's kind per workspace, but you can resize the panels also to your own workflow needs.
    In Bridge preferences you can change the colors for background in the general tab and in the metadata tab you can select what info to view in certain sections. Personally I have set my IPTC to view only description, keywords, date created and a few other subjects.
    That is the nice thing about Bridge, creating custom workspaces, save them and being able to recreate them without problems :-)
    I attach some screenshot of my daily workflow (with the luxury of having a 30' screen) but there are plenty of other options possible, don't forget to name and save your workspace.

  • Need to add 2 new columns to the existing table control of C223 transaction

    Hi ABAP Gurus,
    I have to do a screen enhancement for transaction C223.
    Below is the requirement:
    need to add 2 new columns to the existing table control of C223 transaction.
    there is no customer exits, screen exit or user exit present for this transaction C223, i have found one enhancement spot for this transaction.
    i dont have any idea how to do this in standard transaction C223, the table control in C223 saves the data to MKAL table and the table control uses the structure MKAL_EXPAND in the screen program.
    i have created an append structure for  the 2 fields to the standard table MKAL.
    Can anyone please suggest me how this can be done in standard screen C223, will the enhancement spot can be used to do this....
    please sugest...
    Thanks & Regards

    Hi Santosh,
    Thanks for the reply. I have looked into this Enhancement Spot CPFX_SCREEN_SET , inside this there is only one method INPUT_DISABLED having below parameters
    IM_MKAL     Importing     Type     MKAL                                                                                Production Version
    EX_MSGID     Exporting     Type     SY-MSGID                                                                                Messages, Message
    EX_MSGTY     Exporting     Type     SY-MSGTY                                                                                Messages, Message
    EX_MSGNO     Exporting     Type     SY-MSGNO                                                                                Messages, Message
    EX_MSGV1     Exporting     Type     SY-MSGV1                                                                                Messages, Message
    EX_MSGV2     Exporting     Type     SY-MSGV2                                                                                Messages, Message
    EX_MSGV3     Exporting     Type     SY-MSGV3                                                                                Messages, Message
    EX_MSGV4     Exporting     Type     SY-MSGV4                                                                                Messages, Message
    EX_INPUT_DISABLE     Exporting     Type     CHAR1                                                                                Display Only if X Was Set
    the BADI definition present here is a SAP internal so we cant implement the BADI , but we can created a enhancement spot implementation for this. as per my understanding on this the enhancement spot is only for making the table control fields display / change .  i dont think this can be used to add two new coloumns to C223 table control.
    I am not sure thats why seeking your help/valuable sugestion on this.
    Please provide your sugestion on this , so that i can come to conclusion on this issue.
    Thanks & Regards
    Siddhartha Mishra

Maybe you are looking for

  • FM BBP_PD_SC_CREATE according issues

    Hello all, my latest challenge is, to develop a RFC-wrapper for the function module BBP_PD_SC_CREATE. My client wants to have R/3 PR's only in SRM for approval. My first try was the technical scenario for plan-driven procurement, where R/3 can transf

  • FTPAdapter - logical directory name - file not moved to archive directory

    I created a simple ftp service to read the file from remote inbound directory and archive it to an "archive" directory using logical directories. I supplied the input and archive directories. The process reads the file from the input directory, but d

  • NI Max Configurin​g Motion Bd Parameters - How to retrieve them

     I use my PXI-7344 Motion Card with Labview 7.1 and I configure the parameters such as the software limit thresholds in Ni Max.  When I am writing my Labview program and I am trying to see where the PXI-7344 SW Limits thresholds are set, I can not re

  • Is SPAN port not allowed in Nexus FEX Port ?

    Hi     Customer want me to defined a SPAN port on N2K, it is a fex port. when I configure I got the following statement from the switch. Is there any way to solve the problem? n5k-N2K(config-monitor)# destination ?   interface  Configure interfaces n

  • Prime Infrastructure- switch interface up/down history statistics.

    Hi. Does Prime Infrastructure support a way of showing when some specific interface was last seen up/down? For example I need to know which interfaces are not used very often (that are in the down state most of the time). Thanks!