[ABAP] Informationen zu einem Dynpro ermitteln

SELECTION-SCREEN BEGIN OF LINE.
  SELECTION-SCREEN COMMENT (9) lbl1 FOR FIELD p_matnr.
  PARAMETERS: p_matnr TYPE matnr.
SELECTION-SCREEN END OF LINE.

INITIALIZATION.
  lbl1 = 'Material:'.

START-OF-SELECTION.

  DATA: lv_header TYPE rpy_dyhead.
  DATA: it_containers TYPE dycatt_tab.
  DATA: it_fields_to_containers TYPE dyfatc_tab.
  DATA: it_flow_logic TYPE swydyflow.

* Lesen eines Dynpros
  CALL FUNCTION 'RPY_DYNPRO_READ'
    EXPORTING
      progname             = sy-cprog
      dynnr                = sy-dynnr
    IMPORTING
      header               = lv_header
    TABLES
      containers           = it_containers
      fields_to_containers = it_fields_to_containers
      flow_logic           = it_flow_logic
    EXCEPTIONS
      cancelled            = 1
      not_found            = 2
      permission_error     = 3
      OTHERS               = 4.

  IF sy-subrc = 0.
    cl_demo_output=>write_data( lv_header ).
    cl_demo_output=>write_data( it_containers ).
    cl_demo_output=>write_data( it_fields_to_containers ).
    cl_demo_output=>write_data( it_flow_logic ).

* HTML-Code vom Demo-Output holen
    DATA(lv_html) = cl_demo_output=>get( ).

* Daten im Inline-Browser im SAP-Fenster anzeigen
    cl_abap_browser=>show_html( EXPORTING
                                  title        = |Daten des Dynpros { sy-dynnr }|
                                  html_string  = lv_html
                                  container    = cl_gui_container=>default_screen ).

* cl_gui_container=>default_screen erzwingen
    WRITE: space.
  ENDIF.

[ABAP] Anzeige der Toolbar unterdrücken / ausschalten

Variante 1 (cl_abap_list_layout)

PARAMETERS: p_matnr TYPE matnr.

AT SELECTION-SCREEN OUTPUT.
* Unterdrückt die Applikationszeile auf dem Listdynpro
  cl_abap_list_layout=>suppress_toolbar( ).

START-OF-SELECTION.
  WRITE: / p_matnr.

Variante 2 (RPY_DYNPRO_READ, RPY_DYNPRO_INSERT)

PARAMETERS: p_matnr TYPE matnr.

AT SELECTION-SCREEN OUTPUT.

  DATA: lv_header               TYPE rpy_dyhead.
  DATA: it_containers           TYPE dycatt_tab.
  DATA: it_fields_to_containers TYPE dyfatc_tab.
  DATA: it_flow_logic           TYPE swydyflow.

* Lesen eines Dynpros
  CALL FUNCTION 'RPY_DYNPRO_READ'
    EXPORTING
      progname             = sy-cprog
      dynnr                = sy-dynnr
    IMPORTING
      header               = lv_header
    TABLES
      containers           = it_containers
      fields_to_containers = it_fields_to_containers
      flow_logic           = it_flow_logic
    EXCEPTIONS
      cancelled            = 1
      not_found            = 2
      permission_error     = 3
      OTHERS               = 4.

  IF sy-subrc = 0.
* Anzeige der Toolbar prüfen
    IF lv_header-no_toolbar = abap_false.
      lv_header-no_toolbar = abap_true.

* Einfügen eines Dynpros
      CALL FUNCTION 'RPY_DYNPRO_INSERT'
        EXPORTING
          header                 = lv_header
          suppress_exist_checks  = abap_true
        TABLES
          containers             = it_containers
          fields_to_containers   = it_fields_to_containers
          flow_logic             = it_flow_logic
        EXCEPTIONS
          cancelled              = 1
          already_exists         = 2
          program_not_exists     = 3
          not_executed           = 4
          missing_required_field = 5
          illegal_field_value    = 6
          field_not_allowed      = 7
          not_generated          = 8
          illegal_field_position = 9
          OTHERS                 = 10.
    ENDIF.
  ENDIF.

START-OF-SELECTION.
  WRITE: / p_matnr.