Cycle Count Request Import (MTL_CCEOI_ACTION_PUB API) Fails When Using Serial Number Multiple Per Request (Doc ID 1468453.1)

Last updated on FEBRUARY 28, 2017

Applies to:

Oracle Inventory Management - Version 12.1.3 and later
Information in this document applies to any platform.
The MTL_CCEOI_ACTION_PUB API

SET SERVEROUTPUT ON ;
ACCEPT 1 NUMBER PROMPT 'Please enter the organization_id :'
ACCEPT 2 VARCHAR2 PROMPT 'Please enter the Cycle Count Name : '
ACCEPT 3 VARCHAR2 PROMPT 'Please enter the User name : '
DECLARE

org_id NUMBER := &1 ;
cc_name VARCHAR2(30) := '&2';
user_nm VARCHAR2(100) := '&3';
onhand_cc NUMBER;
emp_id NUMBER ;
lstatus VARCHAR2(1); -- return status of mtl_cceoi_action_pub.import_CountRequest
lmsg_count NUMBER; -- message count
lmsg_data VARCHAR2(240); -- message data
lrec mtl_cceoi_var_pvt.inv_cceoi_type; -- cycle counting record.
l_errorcode NUMBER; -- error code
l_interface_id number; --
i NUMBER ;
j NUMBER ;
v_msg VARCHAR2(4000) ;
BEGIN



SELECT EMPLOYEE_ID INTO emp_id
FROM apps.FND_USER
where UPPER(USER_NAME) = Upper(user_nm);


lrec.PROCESS_MODE := 1 ;
LREC.ACTION_CODE := MTL_CCEOI_VAR_PVT.G_PROCESS;
lrec.cycle_count_entry_id := &entry_id; -- null is of unscheduled entries
select COUNT_LIST_SEQUENCE into LREC.COUNT_LIST_SEQUENCE
from MTL_CYCLE_COUNT_ENTRIES
where CYCLE_COUNT_ENTRY_ID = LREC.CYCLE_COUNT_ENTRY_ID;
LREC.ORGANIZATION_ID := ORG_ID;-- Manufacturing Organization id
LREC.COUNT_UOM := '&ITEM_UOM' ;
lrec.Primary_Uom_Quantity := &quantity;
LREC.COUNT_DATE := sysdate;
LREC.EMPLOYEE_ID := EMP_ID; -- emp id
lrec.subinventory := '&subinventory_code';
LREC.COST_GROUP_ID := &COST_GROUPID ; -- the subinvetory for standard costing.
lrec.inventory_item_id := &INVENTORY_ITEM_ID ;-- inventory item id
lrec.revision := NULL;
LREC.LOT_NUMBER := null;
lrec.serial_number := Null; -- &serialnumber;
lrec.locator_id := NULL;
select cycle_count_header_id into lrec.cycle_count_header_id from MTL_CYCLE_COUNT_HEADERS
where MTL_CYCLE_COUNT_HEADERS.CYCLE_COUNT_HEADER_NAME = cc_name ;
mtl_cceoi_action_pub.import_CountRequest(
p_api_version => 0.9,
P_COMMIT => FND_API.G_TRUE,
P_INIT_MSG_LIST => FND_API.G_TRUE,
x_return_status => lstatus,
x_errorcode => l_errorcode,
x_msg_count => lmsg_count,
x_msg_data => lmsg_data,
p_interface_rec => lrec,
x_interface_id => l_interface_id);

dbms_output.put_line ( 'Status :' || lstatus);

IF (lstatus = fnd_api.g_ret_sts_success) THEN
dbms_output.put_line ( 'SUCCESS');
else
dbms_output.put_line ( 'FAILED, with Status :' || lstatus);
dbms_output.put_line ( 'code :' ||l_errorcode);
dbms_output.put_line ( 'message count :' || lmsg_count);
dbms_output.put_line ( 'message :' || lmsg_data);
dbms_output.put_line ( 'interface_id :' || l_interface_id);
IF ( lmsg_count > 1 ) THEN
FOR i IN 1 .. lmsg_count
LOOP
fnd_msg_pub.get ( p_msg_index => i , p_encoded =>FND_API.G_FALSE,
p_data => v_msg , p_msg_index_out => j ) ;
dbms_output.put_line ( 'message :' || v_msg);

END LOOP ;
end if;
END IF;

Symptoms

Cycle Count Request's API (MTL_CCEOI_ACTION_PUB API)  fails with the following, when using Multiple Per Request Serial Number:

Please understand that serial numbers have been passed, but the API is not populating the serial number in the interface table and throwing this error.

Changes

 

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms