Pick release and pick Confirm for sales orders using the API

Source: Internet
Author: User

DECLARE x_return_status VARCHAR2 (2);  X_msg_count number;  X_msg_data VARCHAR2 (2000);  P_api_version_number Number: = 1.0;  Init_msg_list VARCHAR2 (200);  X_msg_details VARCHAR2 (3000);  X_msg_summary VARCHAR2 (3000);  P_line_rows Wsh_util_core.id_tab_type;  X_del_rows Wsh_util_core.id_tab_type;  L_ship_method_code VARCHAR2 (100);  I number;  L_commit VARCHAR2 (30);  P_DELIVERY_ID number;  P_delivery_name VARCHAR2 (30);  x_trip_id VARCHAR2 (30);  X_trip_name VARCHAR2 (30);  Exep_api EXCEPTION;  L_picked_flag VARCHAR2 (10);  L_return_status VARCHAR2 (1000);  L_msg_count number;  L_msg_data VARCHAR2 (1000);  L_USER_ID number;  L_RESP_ID number;  L_APPL_ID number; CURSOR c_ord_details is SELECT oha.order_number sales_order, oha.org_id, Ola.line_number,         Ola.shipment_number, Ola.flow_status_code , wdd.delivery_detail_id, Wdd.inv_interfaced_flag, Wdd.oe_interfaced_flag, Wdd.released_status     From Apps.oe_order_headers_all OHA, Apps.oe_order_lines_all Ola, Apps.wsh_delivery_details Wdd       WHERE oha.header_id = ola.header_id and oha.org_id = ola.org_id and oha.header_id = wdd.source_header_id and ola.line_id = wdd.source_line_id and Oha.booked_flag = ' Y ' and NVL (Ola.cancelled_flag, ' N ') <> ' Y ' and Wdd.released_status in (' R ', ' B ') and Ola.flow_status_code = ' awaiting_shipping ' and Oha.order_num  ber = 1506764261 and oha.org_id = 121;  --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 Management スーパーユーザー (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--fnd_global.apps_initialize (user_id = v_user_id, resp_id  = v_resp_id, resp_appl_id = v_resp_appl_id);  --X_return_status: = wsh_util_core.g_ret_sts_success;  I: = 0;    For I in C_ord_details LOOP--Mandatory initialization for R12 mo_global.set_policy_context (' S ', i.org_id);      Mo_global.init (' ONT ');      P_line_rows (1): = i.delivery_detail_id; --API call-Auto Create deliveries dbms_output.put_line (' calling Wsh_delivery_details_pub to Perform autocreate D    Elivery ');      Dbms_output.put_line (' ==================================================== '); Wsh_delivery_details_pub.autocReate_deliveries (P_api_version_number = 1.0, P_init_msg_list =& Gt                                                   Apps.fnd_api.g_true, P_commit = L_commit,                                                   X_return_status = X_return_status, X_msg_count = X_msg_count, X_msg_data =&G T                                                   X_msg_data, p_line_rows = P_line_rows,      X_del_rows = x_del_rows);    Dbms_output.put_line (X_return_status);    Dbms_output.put_line (X_msg_count);      Dbms_output.put_line (X_msg_data); IF (x_return_status <> wsh_util_core.g_ret_sts_success) then Dbms_output.put_line (' Failed to Auto create de      Livery for Sales Order ');        RAISE Exep_api;         ELSE Dbms_output.put_line (' Auto Create Delivery Action have successfully completed for so ');    Dbms_output.put_line (' ============================================= ');      END IF;    --Pick release.    p_delivery_id: = x_del_rows (1);      P_delivery_name: = To_char (X_del_rows (1));    Dbms_output.put_line (' Calling Wsh_deliveris_pub to Perform Pick Release of So ');    Dbms_output.put_line (' ============================================= ');                                       --API call for Pick Release wsh_deliveries_pub.delivery_action (p_api_version_number = 1.0,           P_init_msg_list = NULL, x_return_status                                       = X_return_status, X_msg_count = X_msg_count,             X_msg_data = X_msg_data, P_action_code                                      = ' Pick-release ', p_delivery_id = p_delivery_id, P_delivery_name = P_de                                       Livery_name, p_asg_trip_id = NULL,                                       P_asg_trip_name = null, p_asg_pickup_stop_id = NULL, p_asg_pickup_loc_id = NULL, P_asg_picku                                       P_stop_seq = null, P_asg_pickup_loc_code = NULL, P_asg_pickup_arr_date = NULL, p_asg_pickup_dep_date =                                       > null, p_asg_dropoff_stop_id = NULL,                              p_asg_dropoff_loc_id = null, P_ASG_DROPOFF_STOP_SEQ = NULL,         P_asg_dropoff_loc_code = null, p_asg_dropoff_arr_date = NULL, P_asg_dropoff_dep_date = NULL, P_sc_ac                                       Tion_flag = ' S ', P_sc_intransit_flag = ' N ',      P_sc_close_trip_flag = ' N ', P_sc_create_bol_flag                                       = ' N ', P_sc_stage_del_flag = ' Y ',                                       P_sc_trip_ship_method = null, p_sc_actual_dep_date = NULL, p_sc_report_set_id = NULL, P_sc_report_se                                       T_name = NULL, P_sc_defer_interface_flag = ' Y ', P_sc_send_945_flag = null, p_sc_rule_id = NULL,        P_sc_rule_name = NULL, P_wv_override_flag                                       = ' N ', x_trip_id = x_trip_id,      X_trip_name = X_trip_name);    Dbms_output.put_line (X_return_status);    Dbms_output.put_line (X_msg_count);      Dbms_output.put_line (X_msg_data); IF (x_return_status <> wsh_util_core.g_ret_sts_success) then Dbms_output.put_line (' Failed to Pick Release t      He sales order ');        RAISE Exep_api;      ELSE dbms_output.put_line (' Sales Order has successfully Pick released ');        Dbms_output.put_line (' ============================== ');      END IF;    --for pick confirm--commit; END LOOP;    EXCEPTION when Exep_api then Dbms_output.put_line (' ============== '); DbMs_output.put_line (' Error Details If any ');      Dbms_output.put_line (' ============== ');                               Wsh_util_core.get_messages (' Y ', x_msg_summary, X_msg_details,      X_msg_count); IF x_msg_count > 1 then x_msg_data: = X_msg_summary | | '---' ||      X_msg_details;        Dbms_output.put_line (X_msg_data); ELSE x_msg_data: = X_msg_summary | | '---' ||      X_msg_details;        Dbms_output.put_line (X_msg_data);  END IF; END;

Pick release and pick Confirm for sales orders using the API

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.