Thursday, April 24, 2014

Oracle Ebusiness -- Reserve Document sequence number for external system (portal/websites)


Purpose: How to reserve order numbers/ invoice numbers with external system to use. This will help to keep single number across the system.


SET serveroutput ON;
DECLARE
  x_doc_sequence_value NUMBER;
  X_doc_sequence_id    NUMBER;
  x_reuslt             NUMBER;
BEGIN
  fnd_global.apps_initialize (-1, 213322, 660);
  x_reuslt := fnd_seqnum.get_seq_val( 660, -- application id
  TO_CHAR(10),                          -- category code from FND_DOC_SEQUENCE_ASSIGNMENTS
  100,                                    -- Set of Books
  NULL, sysdate, x_doc_sequence_value, X_doc_sequence_id, 'Y', 'Y');
  DBMS_OUTPUT.PUT_LINE('x_doc_sequence_value:'||x_doc_sequence_value);
  DBMS_OUTPUT.PUT_LINE('X_doc_sequence_id:'||X_doc_sequence_id);
  DBMS_OUTPUT.PUT_LINE('x_result:'||x_reuslt);
END;


No comments: