Application Development 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: 

ALV layout details held in table?

Former Member
0 Kudos
2,458

Hi,

I have a requirement to allow the user to download to excel the results of a report in the background according to the ALV layout variant they choose on the selection screen.

In order to do this I need to retrieve the details of the layout variant so I can pass those field in the correct order to the excel file I create. Are these details held in a table somewhere or is there a function module I can use to retrieve these details?

I can already choose the layouts created for the report I'm running, but I need the layout details (i.e. the fields shown) so instead of passing the variant name to the ALV I can pass only those fields to the excel file.

Any suggestions welcome.

Gill

1 ACCEPTED SOLUTION

SuhaSaha
Advisor
Advisor
0 Kudos
299

Hello Gill,

The FM for your requirement is REUSE_ALV_GRID_LAYOUT_INFO_GET.

Check & let us know in case of any other issue.

BR,

Suhas

10 REPLIES 10

SuhaSaha
Advisor
Advisor
0 Kudos
300

Hello Gill,

The FM for your requirement is REUSE_ALV_GRID_LAYOUT_INFO_GET.

Check & let us know in case of any other issue.

BR,

Suhas

Former Member
0 Kudos
299

Thanks, but I think this FM gets the ALV layout details which are currently being used on the screen?

I would like to get these details from the selection screen, i.e. before the ALV has been called. The user wants to select a layout variant from the selection screen (which I have done) and then tick a box which will select all the data but instead of displaying it in an ALV, the program will download the results into a .csv file using the layout variant selected on the selection screen.

Is there a way of doing this?

0 Kudos
299

Hello Gill,

So from the ALV variant which the user selects in the selection-screen you want to get the details of the fields which need to be downloaded to the CSV file.

Do i understand your req. correctly?

Suhas

Former Member
0 Kudos
299

Yes, that's it exactly.

0 Kudos
299

Hello,

I think a look at the FM: REUSE_ALV_VARIANT_SELECT may help.

You input the default fieldcat, layout & variant and in the export you get the correct fieldcat.

Hope this helps.

BR,

Suhas

Former Member
0 Kudos
299

Thanks this is exactly what I needed. It works great now.

Former Member
0 Kudos
299

Hi,

the variants are stored in dbtab VARID. u cn giv the variant name & report & fetch the data.

the CLUSTD field in VARI table contains the Contents of variant.

Regards,

Mdi.Deeba

0 Kudos
299

Thanks for those table names, just one last thing, how do I view the cluster info? Viewing it from SE16 just shows me a number and not the variant fields that I was expecting.

0 Kudos
299

Hello Gill,

you could also try to create a cl_salv_table object, apply your layout as initial layout and then get the columns and check which one is visible and which not. I think your report will do this already if it has also an "non-background" mode. Just remove the call method display() in background-mode.

Another Idea is, to call the ALV in List mode (if you use the OO ALV cl_salv_table) and save the list to a CSV File. Don't know if this works (and how it works), but maybe you can convert the list buffer to a CSV Itab/File.

Kind regards,

bastian

yasser_aoujil
Explorer
0 Kudos
299

This message was moderated.