Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
CLASS lcl_test DEFINITION.
PUBLIC SECTION.
TYPES: BEGIN OF st_list,
tabname TYPE dd03l-tabname,
fieldname TYPE dd03l-fieldname,
keyflag TYPE dd03l-keyflag,
rollname TYPE dd03l-rollname,
ddtext TYPE dd03t-ddtext,
END OF st_list.
CLASS-DATA: t_list TYPE TABLE OF st_list,
t_text TYPE TABLE OF st_list.
CLASS-METHODS: retrieve_data,
process_data,
display_data.
ENDCLASS.
CLASS lcl_test IMPLEMENTATION.
METHOD retrieve_data.
SELECT tabname fieldname keyflag rollname UP TO 100000 ROWS
FROM dd03l INTO CORRESPONDING FIELDS OF TABLE t_list
WHERE as4local = 'A'.
IF t_list IS NOT INITIAL.
SELECT tabname fieldname ddtext FROM dd03t
INTO CORRESPONDING FIELDS OF TABLE t_text
FOR ALL ENTRIES IN t_list
WHERE tabname = t_list-tabname
AND ddlanguage = 'E'
AND as4local = 'A'
AND fieldname = t_list-fieldname.
ENDIF.
ENDMETHOD.
METHOD process_data.
FIELD-SYMBOLS: <ls_list> TYPE st_list,
<ls_text> TYPE st_list.
LOOP AT t_list ASSIGNING <ls_list>.
READ TABLE t_text ASSIGNING <ls_text> WITH KEY tabname = <ls_list>-tabname
fieldname = <ls_list>-fieldname.
IF sy-subrc = 0.
<ls_list>-ddtext = <ls_text>-ddtext.
ENDIF.
ENDLOOP.
ENDMETHOD.
METHOD display_data.
DATA lo_salv TYPE REF TO cl_salv_table.
cl_salv_table=>factory(
IMPORTING
r_salv_table = lo_salv
CHANGING
t_table = t_list ).
lo_salv->display( ).
ENDMETHOD.
ENDCLASS.
START-OF-SELECTION.
lcl_test=>retrieve_data( ).
END-OF-SELECTION.
lcl_test=>process_data( ).
lcl_test=>display_data( ).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.