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: 

Dynamic ALV on selection screen

Former Member
0 Kudos

Hi,

I need to create a program in which I need to display the ALV on the same screen as selection screen. I should be able to expand/collapse the selection screen and accordingly the ALV should adjust.

Could you please suggest me on the design?

Thanks,

Ayushi

5 REPLIES 5

horst_keller
Product and Topic Expert
Product and Topic Expert

Create a subscreen as a special case of a tabbed block and display your ALV in a custom container there.

Another way around, you can also display your ALV on a general screen and embed selection screen(s) as subscreen there.

former_member182550
Active Contributor

Or...

Run your selection and get your result set. Export that to a memory parameter.

In initialisation check to see if you have any results in the memory parameter. If you have, create a docking container docked to the default screen. Then use that as a parent for your alv grid:

Initialization.
   Perform Init Changing gs_Run_Parameters.
*
*  Re-populate the select options.
*
   s_Bullet[] = gs_Run_Parameters-Bulletins.
   s_Werks[]  = gs_Run_Parameters-Plants.
   s_ArbPl[]  = gs_Run_Parameters-Work_Centres.
*
*  Display prior results ?
*
   If gs_Run_Parameters-Populated = Abap_True.
      Perform Display_Bulletins Changing gs_Run_Parameters
                                         gs_Display.
   EndIf.

Don't forget to clear the memory parameter after you have read it:

     Clear es_Run_Parameters.
*
*    Protect the import from crashing - if there is a problem then just delete the
*    cluster.
*
     Try.
        Import ZDM_BULLETIN = es_run_Parameters From Memory.
     Catch CX_SY_IMPORT_MISMATCH_ERROR.
        Clear es_Run_Parameters.
        Delete From Memory Id 'ZDM_BULLETIN'.
     EndTry.
*
     If es_Run_Parameters-Populated = Abap_True.
        Delete From Memory Id 'ZDM_BULLETIN'.
     EndIf.

Regards

Rich

Yeah but OP also wants "Expand/collapse the selection screen and accordingly the ALV should adjust".

0 Kudos

Grab the horizontal sash of the docking container and move it up or down.... 🙂

Perhaps a better explanation of 'Expand/Collapse' of the selection screen would help, because I'm not exactly sure what he means. However, I would think a PAI would/needs to be involved some how and dependant on the input fields (for example if a check box radio button or drop down list is used) but other types of fields would require as far as I know a key stroke from the operator

Rich

Sandra_Rossi
Active Contributor

For the Expand/Collapse, you could use the MODIFY SCREEN and alike statements to hide or show fields at runtime, but if you use a selection screen containing a subscreen area, as Horst suggested, I think it can't collapse as the compiler defines the area with option "vertical resize" equal to OFF.

So, I guess the only option is to use a dynpro with embedded selection screen (see Horst second part of his answer). But then, only the layout of the selection screen will work but not the other features (like program variant).

Otherwise, using a docking container could be the solution as Richard said, by estimating an approximate container's height based on expand/collapse status.