Skip to Content
0
Former Member
Sep 28, 2005 at 07:11 AM

How to make validations before saving a Sales Order?

838 Views

Hi All,

I have tried to make some validations to header data captured when creating/changing Sales Order(VA01/VA02), especially to Plant Field.

Sample code :

I have tried to modify the User Exit (MV45AFZZ) Under teh form "userexit_field_modification" like below.

IF sy-tcode = 'VA01' OR

sy-tcode = 'VA02'.

DATA : v_werks like xvbap-werks,

v_flag1 type c.

  • LOOP AT SCREEN.

  • CHECK screen-name EQ 'VBAP-WERKS'.

READ TABLE xvbap INDEX 1.

v_werks = xvbap-werks.

LOOP AT xvbap.

IF v_werks <> xvbap-werks.

v_flag1 = 'Y'.

ENDIF.

  • ENDLOOP.

IF v_flag1 = 'Y'.

MESSAGE i990(v1) WITH 'Multiple plants Exist.'

'ZP Partner not auto determined.'.

ELSEIF NOT v_werks IS INITIAL.

MESSAGE i990(v1)

WITH 'ZP Partner is auto determined.'.

ENDIF.

ENDLOOP.

ENDIF.

Due to the above code the system response is dead slow.

please help me !!

Thanks in advace.