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: 

Better to use 'WAIT UP TO...' or 'ENQUE_SLEEP'?

former_member201275
Active Contributor
0 Kudos

Hi,

I am looping on and processing IDOCS, i.e.:

LOOP AT lt_edidc INTO ls_edidc.
SUBMIT rbdapp01

WITH docnum = ls_edidc-docnum
AND RETURN.

*   wait up to 100 seconds.

*    CALL FUNCTION 'ENQUE_SLEEP'
*      EXPORTING
*        seconds              = 100.

ENDLOOP.

When the SUBMIT is executed I would like it to finish processing the IDOC before it commences with the next one.

Is it better/safer (in my case above) to use 'WAIT UP TO 100 SECONDS' or to use the 'ENQUE_SLEEP' function?

1 ACCEPTED SOLUTION

Clemenss
Active Contributor
0 Kudos

Hi Glen,

the use of WAIT .. UP TO ... is never a good idea.

It is a program interruption (as i.e. any RFC call) that triggers an implicit database commit - which is not always wanted.

Better create a endless loop and try to enqueue the object (i.e. idoc) that is currently locked because it is being processed. Exit the loop after successfully enqueueing, then dequeue, then continue.

Regards

Clemens

6 REPLIES 6

raymond_giuseppi
Active Contributor
0 Kudos

Look at second tab of the selection screen of the report, did you try to set the indicator "Wait for end of processing" ?

Regards,

Raymond

0 Kudos

Hi Raymond,

Yes I did see that but I don't think it will make a difference in my case as in each loop in my program I am only submitting one IDOC anyway so when RBDAPP01 is executed it will be for only one IDOC. And then when the loop is processed it will create another session for the next IDOC.

I may be wrong though... I will give this a try and see.

Thank you.

Former Member
0 Kudos

Hi Glen,

My suggestion would be check the status of IDOC within a DO..ENDDO statement. Some IDOCS may take a longer time to process, while some may process within seconds.

DO.

<Check the status of the IDOC. Select STATUS from EDIDC.>

If <STATUS EQ 64 "IDOC is not processed">

WAIT FOR 10 SECONDS.

ELSE.

EXIT.

ENDDO.

Cheers

~Niranjan

0 Kudos

Hi Niranjan,

Thank you for suggestion.

I think it is a good idea to check for status, but I am a bit reluctant to use the 'wait for 10 seconds' as everything I read about this statement suggest not to use it.

0 Kudos

Hi Glen,

Since the requirement is to finish processing the IDOC before it commences with the next one, i suggested this option. You may reduce the wait seconds to 1. It would be better to have a discussion with the BASIS team to determine the load of your production system and then decide on the WAIT seconds.

Cheers

~Niranjan

Clemenss
Active Contributor
0 Kudos

Hi Glen,

the use of WAIT .. UP TO ... is never a good idea.

It is a program interruption (as i.e. any RFC call) that triggers an implicit database commit - which is not always wanted.

Better create a endless loop and try to enqueue the object (i.e. idoc) that is currently locked because it is being processed. Exit the loop after successfully enqueueing, then dequeue, then continue.

Regards

Clemens