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: 

expand/collapse button functionality on module pool screen

Former Member
0 Kudos

Hi ,

I want to design a module pool screen with a expand/collapse button on it.

The desired functionality associated with this button would be something similiar to that available in ME21N screen. When the expand button is clicked it should open up a section of screen that allows the user to enter some parameter. Based on this parameter some selections from DB can be perfomed and then displayed below it.

Any pointers on how to achieve this? Any kind of help would be appreciated.

Regards-

Harmeet Singh.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Harmeet,

As per your requirement you need to create a Push Button in the Screen and need to process the User Action in the Process After Input Event. Assign a function code to the push button.

Have a look at the following demo code for an over of the subscreen toggle functionality. Report Name : DEMO_DYNPRO_SUBSCREENS.

Hope this will help.

Thanks,

Samantak.

7 REPLIES 7

naimesh_patel
Active Contributor
0 Kudos

You need to create subscreen areas, and attach the desired Subscreen on respective event.

Check transaction BIBS.

Look for the Collapsible Area example in the left pan.

Regards,

Naimesh Patel

Former Member
0 Kudos

Hi Harmeet,

As per your requirement you need to create a Push Button in the Screen and need to process the User Action in the Process After Input Event. Assign a function code to the push button.

Have a look at the following demo code for an over of the subscreen toggle functionality. Report Name : DEMO_DYNPRO_SUBSCREENS.

Hope this will help.

Thanks,

Samantak.

MarcinPciak
Active Contributor
0 Kudos

Indeed, this is a special technique which requires subscreens. To create something similar to ME21N do the following:

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

- create three subscreen areas on it - these will be used to store your subscreens dynamically - now create 6 subscreens i.e. 201, 202 - (top subscreens) 301, 302 (middle subscreens), 401, 402 (bottom subscreens). Now subscreens 201,301,301 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 subscreen will look like when expanded. Next, subscreens 202,302,402 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.

For screen 100 in 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 201, 301 or 401
CALL SUBSCREEN middle_area INCLUDING sy-repid dynnr_middle. "for subscreens 202, 302,402
CALL SUBSCREEN bottom_area INCLUDING sy-repid dynnr_bottom. "here subscreens 203 ,303 ,403

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

"in ABAP program define such data objects 
data: dynnr_top(4) type n value '0201', 
dynnr_middle(4) type n value '0301',
dynnr_bottom(4) type n value '0401'. "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 = '0202'. "set screen to empty 
   WHEN 'EXPAND_TOP'.
     dynnr_top = '0201'. "set screen with data 

   "do the same for MIDDLE and BOTTOM
...
ENDMODULE. 

- moreover you need a PBO modules in subscreens 201,301,401. they should be responsible for creating respecitve GUI containers and ALVs.

On the left hand side there it also used docking container . To create such use:

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

Regards

Marcin

Former Member
0 Kudos

example for three pushbutton with expand collapse .

First of all define your push button as output field with icon tick in the pushbutton characteristick,

then define this pushbutton in top_include


include <icon>.
data : push_a1 like icons-l4,
         push_a2 like icons-l4,
         push_a3 like icons-l4. 
data : a1 ,
         a2,
         a3.

in pai of the screen

suppose i had assign function code a1 ,a2 , a3 for repective pushbutton


module user_command_9002 input.
  okcd = ok_code.
  clear ok_code.
  case okcd.
    when 'A1'.
      if a1 is initial.
        a1 = 'X'.
      else.
        clear a1.
      endif.
    when 'A2'.
      if a2 is initial.
        a2 = 'X'.
      else.
        clear a2.
      endif.
    when 'A3'.
      if a3 is initial.
        a3 = 'X'.
      else.
        clear a3.
      endif.
  endcase.
endmodule.                 " USER_COMMAND_9002  INPUT

define three seprate screen -group for three pushbutton say a1 a2 a3

during pbo you can directly assign name of icon .


 if a1 is initial.
    push_a1 = icon_collapse.
  else.
    push_a1 = icon_expand.
  endif.
  if a2 is initial.
    push_a2 = icon_collapse.
  else.
    push_a2 = icon_expand.
  endif.
  if a3 is initial.
    push_a3 = icon_collapse.
  else.
    push_a3 = icon_expand.
  endif.
 loop at screen.
    if screen-group1 = 'A1'.
      if a1 = 'X'.
        screen-invisible = 1.
        screen-input = 0.
        modify screen.
      else.
        screen-active = 1.
        screen-invisible = 0.
        screen-input = 1.
      endif.
    elseif screen-group1 = 'A2'.
      if a2 = 'X'.
        screen-invisible = 1.
        screen-input = 0.
        modify screen.
      else.
        screen-active = 1.
        screen-invisible = 0.
        screen-input = 1.
      endif.
    elseif screen-group1 = 'A3'.
      if a3 = 'X'.
        screen-invisible = 1.
        screen-input = 0.
        modify screen.
      else.
        screen-active = 1.
        screen-invisible = 0.
        screen-input = 1.
      endif.
    endif.
  endloop.

regards,

Alpesh

Edited by: Alpesh on May 28, 2009 10:28 AM

0 Kudos

You can find an example in transaction BIBS.

You when you have 2 collapsable areas, you have to create 4 dynpros and 2 subcreens.

Example: If Dynpro 100 has your 2 collapseable areas:

0100 - both areas open

0110 - top area closed buttom area open

0120 - both areas closed

0130 - top area open, buttom closed

If you do not make it this way, there wont be a smooth change between screens when you hit one of the buttons!

regards

0 Kudos

You can find an example in transaction BIBS.

You when you have 2 collapsable areas, you have to create 4 dynpros and 2 subcreens.

Example: If Dynpro 100 has your 2 collapseable areas:

0100 - both areas open

0110 - top area closed buttom area open

0120 - both areas closed

0130 - top area open, buttom closed

If you do not make it this way, there wont be a smooth change between screens when you hit one of the buttons!

regards

0 Kudos

I had the same problem and followed ur steps, its worked like a charm thank you!