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

add columns

Former Member
0 Likes
583

i have internal tanle itab1 is like dis

e_id month exp1 exp2 exp3 exp4 ........... . ...........exp45

258 jan 00 25 25 66 .........

258 feb 30 11 00 22 ...............

258 feb 40 00 22 45..................

258 feb 40 00 26 10.....................

258 mar 00 30 72 45

258 mar 25 88 32 55....................

258 apr 40 00 22 45........................

259 jan 00 25 25 66 ....................

259 feb 30 11 00 22.................

259 feb 40 00 22 45.................

259 feb 40 00 26 10....................

259 mar 00 30 72 45........................

259 mar 25 88 32 55.........................

259 apr 40 00 22 45.......................

260.................

...................

.............

now i want a final intarnal table itab2 like this

e_id month sum(exp1) sum(exp2) sum(exp3) sum(exp4) ........... . ...........sum(exp45)

259 jan 00 25 25 66

259 feb 110 11 48 77

259 mar 25 118 104 110

259 apr 40 00 22 45

260 jan...........

260 feb ......

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
562

hi,

Ur logic would be like this:

sort itab by month.

loop at itab into wa_itab.

at end of month.

SUM.

write: wa_itab-eid, wa_itab-month, wa_itab-ex1 -


wa_itab-exn.

endat.

endloop.

Cheers,

Rudhir

5 REPLIES 5
Read only

Former Member
0 Likes
563

hi,

Ur logic would be like this:

sort itab by month.

loop at itab into wa_itab.

at end of month.

SUM.

write: wa_itab-eid, wa_itab-month, wa_itab-ex1 -


wa_itab-exn.

endat.

endloop.

Cheers,

Rudhir

Read only

0 Likes
562

what about dofferent employee id.

Read only

0 Likes
562

Hi,

loop at itab into fs.

at new month.

sum.

endat.

at end of month.

write: fs-emp_id,

fs-month.

endat.

endloop.

Read only

Former Member
0 Likes
562

hi Ajay,

create itab2 like itab1 and


loop at itab1.
  collect itab1 into itab2.
endloop.

this should be enough. If it can't sum like this you'll have to add to the second table. It's quite simple.

regards,

Edgar

Read only

Former Member
0 Likes
562

Hi Ajay

You can sort the internal table by both emp_id and month in ascending order.

SORT ITAB1 BY EMP_ID MONTH

Now you can loop through the internal table and can use the COLLECT statement ,

as i explained you in the last thread.

Just see your last thread that you have posted.

Regards

Hareesh.

PLS DONT FORGET TO CLOSE THE THREAD

Edited by: Hareesh Menon on Feb 25, 2009 2:17 PM

Edited by: Hareesh Menon on Feb 25, 2009 2:24 PM