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

ALV - Automatic Adjustable Columns (based on selection criteria)

Former Member
0 Likes
725

Hi,

I am currently in the process of building a costing report for a number of materials.

For the output, the columns will be the months, while the rows will pertain to the specific materials (1 or 2 columns for the material text and info).

For example, the columns of the report will look something like:

Material January February March u2026.. December

In the selection-screen, I will have input fields, including posting period range (month) and fiscal year single value.

If the user enters year 2008 and period 10, I only want 1 column for October, with the other columns not present

If they enter year 2008 and period 10 to 11, then only columns October and November show be displayed.

Is this possible in abap ALV programming? If so, how? Are there FMu2019s and object-oriented routes that I can take & if so, what do I do? Please provide code samples if possible.

Please help.

Thanks,

John

Hi,

I am currently in the process of building a costing report for a number of materials.

For the output, the columns will be the months, while the rows will pertain to the specific materials (1 or 2 columns for the material text and info).

For example, the columns of the report will look something like:

Material January February March u2026.. December

In the selection-screen, I will have input fields, including posting period range (month) and fiscal year single value.

If the user enters year 2008 and period 10, I only want 1 column for October, with the other columns not present

If they enter year 2008 and period 10 to 11, then only columns October and November show be displayed.

Is this possible in abap ALV programming? If so, how? Are there FMu2019s and object-oriented routes that I can take & if so, what do I do? Please provide code samples if possible.

Please help.

Thanks,

John

4 REPLIES 4
Read only

former_member156446
Active Contributor
0 Likes
681

I think you can accomplish this using dynamic internal tables...

one another alternative is to have rows of months and columns as data... ie

jan       data1 data2....

feb 

mar
......

Read only

naimesh_patel
Active Contributor
0 Likes
681

You can achieve it using the dynamic internal table. Check this link which describes similar internal table creation dynamically.

http://help-abap.blogspot.com/2008/09/dynamic-internal-table-creation.html

Regards,

Naimesh Patel

Read only

0 Likes
681

Thanks - Just what I was looking for.

I was looking a bit into this and found that another option is to hide the fields before output.

I think hiding might work better, since the only columns that I want missing are the ones containing months that the user didn't specify in the selection criteria.

Still, thanks. Very useful to know that this option exists.

Read only

Former Member
0 Likes
681

Halo John,

Its very much possible in ALV Grid. It all depends upon the logic you build the field Catalog.

Your Initial field catalog should have 12 fields ( ie 12 month names )

Depending upon the user input , you can put the no_out = abap_true.