SAP MGV_COPY_MATERIAL Function Module for









MGV_COPY_MATERIAL is a standard mgv copy material SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used to perform a specific ABAP function and below is the pattern details, showing its interface including any import and export parameters, exceptions etc. there is also a full "cut and paste" ABAP pattern code example, along with implementation ABAP coding, documentation and contribution comments specific to this or related objects.


See here to view full function module documentation and code listing for mgv copy material FM, simply by entering the name MGV_COPY_MATERIAL into the relevant SAP transaction such as SE37 or SE38.

Function Group: MGV_MAINTAIN_VERSIONS
Program Name: SAPLMGV_MAINTAIN_VERSIONS
Main Program: SAPLMGV_MAINTAIN_VERSIONS
Appliation area: M
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update:



Function MGV_COPY_MATERIAL pattern details

In-order to call this FM within your sap programs, simply using the below ABAP pattern details to trigger the function call...or see the full ABAP code listing at the end of this article. You can simply cut and paste this code into your ABAP progrom as it is, including variable declarations.
CALL FUNCTION 'MGV_COPY_MATERIAL'"
EXPORTING
* VTYPE = "
* FLG_MATNR_RES = "
* FLG_OVERWRITE = "
* IV_MODUS = '4' "
* IV_AENNR = ' ' "

CHANGING
MATNR_NEW = "

TABLES
AMERRDAT = "
* IT_MATNR_OLD = "
* IT_MATNR_NEW = "

EXCEPTIONS
MATERIAL_NOT_FOUND = 1 NEW_MATERIAL_EXISTS = 2 ERROR_DURING_CREATE = 3
.



IMPORTING Parameters details for MGV_COPY_MATERIAL

VTYPE -

Data type: VERSIONTYPE
Optional: Yes
Call by Reference: Yes

FLG_MATNR_RES -

Data type: XFELD
Optional: Yes
Call by Reference: Yes

FLG_OVERWRITE -

Data type: XFELD
Optional: Yes
Call by Reference: Yes

IV_MODUS -

Data type: C
Default: '4'
Optional: Yes
Call by Reference: Yes

IV_AENNR -

Data type: AENNR
Default: ' '
Optional: Yes
Call by Reference: Yes

CHANGING Parameters details for MGV_COPY_MATERIAL

MATNR_NEW -

Data type: MATNR
Optional: No
Call by Reference: Yes

TABLES Parameters details for MGV_COPY_MATERIAL

AMERRDAT -

Data type: MERRDAT
Optional: No
Call by Reference: No ( called with pass by value option)

IT_MATNR_OLD -

Data type: PRE03
Optional: Yes
Call by Reference: Yes

IT_MATNR_NEW -

Data type: PRE03
Optional: Yes
Call by Reference: Yes

EXCEPTIONS details

MATERIAL_NOT_FOUND -

Data type:
Optional: No
Call by Reference: No ( called with pass by value option)

NEW_MATERIAL_EXISTS -

Data type:
Optional: No
Call by Reference: No ( called with pass by value option)

ERROR_DURING_CREATE -

Data type:
Optional: No
Call by Reference: No ( called with pass by value option)

Copy and paste ABAP code example for MGV_COPY_MATERIAL Function Module

The ABAP code below is a full code listing to execute function module POPUP_TO_CONFIRM including all data declarations. The code uses the original data declarations rather than 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 newer method of declaring data variables on the fly. 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), which i why i have stuck to the origianl for this example.

DATA:
lv_vtype  TYPE VERSIONTYPE, "   
lt_amerrdat  TYPE STANDARD TABLE OF MERRDAT, "   
lv_matnr_new  TYPE MATNR, "   
lv_material_not_found  TYPE MATNR, "   
lt_it_matnr_old  TYPE STANDARD TABLE OF PRE03, "   
lv_flg_matnr_res  TYPE XFELD, "   
lv_new_material_exists  TYPE XFELD, "   
lt_it_matnr_new  TYPE STANDARD TABLE OF PRE03, "   
lv_flg_overwrite  TYPE XFELD, "   
lv_error_during_create  TYPE XFELD, "   
lv_iv_modus  TYPE C, "   '4'
lv_iv_aennr  TYPE AENNR. "   ' '

  CALL FUNCTION 'MGV_COPY_MATERIAL'  "
    EXPORTING
         VTYPE = lv_vtype
         FLG_MATNR_RES = lv_flg_matnr_res
         FLG_OVERWRITE = lv_flg_overwrite
         IV_MODUS = lv_iv_modus
         IV_AENNR = lv_iv_aennr
    CHANGING
         MATNR_NEW = lv_matnr_new
    TABLES
         AMERRDAT = lt_amerrdat
         IT_MATNR_OLD = lt_it_matnr_old
         IT_MATNR_NEW = lt_it_matnr_new
    EXCEPTIONS
        MATERIAL_NOT_FOUND = 1
        NEW_MATERIAL_EXISTS = 2
        ERROR_DURING_CREATE = 3
. " MGV_COPY_MATERIAL




ABAP code using 7.40 inline data declarations to call FM MGV_COPY_MATERIAL

The below ABAP code uses the newer in-line data declarations. This allows you to see the coding differences/benefits of the later inline syntax. Please note some of the newer syntax below, such as the @DATA is not available until 4.70 EHP 8.

 
 
 
 
 
 
 
 
 
 
DATA(ld_iv_modus) = '4'.
 
DATA(ld_iv_aennr) = ' '.
 


Search for further information about these or an SAP related objects



Comments on this SAP object

What made you want to lookup this SAP object? Please tell us what you were looking for and anything you would like to be included on this page!