wms_container_pub.Create_LPN

To create new LPN

Sample script to pack using wms_container_pub.Create_LPN API
ย 

initial-status-subinventory
wip-completion
create or replace procedure IDC_pack_to_LPN( p_sub_inv varchar2,p_item_id number,p_qty number,loc_id number) is
 l_return_status varchar2(5);
 l_msg_count number;
 l_msg_data varchar2(1000);
 l_lpn_id number;
 l_lpn VARCHAR2(20);
 l_curr_seq number;
 v_sub_inv varchar2(20):=p_sub_inv;--'STA';
 v_item_id number :=p_item_id;--149;
 v_qty number :=p_qty;--1;
 n_request_id  Number;
 begin
 SELECT wms_license_plate_numbers_s1.NEXTVAL INTO l_curr_seq FROM DUAL;
 l_lpn := 'LPN' || TO_CHAR(l_curr_seq) || 'A';
 wms_container_pub.Create_LPN (
   p_api_version         => 1.0
 , p_init_msg_list       => fnd_api.g_false
 , p_commit              => fnd_api.g_false
 , p_validation_level    => fnd_api.g_valid_level_full
 , x_return_status       => l_return_status
 , x_msg_count           => l_msg_count  
 , x_msg_data            =>    l_msg_data
 , p_lpn                 => l_lpn
 , p_organization_id     => 1884
 , p_container_item_id   => NULL
 , p_lot_number          => NULL
 , p_revision            => NULL
 , p_serial_number       => NULL
 , p_subinventory        => NULL
 , p_locator_id          => NULL
 , p_source              => 1
 , p_cost_group_id      =>  NULL
 , p_parent_lpn_id      =>  NULL
 , p_source_type_id     => 5
 , p_source_header_id   => NULL
 , p_source_name       => NULL
 , p_source_line_id    =>  NULL
 , p_source_line_detail_id => NULL
 , x_lpn_id   =>  l_lpn_id );
 dbms_output.put_line ('Return status' || l_return_status);
 dbms_output.put_line ('msg data' || l_msg_data);
 dbms_output.put_line ('lpn_id' || l_lpn_id);
 --- insert into material interface--
 Insert into inv.mtl_transactions_interface(
 transaction_uom,
 transaction_date,
 source_code,
 source_line_id,
 source_header_id,
 process_flag ,
 transaction_mode ,
 lock_flag ,
 locator_id ,
 last_update_date ,
 last_updated_by ,
 creation_date ,
 created_by ,
 inventory_item_id ,
 subinventory_code,
 organization_id,
 transaction_quantity ,
 primary_quantity ,
 transaction_type_id ,
 transfer_lpn_id
 )
 VALUES (
 'Ea', --transaction uom
 SYSDATE, --transaction date
 'Container Pack', --source code
 99,--3844249, --source line id
 99,--2395464, --source header id
 1, --process flag
 3 , --transaction mode
 2 , --lock flag
 loc_id , --locator id
 SYSDATE, --last update date
 0, --last updated by
 SYSDATE , --creation date
 0, --created by
 V_item_id, --inventory item id
 v_sub_inv, --From subinventory code
 1884, --organization id
 v_qty, --transaction quantity
 v_qty, --Primary quantity
 87, --transaction type id
 l_lpn_id); --transfer lpn id
 fnd_global.apps_initialize(1068 ,56229, 724);
  mo_global.init('INV');
 n_request_id := FND_REQUEST.SUBMIT_REQUEST
                 (application   => 'INV', -- Application Name
                  program       => 'INCTCM', -- Program
                  description   => 'Process transaction interface' ,
                  start_time    =>  NULL,       -- START_TIME
                  sub_request   =>  FALSE      -- SUB_REQUEST
                  );
 end;
 /
 select * from user_errors where name ='IDC_PACK_TO_LPN'
LPN-created

wms_container_pub.PackUnpack_Container API

DECLARE
 l_return_status varchar2(5);
 l_msg_count number;
 l_msg_data varchar2(1000);
 x_organization_id NUMBER := 1875;
 x_inventory_item_id NUMBER := 4451;
 x_revision VARCHAR2(3) := NULL;
 x_lot_number VARCHAR2(30) := NULL;
 x_from_serial_number VARCHAR2(30) := NULL;
 x_to_serial_number VARCHAR2(30) := NULL;
 x_subinventory VARCHAR2(10) := 'SVCCASE';
 x_locator_id NUMBER := 1171;
 x_quantity NUMBER := 0;
 x_uom VARCHAR2(10) := NULL;
 x_source NUMBER := NULL;
 x_container_item_id NUMBER := NULL;
 x_cont_revision VARCHAR(10) := NULL;
 x_cont_lot_number VARCHAR(10) := NULL;
 x_cont_serial_number_from VARCHAR(10) := NULL;
 x_cont_serial_number_to VARCHAR(10) := NULL;
 x_lpn_sealed_flag NUMBER := NULL;
 x_print_label NUMBER := NULL;
 x_print_content_report NUMBER := NULL;
 x_return_status VARCHAR2(100);
 x_msg_count NUMBER;
 x_msg_data VARCHAR2(2000);
 V_SUCCESS VARCHAR2(1) := 'T';
 begin
 wms_container_pub.PackUnpack_Container (
     p_api_version         => 1.0
   , p_init_msg_list       => fnd_api.g_false
   , p_commit              => fnd_api.g_false
   , p_validation_level    => fnd_api.g_valid_level_full
   , x_return_status      =>  l_return_status
   , x_msg_count          =>  l_msg_count
   , x_msg_data           =>   l_msg_data
   , p_lpn_id             => 311
   , p_content_lpn_id     => null
   , p_content_item_id    => 149
   , p_content_item_desc  => NULL
   , p_revision           => NULL
   , p_lot_number         => NULL
   , p_from_serial_number => NULL
   , p_to_serial_number   => NULL
   , p_quantity           => null
   , p_uom                => 'Ea'
   , p_sec_quantity           => NULL --INVCONV kkillams
   , p_sec_uom                => NULL --INVCONV kkillams
   , p_organization_id        => 1884
   , p_subinventory           => 'STA'
   , p_locator_id             =>  1592
   , p_enforce_wv_constraints => 2
   , p_operation              => 1
   , p_cost_group_id           =>1326
   , p_source_type_id          => NULL
   , p_source_header_id       =>  NULL
   , p_source_name             => NULL
   , p_source_line_id          =>  NULL
   , p_source_line_detail_id   => NULL
   , p_homogeneous_container    => 2
   , p_match_locations          => 2
   , p_match_lpn_context        => 2
   , p_match_lot                => 2
   , p_match_cost_groups        => 2
   , p_match_mtl_status         => 2
   , p_unpack_all             => 2
   , p_trx_action_id           => NULL
   , p_concurrent_pack         => 0
   , p_ignore_item_controls    => 2);
 DBMS_OUTPUT.PUT_LINE('After Calling Prepack LPN API');
 DBMS_OUTPUT.PUT_LINE ('X_RETURN_STATUS --- '||l_return_status);
 DBMS_OUTPUT.PUT_LINE ('X_MSG_COUNT --- '||TO_CHAR(l_msg_count));
 DBMS_OUTPUT.PUT_LINE ('X_MSG_DATA --- '||l_msg_data);
 if l_return_status != 'S' then
 dbms_output.put_line('failed. printing error msgโ€ฆ');
 dbms_output.put_line(APPS.FND_MSG_PUB.Get
 (p_msg_index => APPS.FND_MSG_PUB.G_LAST,
 p_encoded => APPS.FND_API.G_FALSE));
 V_SUCCESS := 'F';
 -- rollback;
 return;
 else
 DBMS_OUTPUT.PUT_LINE('Completed Sucessfully');
 COMMIT;
 END IF;
 end;

Alert code on mtl_material_transactions

alert-on-mtl-material-transactions-table

wpsadmin
We will be happy to hear your thoughts

Leave a reply

Ads Blocker Image Powered by Code Help Pro

Ads Blocker Detected!!!

We have detected that you are using extensions to block ads. Please support us by disabling these ads blocker.

Powered By
Best Wordpress Adblock Detecting Plugin | CHP Adblock
Cloud Technologies Blog
Logo
Compare items
  • Total (0)
Compare
0
Shopping cart