cancel
Showing results for 
Search instead for 
Did you mean: 

USER EXIT to change VBAP-VSTEL

0 Kudos

Hi all, i have a question

i'm fighting with consultant about this issue.

We have a order type (ZRI0) with many Order Reasons, for a specific order reason (Z30) i want to change the default Shipping Point (VBAP-VSTEL)from V_TVSTZ-VSTEL (FAM1) to V_TVSTZ-VSTE1 (FAM2)

the customization of table TVSTZ is that FAM1 is the default Shipping Point and FAM2 is the Manual Shipping Point

So i asked an user exit that for the specific order reason changes Shipping Point to V_TVSTZ-VSTE1 (FAM2)

they say it's impossible , they can modify only exit MV45AFZZ FORM userexit_move_field_to_vbap

i tried to modifying exit MV45AFZZ FORM userexit_save_document but nothing change, it seems that the customizing overwrites our modifications.

So the question is : where can i insert this modification on document saving?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

check here

MV45AFZZ > sap userexit_move_field_to_vbap, check there and try.

0 Kudos

FORM userexit_move_field_to_vbap.

SELECT SINGLE mtart INTO mara-mtart FROM mara WHERE matnr = vbap-matnr.

IF mara-mtart NE 'DI' .

if vbak-vkorg = 'FA01' and vbak-augru = 'Z30' and vbak-auart = 'ZRI0'.

move 'FRGA' to vbap-lgort.

move 'FAM2' to vbap-vstel.

move 'FA01' TO VBAP-WERKS.

endif

This changes vbap-vstel to FAM2 but on saving vbap-vstel comes back to FAM1

Edited by: Giorgio Ferro on Jun 9, 2011 11:33 AM

Edited by: Giorgio Ferro on Jun 9, 2011 11:33 AM

Former Member
0 Kudos

Hi,

Shipping point determination is running and std SAP code is replacing the one that you have overwritten again

One option is to write this code in USEREXIT_SAVE_DOCUMENT_PREPARE.

Also in config add your shipping point under 'Can be entered manually'.

Goto SPRO > Logistics Execution > Shipping > Basic Shipping Functions > Shipping Point and Goods Receiving Point Determination > Assign Shipping Points

Hope this helps.

Regards,

Amit

0 Kudos

I did this modification in USEREXIT_SAVE_DOCUMENT_PREPARE

SELECT SINGLE mtart INTO mara-mtart FROM mara WHERE matnr = vbap-matnr.

IF mara-mtart <> 'DI' .

if vbak-vkorg = 'FA01' and vbak-augru = 'Z30' and vbak-auart = 'ZRI0'.

move 'FRGA' to vbap-lgort.

move 'FAM2' to vbap-vstel.

move 'FA01' TO VBAP-WERKS.

endif.

but nothing , something overwrites it

so i tried with

SELECT SINGLE mtart INTO mara-mtart FROM mara WHERE matnr = vbap-matnr.

IF mara-mtart <> 'DI' .

if vbak-vkorg = 'FA01' and vbak-augru = 'Z30' and vbak-auart = 'ZRI0'.

move 'FRGA' to vbap-lgort.

move 'FAM2' to Xvbap-vstel.

move 'FA01' TO VBAP-WERKS.

endif.

but nothing , something overwrites it also in this way

This customizing

Goto SPRO > Logistics Execution > Shipping > Basic Shipping Functions > Shipping Point and Goods Receiving Point Determination > Assign Shipping Points

is already ok

Former Member
0 Kudos

Hi,

SELECT SINGLE mtart INTO mara-mtart FROM mara WHERE matnr = vbap-matnr.
IF mara-mtart 'DI' .
if vbak-vkorg = 'FA01' and vbak-augru = 'Z30' and vbak-auart = 'ZRI0'.
move 'FRGA' to vbap-lgort.
move 'FAM2' to *X*vbap-vstel.
move 'FA01' TO VBAP-WERKS.
endif.

You seem to be missing an

ENDIF

statement here.

Put a breakpoint before the select and check if the shipping point is being assigned in debug mode.

There doesnt seem to be any other issue here whatsoever.

Regards,

Amit

0 Kudos

the "endif" missing was just a mistake when i did ctrl+v

Yes the shipping point is assigned in debug mode

But then something overwrites it

If i change the shipping point in va02 it works .. obviously

Is there any flag in VBAP/XVBAP that i have to modify to make the system recognize that there was a modification?

Former Member
0 Kudos

Hi,

There's no flag as such.

What you can try is :

Along with the modification of VBAP structure try modifying XVBAP too using the following code.

SELECT SINGLE mtart INTO mara-mtart FROM mara WHERE matnr = vbap-matnr.
IF mara-mtart 'DI' .
if vbak-vkorg = 'FA01' and vbak-augru = 'Z30' and vbak-auart = 'ZRI0'.
move 'FRGA' to vbap-lgort.
move 'FAM2' to *X*vbap-vstel.
move 'FA01' TO VBAP-WERKS.

loop at xvbap.
xvbap-vstel = 'FAM2'.
xvbap-lgort = 'FRGA'.
modify xvbap.
endloop.
endif.
endif.

Hope you are still writing this logic under save_document_prepare. It should work.

Make sure my syntax is proper. Its been a while I lost tocuh with ABAP.

Regards,

Amit

Edited by: Amit Iyer on Jun 10, 2011 1:07 PM

0 Kudos

Yes it' works!

thankyou

Our consultats suks!

Former Member
0 Kudos

Good to hear it worked !!

Your welcome.

Regards,

Amit

Answers (1)

Answers (1)

sarthak_mohantysd
Active Contributor
0 Kudos

Hello Giorgio,

For your requirement of changing the Shipping point based on Specific Order reason, i would suggest you to use the following User exit.

  1. USEREXIT_MOVE_FIELD_TO_VBAP

And also i am not sure but still you can give a try on the User exit "USEREXIT_SAVE_DOCUMENT_PREPARE" and post an update on your obseration.

Regards,

Sarthak