2006 Jan 06 8:57 AM
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
2006 Jan 06 9:37 AM
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.
2006 Jan 06 9:06 AM
hi,
Go for
<b>include mv45afzz. " User-forms</b>
in the program SAPMV45A.
Regards,
Sailaja.
2006 Jan 06 9:07 AM
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
2006 Jan 06 9:15 AM
Hi Sailaja and pratibha,
Thanks for replies.
How to use XVBAK & XVBAP structures in userexits?
Do i need to use INCLUDE STRUCTURE?
kaki
2006 Jan 06 9:25 AM
no no .. u dont have to declare or include the structure.. just use it..
if xvbap-auart = 'ZSR1'.
...
endif.
pradhiba
2006 Jan 06 9:10 AM
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
2006 Jan 06 9:22 AM
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
2006 Jan 06 9:26 AM
I feel that is a warning message only.
check it, if it is warning proceed with your change.
thanks
vijay
2013 May 14 7:16 AM
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.
2006 Jan 06 9:16 AM
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
2006 Jan 06 9:18 AM
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.
2006 Jan 06 9:37 AM
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.
2006 Jan 06 9:54 AM
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.
2006 Jan 06 9:59 AM
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
2006 Jan 06 10:09 AM
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
2006 Jan 06 10:12 AM
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
2006 Jan 06 10:23 AM
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.
2006 Jan 06 10:24 AM
2006 Jan 08 11:50 AM
Thank you Max bianchi.
Full points alloted.
cheers
kaki
2006 Jan 06 10:23 AM
Hi Kaki,
For USEREXIT_SAVE_DOCUMENT_PREPARE ,
SE38 -> MV45AFZZ . In this program you will find Routine USEREXIT_SAVE_DOCUMENT_PREPARE.
Regards,
Raj