‎2006 Nov 24 10:05 AM
We are facing a problem with clearing the write statement buffer.
Our aim is to send mail by compressing the list memory, and the mail is sent in a loop. In each loop we have different set of data to be sent. But problem here is in the mails after the first mail, the data is getting appended in the subsequent mails.
For example,
do 10 times.
*****Have to clear buffer here*****
write 😕 hi.
perform sendmail.
enddo.
The above code should give ten emails...with only "hi". In other words, the list output should be only one "hi" and not 10 times hi. WE have tried all possibilites to clear the write buffer, Any help in this regard is highly appreciated.
‎2006 Nov 24 10:10 AM
<b>Hi
U can use the following logic
do ctr times. "Define a counter varible and assign it to 10.
*****Have to clear buffer here*****
if sy-index = ctr.
write 😕 hi.
endif.
perform sendmail.
enddo.
It will only print Hi once when the last stmt will be executed.
Mark points if helpful.
Regs
Manas Ranjan Panda.</b>
‎2006 Nov 24 10:07 AM
simple.
data : ch(10) default 'HI'. => out side the loop
do 10 times.
perform sendmail.
enddo.
rgds
Anver
‎2006 Nov 24 10:07 AM
I think the internal table you are passing to send mail function should be refreshed once you send the mail.
‎2006 Nov 24 10:10 AM
Hi aakash,
1. use MODIFY LINE concept,
to modify the line number 1
(so that line 1 is RE-WRITTEN there itself,
instead of line 2, 3, 4,..etc)
2. just copy paste
3. It will give only 1 HI, in 10 loops.
4.
report abc.
DATA : MSG(100) TYPE C.
MSG = 'HI'.
DO 10 TIMES.
IF SY-INDEX = 1.
WRITE 😕 MSG.
ELSE.
MODIFY LINE 1 LINE VALUE FROM MSG.
ENDIF.
ENDDO.
regards,
amit m.
‎2006 Nov 24 10:10 AM
<b>Hi
U can use the following logic
do ctr times. "Define a counter varible and assign it to 10.
*****Have to clear buffer here*****
if sy-index = ctr.
write 😕 hi.
endif.
perform sendmail.
enddo.
It will only print Hi once when the last stmt will be executed.
Mark points if helpful.
Regs
Manas Ranjan Panda.</b>