2 Replies Latest reply on Dec 12, 2009 8:35 AM by 578444

    Closing old PO's API

    740146
      Hi, I am new to oracle apps and coding and am working on the API to close old PO's.When I tried to execute the API it executes without errors but it is actually not closing the PO.Also how can i see what x_return_code holds?Pls help ASAP

      DECLARE
      x_return_code VARCHAR2(200);
      l_result BOOLEAN;
      l_session_id NUMBER;
      BEGIN
      dbms_output.put_line('processing started .....');
      Select Sid
      into l_session_id
      from v$mystat where rownum = 1;
      dbms_output.enable();
      fnd_client_info.set_org_context(103);
      Fnd_Global.INITIALIZE(l_session_id, 0, 20707,201 ,0, -1, 1/*login_id*/, -1, -1, -1, -1, null,null,null,null,null,null,-1);
      l_result:= PO_ACTIONS.CLOSE_PO(
      P_DOCID => 2110,
      P_DOCTYP => 'PO',
      P_DOCSUBTYP => 'STANDARD',
      P_LINEID => NULL,
      P_SHIPID => NULL,
      P_ACTION => 'CLOSE',
      P_CALLING_MODE => 'PO',
      P_REASON => 'Testing',
      P_CONC_FLAG => 'N',
      P_RETURN_CODE => x_return_code,
      P_AUTO_CLOSE => 'N',
      P_ACTION_DATE => SYSDATE
      --P_ORIGIN_DOC_ID => NULL
      );
      IF l_result then
      dbms_output.put_line('The Closure was successful');
      ELSE
      dbms_output.put_line('The Closure was unsuccessful');
      END IF;
      END;

      The dbms output :

      processing started .....

      The Closure was unsuccessful