2011 Aug 11 11:22 AM
Hi forum,
i would like to generate a view (dynpro) with is seperated in 3 vertical (resizable) areas. I have solved this with the splitter container.
Now i would like to fill the 3 areas with dynamic content, i. e. different table views. These different contents should be nested in containers, so i can push my predefined containers into the splitter areas. (just the contents the user would like to see...)
In my opinion, the docking container is the right choise, because i have not to carry about positioning the container at all.
Now theres a problem in adapting the docking container to the splitter container and i am not sure if it is possible at all?!?
I try to create the docking object with the splitter object as parent, but the debugger calls a run time error?!?
CREATE OBJECT docking_container
EXPORTING
parent = splitter_container
* repid =
* dynnr =
* side = docking_container->dock_at_left
* extension = 50
* style =
* lifetime = lifetime_default
caption = 'MyDock'
* metric = 0
* ratio =
* no_autodef_progid_dynnr =
* name =
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
others.Can anyone help? Different solutions are also welcome...
Thanks in advance,
Dennis
2011 Aug 11 1:07 PM
Try assigning the 'Sub Containers' instead of the whole Splitter as parent of the Docking one.
DATA: c1 TYPE REF TO cl_gui_splitter_container,
c2 TYPE REF TO cl_gui_container,
c3 TYPE REF TO cl_gui_docking_container.
CREATE OBJECT c1
EXPORTING
rows = 3
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
OTHERS = 3.
CALL METHOD c1->get_container
EXPORTING
row = 1
column = 1
RECEIVING
container = c2.
CREATE OBJECT c3
EXPORTING
parent = c2
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
OTHERS = 6
.
Hi forum,
i would like to generate a view (dynpro) with is seperated in 3 vertical (resizable) areas. I have solved this with the splitter container.
Now i would like to fill the 3 areas with dynamic content, i. e. different table views. These different contents should be nested in containers, so i can push my predefined containers into the splitter areas. (just the contents the user would like to see...)
In my opinion, the docking container is the right choise, because i have not to carry about positioning the container at all.
Now theres a problem in adapting the docking container to the splitter container and i am not sure if it is possible at all?!?
I try to create the docking object with the splitter object as parent, but the debugger calls a run time error?!?
CREATE OBJECT docking_container
EXPORTING
parent = splitter_container
* repid =
* dynnr =
* side = docking_container->dock_at_left
* extension = 50
* style =
* lifetime = lifetime_default
caption = 'MyDock'
* metric = 0
* ratio =
* no_autodef_progid_dynnr =
* name =
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
others.Can anyone help? Different solutions are also welcome...
Thanks in advance,
Dennis
2011 Aug 11 1:07 PM
Try assigning the 'Sub Containers' instead of the whole Splitter as parent of the Docking one.
DATA: c1 TYPE REF TO cl_gui_splitter_container,
c2 TYPE REF TO cl_gui_container,
c3 TYPE REF TO cl_gui_docking_container.
CREATE OBJECT c1
EXPORTING
rows = 3
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
OTHERS = 3.
CALL METHOD c1->get_container
EXPORTING
row = 1
column = 1
RECEIVING
container = c2.
CREATE OBJECT c3
EXPORTING
parent = c2
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
OTHERS = 6
.
2011 Aug 11 2:42 PM
Hello Jose,
thank you for your quick response.
I tried your suggestion, but it sadly does not solve the problem... the same error message occurs.
When I create the docking container without a parent, the container appears besides the splitter container... ?!?
2011 Aug 11 2:49 PM
Are you sure? I 've tried the above code in my own system and I got no errors at all....
2011 Aug 11 3:57 PM
Jose, thank you.
Here is my complete code and I cannot find any differences to your example...
DATA: custom_container TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
splitter_container TYPE REF TO CL_GUI_SPLITTER_CONTAINER,
splitter_cont1 type ref to cl_gui_container,
dock_container TYPE REF TO CL_GUI_DOCKING_CONTAINER.
* custom container
*-----------------
* the name 'CUSTOM_CONTROL_BASE' references to the
* custom control on the main dynpro 100!!!
CREATE OBJECT custom_container
EXPORTING
container_name = 'CUSTOM_CONTROL_BASE'
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
others = 6
.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
exit.
ENDIF.
* set splitscreen container
*--------------------------
CREATE OBJECT splitter_container
EXPORTING
parent = custom_container
rows = 1
columns = 3
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
others = 3.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
exit.
ENDIF.
CALL METHOD splitter_container->GET_CONTAINER
EXPORTING
ROW = 1
COLUMN = 1
RECEIVING
CONTAINER = splitter_cont1.
CREATE OBJECT dock_container
EXPORTING
parent = splitter_cont1
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
others = 6
.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.In debug - mode I can see, that 'splitter_cont' is initalized... The code only breakes when a parent is set to dock_container.
The error comes from CL_GUI_CONTAINER->GET_FRAME_CONTAINER where the compiler runs into 'RAISE CNTL_ERROR'...
METHOD GET_FRAME_CONTAINER.
DATA: PARENTID TYPE I.
* CALL 'DY_GET_MODAL_LEVEL' ID 'MOD_LEV' FIELD PARENTID.
* CALL 'DY_GET_MODAL_LEVEL' ID 'MOD_LEV_UI' FIELD PARENTID.
* CALL 'DY_GET_MODAL_LEVEL' ID 'ACT_UI_MOD_LEV' FIELD PARENTID.
IF CONTAINER IS INITIAL.
CALL 'DY_GET_MODAL_LEVEL' ID 'ACT_UI_MOD_LEV' FIELD PARENTID.
ELSEIF CONTAINER->H_CONTROL-SHELLID = -1.
CALL 'DY_GET_MODAL_LEVEL' ID 'ACT_UI_MOD_LEV' FIELD PARENTID.
ELSE.
PARENTID = CONTAINER->H_CONTROL-SHELLID.
ENDIF.
IF PARENTID BETWEEN 10 AND 19. " this are the dynpro areas
PARENTID = PARENTID - 10. " now its the corresponding frame
ENDIF.
data: new_dummy_parent_container type ref to CL_GUI_CONTAINER.
IF PARENTID BETWEEN 0 AND 9.
" CREATE OBJECT DUMMY_PARENT_CONTAINER
" EXPORTING CLSID = SPACE.
" DUMMY_PARENT_CONTAINER->H_CONTROL-SHELLID = PARENTID.
" FRAME_CONTAINER = DUMMY_PARENT_CONTAINER.
CREATE OBJECT NEW_DUMMY_PARENT_CONTAINER
EXPORTING CLSID = SPACE.
NEW_DUMMY_PARENT_CONTAINER->H_CONTROL-SHELLID = PARENTID.
FRAME_CONTAINER = NEW_DUMMY_PARENT_CONTAINER.
ELSEIF PARENTID = 99.
FRAME_CONTAINER = CONTAINER.
ELSE.
IF CONTAINER_MUST_BE_TOPLEVEL = 0.
FRAME_CONTAINER = CONTAINER.
ELSE.
RAISE CNTL_ERROR.
ENDIF.
ENDIF.
ENDMETHOD.I have found further solutions like yours on the web, so it seems to be right. I cannot understand why the compiler runs into error?!?
Thanks a lot!
2011 Aug 11 4:26 PM
Hi Dennis,
> I try to create the docking object with the splitter object as parent, but the debugger calls a run time error?!?
You can't, docking containers are to be attached at any side of the whole classic screen.
I didn't understand very well what you wanted to achieve exactly. What I understood so far:
- In your dynpro, you have a custom container area defined A.
- In A, you define dynamically a splitter of 3 rows * 1 column (= 3 containers).
- In each of these containers, you attach any GUI control.
What do you want to achieve exactly now?
Sandra
2011 Aug 11 4:53 PM
Hi Sandra.
> You can't, docking containers are to be attached at any side of the whole classic screen.
I am not sure about it. But Jose writes, that his code works fine and I have found further examples on the web...
> I didn't understand very well what you wanted to achieve exactly. What I understood so far:
> - In your dynpro, you have a custom container area defined A.
> - In A, you define dynamically a splitter of 3 rows * 1 column (= 3 containers).
> - In each of these containers, you attach any GUI control.
>
> What do you want to achieve exactly now?
>
> Sandra
So far, you are right. (3 cols and 1 row, but there are 3 containers anyway...)
My problem is, that I cannot attach a docking container (GUI control) to one of the 3 containers.
In general, I would like to fill the 3 container with different collections of several GUI contols like tables, pictures, toolbars, whatever... The collection should be merged through a container and I think, a docking container could be the right choice?!?
splitter_container
inherits 3 containers
container_1 inherits docking_container_1_1
docking_container_1_1 inherits a toolbar and a grid_view
container_1 inherits docking_container_1_2
docking_container_1_2 inherits another toolbar and a picture
container_2 inherits docking_container_2_1
docking_container_2_1 inherits a tree_view
...I hope, you understand what I am planning to do.
If you think, docking container is not the right choise, let me know your alternative. docking container is not a must be!
Thanks!
2011 Aug 11 5:14 PM
I never saw that docking controls could be used another way. I'd be glad to see a full working example. The doc just says that we can add a docking control on another docking control, but the primary one is to be put onto a screen.
splitter_container inherits 3 containers container_1 inherits docking_container_1_1 docking_container_1_1 inherits a toolbar and a grid_view ...
Why don't you use another splitter container inside container_1, with 2 rows to store toolbar and grid controls?
Sandra
2011 Aug 12 6:50 AM
'docking_container_1_1' is (only) for grouping toolbar and grid control. The controls in container_1, container_2 and container_3 should be dynamically attached and kicked in according to the users preferences.
The 'groups' docking_container_1_1, docking_container_1_2, ... should be predefined. So the program can attach and destroy the full container if the user decides to. If I would take another splitter container instead of the docking containers, I would have to worry about the number of splitters (rows), because the count of 'groups' changes... This is the reason, why docking containers seems to be the first choice.
By the way, I have tested attaching a docking container to another docking container and it does not work either?!? So it seems like there are other problems in general...
Thanks for help!
2011 Aug 12 8:43 AM
Hi,
'docking_container_1_1' is (only) for grouping toolbar and grid control. The controls in container_1, container_2 and container_3 should be dynamically attached and kicked in according to the users preferences.
The 'groups' docking_container_1_1, docking_container_1_2, ... should be predefined. So the program can attach and destroy the full container if the user decides to. If I would take another splitter container instead of the docking containers, I would have to worry about the number of splitters (rows), because the count of 'groups' changes...
I really don't understand the issue with "dynamic" attachment. Control framework is dynamic by definition. You can detach and attach at any time, as you want. I can program an example code for you if you want.
Now, about the docking container, and I hope that'll be the final discussion about it:
By the way, I have tested attaching a docking container to another docking container and it does not work either?!? So it seems like there are other problems in general...
That comes back to what I said. If you don't believe me, look at the documentation and demo programs.
This is the reason, why docking containers seems to be the first choice.
I hope that now you understand that docking containers are not the first choice, I don't understand why you think so much it can be the "first choice", as according to the documentation about docking containers, it doesn't correspond to what you want to do.
Help, forum, tell Dennis what you think about docking containers!
Sandra
2011 Aug 12 8:49 AM
Hi
I just re-checked again my code, and this is the result I got, so in this case we're able to assign a Docking Container to a Spitter Sub-Container.
I've also noticed that you used a Custom Container as Splitter Container's parent, I don't think this is neccesary in this case.
(Maybe that's the source of the error ¿?)
DATA: c1 TYPE REF TO cl_gui_splitter_container,
c2 TYPE REF TO cl_gui_container,
c3 TYPE REF TO cl_gui_container,
c4 TYPE REF TO cl_gui_container,
cd1 TYPE REF TO cl_gui_docking_container,
cd2 TYPE REF TO cl_gui_docking_container,
cd3 TYPE REF TO cl_gui_docking_container.
CALL SCREEN 1.
*&---------------------------------------------------------------------*
*& Module STATUS_0001 OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE status_0001 OUTPUT.
CHECK NOT c1 IS BOUND.
CREATE OBJECT c1
EXPORTING
rows = 3
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
OTHERS = 3.
CALL METHOD c1->get_container
EXPORTING
row = 1
column = 1
RECEIVING
container = c2.
CALL METHOD c1->get_container
EXPORTING
row = 1
column = 2
RECEIVING
container = c3.
CALL METHOD c1->get_container
EXPORTING
row = 1
column = 3
RECEIVING
container = c4.
CREATE OBJECT cd1
EXPORTING
parent = c2
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
OTHERS = 6.
CREATE OBJECT cd2
EXPORTING
parent = c3
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
OTHERS = 6.
CREATE OBJECT cd3
EXPORTING
parent = c4
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
OTHERS = 6.
ENDMODULE. " STATUS_0001 OUTPUT
2011 Aug 12 1:38 PM
Hi,
in the end I give up on handling my problem with docking containers because I think, docking containers can only be attached at screens and not at containers. Anyway...
@Jose: Are you shure your program works like you think it does? In my point of view, only the docking containers are displayed at the screen. I cannot see any splitters (you have created them as rows = horizontal)?!? Your code is running on my system also, but while debugging the gui containers (your parents for the docking containers) are initial, so I think the compiler decides to show the docking containers at the 'base' screen as default. I think you need a custom container to initialize them accurately.
My way around will be using splitter containers instead of docking containers. This solution is not as nice as docking containers would have been, but it is an acceptable workaround.
So thanks for your helps and inputs in finding the right way!
2011 Aug 12 4:46 PM
Hi Dennis,
This solution is not as nice as docking containers would have been
Just a little/final question (I hope 😞 By "nice", I guess that's not a matter of visual effect, as they look identical, so do you mean that :
- a docking container at a container side would have allowed you to add a container at any side at the moment you want
- while the other solution implies that you have to prepare empty containers at all 4 sides so that to be able to later fill the side you want (so that to not have to rebuild existing controls (not containers))
I always saw SAP transactions place controls at only one predefined side. Now, about the applications where controls can be moved by the user, the new debugger for instance: it is made of up to 4 panels corresponding to custom containers, moving the tools from one panel to another is made by rebuilding the controls.
Thanks
Sandra
2011 Aug 12 10:35 PM
Hi again.
You're completely right, sorry about confusing you with the sample (I didn't have the time to check it properly)
So now, there's no doubt, a Docking Container can not be assigned to a splitter container or any subcontainers it may have.
Taking a look at the Docking Constructor's code we can find the reason why:
DATA: MY_PARENT TYPE REF TO CL_GUI_CONTAINER.
MY_PARENT = GET_FRAME_CONTAINER( CONTAINER = PARENT
*CONTAINER_MUST_BE_TOPLEVEL* = 1 ).
Maybe we could try creating a copy ZCL_GUI_DOCKING_CONTAINER and bypass this restriction, but I'm pretty sure it won't work anyway since there must be some further design restrictions on using this kind of container.
Best of luck on your final decision.
2011 Aug 14 3:58 PM
Hi.
Yes Sandra, you are right. It is not a visual problem...
Jose, I cannot believe that the restriction is set without any further reason. So thank you for the hint but I will not try to 'manipulate' the standard sap controls.
By the way, since I have decided to solve the situation with splitter container, my coding proceeds and everything works fine...
Thanks,
Dennis
2011 Aug 12 2:32 PM
Temporarily set to "not answered" to allow further replies as requested here:
Thomas
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |