Thursday, September 20, 2018

MODULE POOL FIELD VALIDATION

       MODULE POOL FIELD VALIDATION USING CHAIN   & 

                         DIRECT VALUE VALIDATION.

Module pool fields can be validated by many ways , if you have one field that is to be validated , you can validated either using direct table selection or by validating on PAI.
If you have multiple fields then simply you can validate using CHAIN & ENDCHAIN Method.

code is  as:

*****************************************************************************
********************validating directly  using table selection *******************
FIELD  scr_field-matnr 
  SELECT * FROM 
MARA WHERE MATNR = SCR_FIELD-MATNR 
WHENEVER NOT FOUND SEND ERRORMESSAGE  001 ON 
INPUT.



******************************************************************************
2nd way:
******************************************************************************
***VALIDATING FIELD ON PAI 
FIELD   scr_field-matnr .
MODULE field_validation  ON INPUT.
**************************************************************************
3rd way:
**********************************************************************************
********************validating using chain and endchain method *************************
CHAIN .

FIELD: SCR_FIELD-MATNR , SCR_FIELD -MAKTX.
MODULE FIELD_VALIDATION.
ENDCHAIN.

**********In the module write your logic as per requirement*************
*********************************************************************************