Skip to Content
0
Former Member
Apr 30, 2007 at 01:02 PM

IF condition to execute ABAP code; VBAK-VSBED; VBPA-KUNNR; XVBPA/YVBPA

681 Views

Hi All!

I need some help. I have to change the MV45AFZZ, the FORM USEREXIT_MOVE_FIELD_TO_VBAK. The user exit should write the VBAK-VSBED (shipping condition) from the KNVV-VSBED for the VBPA-KUNNR, PARVW=WE (the ship-to-party partner). The user exit should also permit the modification of VBAK-VSBED directly from VA01 or VA02 (even if the ship-to-party remain the same).

I write down the ABAP code but I need to write a condition in order to execute the modification of VBAK-VSBED:

1. in VA01, for the first time;

2. in VA01 and VA02 if I change the ship-to-party partner.

Now, if I want to change VBAK-VSBED without modifying the ship-to-party, I can not. The user exit overwrite the VBAK-VSBED for the ship-to-party.

The code is:

-


READ TABLE xvbpa WITH KEY parvw = 'WE' .

IF SY-SUBRC = 0.

SELECT SINGLE * FROM knvv WHERE kunnr EQ xvbpa-kunnr and

vkorg EQ xvbak-vkorg and

vtweg EQ xvbak-vtweg and

spart EQ xvbak-spart .

vbak-vsbed = knvv-vsbed.

ENDIF.

-


Any help will be appreciate.

Florina C.