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 Internal Table & Alv

Former Member
0 Likes
812

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

1 ACCEPTED SOLUTION
Read only

Former Member
5 REPLIES 5
Read only

FredericGirod
Active Contributor
0 Likes
758

Did you start with the Search tool of SCN forum ??

the limit of ALV Grid is 99 columns

Fred

Read only

Former Member
Read only

Former Member
0 Likes
758

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

Read only

p291102
Active Contributor
0 Likes
758

see the belwo SAP standard report

BCALV_TEST_FB_CREATE           Test Report for Dynamic Generation of Tables

Read only

Clemenss
Active Contributor
0 Likes
758

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

Susmitha Susan Thomas. This method triggers an unwanted and intransparent database commit and limits the number of dynamically created tables.

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