Komplexe Datenobjekte editieren
Wer schon einmal einen Funktionsbaustein getestet hat, der kennt mit Sicherheit den Dialog zur Eingabe von strukturierten Daten und Tabellen. Der Funktionsbaustein RS_COMPLEX_OBJECT_EDIT bietet dir genau diese Möglichkeit für deine eigenen Daten an. Folgend ein kleines Demoprogramm, das die Verwendung zeigt.
Code
REPORT zz_edit_complex_data. PARAMETERS p_edit RADIOBUTTON GROUP mode DEFAULT 'X'. PARAMETERS p_show RADIOBUTTON GROUP mode. PARAMETERS p_meta RADIOBUTTON GROUP mode. START-OF-SELECTION. TYPES: BEGIN OF ts_detail, a TYPE c LENGTH 1, b TYPE c LENGTH 3, END OF ts_detail, tt_detail TYPE STANDARD TABLE OF ts_detail WITH EMPTY KEY. TYPES: BEGIN OF ts_data, land1 TYPE land1, landx TYPE landx, detail TYPE tt_detail, END OF ts_data. DATA gt_data TYPE STANDARD TABLE OF ts_data WITH DEFAULT KEY. DATA gv_mode TYPE c LENGTH 1. SELECT * FROM t005t INTO CORRESPONDING FIELDS OF TABLE gt_data UP TO 20 ROWS. gt_data = VALUE #( ( land1 = 'DE' landx = 'Germany' detail = VALUE #( ( a = '1' b = 'AA' ) ( a = '2' b = 'BB' ) ) ) ( land1 = 'FR' landx = 'France' detail = VALUE #( ( a = 'X' b = 'RR' ) ( a = 'Y' b = 'SS' ) ) ) ). gv_mode = COND #( WHEN p_edit = 'X' THEN 'X' WHEN p_meta = 'X' THEN 'M' ELSE space ). CALL FUNCTION 'RS_COMPLEX_OBJECT_EDIT' EXPORTING object_name = 'Edit country details' mode = gv_mode insert_tab = ' ' upper_case = ' ' popup = 'X' display_accessible = 'X' CHANGING object = gt_data EXCEPTIONS object_not_supported = 1 OTHERS = 2. IF sy-subrc <> 0. MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgty WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. ENDIF.
Letzte Artikel von Enno Wulff (Alle anzeigen)
- 7. December: Excel Racing Simulation – Root Vole Race - 7. Dezember 2024
- 5. December: ABAPConf - 5. Dezember 2024
- 4. December: Only a lazy developer is a good developer - 4. Dezember 2024