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 for VA02

Former Member
0 Kudos
999

Hi,

I got a requirement to develop USEREXIT for the pricing condition for sales order (VA02).

It is for ITEM level(<b>VBAP-ABGRU='ZC'</b>)(Reason for Rejection) and i have to check <b>VBAK-AUART = 'ZR01' and 'ZR02'</b>.

If net value is greater than $500 then raise message.

Can any one tell me what is the suitable user exit for this requirement and what is the approach.

Points guaranteed

cheers

kaki

1 ACCEPTED SOLUTION

Former Member
0 Kudos
704

hi Kaki,

"Program names ZX... are reserved for includes of exit function groups" is a warning message only.

You can proceed further as it is not error message.

While creating includes, they follow some naming conventions. ZX.. is reserved for includes in User-exits.

Regards,

Sailaja.

19 REPLIES 19

Former Member
0 Kudos
704

hi,

Go for

<b>include mv45afzz. " User-forms</b>

in the program SAPMV45A.

Regards,

Sailaja.

Former Member
0 Kudos
704

hi..

use the exit - MV45AFZZ and put your code inside FORM USEREXIT_MOVE_FIELD_TO_VBKD. For checking AUART or any field values use structure XVBAK..(if XVBAK-AUART = '..')This structure will have the value in runtime. For VBAP Values use XVBAP.

Regards,

Pradhiba

0 Kudos
704

Hi Sailaja and pratibha,

Thanks for replies.

How to use XVBAK & XVBAP structures in userexits?

Do i need to use INCLUDE STRUCTURE?

kaki

0 Kudos
704

no no .. u dont have to declare or include the structure.. just use it..

if xvbap-auart = 'ZSR1'.

...

endif.

pradhiba

former_member188685
Active Contributor
0 Kudos
704

Hi Kaki,

in the include <b>MV45AFZZ</b>

you need to write the code in the form <b>userexit_move_field_to_vbap</b>

 IF VBAK-AUART = 'ZIC'                                   
      AND VBAP-ABGRU ='ZC' .
      message id 'ZZ' type 'E' number '002' with
       'Document type ZIC is only allowed for Consignments'.
    ENDIF.

thanks

vijay

Message was edited by: Vijay Babu Dudla

0 Kudos
704

Hi Vijay,

It is not allowing to modify the function module.

Getting error "Program names ZX... are reserved for includes of exit function groups"

kaki

0 Kudos
704

I feel that is a warning message only.

check it, if it is warning proceed with your change.

thanks

vijay

0 Kudos
704

Vijay sir,

At run time I am getting 2 work areas namely

vbak and

xvbak

and I want to use them for passing them for fetching some record from database table.

I am confused that which work area should I use to fetch data.

Please guide.

Former Member
0 Kudos
704

Hi KAKI,

Extension: V46H0001

Exit Name: EXIT_SAPLV46H_001

Desc: Customer Function When Creating Item

Include ZXV46U01

Here, read the internal table for items and proceed further.

Regards,

Raj

0 Kudos
704

You could use one of the 16 exits depending upon your need.

SDAPO001

SDTRM001

V45A0001

V45A0002

V45A0003

V45A0004

V45E0001

V45E0002

V45L0001

V45P0001

V45S0001

V45S0003

V45S0004

V45W0001

V46H0001

V60F0001

Regards,

Ankur Bhandari

p.s Reward points if it helps.

Former Member
0 Kudos
705

hi Kaki,

"Program names ZX... are reserved for includes of exit function groups" is a warning message only.

You can proceed further as it is not error message.

While creating includes, they follow some naming conventions. ZX.. is reserved for includes in User-exits.

Regards,

Sailaja.

0 Kudos
704

Hi,

In VA02, Reason for Rejection, I need to calculate total amouts for all the items.( if vbak-auart = 'ZR01' or

vbak-auart = 'ZR02' and vbap-abgru ='ZC').If the amount is greater than 500 then raise message.

I have written this code.Pls let me know whether this code meet my requirement.


data: v_amt(5).

  if vbak-auart = 'ZR01' or
     vbak-auart = 'ZR02' and
      vbap-abgru ='ZC'.

    loop at vbap.
     v_amt = v_amt + vbap-netwr.
    endloop.
  endif.

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

0 Kudos
704
data: v_amt(5).
  if vbak-auart = 'ZR01' or 
    vbak-auart = 'ZR02'.
   loop at vbap <b>where abgru ='ZC'.</b> 
    v_amt = v_amt + vbap-netwr.
    endloop.
  endif.  
if v_amt gt '500'. 
message e000(zmsg) with 'FOC sales order limit exceeded!'.
endif.

check it...

Message was edited by: Vijay Babu Dudla

0 Kudos
704

Hi Kaki

Just one question: what is the total for you?

Is it only total net amount?

If it was so you can know by reading header table.

Another questions: are you interested in all total amounts (1) or only total amonut for intems with abgru ='ZC' (2).

(1) -

CHECK vbak-auart = 'ZR01' or

vbak-auart = 'ZR02'.

READ TABLE XVBAP WITH KEY abgru ='ZC'

TRANSPORTING NO FIELDS.

CHECK SY-SUBRC = 0.

IF VBAK-NETWR GT 500.

message e000(zmsg) with

'FOC sales order limit exceeded!'.

ENDIF.

In this case you don't need to read all items.

(2)

DATA: TOTAL LIKE VBAP-NETWR.

CHECK vbak-auart = 'ZR01' or

vbak-auart = 'ZR02'.

LOOP AT XVBAP WHERE abgru ='ZC'.

TOTAL = TOTAL + XVBAP-NETWR.

ENDLOOP.

IF TOTAL GT 500.

message e000(zmsg) with

'FOC sales order limit exceeded!'.

ENDIF.

In both cases you should do this controls at the end so

you should place this code in user-exit userexit_save_document_prepare, it's triggered just before saving document.

Max

0 Kudos
704

Hi Max bianchi,

Where to find 'userexit_save_document_prepare'? How to go into it? I want to calculate total amount for all the items.So total amount of all the items should not cross 500.

kaki

0 Kudos
704

Hi Kaki,

Since your requirement is for all items then you can proceed with this code'

data: v_amt(5). 
 if vbak-auart = 'ZR01' or 
    vbak-auart = 'ZR02'. 
  loop at vbap where abgru ='ZC'.
     v_amt = v_amt + vbap-netwr. 
   endloop. 
 endif. 
 if v_amt gt '500'.
 message e000(zmsg) with 'FOC sales order limit exceeded!'.
endif.

0 Kudos
704

Hi

Include MV45AFZZ.

Max

0 Kudos
704

Thank you Max bianchi.

Full points alloted.

cheers

kaki

Former Member
0 Kudos
704

Hi Kaki,

For USEREXIT_SAVE_DOCUMENT_PREPARE ,

SE38 -> MV45AFZZ . In this program you will find Routine USEREXIT_SAVE_DOCUMENT_PREPARE.

Regards,

Raj