Introduction:
In this article we’ll create move order using API inv_move_order_pub.process_move_order in oracle apps r12.
What we’ll demonstrate in this article is a short portion of code by giving an example.
Goal:
Create move order using API inv_move_order_pub.process_move_order.
Forms Or Pages:
Prerequisites:
No prerequisites to use API
Example:
create move order using api in oracle apps r12
API IN/OUT Parameters :
— IN
— p_api_version_number IN NUMBER Required
— p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE Required
— p_return_values IN VARCHAR2 := FND_API.G_FALSE
— p_commit IN VARCHAR2 := FND_API.G_FALSE
— p_trohdr_rec IN Trohdr_Rec_Type := G_MISS_TROHDR_REC
— p_trohdr_val_rec IN Trohdr_Val_Rec_Type := G_MISS_TROHDR_VAL_REC
— p_trolin_tbl IN Trolin_Tbl_Type := G_MISS_TROLIN_TBL
— p_trolin_val_tbl IN Trolin_Val_Tbl_Type := G_MISS_TROLIN_VAL_TBL
— OUT
— x_return_status OUT VARCHAR2(1)
— x_msg_count OUT NOCOPY NUMBER
— x_msg_data OUT NOCOPY NUMBER
— IN OUT
— x_trohdr_rec IN OUT NOCOPY Trohdr_Rec_Type
— x_trohdr_val_rec IN OUT NOCOPY Trohdr_Val_Rec_Type
— x_trolin_tbl IN OUT NOCOPY Trolin_Tbl_Type
— x_trolin_val_tbl IN OUT NOCOPY Trolin_Val_Tbl_Type
read more : API to Create inventory organization in oracle apps
API Parameters clarifications:
- Use this procedure to process move orders (both headers and lines) i.e., to create move orders.
- @param p_api_version_number API version number (current version is 1.0).
- @param p_init_msg_list Should be passed as either fnd_api.g_false or fnd_api.g_true to determine whether to initialize the message list.
- @param p_return_values Requests that the API sends back the values on your behalf. valid values: FND_API.G_FALSE or FND_API.G_TRUE.
- @param p_commit Whether or not to commit the changes to the database.
- @param x_return_status Requests that the API return the status of the data for you after it completes its function.
- @param x_msg_count Indicates the number of error messages the API has encountered.
- @param x_msg_data Displays error message text. If the x_msg_count is equal to 1, then this contains the actual message.
- @param p_trohdr_rec The record that contains the information to be used to process the move order header.
- @param p_trohdr_val_rec Contains information values rather than internal identifiers used to process the move order header.
- @param p_trolin_tbl A table of records contains information to be used to process the move order lines.
- @param p_trolin_val_tbl Contains information values rather than internal identifiers used to process the move order Lines.
- @param x_trohdr_rec The information on the move order header that got created.
- @param x_trohdr_val_rec The information values of the move order header that got created.
- @param x_trolin_tbl The information on the move order lines that got created.
- @param x_trolin_val_tbl The information values of the move order lines that got created.
API Calling example:
DECLARE
o_return_status VARCHAR2 (1);
o_msg_data VARCHAR2 (3950);
o_msg_count NUMBER := 0;
l_msg_data VARCHAR2 (3950) := NULL;
p_hdr_rec inv_move_order_pub.trohdr_rec_type := inv_move_order_pub.g_miss_trohdr_rec;
o_hdr_rec inv_move_order_pub.trohdr_rec_type := inv_move_order_pub.g_miss_trohdr_rec;
o_hdr_val_rec inv_move_order_pub.trohdr_val_rec_type;
o_line_val_tbl inv_move_order_pub.trolin_val_tbl_type;
p_line_tbl inv_move_order_pub.trolin_tbl_type := inv_move_order_pub.g_miss_trolin_tbl;
o_line_tbl inv_move_order_pub.trolin_tbl_type := inv_move_order_pub.g_miss_trolin_tbl;
v_msg_index_out NUMBER;
l_err_msg VARCHAR2 (1000);
BEGIN
fnd_global.apps_initialize (1013415, -- User ID: 1013415 Is For ORAASK USER_ID
resp_id => 20539, -- Responsibility ID: This is my inventory responsibility.
resp_appl_id => 401);
p_hdr_rec := inv_move_order_pub.g_miss_trohdr_rec;
o_hdr_rec := inv_move_order_pub.g_miss_trohdr_rec;
p_line_tbl.delete;
o_line_tbl.delete;
p_hdr_rec.date_required := sysdate;
p_hdr_rec.header_status := inv_globals.g_to_status_preapproved;
p_hdr_rec.organization_id := 1645; -- Vision Stores US Organization
p_hdr_rec.status_date := sysdate;
p_hdr_rec.transaction_type_id := inv_globals.g_type_transfer_order_issue;
p_hdr_rec.move_order_type := inv_globals.g_move_order_requisition;
p_hdr_rec.db_flag := fnd_api.g_true;
p_hdr_rec.operation := inv_globals.g_opr_create;
p_hdr_rec.description := 'Oraask.com - Test description to create new move order through API';
p_hdr_rec.to_account_id := 30797;
p_hdr_rec.from_subinventory_code := 'Laboratory';
p_line_tbl (1).date_required := sysdate;
p_line_tbl (1).inventory_item_id := 4199;
p_line_tbl (1).line_id := fnd_api.g_miss_num;
p_line_tbl (1).line_status := inv_globals.g_to_status_preapproved;
p_line_tbl (1).transaction_type_id := inv_globals.g_type_transfer_order_issue;
p_line_tbl (1).organization_id := 1645;
p_line_tbl (1).quantity := 5;
p_line_tbl (1).status_date := sysdate;
p_line_tbl (1).uom_code := 'BG';
p_line_tbl (1).db_flag := fnd_api.g_true;
p_line_tbl (1).operation := inv_globals.g_opr_create;
p_line_tbl (1).from_subinventory_code := 'Laboratory';
p_line_tbl (1).to_account_id := 30797;
p_line_tbl (2).date_required := sysdate;
p_line_tbl (2).inventory_item_id := 59389;
p_line_tbl (2).line_id := fnd_api.g_miss_num;
p_line_tbl (2).line_status := inv_globals.g_to_status_preapproved;
p_line_tbl (2).transaction_type_id := inv_globals.g_type_transfer_order_issue;
p_line_tbl (2).organization_id := 1645;
p_line_tbl (2).quantity := 2;
p_line_tbl (2).status_date := sysdate;
p_line_tbl (2).uom_code := 'BG';
p_line_tbl (2).db_flag := fnd_api.g_true;
p_line_tbl (2).operation := inv_globals.g_opr_create;
p_line_tbl (2).from_subinventory_code := 'Laboratory';
p_line_tbl (2).to_account_id := 30797;
inv_move_order_pub.process_move_order (p_api_version_number => 1.0
,p_init_msg_list => fnd_api.g_true
,p_return_values => fnd_api.g_false
,p_commit => fnd_api.g_true
,x_return_status => o_return_status
,x_msg_count => o_msg_count
,x_msg_data => o_msg_data
,p_trohdr_rec => p_hdr_rec
,p_trolin_tbl => p_line_tbl
,x_trohdr_rec => o_hdr_rec
,x_trohdr_val_rec => o_hdr_val_rec
,x_trolin_tbl => o_line_tbl
,x_trolin_val_tbl => o_line_val_tbl);
dbms_output.put_line ('***************************');
IF o_return_status <> fnd_api.g_ret_sts_success THEN
dbms_output.put_line ('O_RETURN_STATUS = ' || o_return_status);
IF o_msg_count > 0 THEN
FOR v_index IN 1 .. o_msg_count
LOOP
fnd_msg_pub.get (p_msg_index => v_index
,p_encoded => 'F'
,p_data => o_msg_data
,p_msg_index_out => v_msg_index_out);
l_msg_data := substr (o_msg_data, 1, 3950);
END LOOP;
dbms_output.put_line ('L_MSG_DATA = ' || l_msg_data);
END IF;
ELSE
dbms_output.put_line ('O_RETURN_STATUS = ' || o_return_status);
dbms_output.put_line ('O_HDR_REC = ' || o_hdr_rec.header_id);
FOR i IN o_line_tbl.first .. o_line_tbl.last
LOOP
dbms_output.put_line ('O_LINE_TBL.LINE_ID (' || i || ') = ' || o_line_tbl (i).line_id);
END LOOP;
dbms_output.put_line ('***************************');
END IF;
EXCEPTION
WHEN OTHERS THEN
l_err_msg := substr (sqlerrm, 0, 1000);
dbms_output.put_line ('***************************');
dbms_output.put_line ('There is an exception has been raised from API with error message: ' || l_err_msg);
dbms_output.put_line ('***************************');
END;
Note: sometimes the name of some API parameters are different from EBS version 12.1.3 to 12.2.x. So if you face an error while running this API that related to some of the argument of the API is not correct. please change it by your own by opening the source code of the standard API “inv_move_order_pub.process_move_order” in our example and correct them in your code. Or leave a comment below and tell us the error you are facing and we’ll help you as soon as we see your issue.
reading more : Create SIT API in oracle HRMS
Final Result:
In this article, we have demonstrate how to create move order using API in oracle apps r12 .
Hopefully, it was clear and concise.
Please don’t use this code directly on production environment, instead test it on test environment first to make sure that API working correctly as per your requirements.
We are only giving one example of how to allocate one line as constant value.
reading more: API to update work request in oracle apps
[convertkit form=1415728]