API To Cancel Discrete Jobs
API To Cancel Discrete Jobs
8) */
DECLARE
v_wo_rec wip_job_schedule_interface%ROWTYPE;
v_wo_comp_rec wip_job_dtls_interface%ROWTYPE;
v_user_id NUMBER := 10210;
v_resp_id NUMBER := 51233;
v_resp_appl_id NUMBER := 401;
v_organization_id NUMBER := 1504;
v_group_id NUMBER;
v_header_id NUMBER;
x_error_status VARCHAR2 (20);
x_error_message VARCHAR2 (2000);
CURSOR wip_entity_cur
IS
SELECT wip_entity_id
FROM wip_entities
WHERE organization_id = 1504
AND wip_entity_name IN (
SELECT job_number
FROM apps.cco_iw004_wo_stg_t wo
WHERE ( UPPER (line_type) = 'xxxx'
OR item_type IN ('xxxxx')
)
AND wo.item_number IN (
SELECT DISTINCT man.item_number
FROM apps.cco_iw007_sd_stg_t man
WHERE NOT EXISTS (
SELECT *
FROM apps.bom_bill_of_materials
WHERE organization_id = 1504
AND assembly_item_id =
man.item_id)
AND man.status = 'E'));
-- and wo.status = 'E'"
BEGIN
fnd_global.apps_initialize (user_id => v_user_id,
resp_id => v_resp_id,
resp_appl_id => v_resp_appl_id
);
SELECT wip.wip_job_schedule_interface_s.NEXTVAL
INTO v_group_id
FROM DUAL;
--
v_wo_rec.last_update_date := SYSDATE;
v_wo_rec.last_updated_by := v_user_id;
v_wo_rec.creation_date := SYSDATE;
v_wo_rec.created_by := v_user_id;
v_wo_rec.last_update_login := -1;
--
/*------------------------------------------------
If set to N, must provide requirements manually
any values other than N or n are assumed to be Y
-------------------------------------------------*/
--v_wo_rec.allow_explosion := 'Y'
v_wo_rec.load_type := 3; --Update standard or non-standard Discrete Job
/*------------------------------------------------
WIP_LOAD_TYPE MFG_LOOKUPS
1 Create Standard Job
2 Create Repetitive Schedule
3 Update Discrete Job
4 Create Nonstandard Job
-----------------------------------------------*/
v_wo_rec.process_phase := 2; --Validation
v_wo_rec.process_status := 1; --Pending
v_wo_rec.GROUP_ID := v_group_id;
v_wo_rec.header_id := v_header_id;
v_wo_rec.wip_entity_id := get_rec.wip_entity_id;
v_wo_rec.organization_id := v_organization_id;
v_wo_rec.status_type := 7; ---CANCELLED
--
INSERT INTO wip_job_schedule_interface
VALUES v_wo_rec;
COMMIT;
END LOOP;
--API
wip_massload_pub.massloadjobs (p_groupid => v_group_id,-- Group ID
p_validationlevel => 2, -- Validation Level
p_commitflag => 1,-- Commit 1 =Yes , 0
='No'
x_returnstatus => x_error_status,
x_errormsg => x_error_message
);
COMMIT;
DBMS_OUTPUT.put_line ('x_returnstatus:' || x_error_status);
DBMS_OUTPUT.put_line ('x_errormsg:' || x_error_message);
END;