cancel
Showing results for 
Search instead for 
Did you mean: 

BAPI_POSRVAPS_CREATESNPORDER to change existing order

Former Member
0 Kudos

Hi Experts,

I am using the following code to change the Deployment results - Confirmed Stock Transfer Requisition (EG and EF).

After SNP heuristics run, the standard SAP deployment run happens. Then, a stock transport order with reference to production order is created without reference to stock transport requisition or confirmed stock transfer requisition. So, to consume or reduce this confirmed STR quantity, I am using the following code. But the issue is, the date of the confirmed stock transfer requisition gets changed after this BAPI FM. I don't want the date to be changed. Does anyone have any idea of how to just change the quantity, but not to change the dates?

CALL FUNCTION 'BAPI_POSRVAPS_CREATESNPORDER'

EXPORTING

logical_system         = 'SAPXXX113'    " My current SAP APO system

APPLICATION            = 'DEP'        " Changing Deployment orders

EXT_NUMBER_ASSIGNMENT  = ' '        " I use ORDERID, instead of the order

COMMIT_CONTROL         = 'E'        " Commit only on successful completion

PLNG_VERSION           = '000'        " Active planning version

change_if_exists       = 'X'        " If it exists, then change the same. If not create it.

EVENT_CONTROL          = '1'        " To update the ERP system too

CHECK_SOURCE_EXISTENCE = 'X' "To check and return error if the source doesn't exist

TABLES

order_data             = lt_order_data    " Data to be updated

return                 = lt_return.    " Return message of BAPI update

For filling the internal table lt_order_data, I am using the function module BAPI_POSRVAPS_GETLIST3.

* Update fields for BAPI Update

ls_order_data-ordid         = ls_requirements-ordid.        " ORDID from BAPI_POSRVAPS_GETLIST3

ls_order_data-schedid       = ls_requirements-schedid.        " SCHEDID from BAPI_POSRVAPS_GETLIST3

ls_order_data-order_number  = ls_requirements-order_number.    " Order number from BAPI_POSRVAPS_GETLIST3

ls_order_data-product       = '4280143180'.            " Part number from BAPI_POSRVAPS_GETLIST3

ls_order_data-location_from = 'HGKG'.                   " From Location number from BAPI_POSRVAPS_GETLIST3

ls_order_data-loctype_from  = '1001'.                     " From location type from BAPI_POSRVAPS_GETLIST3

ls_order_data-location_to   = 'SGPR'.                    " To location number from BAPI_POSRVAPS_GETLIST3

ls_order_data-loctype_to    = '1001'.                      " To location type from BAPI_POSRVAPS_GETLIST3

ls_order_data-ttype         = ls_receipts-ttype.         " TTYPE from BAPI_POSRVAPS_GETLIST3

ls_order_data-unitofmeas    = ls_requirements-unitofmeas.

ls_order_data-unitofmeas_iso = ls_requirements-unitofmeas.

ls_order_data-order_start_date = ls_requirements-requirement_date. "What date to use here? Whatever the date I give it changes the already existing date. I don't want the dates to be changed

ls_order_data-order_end_date   = ls_requirements-requirement_date.

ls_order_data-fixed             = ls_requirements-fixed.

clear: ls_order_data-atpcat_from, ls_order_data-atpcat_to, ls_order_data-trans_priority.

Thanks,

Suresh

Accepted Solutions (1)

Accepted Solutions (1)

Former Member

Hi Experts,

This is not the suggested FM from SAP. It is not released for usage. Instead I used BAPI_POSRVAPS_SAVEMULTI3 and the EXTENSION_IN table parameter should hold  ORDKEY_APPLI_SNP. Both the Receipts and Requirements internal tables should be filled for the Deployment orders. Order Id, Order number, Item number and schedule lines are filled on both the internal tables (these details are obtained from BAPI_POSRVAPS_GETLIST3 with IO_NODE_SELECTION = 'I'.

And it works

Best Regards,

Suresh

former_member216565
Participant
0 Kudos

Hi Suresh,

I have just come across your query. For your knowledge, I wanted you to know that the bapi 'BAPI_POSRVAPS_CREATESNPORDER' can still be used for your purpose i.e changing the Deployment STR Confirmed  Qty without changing Order Dates.

To acheive this,

1) Pass 'SNP' in the application parameter in the bapi 'BAPI_POSRVAPS_CREATESNPORDER'.

2) Pass the order dates from the bapi 'BAPI_POSRVAPS_GETLIST3', which you wanted to retain, to 'Order_start_date','Order_end_date',of bapi 'BAPI_POSRVAPS_CREATESNPORDER' but with different quantity.

3) However,i suggest you to not to pass ATPCAT_FROM and ATPCAT_TO fields to ORDER_DATA in the bapi 'BAPI_POSRVAPS_CREATESNPORDER'. I found this during debugging the bapi as it is repeatedly failing to update the deployed STR(Confirmed).

Please find attached screenshot of ORDER_DATA structure for your reference.

try these. It does work!!

Thank you,

Santosh KB.

Former Member
0 Kudos

Hi Santhosh,

Yup. I agree. But if order doesn't exist, then it would attempt to create it. And we can't control it using this BAPI. Also, I have tried using SNP too. Had some issues with that too, but can't remember.

Thanks,

Suresh

former_member216565
Participant
0 Kudos

Hi Suresh,

I suppose, the bapi wont create orders incase it is not existing, because as you will be populating the order_data table with ordid and ordno, meaning, you can populate only when you have an order on hand. If the order doesnt exists, it wont create.

Anyways,as you got the solution through some other means, i am writing, for the matter of knowledge sharing.

Thanks,

Santosh KB.

Answers (0)