Use this script to create a procedure in Database and call the procedure by passing the delivery number as a parameter to ship confirm it.
You can set the options for
1. Back ordering unspecified quantities
2. Closing the delivery automatically by submitting the Trip stop program after ship confirm is successful
SHIP CONFIRMATION THROUGH API

CREATE OR REPLACE PROCEDURE erps_ship_confirm_delivery (
   v_delivery_name      IN     VARCHAR2,                   —  delivery number
   v_action             IN     VARCHAR2, — Pass ‘B’ to backorder the unspecified quantity
   p_ship_conf_status      OUT VARCHAR2,
   x_msg_data              OUT VARCHAR2)
IS
   p_api_version_number     NUMBER;

   init_msg_list            VARCHAR2 (30);

   x_msg_count              NUMBER;

   x_msg_details            VARCHAR2 (32000);

   x_msg_summary            VARCHAR2 (32000);

   p_validation_level       NUMBER;

   p_commit                 VARCHAR2 (30);

   x_return_status          VARCHAR2 (15);

   source_code              VARCHAR2 (15);

   changed_attributes       wsh_delivery_details_pub.changedattributetabtype;

   p_action_code            VARCHAR2 (15);

   p_delivery_id            NUMBER;

   p_delivery_name          VARCHAR2 (30);

   p_asg_trip_id            NUMBER;

   p_asg_trip_name          VARCHAR2 (30);

   p_asg_pickup_stop_id     NUMBER;

   p_asg_pickup_loc_id      NUMBER;

   p_asg_pickup_loc_code    VARCHAR2 (30);

   p_asg_pickup_arr_date    DATE;

   p_asg_pickup_dep_date    DATE;

   p_asg_dropoff_stop_id    NUMBER;

   p_asg_dropoff_loc_id     NUMBER;

   p_asg_dropoff_loc_code   VARCHAR2 (30);

   p_asg_dropoff_arr_date   DATE;

   p_asg_dropoff_dep_date   DATE;

   p_sc_action_flag         VARCHAR2 (10);

   p_sc_close_trip_flag     VARCHAR2 (10);

   p_defer_iface            VARCHAR2 (10);

   p_sc_create_bol_flag     VARCHAR2 (10);

   p_sc_stage_del_flag      VARCHAR2 (10);

   p_sc_trip_ship_method    VARCHAR2 (30);

   p_sc_actual_dep_date     VARCHAR2 (30);

   p_sc_report_set_id       NUMBER;

   p_sc_report_set_name     VARCHAR2 (60);

   p_wv_override_flag       VARCHAR2 (10);

   x_trip_id                VARCHAR2 (30);

   x_trip_name              VARCHAR2 (30);

   p_msg_data               VARCHAR2 (32000);

   fail_api                 EXCEPTION;
BEGIN
   x_return_status := wsh_util_core.g_ret_sts_success;

   p_action_code := ‘CONFIRM’;

   p_delivery_name := v_delivery_name;

   p_sc_action_flag := v_action;

   p_sc_close_trip_flag := ‘Y’; — Trip stop concurrent program will be submitted automatically

   p_defer_iface := ‘N’;

   wsh_deliveries_pub.
    delivery_action (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                  => p_msg_data,
                     p_action_code               => p_action_code,
                     p_delivery_id               => p_delivery_id,
                     p_delivery_name             => p_delivery_name,
                     p_asg_trip_id               => p_asg_trip_id,
                     p_asg_trip_name             => p_asg_trip_name,
                     p_asg_pickup_stop_id        => p_asg_pickup_stop_id,
                     p_asg_pickup_loc_id         => p_asg_pickup_loc_id,
                     p_asg_pickup_loc_code       => p_asg_pickup_loc_code,
                     p_asg_pickup_arr_date       => p_asg_pickup_arr_date,
                     p_asg_pickup_dep_date       => p_asg_pickup_dep_date,
                     p_asg_dropoff_stop_id       => p_asg_dropoff_stop_id,
                     p_asg_dropoff_loc_id        => p_asg_dropoff_loc_id,
                     p_asg_dropoff_loc_code      => p_asg_dropoff_loc_code,
                     p_asg_dropoff_arr_date      => p_asg_dropoff_arr_date,
                     p_asg_dropoff_dep_date      => p_asg_dropoff_dep_date,
                     p_sc_action_flag            => p_sc_action_flag,
                     p_sc_close_trip_flag        => p_sc_close_trip_flag,
                     p_sc_create_bol_flag        => p_sc_create_bol_flag,
                     p_sc_stage_del_flag         => p_sc_stage_del_flag,
                     p_sc_trip_ship_method       => p_sc_trip_ship_method,
                     p_sc_actual_dep_date        => p_sc_actual_dep_date,
                     p_sc_report_set_id          => p_sc_report_set_id,
                     p_sc_report_set_name        => p_sc_report_set_name,
                     p_sc_defer_interface_flag   => p_defer_iface,
                     p_wv_override_flag          => p_wv_override_flag,
                     x_trip_id                   => x_trip_id,
                     x_trip_name                 => x_trip_name);

   IF (x_return_status != wsh_util_core.g_ret_sts_success)
   THEN
      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;
      ELSE
         x_msg_data := x_msg_summary;
      END IF;

      p_ship_conf_status := ‘E’;
   ELSE
      p_ship_conf_status := ‘S’;
   END IF;

END erps_ship_confirm_delivery;

SHIP CONFIRMATION THROUGH FORMS
Navigate to Shipping responsibility >> Shipping >> Transactions
Query the delivery that need to be ship confirmed
click ship confirm button.

EGO_ITEM_PUB package provides functionality for maintaining items, item revisions, etc. We can use ASSIGN_ITEM_TO_ORG procedure to assign one item to an organization.

The procedure definition is:

PROCEDURE Assign_Item_To_Org(
    p_api_version             IN      NUMBER
   ,p_init_msg_list           IN      VARCHAR2        DEFAULT  G_FALSE
   ,p_commit                  IN      VARCHAR2        DEFAULT  G_FALSE
   ,p_Inventory_Item_Id       IN      NUMBER          DEFAULT  G_MISS_NUM
   ,p_Item_Number             IN      VARCHAR2        DEFAULT  G_MISS_CHAR
   ,p_Organization_Id         IN      NUMBER          DEFAULT  G_MISS_NUM
   ,p_Organization_Code       IN      VARCHAR2        DEFAULT  G_MISS_CHAR
   ,p_Primary_Uom_Code        IN      VARCHAR2        DEFAULT  G_MISS_CHAR
   ,x_return_status           OUT NOCOPY  VARCHAR2
   ,x_msg_count               OUT NOCOPY  NUMBER);
The parameters are:
  • P_API_VERSION – A decimal number indicating major and minor revisions to the API. Pass 1.0 unless otherwise indicated in the API parameter list.
  • P_INIT_MSG_LIST – A one-character flag indicating whether to initialize the FND_MSG_PUB package’s message stack at the beginning of API processing (and thus remove any messages that may exist on the stack from prior processing in the same session). Valid values are FND_API.G_TRUE and FND_API.G_FALSE.
  • P_COMMIT – A one-character flag indicating whether to commit work at the end of API processing. Valid values are FND_API.G_TRUE and FND_API.G_FALSE.
  • P_INVENTORY_ITEM_ID – Inventory Item Id of the Item
  • P_ITEM_NUMBER – Segment1 of the Item
  • P_ORGANIZATION_ID – Organization Id of the Organization to whom Item must be assigned
  • P_ORGANIZATION_CODE – 3 character Organization Code of the Organization to whom Item must be assigned
  • P_PRIMARY_UOM_CODE – Primary Unit of Measure of the item.
  • X_RETURN_STATUS – A one-character code indicating whether any errors occurred during processing (in which case error messages will be present on the FND_MSG_PUB package’s message stack). Valid values are FND_API.G_RET_STS_SUCCESS, FND_API.G_RET_STS_ERROR, and FND_API.G_RET_STS_UNEXP_ERROR.
  • X_MSG_COUNT – An integer indicating the number of messages on the FND_MSG_PUB package’s message stack at the end of API processing.
Tested in R12.1.3
DECLARE
        g_user_id             fnd_user.user_id%TYPE :=NULL;
        l_appl_id             fnd_application.application_id%TYPE;
        l_resp_id             fnd_responsibility_tl.responsibility_id%TYPE;
        l_api_version    NUMBER := 1.0;
        l_init_msg_list       VARCHAR2(2) := fnd_api.g_false;
        l_commit        VARCHAR2(2) := FND_API.G_FALSE;
        x_message_list        error_handler.error_tbl_type;
        x_return_status    VARCHAR2(2);
        x_msg_count        NUMBER := 0;
BEGIN
        SELECT fa.application_id
          INTO l_appl_id
          FROM fnd_application fa
         WHERE fa.application_short_name = 'INV';

        SELECT fr.responsibility_id
          INTO l_resp_id
          FROM fnd_application fa, fnd_responsibility_tl fr
         WHERE fa.application_short_name = 'INV'
           AND fa.application_id = fr.application_id
           AND UPPER (fr.responsibility_name) = 'INVENTORY';

        fnd_global.apps_initialize (g_user_id, l_resp_id, l_appl_id);

        EGO_ITEM_PUB.ASSIGN_ITEM_TO_ORG(
                   P_API_VERSION          => l_api_version
                ,  P_INIT_MSG_LIST        => l_init_msg_list
                ,  P_COMMIT               => l_commit
                ,  P_INVENTORY_ITEM_ID    => 1004
                ,  p_item_number          => TEST1010
                ,  p_organization_id      => 11047
                ,  P_ORGANIZATION_CODE    => 'DXN'
                ,  P_PRIMARY_UOM_CODE     => 'EA'
                ,  X_RETURN_STATUS        => x_return_status
                ,  X_MSG_COUNT            => x_msg_count
            );
        DBMS_OUTPUT.PUT_LINE('Status: '||x_return_status);
        IF (x_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
          DBMS_OUTPUT.PUT_LINE('Error Messages :');
          Error_Handler.GET_MESSAGE_LIST(x_message_list=>x_message_list);
            FOR j IN 1..x_message_list.COUNT LOOP
              DBMS_OUTPUT.PUT_LINE(x_message_list(j).message_text);
            END LOOP;
        END IF;
EXCEPTION
        WHEN OTHERS THEN
          dbms_output.put_line('Exception Occured :');
          DBMS_OUTPUT.PUT_LINE(SQLCODE ||':'||SQLERRM);
END;
DECLARE
   CURSOR c_operation IS
      SELECT DISTINCT oprn_no
             , oprn_desc
             , process_qty_uom
             , oprn_vers
             , delete_mark
             , effective_start_date
             , operation_status
             , owner_organization_id
             , activity
             , offset_interval
             , activity_factor
        FROM mii_gmd_operations
       WHERE flag IS NULL;
 
   CURSOR c_resource (
      p_oprn_no     varchar2,
      p_activity    varchar2
   ) IS
      SELECT resources,
             process_qty,
             resource_process_uom,
             resource_usage,
             resource_usage_uom,
             cost_cmpntcls_id,
             cost_analysis_code,
             prim_rsrc_ind,
             resource_count,
             scale_type,
             offset_interval
        FROM mii_gmd_operations
       WHERE oprn_no = p_oprn_no
         AND activity = p_activity
       ORDER BY PRIM_RSRC_IND;
       
   l_operations      gmd_operations%ROWTYPE;
   l_oprn_actv_tbl   gmd_operations_pub.gmd_oprn_activities_tbl_type;
   l_oprn_rsrc_tbl   gmd_operation_resources_pub.gmd_oprn_resources_tbl_type;
   l_count           NUMBER                                              := 0;
   l_count1           NUMBER                                              := 0;
   l_loop_cnt        NUMBER                                              := 0;
   l_record_count    NUMBER                                              := 0;
   l_data            VARCHAR2 (2000);
   l_data1            VARCHAR2 (2000);
   l_return_status   VARCHAR2 (1);
   l_return_status1   VARCHAR2 (1);
   l_status          VARCHAR2 (1);
   i                 NUMBER                                              := 1;
   l_dummy_cnt       NUMBER;
   l_api_version     NUMBER                                              := 1;
   l_init_msg_list   BOOLEAN;
   l_commit          BOOLEAN;
   return_sts        BOOLEAN;
   v_oprn_line_id    number;
   v_count           number;
   v_resources                  varchar2(100);
   v_process_qty                number;
   v_resource_process_uom       varchar2(5);
   v_resource_usage             number;
   v_resource_usage_uom         varchar2(5);
   v_cost_cmpntcls_id           number;
   v_cost_analysis_code         varchar2(5);
   v_prim_rsrc_ind              number;
   v_resource_count             number;
   v_scale_type                 number;
   v_offset_interval            number;
BEGIN

   fnd_global.apps_initialize (user_id           => 1090,
                               resp_id           => 22882,
                               resp_appl_id      => 552
                              );
 
   l_init_msg_list := TRUE;
   l_commit := TRUE;
 
   FOR l_oprn IN c_operation
   LOOP
      DBMS_OUTPUT.put_line (‘Value Test ‘ || l_operations.oprn_no);
     
      l_operations.oprn_no := l_oprn.oprn_no;
      l_operations.oprn_desc := l_oprn.oprn_desc;
      l_operations.process_qty_uom := l_oprn.process_qty_uom;
      l_operations.oprn_vers := l_oprn.oprn_vers;
      l_operations.delete_mark := l_oprn.delete_mark;
      l_operations.effective_start_date := l_oprn.effective_start_date;
      l_operations.operation_status := l_oprn.operation_status;
      l_operations.owner_organization_id := l_oprn.owner_organization_id;
     
      l_oprn_actv_tbl (1).activity := l_oprn.activity;
      l_oprn_actv_tbl (1).offset_interval := l_oprn.offset_interval;
      l_oprn_actv_tbl (1).activity_factor := l_oprn.activity_factor;
      l_oprn_actv_tbl (1).delete_mark := l_oprn.delete_mark;
      –l_oprn_actv_tbl (1).activity := l_master.activity;
     
      SELECT COUNT(*)
        INTO v_count
        FROM mii_gmd_operations
       WHERE oprn_no = l_oprn.oprn_no
         AND activity = l_oprn.activity
       ORDER BY PRIM_RSRC_IND;
     
      OPEN c_resource (l_oprn.oprn_no, l_oprn.activity);
     
      FOR i IN 1 .. v_count
      LOOP
         FETCH c_resource INTO v_resources,
             v_process_qty,
             v_resource_process_uom,
             v_resource_usage,
             v_resource_usage_uom,
             v_cost_cmpntcls_id,
             v_cost_analysis_code,
             v_prim_rsrc_ind,
             v_resource_count,
             v_scale_type,
             v_offset_interval;
       
         l_oprn_rsrc_tbl (i).activity := l_oprn.activity;
         l_oprn_rsrc_tbl (i).resources := v_resources;
         l_oprn_rsrc_tbl (i).process_qty := v_process_qty;
         l_oprn_rsrc_tbl (i).resource_process_uom := v_resource_process_uom;
         l_oprn_rsrc_tbl (i).resource_usage := v_resource_usage;
         l_oprn_rsrc_tbl (i).resource_usage_uom := v_resource_usage_uom;
         l_oprn_rsrc_tbl (i).cost_cmpntcls_id := v_cost_cmpntcls_id;
         l_oprn_rsrc_tbl (i).cost_analysis_code := v_cost_analysis_code;
         l_oprn_rsrc_tbl (i).prim_rsrc_ind := v_prim_rsrc_ind;
         l_oprn_rsrc_tbl (i).resource_count := v_resource_count;
         l_oprn_rsrc_tbl (i).scale_type := v_scale_type;
         l_oprn_rsrc_tbl (i).offset_interval := v_offset_interval;
       
         UPDATE mii_gmd_operations
            set flag = ‘Y’
          WHERE oprn_no = l_oprn.oprn_no
            AND resources = v_resources;
       
      END LOOP;
     
      CLOSE c_resource;
     
      gmd_operations_pub.insert_operation (p_api_version        => 1.0,
                                        p_init_msg_list      => l_init_msg_list,
                                        p_commit             => l_commit,
                                        p_operations         => l_operations,
                                        p_oprn_actv_tbl      => l_oprn_actv_tbl,
                                        p_oprn_rsrc_tbl      => l_oprn_rsrc_tbl,
                                        x_message_count      => l_count,
                                        x_return_status      => l_return_status,
                                        x_message_list       => l_data
                                       );  
                                     
      UPDATE gmd_operations_b
      set operation_status = 700
      WHERE operation_status = 100
      AND   oprn_no = l_oprn.oprn_no;  
     
      IF l_status = ‘E’ OR l_status = ‘U’
         THEN
            UPDATE mii_gmd_operations
            set flag = ‘E’
                , note = l_data
          WHERE oprn_no = l_oprn.oprn_no;
         END IF;
       
   END LOOP;
   
   IF l_count >= 0
   THEN
      l_loop_cnt := 1;

      LOOP
         fnd_msg_pub.get (p_msg_index          => l_loop_cnt,
                          p_data               => l_data,
                          p_encoded            => fnd_api.g_false,
                          p_msg_index_out      => l_dummy_cnt
                         );
         DBMS_OUTPUT.put_line (‘Record = ‘ || l_loop_cnt);
         DBMS_OUTPUT.put_line (l_data);

         IF l_status = ‘E’ OR l_status = ‘U’
         THEN
            l_data := CONCAT (‘ERROR ‘, l_data);
         END IF;

         DBMS_OUTPUT.put_line (l_data);

         IF (l_status = ‘U’)
         THEN
            l_return_status := l_status;
         ELSIF (l_status = ‘E’ AND l_return_status <> ‘U’)
         THEN
            l_return_status := l_status;
         ELSE
            l_return_status := l_status;
         END IF;

         l_loop_cnt := l_loop_cnt + 1;

         IF l_loop_cnt > l_count
         THEN
            EXIT;
         END IF;
      END LOOP;
   END IF;
   COMMIT;
   DBMS_OUTPUT.put_line (‘Sucess’);
END;
/

API Material:

DECLARE
   CURSOR c_master IS
      SELECT *
        FROM nfi_gmd_recipe
       WHERE flag = ‘V’
         AND routing_no IS NOT NULL;
 
   CURSOR c_formula (
      p_formula_id  number
   )
   IS
      SELECT *
        FROM FM_MATL_DTL
       WHERE formula_id = p_formula_id
       ORDER BY line_type, line_no;

   l_recipe_flex_tbl     gmd_recipe_detail.recipe_flex;
   l_recipe_mtl_tbl      gmd_recipe_detail.recipe_mtl_tbl;
   l_recipe              nfi_gmd_recipe%ROWTYPE;
   l_formula             FM_MATL_DTL%ROWTYPE;
   l_count               NUMBER                        := 0;
   l_count_mtl               NUMBER                        := 0;
   l_loop_cnt            NUMBER                        := 0;
   l_record_count        NUMBER                        := 0;
   l_data                VARCHAR2 (2000);
   l_data_mtl                VARCHAR2 (2000);
   l_return_status       VARCHAR2 (1);
   l_status              VARCHAR2 (1);
   i                     NUMBER                        := 1;
   l_dummy_cnt           NUMBER;
   l_api_version         NUMBER                        := 1;
   l_init_msg_list       BOOLEAN;
   l_commit              BOOLEAN;
   return_sts            BOOLEAN;
   v_routing_id          number;
   v_formula_id          number;
   v_routingstep_id      number;
   v_formulaline_id      number;
 
BEGIN
–FND_GLOBAL.APPS_INITIALIZE(1112,22882,552,0);
   fnd_global.apps_initialize (user_id           => 1090,
                               resp_id           => 50618,
                               resp_appl_id      => 552
                              );
 
   l_init_msg_list := TRUE;
   l_commit := TRUE;
 
   i := i;
 
—   IF NOT c_master%ISOPEN THEN
—      CLOSE c_master;
—   END IF;
 
   OPEN c_master;
 
   LOOP
      FETCH c_master INTO l_recipe;
      exit WHEN c_master%NOTFOUND;
     
      IF l_recipe.routing_no IS NOT NULL THEN
         SELECT routing_id
           INTO v_routing_id
           FROM fm_rout_hdr
          WHERE routing_no = l_recipe.routing_no
            AND routing_vers = l_recipe.routing_vers;
      END IF;
       
      SELECT formula_id
        INTO v_formula_id
        FROM FM_FORM_MST
       WHERE formula_no = l_recipe.formula_no
         AND formula_vers = l_recipe.formula_vers;
       
     
     
      IF l_recipe.routing_no IS NOT NULL THEN
       
         OPEN c_formula(v_formula_id);
         LOOP
            FETCH c_formula INTO l_formula;
            exit WHEN c_formula%NOTFOUND;
           
            IF l_formula.line_type = -1 AND l_formula.line_no = 1 THEN
               SELECT routingstep_id
                 INTO v_routingstep_id
                 FROM fm_rout_dtl
                WHERE routing_id = v_routing_id
                  AND routingstep_no = 10;
                 
            ELSIF  l_formula.line_type = -1 AND l_formula.line_no > 1 THEN
               SELECT routingstep_id
                 INTO v_routingstep_id
                 FROM fm_rout_dtl
                WHERE routing_id = v_routing_id
                  AND routingstep_no = 20;
           
            ELSIF  l_formula.line_type = 1 THEN
               SELECT routingstep_id
                 INTO v_routingstep_id
                 FROM fm_rout_dtl
                WHERE routing_id = v_routing_id
                  AND routingstep_no = 30;
                       
            END IF;
           
            l_recipe_mtl_tbl (i).recipe_no := l_recipe.recipe_no;
            l_recipe_mtl_tbl (i).recipe_version := l_recipe.recipe_version;
            l_recipe_mtl_tbl (i).formulaline_id := l_formula.formulaline_id;
            l_recipe_mtl_tbl (i).routingstep_id := v_routingstep_id;
           
            DBMS_OUTPUT.put_line(i);
            DBMS_OUTPUT.put_line(l_recipe_mtl_tbl (i).formulaline_id);
            DBMS_OUTPUT.put_line(l_recipe_mtl_tbl (i).recipe_no);
            i := i + 1;
           
            –DBMS_OUTPUT.put_line (‘Value Test ‘ || i || ‘: ‘|| l_recipe_mtl_tbl (i).recipe_no);
         END LOOP;
       
         CLOSE c_formula;
      END IF;
     
     
      UPDATE nfi_gmd_recipe
         set flag = ‘M’
       WHERE recipe_no = l_recipe.recipe_no;  
           
   END LOOP;
   
      CLOSE c_master;
      gmd_recipe_detail.create_recipe_mtl
                                  (p_api_version             => 1.0,
                                   –p_init_msg_list           => FND_API.G_TRUE,
                                   –p_commit                  => FND_API.G_TRUE,    
                                   p_called_from_forms       => ‘NO’,                      
                                   x_return_status           => l_return_status,
                                   x_msg_count               => l_count_mtl,
                                   x_msg_data                => l_data_mtl,
                                   p_recipe_mtl_tbl           => l_recipe_mtl_tbl,
                                   p_recipe_mtl_flex          => l_recipe_flex_tbl
                                  );                        
         
 
   IF l_count_mtl >= 0
   THEN
      l_loop_cnt := 1;

      LOOP
         fnd_msg_pub.get (p_msg_index          => l_loop_cnt,
                          p_data               => l_data_mtl,
                          p_encoded            => fnd_api.g_false,
                          p_msg_index_out      => l_dummy_cnt
                         );
         DBMS_OUTPUT.put_line (‘Record = ‘ || l_loop_cnt);
         DBMS_OUTPUT.put_line (l_data_mtl);

         IF l_status = ‘E’ OR l_status = ‘U’
         THEN
            l_data_mtl := CONCAT (‘ERROR ‘, l_data_mtl);
         END IF;

         DBMS_OUTPUT.put_line (l_data_mtl);

         IF (l_status = ‘U’)
         THEN
            l_return_status := l_status;
         ELSIF (l_status = ‘E’ AND l_return_status <> ‘U’)
         THEN
            l_return_status := l_status;
         ELSE
            l_return_status := l_status;
         END IF;

         l_loop_cnt := l_loop_cnt + 1;

         IF l_loop_cnt > l_count_mtl
         THEN
            EXIT;
         END IF;
      END LOOP;
   END IF;
   COMMIT;

END;

API Validity Rule:

DECLARE
   CURSOR c_master IS
      SELECT *
        FROM nfi_gmd_recipe
       WHERE flag = ‘Y’;
 
     
   l_recipe_flex_tbl     gmd_recipe_detail.recipe_flex;
   l_recipe_vr_tbl       gmd_recipe_detail.recipe_vr_tbl;
   l_recipe              nfi_gmd_recipe%ROWTYPE;
   l_formula             FM_MATL_DTL%ROWTYPE;
   l_count               NUMBER                        := 0;
   l_count_mtl               NUMBER                        := 0;
   l_loop_cnt            NUMBER                        := 0;
   l_record_count        NUMBER                        := 0;
   l_data                VARCHAR2 (2000);
   l_data_mtl                VARCHAR2 (2000);
   l_return_status       VARCHAR2 (1);
   l_status              VARCHAR2 (1);
   i                     NUMBER                        := 1;
   l_dummy_cnt           NUMBER;
   l_api_version         NUMBER                        := 1;
   l_init_msg_list       BOOLEAN;
   l_commit              BOOLEAN;
   return_sts            BOOLEAN;
   v_routing_id          number;
   v_formula_id          number;
   v_routingstep_id      number;
   v_formulaline_id      number;
 
BEGIN
–FND_GLOBAL.APPS_INITIALIZE(1112,22882,552,0);
   fnd_global.apps_initialize (user_id           => 1090,
                               resp_id           => 50618,
                               resp_appl_id      => 552
                              );
 
   l_init_msg_list := TRUE;
   l_commit := TRUE;
 
   i := 0;
 
   DBMS_OUTPUT.put_line (‘Open cursor’);
 
   OPEN c_master;
 
   LOOP
      FETCH c_master INTO l_recipe;
      exit WHEN c_master%NOTFOUND;
     
           
      l_recipe_vr_tbl (c_master%ROWCOUNT).recipe_no := l_recipe.recipe_no;
      l_recipe_vr_tbl (c_master%ROWCOUNT).recipe_version := l_recipe.recipe_version;
      l_recipe_vr_tbl (c_master%ROWCOUNT).organization_id := l_recipe.organization_id;
      l_recipe_vr_tbl (c_master%ROWCOUNT).start_date := l_recipe.start_date;
     
     
 
      DBMS_OUTPUT.put_line (‘Value Test ‘ || c_master%ROWCOUNT || ‘: ‘|| l_recipe_vr_tbl (c_master%ROWCOUNT).recipe_no);
     
      UPDATE nfi_gmd_recipe
         set flag = ‘V’
       WHERE recipe_no = l_recipe.recipe_no;  
           
   END LOOP;
 
    CLOSE c_master;
    DBMS_OUTPUT.put_line (‘Close cursor’);
   
      gmd_recipe_detail.create_recipe_vr
                                  (p_api_version             => 1.0,
                                   p_init_msg_list           => fnd_api.g_true,
                                   p_commit                  => fnd_api.g_true,    
                                   p_called_from_forms       => ‘NO’,                      
                                   x_return_status           => l_return_status,
                                   x_msg_count               => l_count,
                                   x_msg_data                => l_data,
                                   p_recipe_vr_tbl           => l_recipe_vr_tbl,
                                   p_recipe_vr_flex          => l_recipe_flex_tbl
                                  );                        
       
   UPDATE GMD_RECIPE_VALIDITY_RULES
      set VALIDITY_RULE_STATUS = 700
    WHERE VALIDITY_RULE_STATUS != 700;
 
   IF l_count >= 0
   THEN
      l_loop_cnt := 1;

      LOOP
         fnd_msg_pub.get (p_msg_index          => l_loop_cnt,
                          p_data               => l_data,
                          p_encoded            => fnd_api.g_false,
                          p_msg_index_out      => l_dummy_cnt
                         );
         DBMS_OUTPUT.put_line (‘Record = ‘ || l_loop_cnt);
         DBMS_OUTPUT.put_line (l_data);

         IF l_status = ‘E’ OR l_status = ‘U’
         THEN
            l_data := CONCAT (‘ERROR ‘, l_data);
         END IF;

         DBMS_OUTPUT.put_line (l_data);

         IF (l_status = ‘U’)
         THEN
            l_return_status := l_status;
         ELSIF (l_status = ‘E’ AND l_return_status <> ‘U’)
         THEN
            l_return_status := l_status;
         ELSE
            l_return_status := l_status;
         END IF;

         l_loop_cnt := l_loop_cnt + 1;

         IF l_loop_cnt > l_count
         THEN
            EXIT;
         END IF;
      END LOOP;
   END IF;
   COMMIT;

END;

API Recipe Header:

DECLARE
CURSOR c_master IS
SELECT *
FROM nfi_gmd_recipe
WHERE flag IS NULL;

l_recipe_header_tbl gmd_recipe_header.recipe_tbl;
l_recipe_flex_tbl gmd_recipe_header.recipe_flex;
l_recipe nfi_gmd_recipe%ROWTYPE;
l_formula FM_MATL_DTL%ROWTYPE;
l_count NUMBER := 0;
l_count_mtl NUMBER := 0;
l_loop_cnt NUMBER := 0;
l_record_count NUMBER := 0;
l_data VARCHAR2 (2000);
l_data_mtl VARCHAR2 (2000);
l_return_status VARCHAR2 (1);
l_status VARCHAR2 (1);
i NUMBER := 1;
l_dummy_cnt NUMBER;
l_api_version NUMBER := 1;
l_init_msg_list BOOLEAN;
l_commit BOOLEAN;
return_sts BOOLEAN;
v_routing_id number;
v_formula_id number;
v_routingstep_id number;
v_formulaline_id number;

BEGIN
–FND_GLOBAL.APPS_INITIALIZE(1112,22882,552,0);
fnd_global.apps_initialize (user_id => 1090,
resp_id => 50618,
resp_appl_id => 552
);

l_init_msg_list := TRUE;
l_commit := TRUE;

DBMS_OUTPUT.put_line (‘Open cursor’);

OPEN c_master;

LOOP
FETCH c_master INTO l_recipe;
exit WHEN c_master%NOTFOUND;

IF l_recipe.routing_no IS NOT NULL THEN
SELECT routing_id
INTO v_routing_id
FROM fm_rout_hdr
WHERE routing_no = l_recipe.routing_no
AND routing_vers = l_recipe.routing_vers;

l_recipe_header_tbl (c_master%ROWCOUNT).routing_id := v_routing_id;

END IF;

SELECT formula_id
INTO v_formula_id
FROM FM_FORM_MST
WHERE formula_no = l_recipe.formula_no
AND formula_vers = l_recipe.formula_vers;

l_recipe_header_tbl (c_master%ROWCOUNT).recipe_no := l_recipe.recipe_no;
l_recipe_header_tbl (c_master%ROWCOUNT).recipe_description := l_recipe.recipe_description;
l_recipe_header_tbl (c_master%ROWCOUNT).recipe_version := l_recipe.recipe_version;
l_recipe_header_tbl (c_master%ROWCOUNT).user_id := 1090;
l_recipe_header_tbl (c_master%ROWCOUNT).owner_organization_id := l_recipe.owner_organization_id;
l_recipe_header_tbl (c_master%ROWCOUNT).formula_id := v_formula_id;

l_recipe_header_tbl (c_master%ROWCOUNT).recipe_status := ‘700’;

DBMS_OUTPUT.put_line (‘Value Test ‘ || c_master%ROWCOUNT || ‘: ‘|| l_recipe_header_tbl (c_master%ROWCOUNT).recipe_no);

UPDATE nfi_gmd_recipe
set flag = ‘Y’
WHERE recipe_no = l_recipe.recipe_no;

END LOOP;

CLOSE c_master;

DBMS_OUTPUT.put_line (‘Close cursor’);

gmd_recipe_header.create_recipe_header
(p_api_version => 1.0,
–p_init_msg_list => FND_API.G_TRUE,
–p_commit => FND_API.G_TRUE,
p_recipe_header_tbl => l_recipe_header_tbl,
p_recipe_header_flex => l_recipe_flex_tbl,
x_return_status => l_return_status,
x_msg_count => l_count,
x_msg_data => l_data
);

IF l_count >= 0
THEN
l_loop_cnt := 1;

LOOP
fnd_msg_pub.get (p_msg_index => l_loop_cnt,
p_data => l_data,
p_encoded => fnd_api.g_false,
p_msg_index_out => l_dummy_cnt
);
DBMS_OUTPUT.put_line (‘Record = ‘ || l_loop_cnt);
DBMS_OUTPUT.put_line (l_data);

IF l_status = ‘E’ OR l_status = ‘U’
THEN
l_data := CONCAT (‘ERROR ‘, l_data);
END IF;

DBMS_OUTPUT.put_line (l_data);

IF (l_status = ‘U’)
THEN
l_return_status := l_status;
ELSIF (l_status = ‘E’ AND l_return_status <> ‘U’)
THEN
l_return_status := l_status;
ELSE
l_return_status := l_status;
END IF;

l_loop_cnt := l_loop_cnt + 1;

IF l_loop_cnt > l_count
THEN
EXIT;
END IF;
END LOOP;
END IF;
COMMIT;

END;

API Formula:

DECLARE
   CURSOR c_header IS
      SELECT DISTINCT formula_no
      FROM mii_gmd_formula
       WHERE flag IS NULL;
     
   CURSOR c_master  (
      p_formula     varchar2
   ) IS
      SELECT *
        FROM mii_gmd_formula
       WHERE flag IS NULL
         AND formula_no = p_formula;
     
   l_formula_header_tbl   gmd_formula_pub.formula_insert_hdr_tbl_type;
   l_formula              mii_gmd_formula%ROWTYPE;
   l_count                NUMBER                                      := 0;
   l_loop_cnt             NUMBER                                      := 0;
   l_record_count         NUMBER                                      := 0;
   l_data                 VARCHAR2 (2000);
   l_return_status        VARCHAR2 (1);
   l_status               VARCHAR2 (1);
   i                      NUMBER                                      := 1;
   l_dummy_cnt            NUMBER;
   l_api_version          NUMBER                                      := 1;
   l_init_msg_list        BOOLEAN;
   l_commit               BOOLEAN;
   return_sts             BOOLEAN;
   v_item_id              number;
   v_organization_id      number;
   v_user_id                            number;
BEGIN
–FND_GLOBAL.APPS_INITIALIZE(1112,22882,552,0);
   fnd_global.apps_initialize (user_id           => 1090,
                               resp_id           => 22882,
                               resp_appl_id      => 552
                              );
/*FND_GLOBAL.APPS_INITIALIZE(user_id, resp_id, resp_appl_id);*/
   l_init_msg_list := TRUE;
   l_commit := TRUE;

FOR l_header IN c_header  
LOOP
   OPEN c_master(l_header.formula_no);
   LOOP
      FETCH c_master INTO l_formula;
      exit WHEN c_master%NOTFOUND;
     
      dbms_output.put_line (c_master%ROWCOUNT);
      BEGIN
         SELECT DISTINCT inventory_item_id
           INTO v_item_id
           FROM mtl_system_items_b
          WHERE segment1 = UPPER(l_formula.inventory_item_code);
     
         SELECT organization_id
          INTO v_organization_id
           FROM mtl_parameters
          WHERE organization_code = l_formula.owner_organization_code;
     
         SELECT user_id
           INTO v_user_id
           FROM fnd_user
          WHERE user_name = l_formula.owner_name;
      EXCEPTION
         WHEN others THEN
            UPDATE mii_gmd_formula
             set flag = ‘E’
             –, note = ‘Ada exception’
            WHERE formula_no = l_formula.formula_no;
      END;
      l_formula_header_tbl (c_master%ROWCOUNT).record_type := ‘I’;
      l_formula_header_tbl (c_master%ROWCOUNT).formula_no := UPPER(l_formula.formula_no);
      l_formula_header_tbl (c_master%ROWCOUNT).formula_vers := l_formula.formula_vers;
      l_formula_header_tbl (c_master%ROWCOUNT).formula_type := l_formula.formula_type;
      l_formula_header_tbl (c_master%ROWCOUNT).formula_desc1 := l_formula.formula_desc1;
      l_formula_header_tbl (c_master%ROWCOUNT).formula_class := l_formula.formula_class;
      l_formula_header_tbl (c_master%ROWCOUNT).inactive_ind := l_formula.inactive_ind;
      l_formula_header_tbl (c_master%ROWCOUNT).owner_organization_id := v_organization_id;
      l_formula_header_tbl (c_master%ROWCOUNT).formula_status := l_formula.formula_status;
      l_formula_header_tbl (c_master%ROWCOUNT).owner_id := v_user_id;
      l_formula_header_tbl (c_master%ROWCOUNT).line_type := l_formula.line_type;
      l_formula_header_tbl (c_master%ROWCOUNT).line_no := l_formula.line_no;
      l_formula_header_tbl (c_master%ROWCOUNT).inventory_item_id := v_item_id;
      l_formula_header_tbl (c_master%ROWCOUNT).qty := l_formula.qty;
      l_formula_header_tbl (c_master%ROWCOUNT).detail_uom := l_formula.detail_uom;
      l_formula_header_tbl (c_master%ROWCOUNT).release_type := l_formula.release_type;
      l_formula_header_tbl (c_master%ROWCOUNT).scale_type_hdr := l_formula.scale_type_hdr;
      l_formula_header_tbl (c_master%ROWCOUNT).scale_type_dtl := l_formula.scale_type_dtl;
      l_formula_header_tbl (c_master%ROWCOUNT).cost_alloc := l_formula.cost_alloc;
      l_formula_header_tbl (c_master%ROWCOUNT).CONTRIBUTE_YIELD_IND := l_formula.CONTRIBUTE_YIELD_IND;
      l_formula_header_tbl (c_master%ROWCOUNT).PHANTOM_TYPE := l_formula.PHANTOM_TYPE;
      l_formula_header_tbl (c_master%ROWCOUNT).delete_mark := l_formula.delete_mark;
      l_formula_header_tbl (c_master%ROWCOUNT).CONTRIBUTE_STEP_QTY_IND := ‘N’;
     
     
      DBMS_OUTPUT.put_line (‘Value Test ‘ || l_formula_header_tbl (1).formula_no);
     
—      UPDATE mii_gmd_formula
—         set flag = ‘Y’
—       WHERE formula_no = l_formula.formula_no
—         AND line_no = l_formula.line_no
—         AND inventory_item_code = l_formula.inventory_item_code;
       
   END LOOP;
 
   CLOSE c_master;
 
   gmd_formula_pub.insert_formula
                                (p_api_version             => 1.0,
                                 p_formula_header_tbl      => l_formula_header_tbl,
                                 x_return_status           => l_return_status,
                                 x_msg_count               => l_count,
                                 x_msg_data                => l_data
                                );
                                DBMS_OUTPUT.put_line (‘l_return_status:’||l_return_status);
                                DBMS_OUTPUT.put_line (‘l_data:’||l_data);
                               
   –IF l_return_status = ‘E’ OR l_return_status = ‘U’
   —      THEN
            UPDATE mii_gmd_formula
             set flag = l_return_status
             –, note = l_data
       WHERE formula_no = l_formula.formula_no;
—   ELSE
—     UPDATE mii_gmd_formula
—             set flag = ‘Y’
—             , note = l_data
—       WHERE formula_no = l_formula.formula_no;
—   END IF;                            
                                   
END LOOP;
/*
   IF l_count >= 0
   THEN
      l_loop_cnt := 1;

      LOOP
         fnd_msg_pub.get (p_msg_index          => l_loop_cnt,
                          p_data               => l_data,
                          p_encoded            => fnd_api.g_false,
                          p_msg_index_out      => l_dummy_cnt
                         );
         DBMS_OUTPUT.put_line (‘Record = ‘ || l_loop_cnt);
         DBMS_OUTPUT.put_line (l_data);

         IF l_status = ‘E’ OR l_status = ‘U’
         THEN
            l_data := CONCAT (‘ERROR ‘, l_data);
         END IF;

         DBMS_OUTPUT.put_line (l_data);

         IF (l_status = ‘U’)
         THEN
            l_return_status := l_status;
         ELSIF (l_status = ‘E’ AND l_return_status <> ‘U’)
         THEN
            l_return_status := l_status;
         ELSE
            l_return_status := l_status;
         END IF;

         l_loop_cnt := l_loop_cnt + 1;

         IF l_loop_cnt > l_count
         THEN
            EXIT;
         END IF;
      END LOOP;
   END IF;*/
   COMMIT;

END;

How to Clear Apache Cache (Oracle EBS General)

Steps to Clear Apache Cache

Step – 1 Navigate to Functional Administrator responsibility.

Step – 2 Go to: Home > Core Services > Caching Framework
Step – 3 Go to: Global Configuration > Clear All Cache.
Click Apply. Apache Cache is now clear.