Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Return data from submit into an internal table with multiple column

Former Member
0 Kudos

Hello,

I am submitting MB51 and returning list to memory.

Next i am using FM: LIST_FROM_MEMORY to get data and finally using

FM: LIST_TO_ASCI to get it into an internal table.

But, this way, data returned in internal table is in a single column. i.e of type text.

Is there a way that i can get data in individual columns ?

Thanks in advance.

Regards,

Rahul

4 REPLIES 4

former_member182550
Active Contributor
0 Kudos

No - you need to parse the result into your table.

raymond_giuseppi
Active Contributor
0 Kudos

Either you parse/split the data into TWO internal tables (header and detail, REUSE_ALV_HIERSEQ_LIST_DISPLAY) or disguise as MIGO to trigger an export of data and prevent display:

  EXPORT flag    = 'X' TO MEMORY ID 'MB51_FLAG'.
  EXPORT no_list = 'X' TO MEMORY ID 'MB51_NOLIST'.
  " submit RM07DOCS or call transaction 'MB51'
  IMPORT export_list = lt_list FROM MEMORY ID 'MB51_EXPORT_LIST'.

Look in RM07DOCS or LMIGOSR1 for export_list itab definition.

Sijin_Chandran
Active Contributor

Former Member
0 Kudos

Try Using below code you will get data in <lt_pay_data>:

DATA : i_selection TYPE STANDARD TABLE OF rsparams ,
lr_pay_data TYPE REF TO data ,

REFRESH : i_selection[] .

CLEAR : wa_selection.
wa_selection-selname = 'MATNR'.
wa_selection-kind = 'S'.
wa_selection-sign = 'I'.
wa_selection-option = 'BT'.
wa_selection-low = '1000000' .
wa_selection-high = '99999999' .
APPEND wa_selection TO i_selection.
CLEAR wa_selection.

CLEAR : wa_selection.
wa_selection-selname = 'NOZERO'.
wa_selection-kind = 'P'.
wa_selection-low = 'X' .
APPEND wa_selection TO i_selection.

CLEAR : wa_selection.
wa_selection-selname = 'PA_FLT'.
wa_selection-kind = 'P'.
wa_selection-low = 'X' .
APPEND wa_selection TO i_selection.
CLEAR wa_selection.

wa_selection-selname = 'PA_HSQ'.
wa_selection-kind = 'P'.
wa_selection-low = '' .
APPEND wa_selection TO i_selection.
CLEAR wa_selection.


wa_selection-selname = 'PA_SOND'.
wa_selection-kind = 'P'.
wa_selection-low = 'X' .
APPEND wa_selection TO i_selection.
CLEAR wa_selection.

CLEAR : wa_selection.
wa_selection-selname = 'P_VARI'.
wa_selection-kind = 'P'.
wa_selection-low = 'MONTH_END' .
APPEND wa_selection TO i_selection.
CLEAR wa_selection.

FIELD-SYMBOLS : <lt_pay_data> TYPE ANY TABLE ,
<ls_pay_data> TYPE ANY.

cl_salv_bs_runtime_info=>set(
EXPORTING display = abap_false
metadata = abap_false
data = abap_true ).
* Submit MB52
SUBMIT rm07mlbs
WITH SELECTION-TABLE i_selection
AND RETURN.
TRY.
cl_salv_bs_runtime_info=>get_data_ref(
IMPORTING r_data = lr_pay_data ).
IF lr_pay_data IS NOT INITIAL.
ASSIGN lr_pay_data->* TO <lt_pay_data>.
IF <lt_pay_data> IS ASSIGNED.
PERFORM convert_data.
PERFORM write_file_to_app USING p_filename.
CLEAR : lr_pay_data.
REFRESH : <lt_pay_data>[].
ENDIF.
ENDIF.
CATCH cx_salv_bs_sc_runtime_info.
MESSAGE 'Unable to retrieve ALV data' TYPE 'E'.
ENDTRY.
cl_salv_bs_runtime_info=>clear_all( ).