I have an issue regarding delivery block.
I've read a couple of posts regarding this, but they all solved their issue by using userexit_save_document or userexit_save_document_prepare which is no option for me.
My issue is the following:
I've created an order type ZTA (copy of TA) and setup a default delivery block "Z1 - in work" to that order type.
This prevents that after saving the order it will not be automatically delivered by a job which is running in background.
So each time I create a ZTA order with VA01, it will set the delivery block Z1. That's fine.
Now let's say when a customer has a delivery block (e.g. Z5), it will not overwrite the order delivery block Z1, when entering sales-to-party (or ship-to-party)!
Now I tried to add some code to userexit_move_field_to_vbak like that:
if not kuwev-lifsd is initial.
vbak-lifsk = kuwev-lifsd. " Z1 -> Z5
if not kuagv-lifsd is initial.
vbak-lifsk = kuagv-lifsd. " Z1 -> Z5
Result: It will execute my new code sequence, but will not change the delivery block Z1 to Z5 on the VA01 screen. Maybe because I'm at this step not in update but insert mode?
I need to show the customer's delivery block while creating the order, means showing the delv. block after saving is too late.
Is there maybe a better exit to change the order delivery block to the customers delivery block?
Thanks in advance
See SAP Note 178328 - Problems due to incorrect user exits in SD, it explains a lot of details related with the use of these userexits. If you are using a previous document, try to do it in copy rules (populating it with VOFM subroutines). It is not the case, try to do it with userexit_move_field_to_vbak in include MV45AFZZ for SVBAK-TABIX = 0. It is not advisable (I try to avoid to use to populate standard fields), because this userexit is to populate zz-fields, but I remeber that it works. In my opinion, the advisable is populate this field in the data of customer (KNA1-LIFSD) and check this value with userexits.
I hope this helps you
you wrote: "In my opinion, the advisable is populate this field in the data of customer (KNA1-LIFSD) and check this value with userexits".
What do you exactly mean with this?
Could it maybe be a solution to just set a delivery stop (e.g. Z1) in the order (header and items) if the customer doesn't have a delivery stop (like Z5)?
Cause I always want the user to remove the delivery stop (whether it's Z1 or Z5), when he decides that the order is fine and could be delivered by the background job.
But how to do this as my code doesn't work?
My suggestion is:
1. Try to do it in the first step with data from customer. Go to XD02, in General data, go to menu path extras / blocking data, and populate the data for delivery block. You can also do it with MASS for customers (KNA1) table KNA1 for this field. Dont't populate this fields with userexit. Standard reports can do it. Use userexits to check and modify values in exceptional cases.
2. Use this userexits. When you change the data, set a warning message as a information for the user.
3. Use the userexits to check or do validations.
4. Read carefully note 178328 about the UPDKZ indicator and how to works X* and Y* tables.
I hope this helps you