Skip to Content
avatar image
Former Member

Return data from submit into an internal table with multiple column

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Jun 13, 2017 at 11:35 AM

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

    Add comment
    10|10000 characters needed characters exceeded

  • Jun 14, 2017 at 04:55 AM
    Add comment
    10|10000 characters needed characters exceeded

  • Jun 13, 2017 at 12:27 PM

    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.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jun 14, 2017 at 05:17 AM

    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( ).

    Add comment
    10|10000 characters needed characters exceeded