SAP Function Modules

READ_MDFA_FOR_SO SAP Function module







READ_MDFA_FOR_SO 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 READ_MDFA_FOR_SO into the relevant SAP transaction such as SE37 or SE80.

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


Pattern for FM READ_MDFA_FOR_SO - READ MDFA FOR SO





CALL FUNCTION 'READ_MDFA_FOR_SO' "
  EXPORTING
    enday =                     " mdfa-sedtr
    stday =                     " mdfa-sedtr
  IMPORTING
    fa_count =                  "               Number of found production orders
* TABLES
*   aufnr_range =               "
*   matnr_range =               "               Selected area: material number
*   safnr_range =               "               Selected area: run schedule number
*   sel_fa =                    " mdfa          Table of the found production orders
*   verid_range =               "               Selected area: version
*   werk_range =                "               Selected area: plant
  EXCEPTIONS
    DATA_INCOMPLETE = 1         "
    .  "  READ_MDFA_FOR_SO

ABAP code example for Function Module READ_MDFA_FOR_SO





The ABAP code below is a full code listing to execute function module READ_MDFA_FOR_SO 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_fa_count  TYPE STRING ,
it_aufnr_range  TYPE STANDARD TABLE OF STRING,"TABLES PARAM
wa_aufnr_range  LIKE LINE OF it_aufnr_range ,
it_matnr_range  TYPE STANDARD TABLE OF STRING,"TABLES PARAM
wa_matnr_range  LIKE LINE OF it_matnr_range ,
it_safnr_range  TYPE STANDARD TABLE OF STRING,"TABLES PARAM
wa_safnr_range  LIKE LINE OF it_safnr_range ,
it_sel_fa  TYPE STANDARD TABLE OF MDFA,"TABLES PARAM
wa_sel_fa  LIKE LINE OF it_sel_fa ,
it_verid_range  TYPE STANDARD TABLE OF STRING,"TABLES PARAM
wa_verid_range  LIKE LINE OF it_verid_range ,
it_werk_range  TYPE STANDARD TABLE OF STRING,"TABLES PARAM
wa_werk_range  LIKE LINE OF it_werk_range .


SELECT single SEDTR
FROM MDFA
INTO @DATA(ld_enday).


SELECT single SEDTR
FROM MDFA
INTO @DATA(ld_stday).


"populate fields of struture and append to itab
append wa_aufnr_range to it_aufnr_range.

"populate fields of struture and append to itab
append wa_matnr_range to it_matnr_range.

"populate fields of struture and append to itab
append wa_safnr_range to it_safnr_range.

"populate fields of struture and append to itab
append wa_sel_fa to it_sel_fa.

"populate fields of struture and append to itab
append wa_verid_range to it_verid_range.

"populate fields of struture and append to itab
append wa_werk_range to it_werk_range. . CALL FUNCTION 'READ_MDFA_FOR_SO' EXPORTING enday = ld_enday stday = ld_stday IMPORTING fa_count = ld_fa_count * TABLES * aufnr_range = it_aufnr_range * matnr_range = it_matnr_range * safnr_range = it_safnr_range * sel_fa = it_sel_fa * verid_range = it_verid_range * werk_range = it_werk_range EXCEPTIONS DATA_INCOMPLETE = 1 . " READ_MDFA_FOR_SO
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_fa_count  TYPE STRING ,
ld_enday  TYPE MDFA-SEDTR ,
it_aufnr_range  TYPE STANDARD TABLE OF STRING ,
wa_aufnr_range  LIKE LINE OF it_aufnr_range,
ld_stday  TYPE MDFA-SEDTR ,
it_matnr_range  TYPE STANDARD TABLE OF STRING ,
wa_matnr_range  LIKE LINE OF it_matnr_range,
it_safnr_range  TYPE STANDARD TABLE OF STRING ,
wa_safnr_range  LIKE LINE OF it_safnr_range,
it_sel_fa  TYPE STANDARD TABLE OF MDFA ,
wa_sel_fa  LIKE LINE OF it_sel_fa,
it_verid_range  TYPE STANDARD TABLE OF STRING ,
wa_verid_range  LIKE LINE OF it_verid_range,
it_werk_range  TYPE STANDARD TABLE OF STRING ,
wa_werk_range  LIKE LINE OF it_werk_range.


SELECT single SEDTR
FROM MDFA
INTO ld_enday.


"populate fields of struture and append to itab
append wa_aufnr_range to it_aufnr_range.

SELECT single SEDTR
FROM MDFA
INTO ld_stday.


"populate fields of struture and append to itab
append wa_matnr_range to it_matnr_range.

"populate fields of struture and append to itab
append wa_safnr_range to it_safnr_range.

"populate fields of struture and append to itab
append wa_sel_fa to it_sel_fa.

"populate fields of struture and append to itab
append wa_verid_range to it_verid_range.

"populate fields of struture and append to itab
append wa_werk_range to it_werk_range.

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 READ_MDFA_FOR_SO or its description.