SAP MATERIAL_VALIDITY_UPDATE Function Module for Change of validity period of material









MATERIAL_VALIDITY_UPDATE is a standard material validity update SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for Change of validity period of material processing and below is the pattern details for this FM, 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 material validity update FM, simply by entering the name MATERIAL_VALIDITY_UPDATE into the relevant SAP transaction such as SE37 or SE38.

Function Group: WSO7
Program Name: SAPLWSO7
Main Program: SAPLWSO7
Appliation area: W
Release date: N/A
Mode(Normal, Remote etc): Normal Function Module
Update:



Function MATERIAL_VALIDITY_UPDATE 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 'MATERIAL_VALIDITY_UPDATE'"Change of validity period of material
EXPORTING
P_MATNR = "material
* P_WERKS = "
* P_LIQDT = SY-DATUM "End of validity for material
* P_UNAME = SY-UNAME "
* P_DIRECT_UPDATE = 'X' "Update within module

IMPORTING
RET_CODE = "returncode of check

EXCEPTIONS
MATNR_NOT_FOUND = 1
.




Customer Function user exits

Below is a list of CUSTOMER FUNCTION exit user exits that are available within this program and maybe relevant for this FM.
EXIT_SAPLWSO7_001 Find Processor Group for Error Messages

IMPORTING Parameters details for MATERIAL_VALIDITY_UPDATE

P_MATNR - material

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

P_WERKS -

Data type: T001W-WERKS
Optional: Yes
Call by Reference: No ( called with pass by value option)

P_LIQDT - End of validity for material

Data type: MARA-LIQDT
Default: SY-DATUM
Optional: Yes
Call by Reference: No ( called with pass by value option)

P_UNAME -

Data type: SY-UNAME
Default: SY-UNAME
Optional: Yes
Call by Reference: No ( called with pass by value option)

P_DIRECT_UPDATE - Update within module

Data type: CHAR1
Default: 'X'
Optional: Yes
Call by Reference: Yes

EXPORTING Parameters details for MATERIAL_VALIDITY_UPDATE

RET_CODE - returncode of check

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

EXCEPTIONS details

MATNR_NOT_FOUND - materialnumber does not exist

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

Copy and paste ABAP code example for MATERIAL_VALIDITY_UPDATE 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_p_matnr  TYPE MARA-MATNR, "   
lv_ret_code  TYPE SY-SUBRC, "   
lv_matnr_not_found  TYPE SY, "   
lv_p_werks  TYPE T001W-WERKS, "   
lv_p_liqdt  TYPE MARA-LIQDT, "   SY-DATUM
lv_p_uname  TYPE SY-UNAME, "   SY-UNAME
lv_p_direct_update  TYPE CHAR1. "   'X'

  CALL FUNCTION 'MATERIAL_VALIDITY_UPDATE'  "Change of validity period of material
    EXPORTING
         P_MATNR = lv_p_matnr
         P_WERKS = lv_p_werks
         P_LIQDT = lv_p_liqdt
         P_UNAME = lv_p_uname
         P_DIRECT_UPDATE = lv_p_direct_update
    IMPORTING
         RET_CODE = lv_ret_code
    EXCEPTIONS
        MATNR_NOT_FOUND = 1
. " MATERIAL_VALIDITY_UPDATE




ABAP code using 7.40 inline data declarations to call FM MATERIAL_VALIDITY_UPDATE

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.

"SELECT single MATNR FROM MARA INTO @DATA(ld_p_matnr).
 
"SELECT single SUBRC FROM SY INTO @DATA(ld_ret_code).
 
 
"SELECT single WERKS FROM T001W INTO @DATA(ld_p_werks).
 
"SELECT single LIQDT FROM MARA INTO @DATA(ld_p_liqdt).
DATA(ld_p_liqdt) = SY-DATUM.
 
"SELECT single UNAME FROM SY INTO @DATA(ld_p_uname).
DATA(ld_p_uname) = SY-UNAME.
 
DATA(ld_p_direct_update) = 'X'.
 


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!