SAP Function Modules

FM_READ_DATA SAP Function module







FM_READ_DATA is a standard SAP function module available within R/3 SAP systems depending on your version and release level. Below is the pattern details for this FM showing its interface including any import and export parameters, exceptions etc as well as any documentation contributions (Comments) specific to the object.

See here to view full function module documentation and code listing, simply by entering the name FM_READ_DATA into the relevant SAP transaction such as SE37 or SE80.

Associated Function Group: FMES
Released Date: Not Released
Processing type: Normal fucntion module
Normal function module settings


Pattern for FM FM_READ_DATA - FM READ DATA





CALL FUNCTION 'FM_READ_DATA' "
  EXPORTING
    rkb1x =                     " rkb1x         List of application-dependent sort features
    s_form_name =               " dd27v-eform   Transfer name of FORM to data
    s_program_name =            " rs38m-programm  Program name being transferred to data
*   i_rkb1r =                   " rkb1r
  IMPORTING
    sel_date =                  " rkb1d-selda
    sel_time =                  " rkb1d-selti
  TABLES
    selection_table =           " cedst         Selection condition table
*   add_sel_tab =               " cedst
*   selected_fields =           " cfbsf01
*   selected_hieras =           " cfbsh01
  EXCEPTIONS
    NO_RECORD_FOUND = 1         "               No record found
    .  "  FM_READ_DATA

ABAP code example for Function Module FM_READ_DATA





The ABAP code below is a full code listing to execute function module FM_READ_DATA including all data declarations. The code uses the latest in-line data DECLARATION SYNTAX but I have included an ABAP code snippet at the end to show how declarations would look using the original method of declaring data variables up front. This will allow you to compare and fully understand the new inline method. Please note some of the newer syntax such as the @DATA is not available until a later 4.70 service pack (SP8).

DATA:
ld_sel_date  TYPE RKB1D-SELDA ,
ld_sel_time  TYPE RKB1D-SELTI ,
it_selection_table  TYPE STANDARD TABLE OF CEDST,"TABLES PARAM
wa_selection_table  LIKE LINE OF it_selection_table ,
it_add_sel_tab  TYPE STANDARD TABLE OF CEDST,"TABLES PARAM
wa_add_sel_tab  LIKE LINE OF it_add_sel_tab ,
it_selected_fields  TYPE STANDARD TABLE OF CFBSF01,"TABLES PARAM
wa_selected_fields  LIKE LINE OF it_selected_fields ,
it_selected_hieras  TYPE STANDARD TABLE OF CFBSH01,"TABLES PARAM
wa_selected_hieras  LIKE LINE OF it_selected_hieras .

DATA(ld_rkb1x) = 'Check type of data required'.

DATA(ld_s_form_name) = some text here

DATA(ld_s_program_name) = some text here
DATA(ld_i_rkb1r) = 'Check type of data required'.

"populate fields of struture and append to itab
append wa_selection_table to it_selection_table.

"populate fields of struture and append to itab
append wa_add_sel_tab to it_add_sel_tab.

"populate fields of struture and append to itab
append wa_selected_fields to it_selected_fields.

"populate fields of struture and append to itab
append wa_selected_hieras to it_selected_hieras. . CALL FUNCTION 'FM_READ_DATA' EXPORTING rkb1x = ld_rkb1x s_form_name = ld_s_form_name s_program_name = ld_s_program_name * i_rkb1r = ld_i_rkb1r IMPORTING sel_date = ld_sel_date sel_time = ld_sel_time TABLES selection_table = it_selection_table * add_sel_tab = it_add_sel_tab * selected_fields = it_selected_fields * selected_hieras = it_selected_hieras EXCEPTIONS NO_RECORD_FOUND = 1 . " FM_READ_DATA
IF SY-SUBRC EQ 0. "All OK ELSEIF SY-SUBRC EQ 1. "Exception "Add code for exception here ENDIF.







ABAP code to compare 7.40 inline data declaration with original syntax

The below ABAP code uses the older none in-line data declarations. This allows you to see the coding differences/benefits of the later inline syntax. It may also be useful if you are using an older version of SAP as some of the newer syntax above, such as the @DATA is not available until 4.70 EHP 8.

DATA:
ld_sel_date  TYPE RKB1D-SELDA ,
ld_rkb1x  TYPE RKB1X ,
it_selection_table  TYPE STANDARD TABLE OF CEDST ,
wa_selection_table  LIKE LINE OF it_selection_table,
ld_sel_time  TYPE RKB1D-SELTI ,
ld_s_form_name  TYPE DD27V-EFORM ,
it_add_sel_tab  TYPE STANDARD TABLE OF CEDST ,
wa_add_sel_tab  LIKE LINE OF it_add_sel_tab,
ld_s_program_name  TYPE RS38M-PROGRAMM ,
it_selected_fields  TYPE STANDARD TABLE OF CFBSF01 ,
wa_selected_fields  LIKE LINE OF it_selected_fields,
ld_i_rkb1r  TYPE RKB1R ,
it_selected_hieras  TYPE STANDARD TABLE OF CFBSH01 ,
wa_selected_hieras  LIKE LINE OF it_selected_hieras.

ld_rkb1x = 'Check type of data required'.

"populate fields of struture and append to itab
append wa_selection_table to it_selection_table.

ld_s_form_name = some text here

"populate fields of struture and append to itab
append wa_add_sel_tab to it_add_sel_tab.

ld_s_program_name = some text here

"populate fields of struture and append to itab
append wa_selected_fields to it_selected_fields.
ld_i_rkb1r = 'Check type of data required'.

"populate fields of struture and append to itab
append wa_selected_hieras to it_selected_hieras.

Contribute (Add Comments)

Please help keep this info upto date and use the comments section below to add useful hints, tips and information specific to this SAP function. This will then be available for you and other users to easily find by simply searching on the object name FM_READ_DATA or its description.