6 Replies Latest reply on Feb 26, 2011 1:21 AM by MaheedharJ

    PO Loading

    user3273
      Dears,

      Good Day,

      I am populating:
      PO.PO_HEADERS_INTERFACE;
      PO.PO_LINES_INTERFACE;
      PO.PO_DISTRIBUTIONS_INTERFACE;

      I have used a sample api I found, but my Purchase Order is not being created.

      Anyone have any suggestions? or guide me how to use this API (apps.po_interface_s.create_documents)

      DECLARE
      z_document_id number :=0;
      z_number_lines number :=0;
      z_document_creation_method VARCHAR2(1000):='PO';
      BEGIN
      apps.po_interface_s.create_documents (
      18039,--x_batch_id IN number,
      z_document_id,--x_document_id IN OUT NOCOPY number,
      z_number_lines,--x_number_lines IN OUT NOCOPY number,
      z_document_creation_method
      );
      dbms_output.put_line('z_document_id: ' ||z_document_id);
      dbms_output.put_line('z_number_lines: ' ||z_number_lines);
      commit;
      EXCEPTION
      when others then
      dbms_output.put_line('error: ' ||sqlerrm);
      END;

      my inviroment:
      Oracle EBS R12.1.1
      Oracle DB 11i

      Thank you & Best Regards
        • 1. Re: PO Loading
          Srini Chavali-Oracle
          Pl see if MOS Doc 1054004.1 (Vision Demo - How To Import Standard Purchase Orders Using the Purchase Document Open Interface) can help

          HTH
          Srini
          • 2. Re: PO Loading
            Hussein Sawwan-Oracle
            Anyone have any suggestions? or guide me how to use this API (apps.po_interface_s.create_documents)
            I do not think you can use this API -- Please see these docs.

            Release 12 Oracle Purchasing API and Open Interface Changes [ID 437587.1]
            Oracle® Purchasing Release 11i10 Open Interfaces and APIs [ID 359295.1]
            Is It Possible To Add New Lines To A Standard Purchase Order Via Pdoi ? [ID 395234.1]

            Thanks,
            Hussein
            • 3. Re: PO Loading
              824010
              Hussain is correct there is no such API to load.

              Refer Hussain's reply


              Thanks
              Prasanna
              • 4. Re: PO Loading
                user3538840
                Hi,
                We add new lines on existing orders (/ 11.5.10.2) with a freeware that can load data from Excel to forms (http://winparrot.com for Oracle EBS).
                I'm sure you could quickly do the same macro for a R12.
                Regards
                • 5. Re: PO Loading
                  Ankit-K-Oracle
                  Hi,

                  This is not public API, Oracle do not recommend to use it. But if you want to use set org_id before calling API.


                  begin
                            fnd_client_info.set_org_context('org_id');
                            end;

                  Thanks
                  Ankit Kapil
                  • 6. Re: PO Loading
                    MaheedharJ
                    Hi,
                    Using private API is double edge sword. one side you need to automate the process and other side oracle doesn't support.
                    We are using 12.0.4

                    I used following code and it worked for me.

                    declare
                    l_interface_header_id number;
                    l_interface_line_id number;

                    l_po_req_line_id number := 1433626;
                    l_po_req_line_num number :=1;
                    l_process_code varchar2(20) := 'NEW'; -- NEW in case of creation of new PO, ADD incase of adding line to PO
                    l_action varchar2(20) := 'NEW'; -- NEW in case of creation of new PO, ADD incase of adding line to PO
                    l_document_id number := NULL; -- assign PO number in case of adding lines to existing PO...
                    l_document_num number := NULL; -- assign PO number in case of adding lines to existing PO...
                    l_agent_id number := 236;
                    l_vendor_id number;
                    l_vendor_site_id number;

                    ---
                    l_return_status VARCHAR2(1);
                    l_msg_count NUMBER;
                    l_msg_data VARCHAR2(5000);
                    l_num_lines_processed NUMBER;
                    l_document_number PO_HEADERS_ALL.segment1%TYPE;

                    begin
                    mo_global.init('PO');
                    mo_global.set_policy_context('S',84);

                    SELECT po_headers_interface_s.nextval
                    INTO l_interface_header_id
                    FROM dual;

                    select vendor_id,vendor_site_id--,agent_id
                    into l_vendor_id, l_vendor_site_id
                    from po_requisition_lines_all
                    where requisition_line_id= l_po_req_line_id;


                    INSERT
                    INTO po_headers_interface
                    ( interface_header_id
                    ,interface_source_code
                    ,batch_id
                    ,process_code
                    ,action
                    ,document_type_code
                    ,document_subtype
                    ,document_num
                    -- ,freight_terms
                    -- ,FOB
                    --,payment_terms
                    ,group_code
                    ,vendor_id
                    ,vendor_site_id
                    ,agent_id
                    ,currency_code
                    ,creation_date
                    ,created_by
                    ,last_update_date
                    ,last_updated_by
                    ,style_id
                    )
                    VALUES
                    ( l_interface_header_id -- --interface_header_id
                    ,'PO' -- -- interface_source_code
                    ,l_interface_header_id -- -- x_batch_id
                    ,l_process_code -- -- process code
                    ,l_action -- -- action
                    ,'PO' -- -- x_document_type
                    ,'STANDARD' -- -- document_subtype
                    ,l_document_num -- -- document_num
                    -- ,p_freight_terms
                    -- ,p_FOB
                    --,payment_terms
                    ,'DEFAULT' -- -- 'DEFAULT' / 'REQUISITION'
                    ,l_vendor_id -- -- x_vendor_id
                    ,l_vendor_site_id -- -- x_vendor_site_id
                    ,l_agent_id -- -- x_agent_id
                    ,'USD' -- -- x_currency_code
                    ,SYSDATE -- -- x_creation_date
                    ,-1 -- -- x_created_by
                    ,SYSDATE -- -- x_last_update_date
                    ,-1 -- -- x_last_updated_by
                    ,1 -- style_id
                    );


                    SELECT po_lines_interface_s.nextval
                    INTO l_interface_line_id
                    FROM dual;


                    INSERT INTO po_lines_interface
                    ( interface_header_id
                    ,interface_line_id
                    ,requisition_line_id
                    ,line_num
                    ,creation_date
                    ,created_by
                    ,last_update_date
                    ,last_updated_by
                    )
                    VALUES
                    ( l_interface_header_id -- x_interface_header_id,
                    ,l_interface_line_id -- x_interface_line_id,
                    ,l_po_req_line_id -- x_requisition_line_id, from req lines
                    ,l_po_req_line_num -- x_so_line_num, from SO lines
                    ,SYSDATE -- x_creation_date
                    ,-1 -- x_created_by
                    ,SYSDATE -- x_last_update_date
                    ,-1 -- x_last_updated_by
                    );


                    PO_INTERFACE_S.create_documents (
                    p_api_version => 1.0,
                    x_return_status => l_return_status,
                    x_msg_count => l_msg_count,
                    x_msg_data => l_msg_data,
                    p_batch_id => l_interface_header_id,
                    p_req_operating_unit_id => 84,--p_req_operating_unit_id,
                    p_purch_operating_unit_id => 84,--p_purch_operating_unit_id,
                    x_document_id => l_document_id,
                    x_number_lines => l_num_lines_processed,
                    x_document_number => l_document_number,
                    p_document_creation_method => 'AUTOCREATE' -- <DBI FPJ>
                    ,p_sourcing_k_doc_type => null
                    ,p_conterms_exist_flag => null
                    ,p_orig_org_id => null
                    );



                    dbms_output.put_line ('l_return_status: ' || l_return_status);
                    dbms_output.put_line ('l_msg_count: ' || l_msg_count);
                    dbms_output.put_line ('l_msg_data:' || substr(l_msg_data,1,240));
                    dbms_output.put_line ('l_document_id: ' || l_document_id);
                    dbms_output.put_line ('l_document_number: ' || l_document_number);
                    end;