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'.
IF v_flag1 = 'Y'.
MESSAGE i990(v1) WITH 'Multiple plants Exist.'
'ZP Partner not auto determined.'.
ELSEIF NOT v_werks IS INITIAL.
WITH 'ZP Partner is auto determined.'.
Due to the above code the system response is dead slow.
please help me !!
Thanks in advace.