...das hört sich guuuut an. Nur: die Zuweisung zum Custom-Container mache ich doch durchereglam hat geschrieben:Mir kommt gerade noch eine Idee:
Lege für jedes Dynpro einen Parent-Container an und setze den Parent des Controls durch einfache Zuweisung des benötigten Dynpro-Containers im PBO des jeweiligen Dynpro um.
Damit müsstest Du nicht einmal etwas zerstören.
Code: Alles auswählen.
CREATE OBJECT alv ... exporting parent = custom_container.
Code: Alles auswählen.
CREATE OBJECT go_cont_dynp1
EXPORTING
...
container_name = 'Name Custom-Container Dynpro 1'
...
CREATE OBJECT go_cont_dynp2
EXPORTING
...
container_name = 'Name Custom-Container Dynpro 2'
...
PERFORM prepare_grid
USING go_alv_parent
...
CHANGING go_alv
...
FORM prepare_grid...
USING co_alv_parent TYPE REF TO cl_gui_custom_container
CHANGING co_alv...
...
* CO_ALV_PARENT wird hier nicht instanziiert
CREATE OBJECT co_alv
EXPORTING
...
parent = co_parent
...
ENDFORM.
MODULE init_dyp1 OUTPUT.
* Verbindung zum Dynpro herstellen
go_alv_parent = go_cont_dynp1.
ENDMODULE.
MODULE init_dyp2 OUTPUT.
* Verbindung zum Dynpro herstellen
go_alv_parent = go_cont_dynp2.
ENDMODULE.
Code: Alles auswählen.
REPORT zztest.
TYPE-POOLS icon.
DATA gr_cc1 TYPE REF TO cl_gui_custom_container.
DATA gr_cc2 TYPE REF TO cl_gui_custom_container.
DATA gr_cpr TYPE REF TO cl_gui_custom_container. "Parent
DATA gr_pic TYPE REF TO cl_gui_picture.
DATA gv_lnk TYPE char30 VALUE 'CC1'.
DATA gv_nam TYPE char30.
DATA gs_inf TYPE cfw_link.
START-OF-SELECTION.
CALL SCREEN 1.
*----------------------------------------------------------------------*
* MODULE status_0001 OUTPUT
*----------------------------------------------------------------------*
MODULE status_0001 OUTPUT.
SET PF-STATUS 'STLI' OF PROGRAM 'SAPMSSY0'.
IF gr_pic IS INITIAL.
CREATE OBJECT gr_cc1
EXPORTING
container_name = 'CC1'
EXCEPTIONS
OTHERS = 6.
CREATE OBJECT gr_cc2
EXPORTING
container_name = 'CC2'
EXCEPTIONS
OTHERS = 6.
PERFORM link USING gr_cpr
CHANGING gr_pic.
ENDIF.
CASE gv_lnk.
WHEN 'CC1'.
gv_lnk = 'CC2'.
gr_cpr = gr_cc2.
WHEN 'CC2'.
gv_lnk = 'CC1'.
gr_cpr = gr_cc1.
ENDCASE.
ENDMODULE. " STATUS_0100 OUTPUT
*----------------------------------------------------------------------*
* MODULE user_command_0001 INPUT
*----------------------------------------------------------------------*
MODULE user_command_0001 INPUT.
CASE sy-ucomm.
WHEN 'BACK' OR '%EX' OR 'RW'.
SET SCREEN 0.
LEAVE SCREEN.
WHEN '%PRI'.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
*& Form link
*&---------------------------------------------------------------------*
FORM link USING fi_cpr TYPE REF TO cl_gui_custom_container
CHANGING fc_pic TYPE REF TO cl_gui_picture.
CREATE OBJECT fc_pic
EXPORTING
parent = fi_cpr
EXCEPTIONS
OTHERS = 2.
CALL METHOD fc_pic->load_picture_from_sap_icons
EXPORTING
icon = icon_delete
EXCEPTIONS
error = 1.
CALL METHOD fc_pic->set_display_mode
EXPORTING
display_mode = fc_pic->display_mode_stretch
EXCEPTIONS
error = 1.
ENDFORM. "link
Code: Alles auswählen.
*&---------------------------------------------------------------------*
*& Report ZZENNO27
*&---------------------------------------------------------------------*
REPORT zzenno27.
TYPE-POOLS icon.
DATA gr_cc1 TYPE REF TO cl_gui_custom_container.
DATA gr_cc2 TYPE REF TO cl_gui_custom_container.
DATA gr_cpr TYPE REF TO cl_gui_custom_container. "Parent
DATA gr_pic TYPE REF TO cl_gui_picture.
DATA gv_lnk TYPE char30 VALUE 'CC1'.
DATA gv_nam TYPE char30.
DATA gs_inf TYPE cfw_link.
FIELD-SYMBOLS <cpr> TYPE REF TO cl_gui_custom_container.
START-OF-SELECTION.
CALL SCREEN 1.
*----------------------------------------------------------------------*
* MODULE status_0001 OUTPUT
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
MODULE status_0001 OUTPUT.
SET PF-STATUS 'STLI' OF PROGRAM 'SAPMSSY0'.
IF gr_pic IS INITIAL.
CREATE OBJECT gr_cc1
EXPORTING
container_name = 'CC1'
EXCEPTIONS
OTHERS = 6.
CREATE OBJECT gr_cc2
EXPORTING
container_name = 'CC2'
EXCEPTIONS
OTHERS = 6.
ASSIGN gr_cc1 TO <cpr>.
PERFORM link USING <cpr>
CHANGING gr_pic.
ENDIF.
CASE gv_lnk.
WHEN 'CC1'.
gv_lnk = 'CC2'.
ASSIGN gr_cc1 TO <cpr>.
CALL METHOD gr_cc1->link
EXPORTING
repid = space
dynnr = space
container = 'CC1'.
WHEN 'CC2'.
gv_lnk = 'CC1'.
ASSIGN gr_cc2 TO <cpr>.
CALL METHOD gr_cc1->link
EXPORTING
repid = space
dynnr = space
container = 'CC2'.
ENDCASE.
CALL METHOD cl_gui_cfw=>flush.
ENDMODULE. " STATUS_0100 OUTPUT
*----------------------------------------------------------------------*
* MODULE user_command_0001 INPUT
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
MODULE user_command_0001 INPUT.
CASE sy-ucomm.
WHEN 'BACK' OR '%EX' OR 'RW'.
SET SCREEN 0.
LEAVE SCREEN.
WHEN '%PRI'.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
*& Form link
*&---------------------------------------------------------------------*
FORM link USING fi_cpr TYPE REF TO cl_gui_custom_container
CHANGING fc_pic TYPE REF TO cl_gui_picture.
CREATE OBJECT fc_pic
EXPORTING
parent = fi_cpr
EXCEPTIONS
OTHERS = 2.
CALL METHOD fc_pic->load_picture_from_sap_icons
EXPORTING
icon = icon_delete
EXCEPTIONS
error = 1.
CALL METHOD fc_pic->set_display_mode
EXPORTING
display_mode = fc_pic->display_mode_stretch
EXCEPTIONS
error = 1.
ENDFORM. "link
gern geschehen...ewx hat geschrieben:Jippieijey, Schweinebacke...!
Now goes it!
Jetzt muss ich nur noch prüfen, ob's auch tatsächlich mit dem Popup geht...!
Danke ereglam für deine Idee und Hilfe!
...
Ist das in dem Fall nicht das gleiche? Der Zeiger zeigt doch schon auf genau einen Container...ereglam hat geschrieben:Probehalber könnte man noch probieren, ob man mit GET REFERENCE die Referenzen umschichten kann.
Code: Alles auswählen.
REPORT zz.
TYPE-POOLS icon.
DATA gr_cc TYPE REF TO cl_gui_custom_container.
DATA gr_pic TYPE REF TO cl_gui_picture.
DATA gv_lnk TYPE char30 VALUE 'CC1'.
START-OF-SELECTION.
CALL SCREEN 1.
*----------------------------------------------------------------------*
* MODULE status_0001 OUTPUT
*----------------------------------------------------------------------*
MODULE status_0001 OUTPUT.
SET PF-STATUS 'STLI' OF PROGRAM 'SAPMSSY0'.
IF gr_cc IS INITIAL.
CREATE OBJECT gr_cc
EXPORTING
container_name = 'CC1'
EXCEPTIONS
OTHERS = 6.
ENDIF.
IF gr_pic IS INITIAL.
CREATE OBJECT gr_pic
EXPORTING
parent = gr_cc
EXCEPTIONS
OTHERS = 2.
CALL METHOD gr_pic->load_picture_from_sap_icons
EXPORTING
icon = icon_delete
EXCEPTIONS
error = 1.
CALL METHOD gr_pic->set_display_mode
EXPORTING
display_mode = gr_pic->display_mode_stretch
EXCEPTIONS
error = 1.
ENDIF.
CASE gv_lnk.
WHEN 'CC1'.
gv_lnk = 'CC2'.
CALL METHOD gr_cc->link
EXPORTING
repid = space
dynnr = space
container = 'CC1'.
WHEN 'CC2'.
gv_lnk = 'CC1'.
CALL METHOD gr_cc->link
EXPORTING
repid = space
dynnr = space
container = 'CC2'.
ENDCASE.
ENDMODULE. " STATUS_0100 OUTPUT
*----------------------------------------------------------------------*
* MODULE user_command_0001 INPUT
*----------------------------------------------------------------------*
MODULE user_command_0001 INPUT.
CASE sy-ucomm.
WHEN 'BACK' OR '%EX' OR 'RW'.
SET SCREEN 0.
LEAVE SCREEN.
WHEN '%PRI'.
CALL SCREEN 2 STARTING AT 5 5.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT