Select data from the Maintenance View
1.
select single lgnum from v_t320 into DATA(***) where werks eq p_i_werks and lgort eq p_i_lgort.
CALL FUNCTION 'VIEW_MAINTENANCE_CALL'
EXPORTING
action = 'U'
view_name = 'table'
TABLES
dba_sellist = gt_typo
EXCEPTIONS
OTHERS = 14.
REPORT ymaintenance.
DATA:wf_tab TYPE REF TO data,
repid TYPE sy-repid.
FIELD-SYMBOLS: <fs_tab> TYPE table.
PARAMETERS:pa_view TYPE dd02v-tabname OBLIGATORY.
START-OF-SELECTION.
FIELD-SYMBOLS: <f1> TYPE x,
<f2> TYPE x.
DATA: BEGIN OF itab1 OCCURS 1,
c TYPE c LENGTH 8192, " max length
END OF itab1.
CREATE DATA wf_tab TYPE TABLE OF (pa_view).
IF wf_tab IS BOUND.
ASSIGN wf_tab->* TO <fs_tab>.
CHECK <fs_tab> IS ASSIGNED.
ELSE.
EXIT.
ENDIF.
CALL FUNCTION 'VIEW_GET_DATA'
EXPORTING
view_name = pa_view
with_authority_check = 'X'
TABLES
data = itab1
EXCEPTIONS
no_viewmaint_tool = 1
no_authority = 2
no_auth_for_sel = 3
data_access_restricted = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
LOOP AT itab1 ASSIGNING <f1> CASTING.
APPEND INITIAL LINE TO <fs_tab> ASSIGNING <f2> CASTING.
<f2> = <f1>.
ENDLOOP.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_structure_name = pa_view
TABLES
t_outtab = <fs_tab>
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.