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

write single record

Former Member
0 Likes
627

hi all

In my output internal table i have same records but amout and other integer fields are different. i want create single record with same fields but compute amount and integer fields and write output another internal table.

EX: 1252, 10, coal , 200, ton, 255.00, 500.00

1252, 10, coal , 200, ton, 155.00, 400.00

i want output record is :

1252, 10, coal, 200, ton, 410.00, 900.00

regords

polisetti

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
601

Hi

Use COLLECT statement for amount fields

else go for simple sum operation while looping the internal table.

With Regards,

Dwarakanath.S

5 REPLIES 5
Read only

Former Member
0 Likes
602

Hi

Use COLLECT statement for amount fields

else go for simple sum operation while looping the internal table.

With Regards,

Dwarakanath.S

Read only

0 Likes
601

write collect statement on your internal table

Collect itab ..(please check the syntax)

~hitesh

Read only

Former Member
0 Likes
601

assuming that you have field1 to field7 as your internal table fields, then you can do some thing like this..

data: wa like line of itab.
sort itab by field1 field2 field3. 
loop at itab.
  wa = itab.
 at end of field3.
  sum.
  wa-filed6 = itab-field6.
  wa_field7 = itab-field7.
  append wa to it_final.
 endat.
endloop.

Read only

Former Member
0 Likes
601

Hi,

try to create a structure.....

Like..

Types: Begin of ty_struct,

-


define ur fields here

-


End of ty_struct.

Define one internal table of above structure..

Data: it_table type table of ty_struct.

Use this internal table now..

regards

Mudit

Read only

Former Member
0 Likes
601

Hi,

Use AT END of statement as follows,

Loop at itab into wa_tab.

wa_tab-field6 = sum1 + wa_tab-field6 .

wa_tab-field7 = sum2 + wa_tab-field7 .

At END of field1.

MOVE sum1 to wa_newitab-field6.

MOVE sum2 to wa_newitab-field7.

..

All remaining field also move to new itab as above.

END AT.

Regards,

Kusuma