‎2008 May 30 8:02 AM
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
‎2008 May 30 8:07 AM
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
‎2008 May 30 9:01 AM
Hi Malay ,
Can u send me the sample code for this...will be really helpful..
‎2008 May 30 9:36 AM
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
‎2008 May 30 9:47 AM
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...
‎2008 May 30 10:40 AM
Hi Sumit Verma ,
Refer to the following link
[http://www.saptechnical.com/Tutorials/ALV/DynamicALV/Demo.htm]
Thanks,
Surya Pydikondala.
‎2008 Jul 06 8:10 PM
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