2009 May 05 1:26 PM
HI,
The background is that based on Sold to party the Shipping condition is set.
What I need to do is that based on Ship to party the shipping condition should be set.
I used the exit USEREXIT_MOVE_FIELD_TO_VBAK in include MV45AFZZ. The code is working fine, but the problem is its is overwriting if the user is changing Shipping condition Manually in VA01/VA02. This should not happen. I have tried many possible scenarios.
The screen field of shipping condition is VBAK-VSBED but it does not help as I cannot determine which is the last value and what is the changed value.
Any suggestions would be helpful.
Regards,
Arnab
2009 May 05 3:50 PM
Hi,
may be you can check as below,
VBAK-VSBED " for existed value
XVBAK-VSBED " for newly entered value in the user exit - FORM USEREXIT_MOVE_FIELD_TO_VBAK.
2009 May 06 4:06 PM
I already checked this out, VBAK, XVBAK and *VBAK. This does not help. I already checked that out.
That is why I mentioned about the screenfield with that name.
Regards,
Arnab
2009 May 05 3:57 PM
Hi,
Try This
DATA: w_h_vsbed LIKE knvv-vsbed. IF sy-tcode = 'VA01' OR sy-cprog = 'ZVPCONV_OPEN_SO' OR sy-cprog = 'ZVVSALESORDER_CONV'. LOOP AT xvbpa WHERE parvw = 'WE' AND posnr = 0. w_h_cust = xvbpa-kunnr. EXIT. ENDLOOP. SELECT SINGLE vsbed INTO w_h_vsbed FROM knvv "KNVV WHERE kunnr = w_h_cust AND vkorg = vbak-vkorg AND vtweg = vbak-vtweg AND spart = vbak-spart. vbak-vsbed = w_h_vsbed. ENDIF.
Regards
Krishna
Edited by: Krishna Gowrneni on May 5, 2009 8:28 PM
2009 May 06 4:09 PM
Thanks for your response but there is no way this code is going to work.
SY-CPROG contains the Calling Program name. The names you have provided within the check are 'Z' programs which do not exist in another system(the 1 I am working in). We need to find proper enhancement spots / exits or field structures that can help.
Apart from that we dont need the complex logic : KUWEV-KUNNR will have Shipto party and KUAGV-KUNNR will have sold to party details. these are standard structures which get automatically filled on entry in VA01 screen.
Regards,
Arnab
2009 May 07 6:41 PM
Hi,
Can you use the userexit_save_document ? Irrespective of what the user has entered you fetch the shipping condition in this exit as per your logic depending upon Ship to party. I guess the user can't change the values after this exit is called.
KR Jaideep,