SAP MATERIAL_LOGICAL_DELETE Function Module for Delete Material logically and reset validity periods
MATERIAL_LOGICAL_DELETE is a standard material logical delete SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used for Delete Material logically and reset validity periods 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 logical delete FM, simply by entering the name MATERIAL_LOGICAL_DELETE 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_LOGICAL_DELETE 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_LOGICAL_DELETE'"Delete Material logically and reset validity periods.
EXPORTING
* PI_MATNR = "Material
* PI_WERKS = "Plant
* PI_LIQDT = SY-DATUM "End of Validity
* PI_UNAME = SY-UNAME "User
* PI_SPERREN = ' ' "
TABLES
* TAB_PRE01 = "Help Structure for Massaccess Material
* TAB_PRE01_ERROR = "Help Structure for Massaccess Material
EXCEPTIONS
NO_LVORM_SET = 1 VALIDITY_ERROR = 2
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_LOGICAL_DELETE
PI_MATNR - Material
Data type: MARA-MATNROptional: Yes
Call by Reference: No ( called with pass by value option)
PI_WERKS - Plant
Data type: MARC-WERKSOptional: Yes
Call by Reference: No ( called with pass by value option)
PI_LIQDT - End of Validity
Data type: MARA-LIQDTDefault: SY-DATUM
Optional: Yes
Call by Reference: No ( called with pass by value option)
PI_UNAME - User
Data type: SY-UNAMEDefault: SY-UNAME
Optional: Yes
Call by Reference: No ( called with pass by value option)
PI_SPERREN -
Data type: TVGVI-SPERADefault: SPACE
Optional: Yes
Call by Reference: Yes
TABLES Parameters details for MATERIAL_LOGICAL_DELETE
TAB_PRE01 - Help Structure for Massaccess Material
Data type: PRE01Optional: Yes
Call by Reference: Yes
TAB_PRE01_ERROR - Help Structure for Massaccess Material
Data type: PRE01Optional: Yes
Call by Reference: Yes
EXCEPTIONS details
NO_LVORM_SET - No Deletion Flag Set
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
VALIDITY_ERROR - Errors while setting the validity
Data type:Optional: No
Call by Reference: No ( called with pass by value option)
Copy and paste ABAP code example for MATERIAL_LOGICAL_DELETE 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_pi_matnr | TYPE MARA-MATNR, " | |||
| lt_tab_pre01 | TYPE STANDARD TABLE OF PRE01, " | |||
| lv_no_lvorm_set | TYPE PRE01, " | |||
| lv_pi_werks | TYPE MARC-WERKS, " | |||
| lv_validity_error | TYPE MARC, " | |||
| lt_tab_pre01_error | TYPE STANDARD TABLE OF PRE01, " | |||
| lv_pi_liqdt | TYPE MARA-LIQDT, " SY-DATUM | |||
| lv_pi_uname | TYPE SY-UNAME, " SY-UNAME | |||
| lv_pi_sperren | TYPE TVGVI-SPERA. " SPACE |
|   CALL FUNCTION 'MATERIAL_LOGICAL_DELETE' "Delete Material logically and reset validity periods |
| EXPORTING | ||
| PI_MATNR | = lv_pi_matnr | |
| PI_WERKS | = lv_pi_werks | |
| PI_LIQDT | = lv_pi_liqdt | |
| PI_UNAME | = lv_pi_uname | |
| PI_SPERREN | = lv_pi_sperren | |
| TABLES | ||
| TAB_PRE01 | = lt_tab_pre01 | |
| TAB_PRE01_ERROR | = lt_tab_pre01_error | |
| EXCEPTIONS | ||
| NO_LVORM_SET = 1 | ||
| VALIDITY_ERROR = 2 | ||
| . " MATERIAL_LOGICAL_DELETE | ||
ABAP code using 7.40 inline data declarations to call FM MATERIAL_LOGICAL_DELETE
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_pi_matnr). | ||||
| "SELECT single WERKS FROM MARC INTO @DATA(ld_pi_werks). | ||||
| "SELECT single LIQDT FROM MARA INTO @DATA(ld_pi_liqdt). | ||||
| DATA(ld_pi_liqdt) | = SY-DATUM. | |||
| "SELECT single UNAME FROM SY INTO @DATA(ld_pi_uname). | ||||
| DATA(ld_pi_uname) | = SY-UNAME. | |||
| "SELECT single SPERA FROM TVGVI INTO @DATA(ld_pi_sperren). | ||||
| DATA(ld_pi_sperren) | = ' '. | |||
Search for further information about these or an SAP related objects