Sunday, September 17, 2017

Enable Backdate/ Future Date Document Sequence In Order Management

Business Case :
Oracle standard numbering for Sales Order is maintained by document sequence, and it is not possible for backdate / future date numbering. Numbering will always refer to sysdate, not the Quote Date or Date Ordered.
But it can be modified by editing standard package OE_HEADER_UTIL :

1.      Type the package name in TOAD, then press F4, like screenshot below :

2.      Copy all the package body to TOAD

3.      Dont forget to save file as backup, in case some error happens

4.      After saving backup file, start editing by pressing CTRL + G to find the desired line

Line 7895 – 7909 :
           x_result :=   fnd_seqnum.get_seq_info(
                                             660,
                                             x_doc_category_code,
                                             x_set_of_books_id,
                                             null,
                                             sysdate,
                                             X_doc_sequence_id,
                         x_doc_sequence_type,
                         x_doc_sequence_name,
                                             X_db_sequence_name,
                             seqassid,
                         X_Prd_Tbl_Name,
                         X_Aud_Tbl_Name,
                         X_Msg_Flag
                                             );

Line 7924 – 7933 :
                X_result := fnd_seqnum.get_seq_val(
                                                660,
                                                x_doc_category_code,
                                                x_set_of_books_id,
                                                null,
                                                sysdate,
                        x_doc_sequence_value,
                                                X_doc_sequence_id,
                        'Y',
                        'Y');
From those 2 functions, we can see the parameter is SYSDATE, that’s why backdate / future date is not possible. So, we should change the parameter into :
NVL(p_x_header_rec.QUOTE_DATE, p_x_header_rec.ORDERED_DATE)
which means the parameter will refer to quote date / ordered date. After changed, the function will be :
Line 7895 – 7909 :
           x_result :=   fnd_seqnum.get_seq_info(
                                             660,
                                             x_doc_category_code,
                                             x_set_of_books_id,
                                             null,
                                             NVL(p_x_header_rec.QUOTE_DATE, p_x_header_rec.ORDERED_DATE),
                                             X_doc_sequence_id,
                         x_doc_sequence_type,
                         x_doc_sequence_name,
                                             X_db_sequence_name,
                             seqassid,
                         X_Prd_Tbl_Name,
                         X_Aud_Tbl_Name,
                         X_Msg_Flag
                                             );

Line 7924 – 7933 :
                X_result := fnd_seqnum.get_seq_val(
                                                660,
                                                x_doc_category_code,
                                                x_set_of_books_id,
                                                null,
                                                NVL(p_x_header_rec.QUOTE_DATE, p_x_header_rec.ORDERED_DATE),
                        x_doc_sequence_value,
                                                X_doc_sequence_id,
                        'Y',
                        'Y');

After editing, we have to compile the package body by pressing F9, after that backdate / future date Sales Order numbering is enabled.

No comments: