SAP Function Modules

MATERIAL_UNIT_FIND SAP Function module







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

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


Pattern for FM MATERIAL_UNIT_FIND - MATERIAL UNIT FIND





CALL FUNCTION 'MATERIAL_UNIT_FIND' "
  EXPORTING
*   kzall = SPACE               " sy-marky      Indicator, whether all allowed QUs are to be determined (=> F2)
    matnr =                     " mara-matnr    Material number
*   meinh = SPACE               " mara-meins    (Alternative) QU which should be checked
*   meins = SPACE               " mara-meins    Base QU (optional parameter - saves DB access)
  IMPORTING
    kzexi =                     " sy-marky      Indicator, whether (alternative) QU exists
  TABLES
    rmmme_itab =                " rmmme         Allowed units of measure including conversion relationship
  EXCEPTIONS
    MATERIAL_NOT_FOUND = 1      "               Material Does Not Exist
    .  "  MATERIAL_UNIT_FIND

ABAP code example for Function Module MATERIAL_UNIT_FIND





The ABAP code below is a full code listing to execute function module MATERIAL_UNIT_FIND 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_kzexi  TYPE SY-MARKY ,
it_rmmme_itab  TYPE STANDARD TABLE OF RMMME,"TABLES PARAM
wa_rmmme_itab  LIKE LINE OF it_rmmme_itab .

DATA(ld_kzall) = 'some text here'.

SELECT single MATNR
FROM MARA
INTO @DATA(ld_matnr).


SELECT single MEINS
FROM MARA
INTO @DATA(ld_meinh).


SELECT single MEINS
FROM MARA
INTO @DATA(ld_meins).


"populate fields of struture and append to itab
append wa_rmmme_itab to it_rmmme_itab. . CALL FUNCTION 'MATERIAL_UNIT_FIND' EXPORTING * kzall = ld_kzall matnr = ld_matnr * meinh = ld_meinh * meins = ld_meins IMPORTING kzexi = ld_kzexi TABLES rmmme_itab = it_rmmme_itab EXCEPTIONS MATERIAL_NOT_FOUND = 1 . " MATERIAL_UNIT_FIND
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_kzexi  TYPE SY-MARKY ,
ld_kzall  TYPE SY-MARKY ,
it_rmmme_itab  TYPE STANDARD TABLE OF RMMME ,
wa_rmmme_itab  LIKE LINE OF it_rmmme_itab,
ld_matnr  TYPE MARA-MATNR ,
ld_meinh  TYPE MARA-MEINS ,
ld_meins  TYPE MARA-MEINS .

ld_kzall = 'some text here'.

"populate fields of struture and append to itab
append wa_rmmme_itab to it_rmmme_itab.

SELECT single MATNR
FROM MARA
INTO ld_matnr.


SELECT single MEINS
FROM MARA
INTO ld_meinh.


SELECT single MEINS
FROM MARA
INTO ld_meins.

SAP Documentation for FM MATERIAL_UNIT_FIND


The function module determines all maintained or all allowed units of measure for a material number: ...See here for full SAP fm documentation


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