How to share a Control Framework demo such a way it can be run by a simple copy/paste?

I’ve got a very simple ABAP program demonstrating how to display a Text Editor field (cl_gui_textedit), which I want to share via Internet, email, forum, blog post or whatever.

I’d like the people to just copy, paste and run this very simple demonstration in an instant, but this program contains a GUI Status and a Dynpro screen, which are difficult to share because it’s not code (see the details after the program code).

I know these ways to share ABAP and non-ABAP objects, but my opinion is that it’s too much complex for such a simple demonstration: SAP Transport Request, Git repository and abapGit.

Note that I have other Dynpro SAP Control Framework demonstrations (cl_gui_alv_grid, cl_gui_html_viewer, etc.) so I’d like to generalize the question to all types of controls.

Is there a way to easily share, copy, paste and run this demonstration (possibly by refactoring the code), whatever it’s cl_gui_textedit or any other Dynpro Control?

The 3 elements of the demonstration:

  • Program:
    REPORT zdemo_cl_gui_textedit.
    DATA go_custom_container TYPE REF TO cl_gui_custom_container.
    DATA go_textedit TYPE REF TO cl_gui_textedit.
    
    START-OF-SELECTION.
      CALL SCREEN 100.
    
    MODULE _0100_pbo OUTPUT.
      SET PF-STATUS '0100'.
      IF go_textedit IS NOT BOUND.
        CREATE OBJECT go_custom_container
          EXPORTING
            container_name = 'CUSTOM_CONTAINER'.
        CREATE OBJECT go_textedit
          EXPORTING
            parent  = go_custom_container.
      ENDIF.
    ENDMODULE.
    
    MODULE _0100_pai INPUT.
      IF sy-ucomm = 'EXIT'.
        SET SCREEN 0.
      ENDIF.
    ENDMODULE.
    
  • Dynpro:
    • Elements:
      • Field CUSTOM_CONTAINER of type “Custom Control”.
    • Flow logic:
      PROCESS BEFORE OUTPUT.
        MODULE _0100_PBO.
      
      PROCESS AFTER INPUT.
        MODULE _0100_PAI AT EXIT-COMMAND.
      
  • GUI Status:
    • Button EXIT, of type “E” (Exit command).

My preferred way to propose a minimal reproducible example (MRE) is to use cl_gui_container=>screen0 which is a container displayed over a Dynpro screen, and it may contain any kind of Dynpro Control (not limited to cl_gui_textedit).

So, a Dynpro screen must first be displayed. Instead of a general Dynpro screen, a Selection Screen may be used, which is built by the ABAP statements PARAMETERS or SELECT-OPTIONS.

In selection screens, the “Process Before Output” logic corresponds to the event “AT SELECTION-SCREEN OUTPUT”, and the exit button is managed by default (if other buttons are needed, the control CL_GUI_TOOLBAR may be used, several controls may be displayed inside cl_gui_container=>screen0 by using the control CL_GUI_SPLITTER_CONTAINER).

Warning: the solution of using cl_gui_container=>screen0 is nice for demonstration programs, but I don’t recommend using it for productive programs because it’s an unofficial trick. Instead, use containers inside normal Dynpro screens (cl_gui_custom_container), around (cl_gui_docking_container) or over it as a dialog box screen (cl_gui_dialogbox_container).

Hence, the whole example can be simplified to these below lines of code, the Dynpro screen and GUI Status objects are not needed.

REPORT zdemo_cl_gui_textedit.
DATA go_textedit TYPE REF TO cl_gui_textedit.
PARAMETERS dummy.
AT SELECTION-SCREEN OUTPUT.
  IF go_textedit IS NOT BOUND.
    go_textedit = NEW #( parent = cl_gui_container=>screen0 ).
  ENDIF.

NB: other MRE in Stack Overflow based on the same concept:

  • cl_salv_table
    • Can CL_SALV_TABLE display a toolbar above the grid, as does CL_GUI_ALV_GRID?
  • cl_gui_alv_grid
    • How to trigger code when the user clicks an ALV hotspot field?
    • Read ALV changes after user input?
  • cl_gui_html_viewer
    • How to get updated HTML radio button in Workflow Inbox?
  • cl_gui_toolbar
    • Update/refresh Custom Control to reflect new data
  • cl_salv_tree
    • How to capture expand node event in SALV Tree?

NB: a User Interface demonstration can be improved if it contains rich and meaningful data, which you can obtain from the database tables SFLIGHT, SBOOK, etc. For instance, this data can be used for an ALV grid. These tables should be present in all ABAP systems but may be delivered empty. To generate content, run any of these programs:

  • For SCARR, SPFLI, SFLIGHT, SBOOK…: run the program SAPBC_DATA_GENERATOR.
  • For tables starting with ALV_ (e.g. ALV_CHCK, ALV_T_T2) used by a few SAP demo programs: run the program BCALV_GENERATE_ALV_T_T2`.

NB: instead of cl_gui_container=>screen0, you may use cl_gui_container=>default_screen, that’s the same behavior. Technically speaking, cl_gui_container=>screen0 is displayed over cl_gui_container=>default_screen i.e. if both containers contain a control, only the control in cl_gui_container=>screen0 will be shown. If you want to display a control in a popup screen, cl_gui_container=>screen1 up to screen9 have to be used. Each number represents a “modal level”: screen2 is for a popup called from the first popup. I don’t know what represents cl_gui_container=>desktop, I can’t display anything in it.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật