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

Control Break statement query

abdulazeez12
Active Contributor
0 Likes
618

Hi All

I have a requirement like this - there is an internal table IT1 with fld1 fld2. It is sorted in fld1 fld2 order. I want to append the fld1 fld2 entries in another internal table IT2 until there is a change in fld2. Whenever fld2 changes, I want to call a function module and pass internal table IT2. After the execution of function module, I want to refresh IT2. Again populate fld1 fld2 of internal table IT2 until fld2 changes and then call function module

Thanks

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
601

Hi,

you can do it like:

data:

g_fld2 type it1-fld2.

loop at IT1 into wa_it1.

if g_fld2 is initial. "IF 1

g_fld2 = wa_it1-fld2.

append wa_it1 to IT2.

else. "IF 1

if g_fld2 = wa_it1-fld2. "IF 2

append wa_it1 to IT2.

else. "IF 2

call function <FM you want to call with IT2>

refresh IT2.

clear g_fld2.

g_fld2 = wa_it1-fld2.

append wa_it1 to IT2.

endif. "IF 2

endif. "IF 1

endloop.

Edited by: Neha Shukla on Nov 19, 2008 1:47 PM

Edited by: Neha Shukla on Nov 19, 2008 1:47 PM

5 REPLIES 5
Read only

Former Member
0 Likes
601

HI,

You can do like this.

Loop at IT1.

AT New fld2.

"Cal your function module here to copy the fields "

clear fld2.

endat.

Endloop.

Regards

Mudit

Read only

Former Member
0 Likes
601

HI,

Sort the table on fld2.

Loop at Itab1.

append the data to itab2.

at end of fld2.

call the function module.

refresh itab2.

endat.

Endloop.

Edited by: avinash kodarapu on Nov 19, 2008 6:30 PM

Read only

Former Member
0 Likes
601

loop at it1 into wa1.

descibe table it2 lines v_line.

read table it2 into wa2 index v_line.

if sy-subrc = 0.

if wa1-fld1 <> wa2-fld2.

" Call FM.

refresh it2.

else.

append wa1 to it2.

endif.

endif.

endloop.

Read only

Former Member
0 Likes
601

hi srikar,

Use the control break as the at end of fid2 mean while u push all the records into the table 2 at the end of the fld 2 comes make the operation as pushing the whole rtable to function module. and refresh table 2 after getting the output. this process will help u.

regards,

Naresh

Read only

Former Member
0 Likes
602

Hi,

you can do it like:

data:

g_fld2 type it1-fld2.

loop at IT1 into wa_it1.

if g_fld2 is initial. "IF 1

g_fld2 = wa_it1-fld2.

append wa_it1 to IT2.

else. "IF 1

if g_fld2 = wa_it1-fld2. "IF 2

append wa_it1 to IT2.

else. "IF 2

call function <FM you want to call with IT2>

refresh IT2.

clear g_fld2.

g_fld2 = wa_it1-fld2.

append wa_it1 to IT2.

endif. "IF 2

endif. "IF 1

endloop.

Edited by: Neha Shukla on Nov 19, 2008 1:47 PM

Edited by: Neha Shukla on Nov 19, 2008 1:47 PM