10-10-2008 7:59 AM
Hi,
my internaltable contains data like
company cost assignment period amount
code center
cs01 1000 100000 1 1000
cs01 1001 100000 1 1200
cs01 1000 100000 2 1400
cs01 1000 100000 3 1600
I need to modify above internaltable lik below
company cost assignment period1 period2 period3
code center amount amount amount
cs01 1000 100000 1000 1400 1600
cs01 1001 100000 1200 - -
how can i modify?
Regards,
Suresh
10-10-2008 8:08 AM
cs01 1000 100000 1 1000
cs01 1000 100000 2 1400
cs01 1000 100000 3 1600
cs01 1001 100000 1 1200
first sort the table on first 3 fields. the above is the sorted data. now place the control break on second field.
use appropriate types and fieldnames.
data: begin of it_final occurs 0,
first,
second,
third,
id1,
id2,
id3,
...
idn,
end of it_final.
data: val(20).
field-symbols: <fs> type any.
loop at it_data.
it_final-first = it_data-first.
it_final-secnd = it_data-second.
it_final-third = it_Data-third.
concatenate 'IT_FINAL-ID' it_data-four to val.
assign (val) to <fs>.
<fs> = it_data-five.
at end of field2.
append it_final.
endat.
endloop.
10-10-2008 8:08 AM
cs01 1000 100000 1 1000
cs01 1000 100000 2 1400
cs01 1000 100000 3 1600
cs01 1001 100000 1 1200
first sort the table on first 3 fields. the above is the sorted data. now place the control break on second field.
use appropriate types and fieldnames.
data: begin of it_final occurs 0,
first,
second,
third,
id1,
id2,
id3,
...
idn,
end of it_final.
data: val(20).
field-symbols: <fs> type any.
loop at it_data.
it_final-first = it_data-first.
it_final-secnd = it_data-second.
it_final-third = it_Data-third.
concatenate 'IT_FINAL-ID' it_data-four to val.
assign (val) to <fs>.
<fs> = it_data-five.
at end of field2.
append it_final.
endat.
endloop.
10-10-2008 8:47 AM
Hi Vijay,
Thanks for reply. one more question.
in my final internal table like first,second and third columns are static and other columns are id1, id2 ,id3 ...idn are dynamic columns.
How can i bulid the internal table.please help me..
Regards,
Suresh.
10-10-2008 8:59 AM
you can populate the fieldcatalog with the fieldnames and lengths . and using the class cl_alv_table_create , method CREATE_DYNAMIC_TABLE
and create the dynamic table, using that you can proceed. for sample code search here with the class cl_alv_table_create
10-10-2008 8:35 AM
10-10-2008 8:41 AM
10-10-2008 1:34 PM