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 on selection screen

Former Member
0 Likes
11,515

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
5,831

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.

8 REPLIES 8
Read only

Juwin
Active Contributor
0 Likes
5,831

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

Read only

Former Member
0 Likes
5,831

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

Read only

Former Member
0 Likes
5,831

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.

Read only

Former Member
0 Likes
5,831

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

Read only

Former Member
0 Likes
5,832

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.

Read only

0 Likes
5,831

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

Read only

0 Likes
5,831

The CL_GUI_DOCKING_CONTAINER has a method SET_VISIBLE to set control visible or invisible

Regards,

Raymond

Read only

0 Likes
5,831

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