‎2013 Jul 03 1:29 PM
Hi all,
I want to create a Dynamic ALV Report.
The number of Material columns in the output of the ALV should depend upon the
selection criteria entered by the user.
if there are 5 material the 5 columns should be displayed,
if 150 materials are found then dynamically 150 colums for material should be build.
Can anyone please give me some sample code if available?
Thanks in advance...
Regards,
Chintan Doshi
‎2013 Jul 03 1:56 PM
‎2013 Jul 03 1:47 PM
Did you start with the Search tool of SCN forum ??
the limit of ALV Grid is 99 columns
Fred
‎2013 Jul 03 1:56 PM
‎2013 Jul 03 3:27 PM
Hi Chintan,
To control the coloumn in display you need to control the Fieldcatalog table.
Populate the fieldcatalog table inside the loop of your material table. This will generate only required no. of coloumns.
Regrads,
Jyoti Singh
‎2013 Jul 04 7:53 AM
see the belwo SAP standard report
BCALV_TEST_FB_CREATE Test Report for Dynamic Generation of Tables
‎2013 Jul 04 8:15 AM
Hi Chintan,
just my two cents:
If you want to make it simple, create a structure with the maximum of possibly displayed columns, set all columns to no-display (or technical) except the ones you want to see.
If you really want to use a dynamic table created at run time: Please do not use
METHOD cl_alv_table_create=>create_dynamic_table as mentioned in the link posted by
Use RTTS run time type services instead, see my entry in the thread http://scn.sap.com/thread/1679004 as a start.
BTW: there is no such thing as a 99 fields limit in ALV. This is just an outdated warning that can be ignored. For my own amusement, I tried 20000 columns what makes the ALV really slow, but no other impacts.
Note: If you use SALV output you don't need a field catalog as it is created internally. But you should use fully DDIC-referenced fields only with each field connected to a data element and a DDIC domain. Otherwise the field catalog is not created correctly.
Regards
Clemens