2009 Sep 14 4:16 PM
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
2009 Sep 14 4:28 PM
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
2009 Sep 14 4:28 PM
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
2009 Sep 15 9:09 AM
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?
2009 Sep 15 11:24 AM
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
2009 Sep 15 11:27 AM
2009 Sep 15 11:34 AM
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
2009 Sep 15 1:43 PM
2009 Sep 15 9:25 AM
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
2009 Sep 15 10:02 AM
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.
2009 Sep 15 10:29 AM
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
2015 Apr 10 9:46 AM