07-18-2007 3:43 PM
Hi,
I have requirement where I need to clear the values entered in the PO Type field in the PO Data tab of VA01/02. So whatever the user enters in this field, if they press the Save button, should not get saved. I tried to clear the values in XVBKD-BSART in the exit : userexit_save_document_prepare, but it did not work.
Does anyone know how I can handle this?
Regards,
K!
07-18-2007 4:39 PM
Hi Kaustubh,
You have to set the update field XVBKD-UPKDZ = 'U' to update the record before save in the user exit. Let us know if you already did it with some more description of the problem.
Giri..
07-18-2007 4:46 PM
Yes the UPDKZ flag is already set to 'U' as I have already tried to change the PO type.. I just need that, this BSARK field should not get updated to the value which the user has tried to enter but should be changed to initial.
XVBKD has:
BSARK UPDKZ
TELE U
I changed it to
BSARK UPDKZ
U
Regards,
Kaustubh
07-18-2007 4:48 PM
I am sorry the field is UPDKZ not UPKDZ...Clear the required field and change the field from UPDKZ = 'I' to UPDKZ = 'U'.
07-18-2007 4:52 PM
Can you copy paste you code so that I'll have a better understanding and can see where its going wrong...
07-18-2007 5:16 PM
LOOP AT xvbkd where updkz = 'U'.
CLEAR xvbkd-bsark.
MODIFY xvbkd.
ENDLOOP.
07-18-2007 5:45 PM
Kaustub,
The code below should work fine for VA02 item level. Means when you change the purchase order type at the item level it will work as desired. To make it work at the header level check if the field is open at the header level in your system. If the field is open and it is mannually changed even the header record will have U in the xvbkd and the code below should work fine. If the field is not open you should find a SAP note to open the field at the header level or else you should control it from config.
LOOP AT xvbkd where updkz = 'U'.
CLEAR xvbkd-bsark.
MODIFY xvbkd.
ENDLOOP.
If you want to restrict at the sales order creation level VA01 I am sure your code will not work either at header level or Item level. You might need to modify the code if that is desired..
Giri..
Giri..
07-18-2007 5:57 PM
Giri,
We are changing the header level fld, and it gets updated at the detail level on it own. these are values that XVBKD has
MANDT VBELN POSNR UPDKZ BSARK
208 |0000047066|000000 |U |ZUS1 |
208 |0000047066|000010 |U |ZUS1 |
I have added the code which I had mentioned, still when I open the order the next time, it has the value ZUS1 in it..
For VA01, I understand my code would not work...
Regards,
Kaustubh
07-18-2007 6:13 PM
I got your point. Are you mannually able to change the PO type at the header level while you are in VA02 transaction? If that is possible your code will work otherwise it wont. To open that field you should find an appropriate note is SAP.
Giri.
07-18-2007 6:15 PM
yes we are manually able to change the PO type at the header level in VA02. I just enter PO type there, but would like it to be cleared when I save it,
Regards,
Kaustubh
07-18-2007 8:22 PM
I think i got it, it also updates VBAK-BSARK with the same value, and somewhere after the user-exit there is a code: if VBKD-BSARK is initial. then VBKD-BSARK = VBAK-BSARK.
So I guess I need to also clear the value in VBAK-BSARK..
04-26-2011 11:55 AM