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: 

About BAPI_PRODORDCONF_CREATE_TT and releasing Reservation

Flavio
Active Contributor
0 Kudos

Dear Friends at SCN,

I have the following problem when using the bapi BAPI_PRODORDCONF_CREATE_TT, that is called several times in the same program:

the first run completes successfully, and then there is a call to BAPI_TRANSACTION_COMMIT.

with the second, and the remaining ones, usually the BAPI returns an error saying 'Reservation xxxxx is already being processed'.

I believe I should release the Reservation, after the first bapi call, and before the next one, but how to achieve that?

Do you have a clue how to avoid this error appearing?

Thanks a lot for any help or suggestion on this.

Bye,

Flavio

1 ACCEPTED SOLUTION

nabheetscn
Active Contributor

Are you trying to create multiplereservations? if yes please make sure you have put in a wait for 1or 2 seconds please have cleared all the bapi parameters after the call of BAPI.

Nabheet

5 REPLIES 5

nabheetscn
Active Contributor

Are you trying to create multiplereservations? if yes please make sure you have put in a wait for 1or 2 seconds please have cleared all the bapi parameters after the call of BAPI.

Nabheet

Flavio
Active Contributor
0 Kudos

Hi Nabheet,

Thank you for your answer.

I just tried adding a WAIT UP TO 2 SECONDS and a clear / refresh of bapi parameters (after the call), but the error message is still appearing.

Do you have any other idea for this?

Thanks again!

Bye,

Flavio

Flavio
Active Contributor
0 Kudos

Solved:

before calling the BAPI, just added a locking check on Reservation (by means of ENQUEUE_EMRESB and DEQUEUE_EMRESB FM's, in a 60 sec's time-limited loop), that proved to be successful.

Thank you and bye

Flavio

0 Kudos

Hello Flavio,

I have the same problem as you have already experienced. Could you, please, give me a little detail that I managed to implement this function.

thank you,

Stephane

Flavio
Active Contributor
0 Kudos

Hi Stéphane,

Here is the code I used, just before calling the BAPI:

  DATA: l_lock(1) TYPE c,

        l_while  TYPE i.

* Check if Reservation is locked, if yes wait for unlocking

  l_lock = 'X'.

  l_while = 0.

  WHILE l_lock = 'X'.

    CALL FUNCTION 'ENQUEUE_EMRESB'

      EXPORTING

        mode_resb      = 'E'

        rsnum          = l_rsnum

      EXCEPTIONS

        foreign_lock  = 1

        system_failure = 2

        OTHERS        = 3.

    IF sy-subrc <> 0.

      l_lock = 'X'.

      WAIT UP TO 1 SECONDS.

      l_while = l_while + 1.

    ELSE.

      CLEAR l_lock.

      CALL FUNCTION 'DEQUEUE_EMRESB'

        EXPORTING

          mode _resb    = 'E'

          rsnum        = l_rsnum.

      EXIT.

    ENDIF.

    IF l_while = 60.

      EXIT.

    ENDIF.

  ENDWHILE.



I hope it will help.....


Thank you and bye,


Flavio