API to Create Item Specific UOM Conversion (INV_CONVERT.CREATE_UOM_CONVERSION)
TEST INSTANCE: This API is available from the release R12.1.3 Oracle Applications
PACKAGE: INV_CONVERT
PROCEDURE : CREATE_UOM_CONVERSION
NOTES: Creates the Item Specific conversion between two uom's using uom_rate
TO_UOM_CODE = UOM_RATE * FROM_UOM_CODE
Return_status values
S : Successful conversion creation
W : Conversion exists prior
E : Error in creation conversion
U : Unexpected error occurred
SCRIPT:
SET SERVEROUTPUT ON;
DECLARE
p_from_uom_code VARCHAR2(200);
p_to_uom_code VARCHAR2(200);
p_item_id NUMBER;
p_uom_rate NUMBER;
x_return_status VARCHAR2(200);
l_msg_data VARCHAR2(2000);
v_context VARCHAR2(100);
FUNCTION set_context( i_user_name IN VARCHAR2
,i_resp_name IN VARCHAR2
,i_org_id IN NUMBER)
RETURN VARCHAR2
IS
BEGIN
NULL;
-- Inorder to reduce the content of the post I moved the implementation part of this function to another post and it is available here
END set_context;
BEGIN
--1. Set applications context if not already set.
BEGIN
v_context := set_context('OPERATIONS','Inventory, Vision Operations (USA)',204);
IF v_context = 'F'
THEN
DBMS_OUTPUT.PUT_LINE('Error while setting the context'||SQLERRM(SQLCODE));
END IF;
END;
p_from_uom_code := 'USD'; -- Should be a Base unit for Intra-class conversion
p_to_uom_code := 'EUR';
p_item_id := '59412';
p_uom_rate := '1.5';
INV_CONVERT.CREATE_UOM_CONVERSION
(
P_FROM_UOM_CODE => p_from_uom_code,
P_TO_UOM_CODE => p_to_uom_code,
P_ITEM_ID => p_item_id,
P_UOM_RATE => p_uom_rate,
X_RETURN_STATUS => x_return_status
);
IF x_return_status = 'S' Then
dbms_output.put_line(' Conversion Got Created Sucessfully ');
ELSIF x_return_status = 'W' Then
dbms_output.put_line(' Conversion Already Exists ');
ELSIF x_return_status = 'U' Then
dbms_output.put_line(' Unexpected Error Occured ');
ELSIF x_return_status = 'E' Then
LOOP
l_msg_data := FND_MSG_PUB.Get(FND_MSG_PUB.G_NEXT,FND_API.G_FALSE);
IF l_msg_data is NULL Then
EXIT;
END IF;
DBMS_OUTPUT.PUT_LINE('Message' || l_msg_data);
END LOOP;
END IF;
END;