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: 

counter

Former Member
0 Kudos

Hi Frnds,

In my selection-screen i have few fields and a email button.

when i click on the email button it asks for email id.

then i execute the report.the output is send to the person.

now i have created a ztable which store some data along with

no of times the email has been sent.

how to work out for this..hope the counter loop can be used.

if counter how to work!!

tnx..

4 REPLIES 4

Former Member
0 Kudos

HI,

Fetch the Data from the Z table and Also the Number of times Value in Variable VAR

Apply the Value in

DO VAR Times.

Code to Send MAil.

Enddo.

Regards

Sumit Agarwal

sachin_mathapati
Contributor
0 Kudos

Hi ,

Try this...

select * from ztable into table tb_email where mail = e-mail-id.

If sy-sybrc ne 0.

Update the required data in your Ztable with counter = 1.

Else.

sort tb_email ascending by counter .

read table tb_email into wa_email index 1.

wa_email-counter = wa_email-counter + 1.

modify tb_email from wa_email index 1 tranporting counter.

Endif.

Now modify the Ztable from tb_email.

Regards,

Sachin M M

Former Member
0 Kudos

Hi,

here is the algorithm for ur requirement

when user clicks send email button,

1) Fetch the no_of_times field from ZTABLE into lv_counter

2) Send the email now.

3) if its successfully sent,

ADD 1 to lv_counter.

4) UPDATE ZTABLE SET no_of_times = lv_counter WHERE <condition>

Hope this helps.

Cheers,

Kothand

kiran_k8
Active Contributor
0 Kudos

Rudra,

Generate a number everytime you send a mail and store the number and the mail id along with the other data in the ztable.To generate a number you can use the function module

GET_NEXT_NUMBERS.

K.Kiran.