Use API to create a sales order and api to create an order
DECLARE invalid NUMBER: = 1; v_return_status VARCHAR2 (2000); v_msg_count NUMBER; v_msg_data VARCHAR2 (2000); -- IN Variables -- v_header_rec limit; v_line_tbl limit; v_action_request_tbl limit; -- OUT Variables -- v_header_rec_out sequence; v_header_val_rec_out sequence; Sequence sequence; v_line_tbl_out sequence; v_line_val_tbl_out sequence; Sequence sequence; v_line_adj_val_tbl_out oe_order_pub.line_adj_val_tbl_type; v_line_price_att_tbl_out oe_order_pub.line_price_att_tbl_type; v_line_adj_att_tbl_out oe_order_pub.line_adj_att_tbl_type; v_line_adj_assoc_tbl_out oe_order_pub.line_adj_assoc_tbl_type; v_line_scredit_tbl_out oe_order_pub.line_scredit_tbl_type; v_line_scredit_val_tbl_out oe_order_pub.line_scredit_val_tbl_type; v_lot_serial_tbl_out oe_order_pub.lot_serial_tbl_type; v_lot_serial_val_tbl_out oe_order_pub.lot_serial_val_tbl_type; v_action_request_tbl_out oe_order_pub.request_tbl_type; -- v_user_id NUMBER; v_resp_id NUMBER; v_resp_appl_id NUMBER; -- BEGIN --/* To get the user id details */SELECT user_id INTO v_user_id FROM fnd_user WHERE user_name = 'setup01 '; /* To get the responsibility and responsibility application id */SELECT f. responsibility_id, f. application_id INTO v_resp_id, v_resp_appl_id FROM fnd_responsibility_tl f WHERE f. responsibility_name = 'note スパユーザ (SC) 'AND f. language = 'ja '; dbms_output.put_line (v_user_id | ''| v_resp_id |'' | v_resp_appl_id); -- dbms_output.put_line ('starting of script '); -- Setting the Enviroment -- mo_global.init ('ont '); values (user_id => v_user_id, resp_id => v_resp_id, resp_appl_id => v_resp_appl_id); values ('s', fnd_global.org_id ); -- Header Record -- v_header_rec: = response; v_header_rec.operation: = oe_globals.g_opr_create; v_header_rec.order_number: = 1111111; Response: = 1001; -- Response response: = 70802; -- Response (INV) response: = 5859039; -- lower (SHIP_TO) lower: = 1154; -- lower (BILL_TO) v_header_rec.order_source_id: = 1001; -- lower limit: = 'n'; v_header_rec.price_list_id: = 7023; -- export v_header_rec.pricing_date: = SYSDATE; v_header_rec.flow_status_code: = 'entered'; -- Comment: = ''; Comment: = 121; -- OU v_header_rec.salesrep_id: = 100001013; -- Comment failed: = 'jpy'; -- Currency v_action_request_tbl (1): = bytes; -- Line Record -- v_line_tbl (1): = oe_order_pub.g_miss_line_rec; v_line_tbl (1 ). operation: = oe_globals.g_opr_create; v_line_tbl (1 ). inventory_item_id: = 362133; -- MTL_SYSTEM_ITEMS_ B .INVENTORY_ITEM_ID v_line_tbl (1 ). ordered_quantity: = 1; v_line_tbl (1 ). unit_selling_price: = 235; v_line_tbl (1 ). calculate_price_flag: = 'n'; v_line_tbl (1 ). line_type_id: = 1013; -- Initialize sequence ('starting of API '); -- Calling the API to create an Order -- aggregate (p_api_version_number => v_api_version_number, p_header_rec => v_header_rec, p_line_tbl => v_line_tbl, direction => v_action_request_tbl, direction => direction -- OUT variables, x_header_rec => v_header_rec_out, x_header_val_rec => direction, direction => direction, direction => limit, rows => rows, x_line_tbl => v_line_tbl_out, x_line_val_tbl => rows, x_line_adj_tbl => rows, response => response, x_line_price_att_tbl => response, response => response, response => response, x_line_scredit_tbl => response, response => response, x_lot_serial_tbl => response, response => response, condition => condition, x_return_status => v_return_status, x_msg_count => v_msg_count, x_msg_data => v_msg_data); condition ('completion of API '); IF v_return_status = condition THEN -- COMMIT; dbms_output.put_line ('order Import Success: '| response); ELSE dbms_output.put_line ('order Import failed:' | v_msg_data); -- ROLLBACK; FOR I IN 1 .. v_msg_count LOOP v_msg_data: = oe_msg_pub.get (p_msg_index => I, p_encoded => 'F'); dbms_output.put_line (I | ')' | v_msg_data); END LOOP; END IF; END;