‎2011 May 26 5:35 AM
Hi friends,
I have to display messages in a program. The problem is that after the 'Write' command there is more data processing. Once the write statement is encountered I want the program to display the messages and not go ahead with further processing. I tried using leave program, leave to screen 0 and leave list-processing but all these do not take me to the output screen.
Can someone please help me with this.
Thanks,
Dikshitha G
‎2011 May 26 6:28 AM
Hi,
You can try with statement MESSAGE with type I instead of WRITE if you want to populate the messages. After message statement do not write LEAVE TO LIST-PROCESSING. This will continue further processing of code.
Or else you can put a flag after the WRITE statement. After the statement check the flag to decide whether to proceed processing or not.
for eg:
WRITE 'HELLO'.
FLAG = 'X'.
CHECK FLAG is INTIAL.
‎2011 May 26 5:37 AM
‎2011 May 26 5:45 AM
I am using in Start-of-selection. And my requirement is to do it in this event.
Regards,
Dikshitha
‎2011 May 26 5:50 AM
Try to call SAP EASY access prg and screen number..
try to use like this FM ......for calling dynpro....not exatly this but you can try someother FM CALL FUNCTION 'DYNP_VALUES_READ'
‎2011 May 26 6:18 AM
‎2011 May 26 6:28 AM
Hi,
You can try with statement MESSAGE with type I instead of WRITE if you want to populate the messages. After message statement do not write LEAVE TO LIST-PROCESSING. This will continue further processing of code.
Or else you can put a flag after the WRITE statement. After the statement check the flag to decide whether to proceed processing or not.
for eg:
WRITE 'HELLO'.
FLAG = 'X'.
CHECK FLAG is INTIAL.
‎2011 May 26 6:31 AM
Hi,
just use 'EXIT' after the write statement.
it would work fine.
‎2011 May 26 6:45 AM
Since this is inside a loop, exit will exit from the loop and not from the program to the output.
Regards,
Dikshitha
‎2011 May 26 6:51 AM
Hi,
before exit statement use some counter.
once flow come out of loop.
check for the counter. if counter is checked, use 'Return' statement
loop at itab.
c = 'X'.
exit.
endloop.
if c = 'X'.
return.
endif.
Regards
Dande
‎2011 May 26 6:52 AM
Hi,
Check the below ..
start-of-selection.
clear : v_flag .
loop at ....
if <some condition> ....
write : 'message'.
v_flag = 'X'.
exit.
endif.
endloop.
if v_flag is initial.
process further ....
endif.
Regards,
Srini.
‎2011 May 26 6:44 AM
Hi,
Please check this code, it will help you in resolving the issue.
parameters: p type matnr.
start-of-selection.
if p is initial.
message 'Test' type 'I'.
return.
else.
write p.
endif.
Regards
Dande
‎2011 May 26 6:59 AM
Hi,
you need LEAVE TO LIST-PROCESSING before your write command.
Don't mistake LEAVE LIST-PROCESSING for LEAVE TO LIST-PROCESSING.
Regards,
Klaus
‎2011 May 26 7:15 AM
Hi,
Leave to list processing also wont help.It would just print your basic list in the end and contuinue with processing.
BEst option is, set a flag.And then use exit.
Once you are out of the loop.
CHeck if flag is set, then again use exit to exit program. or use check statement.
‎2011 May 26 9:44 AM
Thanks for all your replies.
I used the flag suggestion and its working for me. Thanks a lot !
Regards,
Dikshitha G