‎2011 Feb 01 4:33 AM
Hi Experts,
I have a requirement that when Schedule line qty is made zero then an error msg should be displayed.
Msg should be displayed as soon as qty is made 0 and enter is pressed and at the time of saving it.
I have tried to code in User exit field_modification, but still it does not work.
Plz suggest the way in which this can be achieved.
‎2011 Feb 01 4:44 AM
‎2011 Feb 01 5:12 AM
This code is in MV45AFZZ: userexit_field_modification.
DATA: v_days TYPE VTBBEWE-ATAGE,
vbep_edatu Type VTBBEWE-DBERVON,
V_sydat TYPE VTBBEWE-DBERBIS,
n type N,
V_change type c value 'N'.
constants: c_item_cat type string value 'TAPA'.
Data : ls_vbap_posnr type string.
*
DATA : LIT_VBAP type STANDARD TABLE OF VBAP with header line ,
WA_VBAP TYPE VBAP.
*
DATA :LIT_OLD_VBEP type STANDARD TABLE OF vbep WITH HEADER LINE,
WA_VBEP TYPE VBEP.
check sy-uname = 'CCHAUHA1'.
*
*SELECT VBELN POSNR ETENR LFREL EDATU WMENG FROM VBEP into CORRESPONDING FIELDS OF TABLE LIT_OLD_VBEP
WHERE vbeln = xvbep-vbeln.
*
*SELECT KEVER FROM VBAP into CORRESPONDING FIELDS OF TABLE LIT_VBAP
WHERE vbeln = xvbep-vbeln.
*
*
IF SY-TCODE ='VA32'AND XVBAP-PSTYV = 'TAPA' and VBAK-VBTYP = 'E'
and vbak-auart = 'ZLZ' OR vbak-auart = 'ZLP'.
*
*Loop at xvbep where VBELN = xvbep-VBELN.
V_sydat = sy-datum.
vbep_edatu = xvbep-edatu.
*
CALL FUNCTION 'FIMA_DAYS_AND_MONTHS_AND_YEARS'
EXPORTING
I_DATE_FROM = V_sydat
I_DATE_TO = VBEP_EDATU
IMPORTING
E_DAYS = v_days.
*
IF v_days > 0 and v_days <= WA_VBAP-KEVER
and VBAK-VBTYP = 'E'
and vbak-auart = 'ZLZ' OR vbak-auart = 'ZLP'.
READ TABLE lit_old_vbep INTO wa_vbep index sy-tabix.
*
IF wa_vbep-WMENG ne xvbep-WMENG ."and xvbep-posnr eq lS_vbap_posnr.
MESSAGE 'Quantity zero not allowed ' TYPE 'E'.
ENDIF.
endif.
ENDLOOP.
*ENDIF.