‎2006 May 15 1:37 PM
Hello All.
My requirement is, In VA01, While order creation , when ever Order reason (VBAK-AUGRU) is NOT blank, check for the vbak-kostl in VA01 transaction, and if the value is blank or
a dummy value, a popup shold come with the message 'Please enter the correct cost center'. Then user will change the cost center, manually.
For this I have coded an information message in the user_exit 'USEREXIT_MOVE_FIELD_TO_VBAK'. But the problem here is ,
when we run the transaction VA01, this form 'USEREXIT_MOVE_FIELD_TO_VBAK' is getting called more than one time and
popup is also calling of more than once.
Below is the code. Please help me in solving the problem.
FORM USEREXIT_MOVE_FIELD_TO_VBAK.
to check whether the cost center is DUMMY or blank. If so, popup to
check the cost center and to correct it.
Data: l_f_kostl like tvauk-kostl.
CLEAR l_f_kostl.
IF NOT vbak-augru is initial.
IF NOT vbak-kostl is initial.
select single kostl into l_f_kostl
from TVAUK where vkorg = vbak-vkorg and
vtweg = vbak-vtweg and
spart = vbak-spart and
augru = vbak-augru and
NOT datab is NULL.
if sy-subrc = 0.
if vbak-kostl = l_f_kostl.
Message I208(00) with 'Please enter the correct cost center'.
endif.
endif.
else.
Message I208(00) with 'Please enter the correct cost center'.
endif.
endif.
ENDFORM. "USEREXIT_MOVE_FIELD_TO_VBAK
‎2006 May 15 1:45 PM
Try the user exit USEREXIT_SAVE_DOCUMENT_PREPARE
Or
Create a static variable in the userexit USEREXIT_MOVE_FIELD_TO_VBAK..
statics: flag.
if flag = space.
flag = 'X'.
message i000 with.. <ur message>
endif.
Message was edited by: Sravanthi
‎2006 May 15 1:41 PM
Place code into UserExit - userexit_save_document_prepare.
This will not display the pop-up multiple times.
‎2006 May 15 1:42 PM
Hi,
Check with the enhancement of that userexit.
In CMOD, u can check that.
Regards,
Bharadwaj
‎2006 May 15 1:44 PM
‎2006 May 15 1:45 PM
Try the user exit USEREXIT_SAVE_DOCUMENT_PREPARE
Or
Create a static variable in the userexit USEREXIT_MOVE_FIELD_TO_VBAK..
statics: flag.
if flag = space.
flag = 'X'.
message i000 with.. <ur message>
endif.
Message was edited by: Sravanthi
‎2006 May 15 1:45 PM
Another soloution would be to -
1. Allow the popup to come when user will pres SAVE
2. For this write your entire code within a IF CONDITION.
3. IF FCODE = 'SICH'.
<your code>
endif.
4. So the userexit gets triggered only during save.