Tuesday 4 June 2013

Pseudo Code For PO Interface

CREATE OR REPLACE PROCEDURE xxaj_po_interface
l_interface_header_id number;
l_interface_line_id   NUMBER;
BEGIN
SELECT po_headers_interface_s.NEXTVAL
INTO l_interface_header_id
FROM dual;
dbms_output.put_line('Header SEQ:'||l_interface_header_id);
INSERT INTO po_headers_interface (batch_id
,interface_header_id
, interface_source_code
, action
, org_id
, document_type_code
, agent_id
, vendor_id
, vendor_site_id
, approval_status
,comments
, last_update_date
, last_updated_by
, creation_date
, created_by
)
VALUES   ( 1001                      --Batch ID
, l_interface_header_id       --Header Sequence
, 'CONVERSION'                         --Source Code
, 'ORIGINAL'                           --Action
, 204                        --Org ID
, 'STANDARD'                           --PO/Document Type
, 25                      --Agent ID
, 6                     --Vendor ID
, 7                --Vendor Site ID
, 'APPROVED'                           --PO status
, 'This is my Interface PO'                       --Comments
, SYSDATE                            
, 1318
, SYSDATE
, 1318
);
dbms_output.put_line('Header Details Inserted...');
BEGIN
SELECT po_lines_interface_s.NEXTVAL
INTO l_interface_line_id
FROM dual;
EXCEPTION WHEN OTHERS THEN
dbms_output.put_line( 'Error In Getting lines Seuence Number po_lines_interface_s.NEXTVAL..');
END;
INSERT INTO po_lines_interface (interface_line_id
, interface_header_id
,action
, line_num
, shipment_num
, line_type
, item
, uom_code
, quantity
, unit_price
,ship_to_organization_code
, ship_to_location
, need_by_date
, promised_date
, last_update_date
, last_updated_by
, last_update_login
, creation_date
, created_by )
VALUES   ( l_interface_line_id     --Interface Line ID
, l_interface_header_id               --Interface Header Id
,'ORIGINAL'                           --Action
, 1                          --Line Num
, 1                                   --Shipment Num
, 'Goods'                             --Line Type
, 'AS54888'                    --Item Name
, 'Ea'                           --Uom Code
, 10                     --Quantity
, 3                        --Price
, 'V1'                    --Ship to Organization Code
, 'V1- New York City'        -- 'One Time Address'
, sysdate+1                --Need by Date
, sysdate+1                --Promise Date
, SYSDATE                             --Last Update Date
, 1318
, 1318
, SYSDATE
, 1318);
---======================================
---Inserting PO Distributions
INSERT INTO po_distributions_interface (
    interface_header_id
  , interface_line_id
  , interface_distribution_id
  , quantity_ordered
  , charge_account_id
  , last_update_date
  , last_updated_by
  , last_update_login
  , creation_date
  , created_by
)
VALUES ( l_interface_header_id       --Interface Header Id
, l_interface_line_id              --Interface Line ID
, po_distributions_interface_s.NEXTVAL       --Interface Distribution id
, 10                            --Quantity
, 13401
, SYSDATE
, 1318
, 1318
, SYSDATE
, 1318);
END xxaj_po_interface;


Ur's
AmarAlam

0 comments:

Post a Comment