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

Dynamic ALV .

Former Member
0 Likes
640

Hi All ,

I need to create a dynamic alv , ie. the number of columns that is to be displayed will depend on the user selection on the selection screen .

Can u help me with this..

thanks,

Sumit

6 REPLIES 6
Read only

Former Member
0 Likes
618

VERY EASY USE OO ALV

AND TAKE HELP OF

Changing Field Catalog or Layout after First Display

During runtime, it is possible to set a new layout or a new field catalog after first displaying of the list. These components have set/get methods to accomplish this.

For the field catalog : get_frontend_fieldcatalog

set_frontend_fieldcatalog

For the layout : get_frontend_layout

set_frontend_layout

Read only

Former Member
0 Likes
618

Hi Malay ,

Can u send me the sample code for this...will be really helpful..

Read only

0 Likes
618

no problem....

as me sending u code for this part only... assuming u comfortable with rest of alv...

.. ..

DATA ls_fcat TYPE lvc_s_fcat .

DATA lt_fcat TYPE lvc_t_fcat .

DATA ls_layout TYPE lvc_s_layo .

CALL METHOD gr_alvgrid->get_frontend_fieldcatalog

IMPORTING

et_fieldcatalog = lt_fcat[] .

LOOP AT lt_fcat INTO ls_fcat .

IF ls_fcat-fieldname = 'PAYMENTSUM' .

ls_fcat-no_out = space .

MODIFY lt_fcat FROM ls_fcat .

ENDIF .

ENDLOOP .

CALL METHOD gr_alvgrid->set_frontend_fieldcatalog

EXPORTING

it_fieldcatalog = lt_fcat[] .

CALL METHOD gr_alvgrid->get_frontend_layout

IMPORTING

es_layout = ls_layout .

ls_layout-grid_title = 'Flights (with Payment Sums)' .

CALL METHOD gr_alvgrid->set_frontend_layout

EXPORTING

is_layout = ls_layout

Read only

0 Likes
618

use one more thing...

make 3 button..

select query for column which u want to display

for example in one view select c1,c2 for secomd select c1,c2,c3 ..

now fill internal table for this column only and pass it to alv_grid_display and show the data...

Read only

Former Member
0 Likes
618

Hi Sumit Verma ,

Refer to the following link

[http://www.saptechnical.com/Tutorials/ALV/DynamicALV/Demo.htm]

Thanks,

Surya Pydikondala.

Read only

uwe_schieferstein
Active Contributor
0 Likes
618

Hello Sumit

You may want to have a look at [Creating Flat and Complex Internal Tables Dynamically using RTTI|https://wiki.sdn.sap.com/wiki/display/Snippets/CreatingFlatandComplexInternalTablesDynamicallyusingRTTI]

Regards

Uwe