Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Dump while passing internal table to FM RFC enabled

I am passing dynamic internal table to FM RFC enabled .. for that matter i am passing these values into String and then using this string in FM .. correct me if this is wrong way to do .

Following code is giving dump ...for Unicode conversion from <l_struct> to lt_string not possible. some special conversion needed.

data : lt_string TYPE sxms_str_t.

LOOP AT <lt_data> INTO <l_struct>.

APPEND <l_struct> TO lt_string.

ENDLOOP.

Pls suggets me if there is any other way to pass dynamic internal table to FM RFC enabled .

Thanks in advance .

Tags:
Former Member
replied

you can try out this approach...using RFC_READ_TABLE function

data: lt_options type table of rfc_db_opt,
        lt_fields  type table of rfc_db_fld,
        lt_data    type table of tab512,
        l_offset   type i,
        l_len      type i,
        ls_flight  type sflight.

  field-symbols: <ls_fields> type rfc_db_fld,
                 <ls_data>   type tab512,
                 <l_field>   type any.


options-text = ' '. " Where condtions you can pass to the options parameter
append options to lt_options.

  call function 'RFC_READ_TABLE'
           destination bwsystem-rfcdest
    exporting
      query_table                = 'SFLIGHT'
    tables
      options                    = lt_options
      fields                     = lt_fields
      data                       = lt_data
    exceptions
      table_not_available        = 1
      table_without_data         = 2
      option_not_valid           = 3
      field_not_valid            = 4
      not_authorized             = 5
      data_buffer_exceeded       = 6
      others                     = 7
            .
  if sy-subrc <> 0.
* function not possible try RFC_FUNCTION_SEARCH
    exit.
  endif.
  loop at lt_data assigning <ls_data>.

    loop at lt_fields assigning <ls_fields>.
      l_offset = <ls_fields>-offset.
      l_len = <ls_fields>-length.

      assign component <ls_fields>-fieldname of structure
                                ls_flight to <l_field>.

      if sy-subrc eq 0.
        <l_field> = <ls_data>+l_offset(l_len).
        "Reading the columns one by one...here
      endif.

    endloop.

endloop.

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question