DECLARE
vLineLocationId po_line_locations_all.line_location_id%TYPE := 1000000;
vShipment po_line_locations_all%ROWTYPE;
vNewShipmentNum po_line_locations_all.shipment_num%TYPE;
vChange po_changes_rec_type;
vShipmentChanges Po_Shipments_Rec_Type;
vPoLineLocationId Po_Tbl_Number := Po_Tbl_Number();
vQuantity Po_Tbl_Number := Po_Tbl_Number();
vNeedByDate Po_Tbl_Date := Po_Tbl_Date();
vPriceOverride Po_Tbl_Number := Po_Tbl_Number();
vPromisedDate Po_Tbl_Date := Po_Tbl_Date();
vReturnStatus VARCHAR2(1);
vMsgData VARCHAR2(2000);
vErrors Po_Api_Errors_Rec_Type;
BEGIN
SELECT *
INTO vShipment
FROM po_line_locations_all
WHERE line_location_id = vLineLocationId;
vNewShipmentNum := po_line_locations_pkg_s3.get_max_shipment_num(X_po_line_id => vShipment.Po_Line_Id,
X_po_release_id => vShipment.Po_Release_Id,
X_shipment_type => vShipment.Shipment_Type) + 1;
--initial
mo_global.init('PO');
mo_global.set_policy_context('S', 00);
fnd_global.apps_initialize(user_id => 00, resp_id => 00,resp_appl_id => 201);
vPoLineLocationId := Po_Tbl_Number(NULL);
vQuantity := Po_Tbl_Number(1000);
vPriceOverride := Po_Tbl_Number(NULL);
vPromisedDate := Po_Tbl_Date(NULL);
vNeedByDate := Po_Tbl_Date(SYSDATE);
vShipmentChanges := Po_Shipments_Rec_Type.Create_Object(p_Po_Line_Location_Id => vPoLineLocationId,
p_Quantity => vQuantity,
p_Promised_Date => vPromisedDate,
p_Price_Override => vPriceOverride,
p_Parent_Line_Location_Id => Po_Tbl_Number(vLineLocationId),
p_Split_Shipment_Num => Po_Tbl_Number(vNewShipmentNum),
p_Need_By_Date => vNeedByDate);
vChange := Po_Changes_Rec_Type.Create_Object(p_Po_Header_Id => vShipment.Po_Header_Id,
p_Po_Release_Id => vShipment.Po_Release_Id,
p_Shipment_Changes => vShipmentChanges);
Po_Document_Update_Grp.Update_Document(p_Api_Version => 1.0,
p_Init_Msg_List => Fnd_Api.g_True,
x_Return_Status => vReturnStatus,
p_Changes => vChange,
p_Run_Submission_Checks => Fnd_Api.g_False,
p_Launch_Approvals_Flag => Fnd_Api.g_False,
p_Buyer_Id => NULL,
p_Update_Source => NULL,
p_Override_Date => NULL,
x_Api_Errors => vErrors,
p_Mass_Update_Releases => NULL);
dbms_output.put_line('Update Status:' || vReturnStatus);
IF vErrors IS NOT NULL THEN
FOR i IN 1 .. vErrors.Message_Text.Count
LOOP
vMsgData := vErrors.Message_Text(i) || ' - ' ||
vErrors.Message_Name(i) || '; ' || vMsgData;
END LOOP;
Dbms_Output.Put_Line('Error Message:' || vMsgData);
END IF;
END;
沒有留言:
張貼留言