How to Uncheck ignore for planning flag using "wsh_deliveries_pub.delivery_action" API


DECLARE
    l_delivery_id          NUMBER;
    l_delivery_detail_id   NUMBER;

--   MO_GLOBAL.init('ONT');
    l_init_msg_list        VARCHAR2(1000);
    l_return_status        VARCHAR2(1000);
    l_msg_count            NUMBER;
    l_msg_data             VARCHAR2(1000);
    l_trip_id              VARCHAR2(1000);
    l_trip_name            VARCHAR2(1000);
    v_counter              NUMBER;
    p_api_version          NUMBER;
    p_init_msg_list        VARCHAR2(200);
    p_commit               VARCHAR2(200);
    p_validation_level     NUMBER;
    p_tabofdeldets         apps.wsh_delivery_details_pub.id_tab_type;
    p_action               VARCHAR2(200);
    p_delivery_id          NUMBER;
    p_delivery_name        VARCHAR2(200);
    p_count                NUMBER;
    v_context              VARCHAR2(100);
    x_return_status        VARCHAR2(200);
    x_msg_count            NUMBER;
    x_msg_data             VARCHAR2(4000);
    CURSOR ignore_for_plan_cur IS SELECT DISTINCT
        wnd.organization_id,
        wnd.ship_method_code,
        wnd.status_code,
        wnd.name,
        wnd.delivery_id,
        wdd.delivery_detail_id
                                  FROM
        wsh_new_deliveries wnd,
        wsh_delivery_details wdd,
        fnd_lookup_values_vl flv,
        wsh_delivery_assignments wda
                                  WHERE
        wnd.organization_id =:p_org_id
        AND wnd.ignore_for_planning = 'Y'
        AND upper(flv.lookup_code) = upper(wnd.ship_method_code)
        AND flv.lookup_type = 'SHIP_METHOD'
        AND upper(flv.attribute1) <> upper('yes')
        AND wdd.released_status IN (
            'N',
            'R',
            'S',
            'Y',
            'B',
            'X'
        )
        AND upper(wnd.status_code) <> upper('CL')
        AND wda.delivery_id = wnd.delivery_id
        AND wda.delivery_detail_id = wdd.delivery_detail_id;
   -- AND wnd.DELIVERY_ID IN (126064);

BEGIN
    FOR ignore_plan_rec IN ignore_for_plan_cur LOOP

        fnd_file.put_line(fnd_file.log,'Unchecking the flag' || ignore_plan_rec.delivery_id);

wsh_deliveries_pub.delivery_action(
p_api_version_number => 1
,p_init_msg_list => l_init_msg_list
,x_return_status => l_return_status
,x_msg_data => l_msg_data
,x_msg_count => l_msg_count
,p_action_code => 'INCLUDE_PLAN'
,p_delivery_id => ignore_plan_rec.DELIVERY_ID
,p_delivery_name=>ignore_plan_rec.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_pickup_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_action_flag=> null
,p_sc_intransit_flag=> null
,p_sc_close_trip_flag=> null
,p_sc_create_bol_flag=> null
,p_sc_stage_del_flag=> null
,p_sc_trip_ship_method=> null
,p_sc_actual_dep_date=> null
,p_sc_report_set_id=> null
,p_sc_report_set_name=> null
,p_sc_defer_interface_flag=> null
,p_sc_send_945_flag=> null
,p_sc_rule_id=> null
,p_sc_rule_name=> null
,p_wv_override_flag=> null
,x_trip_id => l_trip_id
,x_trip_name => l_trip_name
);
    COMMIT;
    END LOOP;

    END;
END;