创建货位 简单示例
创建货位, 官方示例
create or replace PROCEDURE XX_CREATE_LOCATOR AS -- Common Declarations l_api_version NUMBER := 1.0; x_return_status VARCHAR2(2); x_msg_count NUMBER := 0; x_msg_data VARCHAR2(255); -- WHO columns l_user_id NUMBER := -1; l_resp_id NUMBER := -1; l_application_id NUMBER := -1; l_row_cnt NUMBER := 1; l_user_name VARCHAR2(30) := 'MFG'; l_resp_name VARCHAR2(50) := 'Manufacturing and Distribution Manager'; -- API specific declarations x_inventory_location_id NUMBER := NULL; x_locator_exists VARCHAR2(1) := NULL; BEGIN -- Get the user_id SELECT user_id INTO l_user_id FROM fnd_user WHERE user_name = l_user_name; -- Get the application_id and responsibility_id SELECT application_id, responsibility_id INTO l_application_id, l_resp_id FROM fnd_responsibility_vl WHERE responsibility_name = l_resp_name; FND_GLOBAL.APPS_INITIALIZE(l_user_id, l_resp_id, l_application_id); dbms_output.put_line('Initialized applications context: '|| l_user_id || ' '|| l_resp_id ||' '|| l_application_id ); -- call API to update material status DBMS_OUTPUT.PUT_LINE('======================================================='); DBMS_OUTPUT.PUT_LINE('Calling INV_LOC_WMS_PUB.CREATE_LOCATOR'); INV_LOC_WMS_PUB.CREATE_LOCATOR ( x_return_status => x_return_status , x_msg_count => x_msg_count , x_msg_data => x_msg_data , x_inventory_location_id => x_inventory_location_id , x_locator_exists => x_locator_exists , p_organization_id => 602 , p_organization_code => 'P1' , p_concatenated_segments => 'A5.A5.A5..' , p_description => 'Locator from API' , p_inventory_location_type=> 3 , p_picking_order => NULL , p_location_maximum_units => NULL , p_SUBINVENTORY_CODE => 'SU_LOC_SUB' , p_LOCATION_WEIGHT_UOM_CODE => NULL , p_mAX_WEIGHT => NULL , p_vOLUME_UOM_CODE => NULL , p_mAX_CUBIC_AREA => NULL , p_x_COORDINATE => NULL , p_Y_COORDINATE => NULL , p_Z_COORDINATE => NULL , p_PHYSICAL_LOCATION_ID => NULL -- required when creating logical locators , p_PICK_UOM_CODE => NULL , p_DIMENSION_UOM_CODE => NULL , p_LENGTH => NULL , p_WIDTH => NULL , p_HEIGHT => NULL , p_STATUS_ID => 1 , p_dropping_order => NULL , p_attribute_category => NULL , p_attribute1 => NULL , p_attribute2 => NULL , p_attribute3 => NULL , p_attribute4 => NULL , p_attribute5 => NULL , p_attribute6 => NULL , p_attribute7 => NULL , p_attribute8 => NULL , p_attribute9 => NULL , p_attribute10 => NULL , p_attribute11 => NULL , p_attribute12 => NULL , p_attribute13 => NULL , p_attribute14 => NULL , p_attribute15 => NULL , p_alias => NULL ); DBMS_OUTPUT.PUT_LINE('======================================================='); DBMS_OUTPUT.PUT_LINE('Return Status: '||x_return_status); DBMS_OUTPUT.PUT_LINE('x_locator_exists: '||x_locator_exists||' x_inventory_location_id:'||x_inventory_location_id); IF (x_return_status <> FND_API.G_RET_STS_SUCCESS) THEN DBMS_OUTPUT.PUT_LINE('Msg Count:'||x_msg_count||' Error Message :'||x_msg_data); IF ( x_msg_count > 1 ) THEN FOR i IN 1 .. x_msg_count LOOP x_msg_data := fnd_msg_pub.get ( p_msg_index => i , p_encoded =>FND_API.G_FALSE ) ; dbms_output.put_line ( 'message :' || x_msg_data); END LOOP; END IF; END IF; DBMS_OUTPUT.PUT_LINE('======================================================='); END XX_CREATE_LOCATOR;