on 08-14-2015 6:55 AM
Hi,
How to create a Transpose ALV(Rows to Cols and Columns to Rows) in webdynpro. I was able to create Dynamic ALV but how to make it transpose? Could any one please share a sample doc or code ??
Appreciate your help.
Thanks.
Hi Uday,
Could you please provide more details on your requirement.
Regards,
Rama
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ram,
My requirement is to display the table in this Format.
CustomerNum 1000 1001 1002 1003
CustomerName AAA BBB CCC DDD
City AA BB CC DD
Country US US US US
As of now, I could able to display in below format using UI Container ALV Table. That means I want to Transpose the Rows & Columns of below table...
CustomerNumber CustomerName City Country
1000 AAA AA US
1002 BBB BB US
1003 CCC CC US
Regards,
Uday.
HI Uday,
Please follow the below steps to achieve your requirement
FIELD-SYMBOLS:
<fs_data_target> like line of lt_data_target,
<fs_data_source> like line of lt_data_source.
data: ls_data_target like line of lt_data_target.
" Prepare headings column
do 4 times. " no. of columns
clear ls_data_target.
case sy-index.
when 1.
ls_data_target-c1 = "Customer Number".
when 2.
ls_data_target-c1 = "Customer Name".
when 3.
ls_data_target-c1 = "city".
when 4.
ls_data_target-c1 = "country".
endcase.
append ls_data_target to lt_data_target.
enddo.
data: lv_col_index type n length 1,
lv_col_name type string.
Loop at lt_data_source assigning <fs_data_source>.
lv_col_index = sy-tabix + 1.
concatenate 'C' lv_col_index into lv_col_name.
loop at lt_data_target assigning <fs_data_target>.
assign component lv_col_name of structure <fs_data_target> to <fs_value>.
if <fs_value> is assigned.
" assign value from respective column
case sy-tabix.
when 2. <fs_value> = <fs_data_source>-customer_num.
when 3. <fs_value> = <fs_data_source>-customer_name.
when 4. <fs_value> = <fs_data_source>-city.
when 5. <fs_value> = <fs_data_source>-country.
endcase.
endif.
endloop.
endloop.
The context node should have a node with all 5 attributes of type STRING and bind data lt_data_target to node.
Now, display the data into alv.
Regards,
Rama
User | Count |
---|---|
85 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.