export no_list from m_flag to memory id 'MB51_NOLIST'.
export flag from m_flag to memory id 'MB51_FLAG'.
export flag from m_flag to memory id 'ZMB51_FULLLIST_EXPORT'.
- import export to mt_list from memory id 'ZMB51_FULLLIST_EXPORT'.
i_selection_from_program type c default space -> if we want that method reads select options from caller
i_progname type sy-repid default space -> caller name
it_seltab type rsparams_tt optional -> selection options passed manually
ct_list type standard table -> list with results from MB51
method call_mb51_static.
field-symbols: <list> type any,
<expt> type standard table,
<expl> type any.
data: m_flag type c value 'X'.
data: mt_list type tt_list.
data: mt_exlist type ref to data.
data: ms_exlist type ref to data.
if i_selection_from_program ne space and i_progname ne space.
call method zab_mb51_call=>get_selection_screen_criteria(
exporting
i_progname = i_progname
changing
it_seltab = it_seltab[]
).
endif.
export no_list from m_flag to memory id 'MB51_NOLIST'.
export flag from m_flag to memory id 'MB51_FLAG'.
export flag from m_flag to memory id 'ZMB51_FULLLIST_EXPORT'.
submit rm07docs with selection-table it_seltab and return .
import export to mt_list from memory id 'ZMB51_FULLLIST_EXPORT'.
free memory id 'ZMB51_FULLLIST_EXPORT'.
create data mt_exlist like ct_list.
create data ms_exlist like line of ct_list.
assign mt_exlist->* to <expt>.
assign ms_exlist->* to <expl>.
loop at mt_list assigning <list>.
move-corresponding <list> to <expl>.
append <expl> to ct_list."<expt>.
clear <expl>.
delete table mt_list from <list>.
endloop.
" ct_list[] = <expt>.
free: mt_list[], m_flag.
endmethod.