Skip to content

/BODS/RFC_READ_TABLE

Extended-width variant of RFC_READ_TABLE — available on systems with SAP BusinessObjects Data Services.

Purpose

/BODS/RFC_READ_TABLE is a drop-in replacement for the standard RFC_READ_TABLE that removes the 512-byte row width restriction, supporting rows up to 32 KB or more. Use it when you have wide tables (many columns, long text fields) that cause DATA_BUFFER_EXCEEDED with the standard FM.

Availability is not guaranteed

This FM is only present on systems where SAP BusinessObjects Data Services (BODS) has been installed. Check SE37 before writing code that depends on it. If it's missing, use BBP_RFC_READ_TABLE or a custom RFC wrapper instead.

Signature

Identical to RFC_READ_TABLE — just replace the function module name.

Parameter Direction Type Notes
QUERY_TABLE IMPORTING DD02L-TABNAME Table to read. Required.
DELIMITER IMPORTING CHAR1 Column separator in the output. Use \| to avoid collisions.
NO_DATA IMPORTING CHAR1 Pass 'X' to return field metadata only.
ROWSKIPS IMPORTING INT4 Skip first N rows (pagination).
ROWCOUNT IMPORTING INT4 Max rows to return (0 = all).
FIELDS TABLES RFC_DB_FLD Fields to return. Empty = all fields.
OPTIONS TABLES RFC_DB_OPT WHERE clause fragments, max 72 chars each.
DATA TABLES TAB512 Output rows as flat strings split by DELIMITER.

Example — replacing RFC_READ_TABLE for a wide table

DATA: lt_fields  TYPE STANDARD TABLE OF rfc_db_fld,
      lt_options TYPE STANDARD TABLE OF rfc_db_opt,
      lt_data    TYPE STANDARD TABLE OF tab512.

APPEND VALUE rfc_db_fld( fieldname = 'VBELN' ) TO lt_fields.
APPEND VALUE rfc_db_fld( fieldname = 'POSNR' ) TO lt_fields.
APPEND VALUE rfc_db_fld( fieldname = 'ARKTX' ) TO lt_fields.   " long text

APPEND VALUE rfc_db_opt( text = 'MANDT = SY-MANDT' ) TO lt_options.

CALL FUNCTION '/BODS/RFC_READ_TABLE'
  EXPORTING
    query_table = 'VBAP'
    delimiter   = '|'
    rowcount    = 500
  TABLES
    fields      = lt_fields
    options     = lt_options
    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.
  " Fall back to BBP_RFC_READ_TABLE or raise error
  MESSAGE ID sy-msgid TYPE 'E' NUMBER sy-msgno.
ENDIF.

LOOP AT lt_data INTO DATA(ls_row).
  SPLIT ls_row-wa AT '|' INTO DATA(lv_vbeln) DATA(lv_posnr) DATA(lv_arktx).
  WRITE: / lv_vbeln, lv_posnr, lv_arktx.
ENDLOOP.

Defensive fallback pattern

Wrap the call in a dynamic CALL FUNCTION with exception handling, or check FM existence via FUNCTION_EXISTS, so the program degrades gracefully on systems without BODS.

Common pitfalls

  • Not universally available: BODS is a separately licensed product. Never assume this FM exists without verifying in SE37 on the target system.
  • Same WHERE clause limits apply: each OPTIONS row is still max 72 characters. The wider row output does not relax the WHERE clause constraint.
  • Client filtering: like the standard FM, /BODS/RFC_READ_TABLE does not auto-filter by client. Add MANDT = SY-MANDT to OPTIONS for client-dependent tables.
  • Authorization: the caller still needs S_TABU_DIS with activity 03 for the table's authorization group.
  • If missing, fall back: the next best options are BBP_RFC_READ_TABLE (more widely available) or a custom RFC-enabled FM with a proper SELECT.

See also

Comments