Application Development 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: 

user exit doubt

Former Member
0 Kudos

Hi experts,

Iam trying to write userexit using MV45AFZB.

If AUART eq ZR01 & ZR02 and price limit(NETWR) is greater than 500,I want to raise the messgae.


data: v_total like vbap-netwr.

check xvbak-auart = 'ZR01' or
      xvbak-auart = 'ZR02'.

loop at xvbap where abgru = 'ZC'.
     v_total = v_total + xvbap-netwr.
endloop.

if v_total gt 500.
      message e000(zmsg) with
         'FOC sales order limit exceeded!'.
endif.

I have written this code in FORM USEREXIT_SAVE_DOCUMENT_PREPARE(MV45AFZB) subroutine.

It is not triggering when Amount is more that 500.What might be the reason? Where i need to write this program?

MV45AFZB or MV45AFZZ?And also let me know the subroutine.

When i press enter, i want display message.

Reward guaranteed

thanks

kaki

1 ACCEPTED SOLUTION

ferry_lianto
Active Contributor
0 Kudos

Hi Kaki,

Please try to place your logic in program <b>MV45AFZZ</b> and <b>FORM USEREXIT_MOVE_FIELD_TO_VBAP</b>.

Use <b>VBAK</b> and <b>VBAP</b> instead of XVBAK and XVBAP.

or you can place the code in program <b>MV45AFZB</b> and <b>FORM USEREXIT_CHECK_VBAP USING US_DIALOG</b>.

Hope this will help.

Regards,

Ferry Lianto

12 REPLIES 12

Former Member
0 Kudos

Hi Kaki,

Try the same code in

FORM userexit_check_vbap USING us_dialog.

Regards,

Wenceslaus.

Former Member
0 Kudos

Hi Kaki,

It should be written in MV45AFZZ as if you see the routine it is present in this one but not the one which you have given MV45AFZB.

The name of the Modification Modules should start with 'ZZ'

Cheers,

YJR.

Former Member
0 Kudos

Kaki,

Your code looks right, are you sure you have written in the right User exit?

regards,

Ravi

ferry_lianto
Active Contributor
0 Kudos

Hi Kaki,

Please try to place your logic in program <b>MV45AFZZ</b> and <b>FORM USEREXIT_MOVE_FIELD_TO_VBAP</b>.

Use <b>VBAK</b> and <b>VBAP</b> instead of XVBAK and XVBAP.

or you can place the code in program <b>MV45AFZB</b> and <b>FORM USEREXIT_CHECK_VBAP USING US_DIALOG</b>.

Hope this will help.

Regards,

Ferry Lianto

0 Kudos

Hi Experts,

I tried in both the programs...

MV45AFZZ and FORM USEREXIT_MOVE_FIELD_TO_VBAP &

MV45AFZB and FORM USEREXIT_CHECK_VBAP USING US_DIALOG.

It is not working...And also if i give VBAP insetead of XVBAP iam getting error that "VERSION....expected after VBAP".

What might be the reason?

Thanks

kaki

ferry_lianto
Active Contributor
0 Kudos

Hi Kaki,

You can code something like this and please debug it (if needed).


data: v_total like vbap-netwr,
      v_gtotal type i.
 
check xvbak-auart = 'ZR01' or
      xvbak-auart = 'ZR02'.
 
loop at xvbap where abgru = 'ZC'.
     v_total = v_total + xvbap-netwr.
endloop.

move v_total to v_gtotal.
 
if v_gtotal > '500'.
  message e000(zmsg) with 
          FOC sales order limit exceeded!'.
endif.

Hope this will help.

Regards,

Ferry Lianto

0 Kudos

Hi,

Please try by declaring the variable v_total as static.

Instead of looping xvbap, just check for abgru and add the net value (NETWR) to the static variable.

Then raise the message as usual.

Thanks,

Rashmi.

0 Kudos

Hi experts,

Still i could not find where the problem is.

If iam in the Conditions tab in the VA02,if i give value more than 500 and press enter, i want to through the message.

Iam writing this code in FORM USEREXIT_CHECK_VBAP USING US_DIALOG(MV45AFZB).Why it is not getting triggered?

Is there any other way to achieve this???

Thanks

kaki

0 Kudos

If you are on the conditions tab:

1. USEREXIT_CHECK_VBAP will not get triggered on enter. This only gets triggered on an item tab for an item that you have added or changed

2. USEREXIT_SAVE_DOCUMENT_PREPARE will not get triggered. It will not get triggered until you attempt to save the document.

The conditions tab is controlled by program SAPLV69A (function group V69A). Go to SE80 for this function group and look at the USEREXIT* subroutines to see if any of these will meet your needs.

ferry_lianto
Active Contributor
0 Kudos

Hi Kaki,

You need to place your logic <b>FORM USEREXIT_SAVE_DOCUMENT</b> in program <b>MV45AFZZ</b>.

You can not put in FORM USEREXIT_CHECK_VBAP USING US_DIALOG(MV45AFZB) because this routine is used to check item level (looping). If you ONLY have one item with price $501, your logic will work. But if you have more than one item with price less than $501, it will not work when you try to accumulate.

Hope this will help.

Regards,

Ferry Lianto

0 Kudos

Its the right formname. Try both programs MV45AFZZ and MV45AFZB. Put a break point on the code. Its what you should try first.

Former Member
0 Kudos

Program SAPMV45A (Sales order processing) has "fixed point arithmetic" option turned off (program attributes). That being the case, try moving your validation check to another location (maybe a function module or a subroutine pool where this attribute "fixed point arithmetic" is turned on) and I hope the validation should work fine.