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: 

Splitter Control: How to set it to full window size

Former Member
0 Kudos

Hello All,

I have created a Custom Container. Then using splitter control, I have first split it into 2 rows (30:70 ratio). Then I have split the second row into 2 coulmns (30:70 ratio). Now my requirement is as follows:-

1) I want the container to cover the entire screen size but it is leaving some space on the right side. How shall I make it cover the entire window size. I know there is a method to get the window width.

2) I am not able to set the border of splitter. I can see a border on left and top of container but there is no border on right and bottom. I tried to use SET_BORDER method but still I am not able to get it.

Kindly help me out with the above 2 scenarios.

Points will be awarded to those who provide the solution

Regards,

Abhishek

1 ACCEPTED SOLUTION

uwe_schieferstein
Active Contributor
0 Kudos

Hello Abishek

Do you really need a custom container (because you have additional elements on your screen)?

If so the set the custom control resizable (in screen painter).

If you do not need a custom container (or custom control) on your screen then I would suggest the following approach:

(1) Create a docking container (as parent for the splitter container)


CREATE OBJECT go_docking
  EXPORTING
    parent = cl_gui_container=>screen0  " full-screen size
    ratio = 90
  EXCEPTIONS
  OTHERS = 6.
IF sy-subrc ne 0.
*   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*   WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

CALL METHOD go_docking->set_width
   EXPORTING
     width = 99999.  "
  

Alternatively, when calling the CONSTRUCTOR method of cl_gui_splitter_container you could directly use:


    parent = cl_gui_container=>screen0
  

You may ask how to "attach" the container to your target screen? Well, simply link it to the screen:


CALL METHOD go_docking->link
EXPORTING
repid = syst-repid
dynnr = '0100'
* CONTAINER =
EXCEPTIONS
OTHERS = 4.
IF sy-subrc ne 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
  

For a more elaborated example have a look at my sample report ZUS_SDN_TWO_ALV_GRIDS in thread:

[ALV|;

Regards,

Uwe

6 REPLIES 6

uwe_schieferstein
Active Contributor
0 Kudos

Hello Abishek

Do you really need a custom container (because you have additional elements on your screen)?

If so the set the custom control resizable (in screen painter).

If you do not need a custom container (or custom control) on your screen then I would suggest the following approach:

(1) Create a docking container (as parent for the splitter container)


CREATE OBJECT go_docking
  EXPORTING
    parent = cl_gui_container=>screen0  " full-screen size
    ratio = 90
  EXCEPTIONS
  OTHERS = 6.
IF sy-subrc ne 0.
*   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*   WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

CALL METHOD go_docking->set_width
   EXPORTING
     width = 99999.  "
  

Alternatively, when calling the CONSTRUCTOR method of cl_gui_splitter_container you could directly use:


    parent = cl_gui_container=>screen0
  

You may ask how to "attach" the container to your target screen? Well, simply link it to the screen:


CALL METHOD go_docking->link
EXPORTING
repid = syst-repid
dynnr = '0100'
* CONTAINER =
EXCEPTIONS
OTHERS = 4.
IF sy-subrc ne 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
  

For a more elaborated example have a look at my sample report ZUS_SDN_TWO_ALV_GRIDS in thread:

[ALV|;

Regards,

Uwe

0 Kudos

Hello Uwe,

I have never used docking container before.

I am using Custom container just to create one parent container for the splitter containers.

I have certain clarification regarding the solution you gave:-

1) In case I use docking container, do I have create some kind of Custom container on my screen as I do for the Custom container.

I wrote following code. But this is not giving me any output:-

DATA: go_docking type ref to cl_gui_docking_container,

go_splitter type ref to cl_gui_splitter_container.

*call screen 100.

CREATE OBJECT go_docking

EXPORTING

parent = cl_gui_container=>screen0 " full-screen size

ratio = 90

EXCEPTIONS

OTHERS = 6.

CALL METHOD go_docking->set_width

EXPORTING

width = 99999. "

CREATE OBJECT go_splitter

EXPORTING

parent = go_docking

rows = 2

columns = 1.

CALL METHOD go_splitter->set_row_mode

EXPORTING

mode = 0

.

CALL METHOD go_splitter->set_row_height

EXPORTING

id = 1

height = 30

.

Regards,

Abhishek

0 Kudos

Hello Abishek

If you do not need any other screen elements except your controls then I would always use a docking container.

The logic is as you have coded already.


" create docking container
...
" create splitter container with docking container as parent
...

" Link the docking container to your target screen (my dynpros usually never have any elements, not even a custom control)

gd_repid = syst-repid.
CALL METHOD go_docking->link
EXPORTING
repid = gd_repid  " using syst-repid will not work on 4.6c
dynnr = '0100'
* CONTAINER =
EXCEPTIONS
OTHERS = 4.
IF sy-subrc ne 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

" Now the docking container is attached to your screen, next call your screen.

CALL SCREEN '0100'.

The beautiful thing about linking controls instead of "sticking" them to dynpros via custom controls is that you can easily re-link the docking container to another screen.

For example, at PAI you could code as following (e.g. USER_COMMAND_0100):


CALL METHOD go_docking->link
EXPORTING
repid = gd_repid  
dynnr = '0200'     " link to other screen !!!
* CONTAINER =
EXCEPTIONS
OTHERS = 4.
IF sy-subrc ne 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

SET SCREEN '0200'.
LEAVE SCREEN.

Regards,

Uwe

0 Kudos

Thanks a lot Uwe!!!

Just one last question.

What is the difference between using a docking container (with it's parent assigned to parent = cl_gui_container=>screen0) and directly assigning the parent of Splitter container to "parent = cl_gui_container=>screen0" without using docking container.

I can see one advantage from your solution that I can attach docking container to any screen but then in that case it will take the entire screen area as compared to one subscreen area (as in case of custom container).

Also what are these "screen elements" that you have mentioned in your solution?

Regards,

Abhishek

0 Kudos

Hello Abishek

If you just want to display a full-screen size ALV list then there should not be any difference.

One advantage or additional option of docking containers is that when you create the docking container you define via IMPORTING parameter SIDE the edge of the screen to which you want to attach the container (for details please refer to: [CONSTRUCTOR|http://help.sap.com/saphelp_46c/helpdata/en/f5/4f6e0a9f2511d295cc00a0c930660b/frameset.htm]

With screen elements I mean the following: If you display a sales order (VA03) you have a header section with input fields (e.g. for Sold-to-party, PO number, PO date, etc.). Below the header you have a tabstrip showing various details of the sales order (e.g. items in a table control).

These are all screen elements.

Regards,

Uwe

0 Kudos

If I want to design my screen in such a way that there are 3 parts of screen. One top row which displays company logo n other generic information. Then there are 2 columns. Column on left has simple tree control which has names of different reports. Now at present, when I double click on any report name, it opens the ALV report in a new window. (it uses REUSE_ALV_GRID_DISPLAY function mod)

Can I open the report in the right column by building an ALV grid? I would need a "Top of Page", ALV toolbar, ALV report and "Bottom of Page" all to be displayed on the same right column.

Which one do you think will be simple for me?

Your inputs have been really helpful.

Regards,

Abhishek