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: 

show/hide button

Former Member
0 Kudos

Hello experts,

I have a 2 ALV's requirement (header and items, splitter container), thought it might be cool to include a hide-show button, something like MIGO t-code. Does anyone has done this before? What do i have to do? I really appreciate for your help.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

You can have a button "HIDE/SHOW" on your application toolbar and when you click on that , Based on the click you can refresh and populate your fieldcatlog accodingly based on your condition keep the values of internal table same as it is and then call ALV DISPLAY to display the content Vice-versa.

Incase you have problem understanding the above solution reopen the thread.

5 REPLIES 5

Former Member
0 Kudos

You can have a button "HIDE/SHOW" on your application toolbar and when you click on that , Based on the click you can refresh and populate your fieldcatlog accodingly based on your condition keep the values of internal table same as it is and then call ALV DISPLAY to display the content Vice-versa.

Incase you have problem understanding the above solution reopen the thread.

0 Kudos

Actually what i need to do is resize the screen size once the items ALV is hided dinamically, allowing the header ALV to show more data. Searching online i found that is necessary to use subscreens for this purpose, so the button will hide the subscreen, not the ALV, but i don't know how to do this either

0 Kudos

Hi Marco,

Indeed, this is a special technique which requires subscreens. Nevetherless, it doesn't use splitter contrainer.

To create something similar to MIGO do the following:

- first create a blank main screen i.e 100 - this will be a main screen

- create two subscreen areas on it - these will be used to store your subscreens dynamically

- now create 4 subscreens i.e. 101, 102, 103, 104

- subscreens 101 and 102 will hold actual data which is your alvs during runtime. On each of them place a button with icon ICON_DATA_AREA_COLLAPSE and a custom container next to it (so that the button's top base line fits top base line of container). This is how your sunbscreen will look like when expanded. Do the same for screen 102.

- subscreen 103 and 104 must only hold a pushbutton ICON_DATA_AREA_EXPAND . When you collapse your subsreen you just display an empty screen with only pushbutton on its (this one), which subsequnetly results in collapsing whole area. Do the same for screen 104.

- in your screen flow logic write


PROCESS BEFORE OUTPUT.
  MODULE docking_container.  
  CALL SUBSCREEN top_area    INCLUDING sy-repid dynnr_top.   "here you top subscreen area and respecitive subscreen is processed either 101 or 103
  CALL SUBSCREEN bottom_area INCLUDING sy-repid dynnr_bottom. "here subscreens 102 or 104

PROCESS AFTER INPUT.
  CALL SUBSCREEN top_area.
  CALL SUBSCREEN bottom_area.
  MODULE pai_0100.

"in ABAP program define such data objects
data: dynnr_top(4) type n value '0101',
        dynnr_bottom(4) type n value '0103'. "by defauls set those not empty screens

"in PAI module you change your subscreen assignment depending on pusbutton state
MODULE pai_0100 INPUT.
  MOVE ok_code TO save_ok.
  CLEAR ok_code.
  CASE save_ok.
    WHEN 'COLLAPSE_TOP'.  "function code of top button
      dynnr_top = '0102'.  "set screen to empty
    WHEN 'EXPAND_TOP'.
      dynnr_top = '0101'.  "set screen with data
    WHEN 'COLLAPSE_BOTTOM'.
      dynnr_bottom = '0104'. "empty
    WHEN 'EXPAND_BOTTOM'.
      dynnr_bottom = '0103'.  "with data
  ENDCASE.
ENDMODULE.

- moreover you need a PBO modules in subscreens 101 and 102. they should be responsible for creating respecitve GUI containers and ALVs

- as you may noticed, in screen 100 there is also module docking_container . This one is used on the left hand side of MIGO transaction (not splitter container). Create it here. Also please note that it must have side set to left


create object r_docking_container
...
side = cl_gui_docking_container=>dock_at_left

This is because your subscreens will automaticaly be justified to the right when docking container is displayed. On the other hand setting it to the right side will not bring the same effect.

Hope this explanation gives you better understanding of this technique and its abilities. You could i.e. nest a subscreen area in one of the subscreen 101 so you could display in turn an alv or other GUI control there depending on the program context. You can even mix GUI controls with stnadard one i.e creating a subscreen and placing there only classical controls. Then disolaying this screen in appropriate subscreen area.

This gives really powerful tool when applied correclty, but unfortunately is error prone due to lots of screens and difficult maintenace.

Regards

Marcin

Former Member
0 Kudos

Marcin thank you very much for your answer. As a matter of fact it sounds complicated, but i'm definitely going for it.

Once again, thanks for taking the time.

0 Kudos

No problem Marco. Believe me, once you get it, you willl definitely improve your "dialog" skills and be able to create really complicated ones. I think this demo programs will also interest you, there are lots of examples of using controls. Type tcode: DWDM, the program name is SAPMSDM1 (if you don't have authorization to to transaction). At the very bottom there are examples of these techniques (select USER interface -> Examples of user iterface design . Alternatively type BIBS and select Collapsible area. )

Keep training:)

Regards

Marcin