首页  ·  知识 ·  生产制造
接收退货接口开发(ReceivingReturntoSupplier)
网友  http://bbs.itjaj.com/viewthread.php?tid=1069    编辑:德仔   图片来源:网络
create or replace package body xxuts_o2c_receipt_return_pkg As /* ----------------------------------------------
create or replace package body xxuts_o2c_receipt_return_pkg As
/*
---------------------------------------------------------------------------------------------
-- File Name    : XXUTS_O2C_PO_IMP_PKG.pck
-- Program Name :
-- Purpose      :
-- parameters   : None
-- Dependencies :
--
-- Modification History
---------------------------------------------------------------------------------------------
-- |  WHEN      | Ver   | WHO        |    WHAT
---------------------------------------------------------------------------------------------
--
--  19-Mar-2008 |v1.0   | SIMON      | 
---------------------------------------------------------------------------------------------
*/
  procedure main(errbuf               OUT VARCHAR2,
                 retcode              OUT number,
                 p_organization_id    in  number,
                 p_group_id        in number)
  Is
    Cursor Cur_receipt is
        select rt.transaction_id,
               rt.group_id,
               rt.po_header_id,
               rt.po_line_id,
               rt.po_line_location_id,
               rt.po_distribution_id,
               rt.organization_id,
               rt.vendor_id,
               rt.vendor_site_id,
               rt.unit_of_measure,
               rt.destination_type_code,
               rt.subinventory,
               rt.shipment_header_id,
               rt.shipment_line_id,
               rt.primary_quantity
               --,rt.*
          from rcv_transactions rt
         where rt.transaction_type = 'DELIVER'
           and rt.po_header_id in (20630, 20631, 20632)
           --and rt.group_id = p_group_id
           ;  
    v_user_id number;
    v_group_id number;   
    l_request_id number;
    l_request_id2 number;
  Begin
     v_user_id := fnd_global.USER_ID;
     Select RCV_INTERFACE_GROUPS_S.nextval into v_group_id from dual;
     For c_receipt in Cur_receipt Loop
          INSERT INTO RCV_TRANSACTIONS_INTERFACE
            (INTERFACE_TRANSACTION_ID,
             GROUP_ID,
             LAST_UPDATE_DATE,
             LAST_UPDATED_BY,
             CREATION_DATE,
             CREATED_BY,
             LAST_UPDATE_LOGIN,
             TRANSACTION_TYPE,
             TRANSACTION_DATE,
             PROCESSING_STATUS_CODE,
             PROCESSING_MODE_CODE,
             TRANSACTION_STATUS_CODE,
             QUANTITY,
             PRIMARY_QUANTITY,
             UNIT_OF_MEASURE,
             ITEM_ID,
             ITEM_DESCRIPTION,
             EMPLOYEE_ID,
             SHIPMENT_HEADER_ID,
             SHIPMENT_LINE_ID,
             RECEIPT_SOURCE_CODE,
             VENDOR_ID,
             VENDOR_SITE_ID,
             FROM_ORGANIZATION_ID,
             FROM_SUBINVENTORY,
             FROM_LOCATOR_ID,
             SOURCE_DOCUMENT_CODE,
             PARENT_TRANSACTION_ID,
             PO_HEADER_ID,
             PO_LINE_ID,
             PO_LINE_LOCATION_ID,
             PO_DISTRIBUTION_ID,
             DESTINATION_TYPE_CODE,
             DESTINATION_CONTEXT,
             DELIVER_TO_PERSON_ID,
             LOCATION_ID,
             DELIVER_TO_LOCATION_ID,
             VALIDATION_FLAG)
          VALUES
            (rcv_transactions_interface_s.nextval, --INTERFACE_TRANSACTION_ID
             v_group_id,--rcv_interface_groups_s.nextval, --GROUP_ID
             SYSDATE, --LAST_UPDATE_DATE
             5610, --LAST_UPDATE_BY
             SYSDATE, --CREATION_DATE
             5610, --CREATED_BY
             5610, --LAST_UPDATE_LOGIN
             'RETURN TO VENDOR', --TRANSACTION_TYPE
             SYSDATE, --TRANSACTION_DATE
             'PENDING', --PROCESSING_STATUS_CODE
             'IMMEDIATE', --PROCESSING_MODE_CODE
             'PENDING', --TRANSACTION_STATUS_CODE
             c_receipt.primary_quantity, --QUANTITY
             c_receipt.primary_quantity, --PRIMARY_QUANTITY
             c_receipt.unit_of_measure, --UNIT_OF_MEASURE
             Null, --ITEM_ID
             Null,--'手写笔',
             0, --EMPLOYEE_ID
             c_receipt.shipment_header_id, --SHIPMENT_HEADER_ID
             c_receipt.shipment_line_id, --SHIPMENT_LINE_ID
             'VENDOR', --RECEIPT_SOURCE_CODE
             c_receipt.vendor_id, --VENDOR_ID
             c_receipt.vendor_site_id, --VENDOR_SITE_ID
             c_receipt.organization_id, --FROM_ORGANIZATION_ID
             Null, --'NA01',                  --FROM_SUBINVENTORY
             null, --FROM_LOCATOR_ID
             'PO', --SOURCE_DOCUMENT_CODE
             c_receipt.transaction_id, --PARENT_TRANSACTION_ID
             c_receipt.po_header_id, --PO_HEADER_ID
             c_receipt.po_line_id, --PO_LINE_ID
             c_receipt.po_line_location_id, --PO_LINE_LOCATION_ID
             c_receipt.po_distribution_id, --PO_DISTRIBUTION_ID
             c_receipt.destination_type_code, --'RECEIVING',                      --DESTINATION_TYPE_CODE
             c_receipt.destination_type_code, --DESTINATION_CONTEXT
             null, --DELIVER_TO_PERSON_ID
             null, --LOCATION_ID
             null, --DELIVER_TO_LOCATION_ID
             'Y' --VALIDATION_FLAG
             );
    
     End Loop;
    l_request_id  := fnd_request.submit_request('PO', --APPLICATIONI SHORT NAME;
                                                'RVCTP', --PROGRAME SHORT NAME;
                                                '',
                                                '',
                                                FALSE,
                                                'IMMEDIATE',
                                                v_group_id
                                                --104--104,
                                                --CHR(0)
                                                );
    l_request_id2 := fnd_request.submit_request('PO', --APPLICATIONI SHORT NAME;
                                                'RCVDLPDT', --PROGRAME SHORT NAME;
                                                '',
                                                '',
                                                FALSE,
                                                'P_group_id=' || v_group_id,
                                                'P_receipt_source_type=Supplier',
                                                'P_qty_precision=2',
                                                'P_org_id=' || p_organization_id);
    FND_FILE.put_line(2,
                      'Receiving Transaction Processor: ' || l_request_id ||
                      ' Receipt Traveller Concurrent program: ' ||
                      l_request_id2);
    FND_FILE.put_line(2, 'Group Id: ' || v_group_id);
    commit;
   
  End main;
end xxuts_o2c_receipt_return_pkg;
本文作者:网友 来源:网络http://bbs.itjaj.com/viewthread.php?tid=1069
CIO之家 www.ciozj.com 微信公众号:imciow
   
免责声明:本站转载此文章旨在分享信息,不代表对其内容的完全认同。文章来源已尽可能注明,若涉及版权问题,请及时与我们联系,我们将积极配合处理。同时,我们无法对文章内容的真实性、准确性及完整性进行完全保证,对于因文章内容而产生的任何后果,本账号不承担法律责任。转载仅出于传播目的,读者应自行对内容进行核实与判断。请谨慎参考文章信息,一切责任由读者自行承担。
延伸阅读