Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Internal order getting updated even if it is open in KO02

vinay_pasalkar
Participant
0 Kudos

Hi,

I am modifying an Internal order using ALE_INTERNALORDER_DB_CHANGE & status of Internal order using STATUS_CHANGE_INTERN_VB.

Now sometimes when the Internal order which is being updated through my program is also open in KO02, even then program update the internal order rather than giving error.

Could you please let me know, How can I produce an error that Internal order is locked before updating the Internal order.

Thanks

Vinay

1 ACCEPTED SOLUTION

alex_campbell
Contributor
0 Kudos

FM ALE_INTERNALORDER_DB_CHANGE is a very low level FM used internally by SAP. It is not documented and not released for customer use, so I would HIGHLY recommend not using it in your custom development. I suggest instead using FM BAPI_INTERNALORDER_SAVEREPLICA. This FM is documented, and released for customer use. Furthermore, it does consistency checks, validation, and it appears to even do the locking check that you've asked about. It also probably does status updates, so you shouldnt need to call STATUS_CHANGE_INTERN_VB (which is also undocumented and not released).

In the future, always look for BAPIs for this type of functionality. Only in very, very rare circumstances should you use undocumented, not released FMs.

6 REPLIES 6

alex_campbell
Contributor
0 Kudos

FM ALE_INTERNALORDER_DB_CHANGE is a very low level FM used internally by SAP. It is not documented and not released for customer use, so I would HIGHLY recommend not using it in your custom development. I suggest instead using FM BAPI_INTERNALORDER_SAVEREPLICA. This FM is documented, and released for customer use. Furthermore, it does consistency checks, validation, and it appears to even do the locking check that you've asked about. It also probably does status updates, so you shouldnt need to call STATUS_CHANGE_INTERN_VB (which is also undocumented and not released).

In the future, always look for BAPIs for this type of functionality. Only in very, very rare circumstances should you use undocumented, not released FMs.

0 Kudos

Hi Alex,

I tried BAPI_INTERNALORDER_SAVEREPLICA before

using ALE_INTERNALORDER_DB_CHANGE & STATUS_CHANGE_INTERN_VB.

I could not find any example wherein it is explained how BAPI_INTERNALORDER_SAVEREPLICA  can be used to change an existing Internal order & it's status.

I tried to do the Where used list, but in all those example ALE scenario was used.

Could you please let me know how a existing Internal order can be modified using the BAPI_INTERNALORDER_SAVEREPLICA, so that I can try if it gives the lock error when the Internal Order is open in KO02.

Thanks

Vinay

raymond_giuseppi
Active Contributor
0 Kudos

Lock the record before calling the FM or look at the OBJECTSTATUS parameter of BAPI_INTERNALORDER_SAVEREPLICA.

To identify the ENQUEUE FM, just call KO02 and execute SM12...

(Spoiler, select to highlight: ENQUEUE_ESORDER)

Regards,

Raymond

0 Kudos

Hi Raymond,

I need to update all the fields of internal order instead of only status of it.

I did searched for BAPI_INTERNALORDER_SAVEREPLICA  & it's where used list however did not get any example for the same.

Can you please give me the mandatory fields to be passed to the BAPI or any example for the same in order to update the Internal order.

Thanks

Vinay

0 Kudos

You have to perform some try and check, as the mandatory fields are partially dependant on your customizing (can depend on order type)

Nevertheless, you can first call BAPI_INTERNALORDER_GETDETAIL to get current values.

Regards,

Raymond

vinay_pasalkar
Participant
0 Kudos

Hi Alex / Raymond,

I tried to use the BAPI BAPI_INTERNALORDER_SAVEREPLICA however it seems that it does not change the Existing Internal order in same Logical system.

Have you seen any example wherein BAPI_INTERNALORDER_SAVEREPLICA is used for changing the Internal Order in the Same Logical system.

Because when I debugged the BAPI, Input Logical system is mandatory field & In the runtime when the Input Logical system is diffrent than the Current Logical system, BAPI BAPI_INTERNALORDER_SAVEREPLICA gives error & it exits without proceeding further.

* error, if logical system of order is not filled

  IF P_AUFK-LOGSYSTEM IS INITIAL

  OR P_AUFK-LOGSYSTEM = L_CURRENT_LOGSYSTEM.

    P_SUBRC = 1.

    WRITE P_AUFK-AUFNR TO SY-MSGV1.

    PERFORM APPEND_RETURN TABLES PT_RETURN

                          USING 'E'

                                '2075ALE'

                                '011'

                                SY-MSGV1

                                SPACE SPACE SPACE.

*   message e011(2075ALE).

    EXIT.  "FORM

Thanks

Vinay