‎2010 Mar 28 6:38 PM
Hi,
My program has to be wait in particular line based on condition.
The condition is If this program is running already in another instance, this program has to be wait
till that instance is finished its processing
How can i do this ?
Regards
Ramakrishna L
‎2010 Mar 28 8:51 PM
Hello Rama
Based on this particular condition your report has to set a lock entry.
For example, the lock object E_RSCATGLX is explictly used to "Lock Report RSCATGLX Against Parallel Execution".
You could "abuse" this lock object by simply using your report name as argument.
Thus, you logic could look like this:
...
START-OF-SELECTION.
DO.
CALL FUNCTION 'ENQUEUE_E_RSCATGLX'
EXPORTING
RSCATGLX = <name of your report>
EXCEPTIONS
FOREIGN_LOCK
SYSTEM_FAILURE.
IF ( syst-subrc = 0 ).
EXIT. " leave DO loop
ELSE.
WAIT UP TO 5 SECONDS.
ENDIF.
ENDDO.
...
Of course you should define a time-out (e.g. 100x 5 seconds) to avoid an endless loop in case that the foreign lock is never removed.
Regards
Uwe
‎2010 Mar 29 7:34 AM
data : prg type INDX-SRTFD value 'ZTEST1_CHECJ'.
if count ne 1.
endif.
do.
CALL FUNCTION 'ENQUEUE_ESINDX'
EXPORTING
MODE_INDX = 'E'
MANDT = SY-MANDT
RELID = 'ZZ'
SRTFD = prg " program name
SRTF2 =
X_RELID = ' '
X_SRTFD = ' '
X_SRTF2 = ' '
_SCOPE = '2'
_WAIT = ' '
_COLLECT = ' '
EXCEPTIONS
FOREIGN_LOCK = 1
SYSTEM_FAILURE = 2
OTHERS = 3
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
else.
exit.
ENDIF.
can i use this ?
If it is use can i give function module name in the SRTFD field instead of program name?
Regards
Ramakrishna L
‎2010 Mar 29 7:19 AM
Along with this you should also use the parameter wait = 'X' in the call function which waits for some time to check if the lock gets released and rest the above process is fine.