2016 Jun 21 2:50 PM
Dear experts,
I have a selection screen with a pushbutton to expand/collapse the parameters and select options.
At F8 (CRET), I would like to collapse the selection criteria and display an ALV with the results right under (dock_at_bottom).
The ALV should be invisible at program start. It should be displayed only at fcode CRET.
In which event do I have to create/adjust the container object and the alv object?
I have tried to create the container and the alv objects in the AT SELECTION-SCREEN event.
Unfortunately, the program doesn't display the results, although sy-subrc=0.
Could you please advise me also on how to adjust the dimensions of the ALV container based on the expand/collapse button of the selection fields?
Thank you for your help!
BR,
Matei
2016 Jun 21 3:29 PM
Refer the below link, a very simple explanation (and the code) which answers your question :
http://zevolving.com/2008/10/display-alv-report-output-in-the-same-selection-screen/
The link demonstrates what Richard Haper has explained on how it can be achieved.
-Amit.
2016 Jun 21 3:12 PM
AT SELECTION-SCREEN event is the equivalent of PAI. You need to build containers & ALV objects in PBO event, which is AT SELECTION-SCREEN OUTPUT.
Have a look at this document: http://scn.sap.com/community/abap/blog/2015/07/02/screen-hacks
Thanks,
Juwin
2016 Jun 21 3:52 PM
Thank you for your answer,
That solved my problem to display the ALV+container. But the thing is I want it hidden at selection-screen output.
Could you please be so kind and give me more details about how to set an alv grid+container on invisible=true or false? I would like to display it, only if the table contains data...
BR,
Matei
2016 Jun 21 4:14 PM
That's the point - you only call the procedure (you have got it in a procedure...) when the result table is populated, not when it's empty. You MUST always clear the memory ID after you have read it at initialisation.
2016 Jun 21 3:20 PM
Hi,
I do this type of thing a lot and it's quite easy when you get your head around it.
First, you run the report and you build the table that you wish to display in the alv grid.
When everything is populated you then export the results to a memory id.
In the initialisation event of the report you import that memory id back into the global table it came from. Don't forget to clear the memory id.
If the table is populated and sy-subrc is 0, create a docking container, calculate the ratio of the screen you would like to occupy and dock it at the bottom of the screen. The ration will depend on what parameters you have displayed. Then create your alv grid using the docking container as a parent.
Rich
2016 Jun 21 3:29 PM
Refer the below link, a very simple explanation (and the code) which answers your question :
http://zevolving.com/2008/10/display-alv-report-output-in-the-same-selection-screen/
The link demonstrates what Richard Haper has explained on how it can be achieved.
-Amit.
2016 Jun 21 3:38 PM
Thank you,
That is what I used as inspiration up to this moment. Still, my program doesn't display anything yet.
Could you please give me more details about how to set an alv grid+container on invisible=true or false? Also, how am I supposed to set_table_for_first display if I don't have any data? Only after I read the selection parameters and execute, I want to display it the container+alv table.
I have used the reuse function for ALV, but that opens a new window with the results. Do you have any other suggestion?
Thank you,
BR,
Matei
2016 Jun 21 3:47 PM
2016 Jun 21 4:19 PM
You don't need it.....
Unfortunately cut and paste does not work.
In the initialisation even get your table back from where you've exported it to.
(In this example I'm using an application log but the concept is still the same)
Then if the table is populated, call the routine to do the display.
Regards,.
Rich