I can already call MB51 from previously created method but still I need to add an implicit enhancement into RM07DOCS so I'll be able to export results from MB51 and leave the program without displaying them. Enhancement must be done at the end of form process_list.
I'll create a method to do the export inside MB51 with only one changing parameter, which will check if we're calling MB51 from our class and if yes then it will copy results of MB51 to memory and leave the program.
it_list type any table
Implementation:
method export_list_to_memory.
field-symbols: <list> type any,
<comp> type any.
data: ms_list type t_list.
data: mt_list type tt_list.
data: m_flag type c.
import flag to m_flag from memory id 'ZMB51_FULLLIST_EXPORT'.
if m_flag is not initial.
check it_list[] is not initial.
loop at it_list assigning <list>.
move-corresponding <list> to ms_list.
delete table it_list from <list>.
append ms_list to mt_list.
endloop.
refresh: it_list[].
export export from mt_list to memory id 'ZMB51_FULLLIST_EXPORT'.
refresh: mt_list[].
leave program.
endif.
endmethod.
After we have the last needed method and it's called in MB51 we should create now our ZMB51 program.