Thursday, August 13, 2015

check model bill similarity check in bulk

---------Block to submit BOM SIM and publication concurrent reqst-----------------
DECLARE
  CURSOR BOMSIM_PUBLCTN_CURSOR
  IS
    SELECT pn.name model_name,
      rp.name Description,
      rp.enclosing_folder folder_id,
      pn.devl_project_id model_id
    FROM cz_ps_nodes pn,
      cz_rp_entries rp
    WHERE pn.ps_node_id = rp.object_id
    AND rp.deleted_flag = 0
    AND rp.object_type  = 'PRJ'
    AND rp.name NOT LIKE 'Copy%'
    AND (pn.name        like 'MODEL-%')
    AND pn.deleted_flag = 0
    order by pn.name;
  V_inputdata BOMSIM_PUBLCTN_CURSOR%rowtype;
  ln_request_id NUMBER;
BEGIN
  -- Initialize Apps
  fnd_global.apps_initialize (1848 ,22687 ,708 );
  OPEN BOMSIM_PUBLCTN_CURSOR;
  FETCH BOMSIM_PUBLCTN_CURSOR INTO V_inputdata;
  WHILE BOMSIM_PUBLCTN_CURSOR%FOUND LOOP
    --DBMS_OUTPUT.PUT ('Model name '||V_inputdata.Model_Name);
    --DBMS_OUTPUT.PUT (', Folder '||V_inputdata.Folder_ID);
    --DBMS_OUTPUT.PUT_LINE (', Model ID is '||V_inputdata.Model_ID);
    ln_request_id := fnd_request.submit_request ('CZ' ,--IN VARCHAR2 DEFAULT NULL,                -- application
    'CZBOMSIM',                                        -- IN VARCHAR2 DEFAULT NULL,-- program short name
    '',                                                -- description
    '',                                                -- start time
    FALSE,                                             -- IN BOOLEAN DEFAULT FALSE,                -- sub request
    'PROD',                                         -- IN VARCHAR2 DEFAULT CHR (0),          -- argument1
    V_inputdata.Folder_ID,                                          -- IN VARCHAR2 DEFAULT CHR (0),          -- argument2
    V_inputdata.Model_ID,                                -- IN VARCHAR2 DEFAULT CHR (0),                  -- argument3
    CHR (0)                                            -- represents end of arguments
    );
    COMMIT;
    dbms_output.put_line ('l' ||ln_request_id || '.req' || ',' || V_inputdata.Model_Name || ',' || V_inputdata.Description ||',' ||
      V_inputdata.Folder_ID || ',' ||
      V_inputdata.Model_ID ||',' || ln_request_id );
    IF ln_request_id = 0 THEN
      dbms_output.put_line ('Concurrent request failed to submit');
    END IF;
    FETCH BOMSIM_PUBLCTN_CURSOR into V_inputdata;
  END LOOP;
  END;
  ------------------------------------------------------------------------------------------


No comments:

Post a Comment