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

clear collected value

Former Member
0 Likes
757

hi

after the collect statement, may i know what is the best practice to initialise(clear) the field that not intended for the collect. i have 6 fields which are type DEC. the internal table is like a structure where the numeric fields are type DEC.

I only want 4 out of 6 fields to accumulate the value whereas another 2 i do not want as these 2 fields not large enough to store the accumulated value and also these 2 are not meant to accumulate value.

I cannot make the 2 fields to character field as i use itab like table occurs 0.

i just want comment what method i can use after the collect statement to initialise (clear) the other 2 fields.

thanks

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
622

Hi,

What I thin u can do is that in the loop where u r collecting the internal table, prior to that clear the both fields which are not required to be collected.

e.g. CLEAR : ITAB-B, ITAB-C.

COLLECT ITAB.

In this case the ITAB-B and C fields will always contain initial value.

Hope it helps.

Regards,

Himanshu

3 REPLIES 3
Read only

Former Member
0 Likes
623

Hi,

What I thin u can do is that in the loop where u r collecting the internal table, prior to that clear the both fields which are not required to be collected.

e.g. CLEAR : ITAB-B, ITAB-C.

COLLECT ITAB.

In this case the ITAB-B and C fields will always contain initial value.

Hope it helps.

Regards,

Himanshu

Read only

Former Member
0 Likes
622

Hi..,

suppose A,B,C,D,E,F are the fields and u dont want E and F to get accumulated ...

just before the collect statement clear those two fields..

<b>clear : wa_itab-E, wa_itab-F.

collect wa_itab to itab.</b>

reward all helpful answers..

sai ramesh

Read only

Former Member
0 Likes
622

Hi..

loop at itab.

collect itab into itab.

clear: itab-5, itab-6.

modify itab index sy-tabix from itab transporting itab-5 itab-6.

endloop.

try this,...

Message was edited by:

Rammohan Nagam