10-10-2007 7:38 AM
Hi all,
I am having data in one internal table like this.
country office amount
c1 o1 100
c1 o2 102
c1 o3 130
c2 o1 120
c2 o2 110
c3 o1 112
c3 o2 110
c3 o3 142
I want to display the output in alv format as shown below.
c1 total c2 total c3 total grandtotal
o1 o2 o3 o1 o2 o1 o2 o3
100 102 130 332 120 110 230 112 110 142 364 926
total 100 102 130 332 120 110 230 112 110 142 364 926
Please help me.
Its toooooo urgent.
full points will be rewarded.
Thanks in advance,
kumar.
Message was edited by:
kumar
10-10-2007 7:45 AM
in this display do you wish to display all these contents in diff columns???
you can display the data in whatevr format you want if you get that data in ITAB.. as per your requirement.....
try to get the data you have mentioned in the desired format.. in some other itab
10-10-2007 7:49 AM
Hi sharayu,
Thanks for immediate response. But the final internal tble is not a physical one, its a dynamic internal table. the columns are dynamic and depends on the data of previous internal table.
please suggest.
Thanks,
kumar.
10-10-2007 7:54 AM
HI,
use at end of <filed>. in loop while displaying the list.
rgds,
bharat.
10-10-2007 10:01 AM
Hi,
We have problem in displaying the rows from internal table horizontally in a ALV List display output.
Kindly suggst.
Thanks & Regards,
Kumar
10-10-2007 10:10 AM
u have to create dynamic internal table.
first.
build a fieldcat with the fiedlvalue not with field name.
for example.
itab-country value is c1. c1 should be the column in the dynamic interna; table.
so, build field cat like below.
ls_fieldcat-fieldname = itab-country.
build fieldcat like above.
now u can create a dynamic internal table like below:
data: dref type ref to data.
field-symbols: <fs> type any.
call method cl_alv_table_create=>create_dynamic_table
exporting
it_fieldcatalog =lt_fieldcat
importing
ep_table = dref.
assign dref->* to <fs>.
loop at itab.
field-symbols: <fs1> type any.
move corresponding itab to <fs>.
assign component itab-country of structure <fs> to <fs1>.
<fs1> = itab-value.
endloop.
10-10-2007 10:37 AM
Hi Hymavathi,
Thanks for reply.
we having column wise data in it_data internal table with the n number of rows. we want to display these rows as n number of columns which is a dynamic internal table in ALV List as output.
what we have done is
Data: begin of it_data occurs 0,
coun(10) type c,
offc(10) type c,
fte(5) type c,
end of it_data.
CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
EXPORTING
I_STYLE_TABLE =
IT_FIELDCATALOG = LT_FIELDCATALOG
I_LENGTH_IN_BYTE =
IMPORTING
EP_TABLE = <FS_DATA>
E_STYLE_FNAME =
EXCEPTIONS
GENERATE_SUBPOOL_DIR_FULL = 1
others = 2
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*
assign <FS_DATA>->* to <FS_1>.
create data NEW_line like line of <FS_1>.
assign NEW_LINE->* to <WA>.
ASSIGN <fs_data>->* TO <it_data>.
CREATE DATA it_struct LIKE LINE OF <it_data>.
ASSIGN it_struct->* TO <header>.
loop at it_data assigning <header>.
assign component it_data-offc of structure <header> to <WA>.
append <WA> TO <fs_1>.
endloop.
but we are not getting the output as desired. we are getting only header.
Kindly suggest.
Regards,
kumar