Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

User Exit SD

Former Member
0 Likes
1,526

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,174

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

5 REPLIES 5
Read only

Former Member
0 Likes
1,174

Place code into UserExit - userexit_save_document_prepare.

This will not display the pop-up multiple times.

Read only

Former Member
0 Likes
1,174

Hi,

Check with the enhancement of that userexit.

In CMOD, u can check that.

Regards,

Bharadwaj

Read only

Former Member
0 Likes
1,174

Hi,

Better to implement field exit.

Thanks,

Suresh

Read only

Former Member
0 Likes
1,175

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

Read only

Former Member
0 Likes
1,174

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.