SAP Function Modules

MERCHANDISE_GROUP_USE SAP Function module - Use of Material Groups







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

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


Pattern for FM MERCHANDISE_GROUP_USE - MERCHANDISE GROUP USE





CALL FUNCTION 'MERCHANDISE_GROUP_USE' "Use of Material Groups
  EXPORTING
    wg =                        " c
    wh =                        " c
    mp =                        " c
    all =                       " c
    tree_output =               " c
*   i_detail =                  " c
*   no_artikel =                " c
*   no_eckpreis =               " c
*   no_aufteiler =              " c
*   no_werks =                  " c
  TABLES
*   mat =                       " mara
*   eckpr =                     " twpko
*   auftl =                     " svko
*   werk =                      " wrf6
    wg_objekt =                 "
  EXCEPTIONS
    NO_BASIS_MG = 1             "
    NO_MG_HIER = 2              "
    NO_PROFILE = 3              "
    NO_WGOBJ = 4                "
    .  "  MERCHANDISE_GROUP_USE

ABAP code example for Function Module MERCHANDISE_GROUP_USE





The ABAP code below is a full code listing to execute function module MERCHANDISE_GROUP_USE 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:
it_mat  TYPE STANDARD TABLE OF MARA,"TABLES PARAM
wa_mat  LIKE LINE OF it_mat ,
it_eckpr  TYPE STANDARD TABLE OF TWPKO,"TABLES PARAM
wa_eckpr  LIKE LINE OF it_eckpr ,
it_auftl  TYPE STANDARD TABLE OF SVKO,"TABLES PARAM
wa_auftl  LIKE LINE OF it_auftl ,
it_werk  TYPE STANDARD TABLE OF WRF6,"TABLES PARAM
wa_werk  LIKE LINE OF it_werk ,
it_wg_objekt  TYPE STANDARD TABLE OF STRING,"TABLES PARAM
wa_wg_objekt  LIKE LINE OF it_wg_objekt .

DATA(ld_wg) = 'Check type of data required'.
DATA(ld_wh) = 'Check type of data required'.
DATA(ld_mp) = 'Check type of data required'.
DATA(ld_all) = 'Check type of data required'.
DATA(ld_tree_output) = 'Check type of data required'.
DATA(ld_i_detail) = 'Check type of data required'.
DATA(ld_no_artikel) = 'Check type of data required'.
DATA(ld_no_eckpreis) = 'Check type of data required'.
DATA(ld_no_aufteiler) = 'Check type of data required'.
DATA(ld_no_werks) = 'Check type of data required'.

"populate fields of struture and append to itab
append wa_mat to it_mat.

"populate fields of struture and append to itab
append wa_eckpr to it_eckpr.

"populate fields of struture and append to itab
append wa_auftl to it_auftl.

"populate fields of struture and append to itab
append wa_werk to it_werk.

"populate fields of struture and append to itab
append wa_wg_objekt to it_wg_objekt. . CALL FUNCTION 'MERCHANDISE_GROUP_USE' EXPORTING wg = ld_wg wh = ld_wh mp = ld_mp all = ld_all tree_output = ld_tree_output * i_detail = ld_i_detail * no_artikel = ld_no_artikel * no_eckpreis = ld_no_eckpreis * no_aufteiler = ld_no_aufteiler * no_werks = ld_no_werks TABLES * mat = it_mat * eckpr = it_eckpr * auftl = it_auftl * werk = it_werk wg_objekt = it_wg_objekt EXCEPTIONS NO_BASIS_MG = 1 NO_MG_HIER = 2 NO_PROFILE = 3 NO_WGOBJ = 4 . " MERCHANDISE_GROUP_USE
IF SY-SUBRC EQ 0. "All OK ELSEIF SY-SUBRC EQ 1. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 2. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 3. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 4. "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_wg  TYPE C ,
it_mat  TYPE STANDARD TABLE OF MARA ,
wa_mat  LIKE LINE OF it_mat,
ld_wh  TYPE C ,
it_eckpr  TYPE STANDARD TABLE OF TWPKO ,
wa_eckpr  LIKE LINE OF it_eckpr,
ld_mp  TYPE C ,
it_auftl  TYPE STANDARD TABLE OF SVKO ,
wa_auftl  LIKE LINE OF it_auftl,
ld_all  TYPE C ,
it_werk  TYPE STANDARD TABLE OF WRF6 ,
wa_werk  LIKE LINE OF it_werk,
ld_tree_output  TYPE C ,
it_wg_objekt  TYPE STANDARD TABLE OF STRING ,
wa_wg_objekt  LIKE LINE OF it_wg_objekt,
ld_i_detail  TYPE C ,
ld_no_artikel  TYPE C ,
ld_no_eckpreis  TYPE C ,
ld_no_aufteiler  TYPE C ,
ld_no_werks  TYPE C .

ld_wg = 'Check type of data required'.

"populate fields of struture and append to itab
append wa_mat to it_mat.
ld_wh = 'Check type of data required'.

"populate fields of struture and append to itab
append wa_eckpr to it_eckpr.
ld_mp = 'Check type of data required'.

"populate fields of struture and append to itab
append wa_auftl to it_auftl.
ld_all = 'Check type of data required'.

"populate fields of struture and append to itab
append wa_werk to it_werk.
ld_tree_output = 'Check type of data required'.

"populate fields of struture and append to itab
append wa_wg_objekt to it_wg_objekt.
ld_i_detail = 'Check type of data required'.
ld_no_artikel = 'Check type of data required'.
ld_no_eckpreis = 'Check type of data required'.
ld_no_aufteiler = 'Check type of data required'.
ld_no_werks = 'Check type of data required'.

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