RMA直接接收入库Interface导入

独自空忆成欢 提交于 2019-11-28 08:52:58

采购接收入库与RMA接收入库方式分为三种:

1:直接接收(不需要接入暂收区,直接入库到仓库)

2:标准接收(先接收到暂收区,产生接收单号,再根据接收单号或订单号做接收入库)

3:检验接收(先接收到暂收区,产生接收单号,再根据接收单号或订单号做检验动作,检验合格最后再接收入库)

以下是RMA直接接收入库的Code,先填写接口表数据,然后运行标准的Concurrent,即可入库

select po.rcv_headers_interface_s.NEXTVAL 
       into tl_rcv_headers_interface.header_interface_id
       from dual; 
       
     select po.rcv_interface_groups_s.NEXTVAL 
       into tl_rcv_headers_interface.group_id
       from dual;
       
     tl_rcv_headers_interface.processing_status_code := 'PENDING';
     tl_rcv_headers_interface.receipt_source_code := 'CUSTOMER';
     tl_rcv_headers_interface.transaction_type := 'NEW';
     tl_rcv_headers_interface.expected_receipt_date := sysdate;
     tl_rcv_headers_interface.validation_flag := 'Y';
     tl_rcv_headers_interface.attribute1 := P_HEADER_ID;
     tl_rcv_headers_interface.CREATION_DATE := V_CREATION_DATE;
     tl_rcv_headers_interface.CREATED_BY := V_CREATED_BY;
     tl_rcv_headers_interface.LAST_UPDATE_DATE := V_LAST_UPDATE_DATE;
     tl_rcv_headers_interface.LAST_UPDATED_BY := V_LAST_UPDATED_BY;
     tl_rcv_headers_interface.LAST_UPDATE_LOGIN := V_LAST_UPDATE_LOGIN;
     
     INSERT INTO rcv_headers_interface VALUES tl_rcv_headers_interface;
     P_REQUEST_ID := -4;
     --------------------INSERT INTO rcv_transactions_interface
     for v_line in c_line(P_HEADER_ID,tl_rcv_headers_interface.Ship_To_Organization_Id) loop
        P_REQUEST_ID := -5;
        select distinct jodt.wh
          into tl_rcv_transactions_interface.subinventory
          from jw_om_delivery_lots jodt
         where jodt.delivery_line_id = v_line.delivery_line_id;
        
        select sum(jodt.quantity) * decode(v_line.uom,'PCS',1,'KPS',1000,1)
          into tl_rcv_transactions_interface.quantity
          from jw_om_delivery_lots jodt
         where jodt.delivery_line_id = v_line.delivery_line_id;
         
        select rcv_transactions_interface_s.nextval
          into tl_rcv_transactions_interface.interface_transaction_id
          from dual;
        
        tl_rcv_transactions_interface.group_id  := tl_rcv_headers_interface.group_id;
        tl_rcv_transactions_interface.primary_quantity := tl_rcv_transactions_interface.quantity;
        tl_rcv_transactions_interface.transaction_type        := 'RECEIVE';--'RECEIVE';
        tl_rcv_transactions_interface.transaction_date        := SYSDATE;
        tl_rcv_transactions_interface.processing_status_code  := 'PENDING';
        tl_rcv_transactions_interface.processing_mode_code    := 'BATCH';
        tl_rcv_transactions_interface.transaction_status_code := 'PENDING';
        tl_rcv_transactions_interface.category_id             := v_line.category_id;
        tl_rcv_transactions_interface.unit_of_measure         := 'PCS';
        tl_rcv_transactions_interface.primary_unit_of_measure := 'PCS';
        tl_rcv_transactions_interface.interface_source_code   := 'RCV';
        tl_rcv_transactions_interface.validation_flag         := 'Y';
        tl_rcv_transactions_interface.item_id                 := v_line.item_id;
        tl_rcv_transactions_interface.item_description        := v_line.DESC1;
        tl_rcv_transactions_interface.uom_code                := 'PCS';
        tl_rcv_transactions_interface.auto_transact_code      := 'DELIVER';
        tl_rcv_transactions_interface.receipt_source_code     := 'CUSTOMER';
        tl_rcv_transactions_interface.to_organization_id      := tl_rcv_headers_interface.Ship_To_Organization_Id;
        tl_rcv_transactions_interface.routing_header_id       := 3;
        tl_rcv_transactions_interface.routing_step_id         := 1;
        tl_rcv_transactions_interface.source_document_code    := 'RMA';
        tl_rcv_transactions_interface.destination_type_code   := 'INVENTORY';
        select DECODE(SUBSTR(tl_rcv_transactions_interface.subinventory,
                             2,
                             1),
                      '2',
                      143,
                      '1',
                      142,
                      143)
          into tl_rcv_transactions_interface.location_id
          from dual;
        tl_rcv_transactions_interface.deliver_to_location_id  := tl_rcv_transactions_interface.location_id;
        tl_rcv_transactions_interface.subinventory            := tl_rcv_transactions_interface.subinventory;
        tl_rcv_transactions_interface.expected_receipt_date   := SYSDATE;
        tl_rcv_transactions_interface.destination_context     := 'INVENTORY';
        tl_rcv_transactions_interface.oe_order_header_id      := v_line.header_id;
        tl_rcv_transactions_interface.oe_order_line_id        := v_line.order_line_id;
        tl_rcv_transactions_interface.customer_id             := tl_rcv_headers_interface.customer_id;
        tl_rcv_transactions_interface.header_interface_id   := tl_rcv_headers_interface.header_interface_id;
        tl_rcv_transactions_interface.last_update_date  := V_LAST_UPDATE_DATE;
        tl_rcv_transactions_interface.last_updated_by   := V_LAST_UPDATED_BY;--fnd_global.user_id;
        tl_rcv_transactions_interface.creation_date     := V_CREATION_DATE;
        tl_rcv_transactions_interface.created_by        := V_CREATED_BY;--fnd_global.user_id;
        tl_rcv_transactions_interface.last_update_login := V_LAST_UPDATE_LOGIN;--fnd_global.login_id;
        
        tl_rcv_transactions_interface.interface_source_code    := 'notice_ship';
        tl_rcv_transactions_interface.interface_source_line_id := v_line.delivery_line_id;
        
        insert into rcv_transactions_interface values tl_rcv_transactions_interface;
        P_REQUEST_ID := -6;
        if v_line.lot_control_code = '2' then
          for v_lot in c_lot(V_LINE.delivery_line_id) loop
             tl_MTL_TXN_LOTS_INTERFACE.TRANSACTION_INTERFACE_ID := tl_rcv_transactions_interface.interface_transaction_id;
             tl_MTL_TXN_LOTS_INTERFACE.ORIGINATION_TYPE := 3;
             tl_MTL_TXN_LOTS_INTERFACE.LAST_UPDATE_DATE := V_LAST_UPDATE_DATE;
             tl_MTL_TXN_LOTS_INTERFACE.LAST_UPDATED_BY := V_LAST_UPDATED_BY;
             tl_MTL_TXN_LOTS_INTERFACE.CREATION_DATE := V_CREATION_DATE;
             tl_MTL_TXN_LOTS_INTERFACE.CREATED_BY := V_CREATED_BY;
             tl_MTL_TXN_LOTS_INTERFACE.LAST_UPDATE_LOGIN := V_LAST_UPDATE_LOGIN;
             tl_MTL_TXN_LOTS_INTERFACE.LOT_NUMBER := v_lot.lot;
             select v_lot.quantity * decode(v_line.uom,'PCS',1,'KPS',1000,1)
               INTO tl_MTL_TXN_LOTS_INTERFACE.TRANSACTION_QUANTITY
               from dual;
             tl_MTL_TXN_LOTS_INTERFACE.PRIMARY_QUANTITY := tl_MTL_TXN_LOTS_INTERFACE.TRANSACTION_QUANTITY;
             tl_MTL_TXN_LOTS_INTERFACE.PRODUCT_CODE := 'RCV';
             tl_MTL_TXN_LOTS_INTERFACE.PRODUCT_TRANSACTION_ID := tl_rcv_transactions_interface.interface_transaction_id;
             P_REQUEST_ID := -7;
             INSERT INTO MTL_TRANSACTION_LOTS_INTERFACE VALUES tl_MTL_TXN_LOTS_INTERFACE;
          end loop;
        end if;
     end loop;
     P_REQUEST_ID := -8;
     COMMIT;
     ln_request_id := fnd_request.submit_request(application => 'PO'
                                                       ,program     => 'RVCTP'  
                                                       ,sub_request => FALSE
                                                       ,argument1   => 'BATCH'--v_split.OPERATING_UNIT
                                                       ,argument2   => tl_rcv_headers_interface.group_id--v_split.order_source_id
                                                       ,argument3   => NULL--v_split.orig_sys_document_ref
                                                       ,argument4   => ''
                                                       ,argument5   => ''
                                                       ,argument6   => ''
                                                       ,argument7   => ''
                                                       ,argument8   => ''
                                                       ,argument9   => ''
                                                       ,argument10  => ''
                                                       ,argument11  => ''
                                                       ,argument12  => ''
                                                       ,argument13  => ''
                                                       ,argument14  => ''
                                                       ,argument15  => '');
     commit;
     P_REQUEST_ID := ln_request_id;


 

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!