Application Development and Automation 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: 
Read only

Output not displaying after 'WRITE' command

Former Member
0 Likes
3,601

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,272

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.

13 REPLIES 13
Read only

Former Member
0 Likes
2,272

In which event you are using write statement?

Read only

0 Likes
2,272

I am using in Start-of-selection. And my requirement is to do it in this event.

Regards,

Dikshitha

Read only

Former Member
0 Likes
2,272

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'

Read only

Former Member
0 Likes
2,272

Please try the same in end-of-selection event.

Read only

Former Member
0 Likes
2,273

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.

Read only

Former Member
0 Likes
2,272

Hi,

just use 'EXIT' after the write statement.

it would work fine.

Read only

0 Likes
2,272

Since this is inside a loop, exit will exit from the loop and not from the program to the output.

Regards,

Dikshitha

Read only

0 Likes
2,272

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

Read only

0 Likes
2,272

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.

Read only

Former Member
0 Likes
2,272

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

Read only

Former Member
0 Likes
2,272

Hi,

you need LEAVE TO LIST-PROCESSING before your write command.

Don't mistake LEAVE LIST-PROCESSING for LEAVE TO LIST-PROCESSING.

Regards,

Klaus

Read only

0 Likes
2,272

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.

Read only

0 Likes
2,272

Thanks for all your replies.

I used the flag suggestion and its working for me. Thanks a lot !

Regards,

Dikshitha G