DATA: o_doc TYPE REF TO cl_dd_document. DATA: o_form_area TYPE REF TO cl_dd_form_area. DATA: o_input TYPE REF TO cl_dd_input_element. DATA: o_combo TYPE REF TO cl_dd_select_element. DATA: o_btn TYPE REF TO cl_dd_button_element. DATA: o_link TYPE REF TO cl_dd_link_element. DATA: it_options TYPE sdydo_option_tab. CLASS lcl_events DEFINITION. PUBLIC SECTION. CLASS-METHODS: on_button_clicked FOR EVENT clicked OF cl_dd_button_element IMPORTING sender. CLASS-METHODS: on_selected FOR EVENT selected OF cl_dd_select_element IMPORTING sender. CLASS-METHODS: on_enter FOR EVENT entered OF cl_dd_input_element IMPORTING sender. CLASS-METHODS: on_f1 FOR EVENT help_f1 OF cl_dd_input_element IMPORTING sender. CLASS-METHODS: on_link_clicked FOR EVENT clicked OF cl_dd_link_element IMPORTING sender. ENDCLASS. CLASS lcl_events IMPLEMENTATION. METHOD on_button_clicked. MESSAGE |{ sender->name }: { o_input->value } und { o_combo->value }| TYPE 'I'. ENDMETHOD. METHOD on_selected. MESSAGE sender->value TYPE 'I'. ENDMETHOD. METHOD on_enter. MESSAGE |{ sender->name }: { sender->value }| TYPE 'I'. ENDMETHOD. METHOD on_f1. MESSAGE |{ sender->name }: { sender->value }| TYPE 'I'. ENDMETHOD. METHOD on_link_clicked. MESSAGE |{ sender->name }| TYPE 'I'. ENDMETHOD. ENDCLASS. START-OF-SELECTION. * Dokument o_doc = NEW cl_dd_document( ). o_doc->add_text( text = 'Eingabefelder' sap_style = cl_dd_area=>heading ). * Formular o_doc->add_form( IMPORTING formarea = o_form_area ). * Editfeld o_form_area->add_input_element( EXPORTING value = 'Wert' name = 'EDINPUT' size = '40' maxlength = '40' tooltip = 'Bitte einen Wert eingeben' IMPORTING input_element = o_input ). SET HANDLER lcl_events=>on_enter FOR o_input. SET HANDLER lcl_events=>on_f1 FOR o_input. * Combobox it_options = VALUE #( ( value = 'P1' text = 'Punkt1' ) ( value = 'P2' text = 'Punkt2' ) ( value = 'P3' text = 'Punkt3' ) ). o_form_area->add_select_element( EXPORTING name = 'CBTEST' value = 'P2' options = it_options IMPORTING select_element = o_combo ). SET HANDLER lcl_events=>on_selected FOR o_combo. * Button o_form_area->add_button( EXPORTING sap_icon = 'ICON_LED_GREEN' label = 'Klick' name = 'BTN_TEST' IMPORTING button = o_btn ). SET HANDLER lcl_events=>on_button_clicked FOR o_btn. * Link o_form_area->add_link( EXPORTING text = 'Linktext' name = 'LINK1' tooltip = 'Klick me' IMPORTING link = o_link ). SET HANDLER lcl_events=>on_link_clicked FOR o_link. * Dokumentelemente zusammenführen o_doc->merge_document( ). * Dokument anzeigen o_doc->display_document( parent = cl_gui_container=>default_screen ). * erzwingen von cl_gui_container=>default_screen WRITE space.
Kategorien
-
Neueste Beiträge
- [ABAP] Ergebnisse eines SQL-Ausdrucks in einer Zeile verketten
- [SAP] Profit Center
- [SAP Fiori] Setup Fiori My Inbox
- [SAP Fiori] Setup der Fiori Suche / Fiori search
- [ABAP] Liste aller Umgebungsvariablen
- [ABAP] Muster-Leistungsverzeichnisse lesen
- [ABAP] ABAP2XLSX: Column Autosize, Verwendung Iterator
- [ABAP] Schlüsselspalten einer DB-Tabelle ermitteln
- [ABAP] SALV-Grid: Eventhandler für Klick auf eine Zelle (link_click, hotspot)
- [ABAP] Material-Ledger: Materialpreise für unterschiedliche Währungstypen pflegen