Skip to Content
avatar image
Former Member

Modifying check on purchase order number in sales document

I've been experimenting with the following case.

- We have global use of a document type OR

- One sales organization wants to have the check on PO number.

- In customizing, you can define field TVAK-PRBST = 'A' for documenty type to check on PO number

- But in my case only 1 sales organization wants to make use of this functionality. So I want to check in userexit if this is sales org. xxxx, then set field 'A', else keep blank.

I got it partially to work, I used but only this does not work when I enter the customer AND po number in one go. When I enter the customer number, enter, then the PO number it works.

MV45AFZZ - form userexit_field_modification.

MV45AFZB - form userexit_check_vbak using us_dialog.

Now I see RV45PFZA - USEREXIT_SET_STATUS_VBUK as an user exit. Is this the correct place or is there an other exit or start where I can put my check:

if vbak-vkorg = 'xxxx'.

tvak-prbst = 'A'.

endif.

Any info would be appreciated!

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

5 Answers

  • Best Answer
    Nov 18, 2008 at 09:58 PM

    What you're trying to do is not going to work (at least not like this), no matter in which user exit you put it. The user exits are not meant to change the configuration. Also everything that SAP wanted to be done with that field in TVAK most likely has already been done before it even hits any user exits.

    The best solution for this would be to create a new document type (a copy of OR) with the necessary settings in configuration. Otherwise you'll need to find out what exactly SAP code does with this field and just re-create the same thing in a user exit (USEREXIT_MOVE_FIELD_TO_VBAK might be a good place). Hopefully, it will be just a routine or an FM that you could also use, but, since nothing comes up in 'where used' for this field, it might be challenging to figure it out. This might also become a maintenance issue, because SAP might change the functionality over time.

    Also make sure to read SAP Help on the user exits before you go any further:

    http://help.sap.com/saphelp_46c/helpdata/en/1c/f62c7dd435d1118b3f0060b03ca329/content.htm

    Add comment
    10|10000 characters needed characters exceeded

  • Nov 19, 2008 at 03:28 AM

    Dear Peters

    The best solution would be create a new sale order type and assign the incompletion procedure "11" in VOV8 for the sale order type for which you want this control.

    Meanwhile, go to OVA2, select "A - Sales-Header" and double click on Procedures. Again block on "11 - Standard order" and click on Fields. There maintain the following:-

    Table:::Fld name::::::::Description::::Screen:::Status:::Warning

    VBKD:::::BSTKD::::::::PO number:::::KBES::::::01:::::::::::X

    Now try this check how it works.

    thanks

    G. Lakshmipathi

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Nov 19, 2008 at 03:39 AM

    Simple and Ideal solution to the issue is create a new sales order type. You will not require to do any sort of enhancement and the objective will be met.

    Regards,

    Rajesh Banka

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Nov 19, 2008 at 02:47 PM

    Thanks for the information only what I did not tell is that this is a global order type, used by numerous sales organizations and I don't want to change the order type because this hits functionalities associated with this order type. The OR is an example in my question, but in fact it is already an own made order type.

    So in fact I am indeed looking for the determination of the TVAK and just after that, able to change it.

    Now I have this that when entering a customer, enter, then enter the PO number, then it works. But not in one go.

    But I am now checking RV45PFZA maybe this one will help.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Nov 20, 2008 at 12:39 PM

    I think I have found it and solved it 😉

    During debugging I have seen that before checking the po number field, a userexit is called. MV45AFZB in routine USEREXIT_MOVE_FIELD_TO_TVCOM_H. Although the place and function of the exit is not correct what I want...it does work.

    • First get original setting from customizing to avoid problems

    clear: tvak-prbst.

    select single prbst

    into tvak-prbst

    from tvak

    where auart = tvcom-auart.

    • Now set value different for the specific sales organization(s)

    if tvcom-vkorg = 'xxxx'

    and tvcom-vtweg = 'xx'.

    tvak-prbst = 'A'.

    endif.

    So a reread of the customizing table because if you switch to an other customer for a sales org. in the same transaction (or leave the transaction and go into the transaction again), the tvak field is not cleared.

    Hope this helps someone else. But help was much appreciated!

    Add comment
    10|10000 characters needed characters exceeded