Salam Alaikum,
Following an example API to create, release and transfer in the Oracle Process Manufacturing (OPM). It calls three different API's. Naturally, the first one is to create and the second to release and the third to transfer, based on the Transfer_action.
Hope you found it useful, feel free to leave a comment if have any note on the subject.
Following an example API to create, release and transfer in the Oracle Process Manufacturing (OPM). It calls three different API's. Naturally, the first one is to create and the second to release and the third to transfer, based on the Transfer_action.
DECLARE
x_status VARCHAR2 (1);
x_count NUMBER;
x_msg_data VARCHAR2 (2000);
l_transfer_rec GMIGXFR.TYPE_XFER_REC;
x_out_rec IC_XFER_MST%ROWTYPE;
l_dummy NUMBER;
x_dummy_cnt NUMBER;
BEGIN
l_transfer_rec.transfer_action := 1;
l_transfer_rec.transfer_no := NULL;
l_transfer_rec.transfer_batch := 'TEST XFER';
l_transfer_rec.orgn_code := 'PR1';
l_transfer_rec.item_no := 'JGC_1';
l_transfer_rec.lot_no := 'JGC_165';
l_transfer_rec.sublot_no := NULL;
l_transfer_rec.source_warehouse := 'PR1';
l_transfer_rec.source_location := '1';
l_transfer_rec.target_warehouse := 'PR2';
l_transfer_rec.target_location := '1';
-- date for testing period
l_transfer_rec.scheduled_release_date := TO_DATE (SYSDATE, 'dd.mm.yyyy');
l_transfer_rec.scheduled_receive_date := TO_DATE (SYSDATE, 'dd.mm.yyyy');
l_transfer_rec.actual_release_date := TO_DATE (SYSDATE, 'dd.mm.yyyy');
l_transfer_rec.actual_receive_date := TO_DATE (SYSDATE, 'dd.mm.yyyy');
l_transfer_rec.cancel_date := NULL;
l_transfer_rec.release_quantity1 := 1.0;
l_transfer_rec.release_quantity2 := NULL;
l_transfer_rec.reason_code := 'ADJ';
l_transfer_rec.comments := 'test API XFER';
l_transfer_rec.user_name := 'OPMUK';
-- Creating
GMIPXFR.Inventory_Transfer (
p_api_version => 1.0,
p_init_msg_list => FND_API.G_TRUE,
p_commit => FND_API.G_TRUE,
p_validation_level => FND_API.G_valid_level_full,
p_xfer_rec => l_transfer_rec,
x_ic_xfer_mst_row => x_out_rec,
x_return_status => x_status,
x_msg_count => x_count,
x_msg_data => x_msg_data);
IF x_status != 'S'
THEN
DBMS_OUTPUT.put_line ('Error creating');
IF x_count > 1
THEN
FOR l_dummy IN 1 .. x_count
LOOP
fnd_msg_pub.get (p_msg_index => l_dummy,
p_data => x_msg_data,
p_encoded => fnd_api.g_false,
p_msg_index_out => x_dummy_cnt);
DBMS_OUTPUT.put_line (SUBSTR (x_msg_data, 1, 255));
END LOOP;
ELSE
DBMS_OUTPUT.put_line (SUBSTR (x_msg_data, 1, 255));
END IF;
ELSE -- if success
-- RELEASE
l_transfer_rec.transfer_action := 2;
l_transfer_rec.transfer_no := x_out_rec.transfer_no;
DBMS_OUTPUT.put_line ('XFER no:' || l_transfer_rec.transfer_no);
GMIPXFR.Inventory_Transfer (
p_api_version => 1.0,
p_init_msg_list => FND_API.G_TRUE,
p_commit => FND_API.G_TRUE,
p_validation_level => FND_API.G_valid_level_full,
p_xfer_rec => l_transfer_rec,
x_ic_xfer_mst_row => x_out_rec,
x_return_status => x_status,
x_msg_count => x_count,
x_msg_data => x_msg_data);
IF x_status != 'S'
THEN
DBMS_OUTPUT.put_line ('Error releasing');
IF x_count > 1
THEN
FOR l_dummy IN 1 .. x_count
LOOP
fnd_msg_pub.get (p_msg_index => l_dummy,
p_data => x_msg_data,
p_encoded => fnd_api.g_false,
p_msg_index_out => x_dummy_cnt);
DBMS_OUTPUT.put_line (SUBSTR (x_msg_data, 1, 255));
END LOOP;
ELSE
DBMS_OUTPUT.put_line (SUBSTR (x_msg_data, 1, 255));
END IF;
ELSE
-- receive
l_transfer_rec.transfer_action := 3;
GMIPXFR.Inventory_Transfer (
p_api_version => 1.0,
p_init_msg_list => FND_API.G_TRUE,
p_commit => FND_API.G_TRUE,
p_validation_level => FND_API.G_valid_level_full,
p_xfer_rec => l_transfer_rec,
x_ic_xfer_mst_row => x_out_rec,
x_return_status => x_status,
x_msg_count => x_count,
x_msg_data => x_msg_data);
IF x_status != 'S'
THEN
DBMS_OUTPUT.put_line ('Error receiving');
IF x_count > 1
THEN
FOR l_dummy IN 1 .. x_count
LOOP
fnd_msg_pub.get (p_msg_index => l_dummy,
p_data => x_msg_data,
p_encoded => fnd_api.g_false,
p_msg_index_out => x_dummy_cnt);
DBMS_OUTPUT.put_line (SUBSTR (x_msg_data, 1, 255));
END LOOP;
ELSE
DBMS_OUTPUT.put_line (SUBSTR (x_msg_data, 1, 255));
END IF;
END IF;
END IF;
END IF;
END;
/
Hope you found it useful, feel free to leave a comment if have any note on the subject.
No comments:
Post a Comment