Auto Create deliveries – API

Hi, this post I will show the API to create deliveries.

Sem título

DECLARE
   l_operation            VARCHAR2 (30) := 'Autocreate Delivery ';
   x_return_status        VARCHAR2 (1);
   x_msg_data             VARCHAR2 (2000);
   x_msg_count            VARCHAR2 (2000);

   p_api_version_number   NUMBER;
   init_msg_list          VARCHAR2 (30);
   x_msg_details          VARCHAR2 (3000);
   x_msg_summary          VARCHAR2 (3000);

   l_line_rows            WSH_UTIL_CORE.ID_TAB_TYPE;
   l_del_rows             WSH_UTIL_CORE.ID_TAB_TYPE;
   i                      NUMBER :=1;
BEGIN
    x_return_status := WSH_UTIL_CORE.G_RET_STS_SUCCESS;

    FND_GLOBAL.APPS_INITIALIZE (user_id        => 1139,
                               resp_id        => 21623,
                               resp_appl_id   => 660);
    MO_GLOBAL.init ('ONT');
    MO_GLOBAL.set_policy_context ('S', 81);                               
                               
    
    FOR C IN (SELECT delivery_detail_id
                FROM wsh_delivery_details a,
                     oe_order_headers_all ooha,
                     oe_order_headers_all oola
               WHERE a.source_header_id = ooha.header_id
                 AND ooha.header_id = oola.header_id
                 AND ooha.order_number = 97)

    LOOP                           

        l_line_rows (i) := c.delivery_detail_id; 
        i := i + 1;
       
    END LOOP;
    
    WSH_DELIVERY_DETAILS_PUB.AUTOCREATE_DELIVERIES ( p_api_version_number   => 1.0,
                                                     p_init_msg_list        => init_msg_list,
                                                     x_return_status        => x_return_status,
                                                     x_msg_count            => x_msg_count,
                                                     x_msg_data             => x_msg_data,
                                                     p_line_rows            => l_line_rows,
                                                     x_del_rows             => l_del_rows);


    IF x_return_status = WSH_UTIL_CORE.G_RET_STS_SUCCESS THEN
      DBMS_OUTPUT.put_line (l_operation || ' done successfully.');
      COMMIT;
    ELSE
      DBMS_OUTPUT.put_line ('Failure.');
      DBMS_OUTPUT.put_line ('Return Status = ' || x_return_status);
      wsh_util_core.get_messages ('Y',
                                  x_msg_data,
                                  x_msg_details,
                                  x_msg_count);
      DBMS_OUTPUT.put_line (l_operation || ': ');
      DBMS_OUTPUT.put_line ('Summary: ' || SUBSTRB (x_msg_data, 1, 200));
      DBMS_OUTPUT.put_line ('Detail: ' || SUBSTRB (x_msg_details, 1, 200));
      ROLLBACK;
    END IF;
    
END;

After run this script, the delivery was created.

Sem título

Deixe uma resposta

Powered by WordPress.com. Tema: Baskerville 2 por Anders Noren

Acima ↑

%d blogueiros gostam disto: