Skip to Content

How to validate the Aufnr field on the basis of G/L account selected from valid sets

I have requirement in my project where I have to validate the below field : In the Purchase Order (I.E ME21N Tcode), In the Account Assignment Tab at Item level,when user choose GL Account(sakto) in the G/L account field from the valid set,then we need to make sure that Order Number field(Aufnr) is mandatory . I am new to user exits and I don't know from where should I begin to complete this requirement..Any suggestions will be helpful..Thanks in advance.

Add comment
10|10000 characters needed characters exceeded

1 Answer

  • Posted on Oct 04, 2017 at 05:37 AM

    Don't use any old customer exit, better use available BAdI

    • Suggested BAdI ME_PROCESS_PO_CUST and method PROCESS_ACCOUNT
    • To read required information on PO assignment use im_account->get_data( )
    • To check if account is member of set call FM G_SET_GET_ALL_VALUES
    • To check that account field status group contains the mandatory flag for order, call FM FI_GET_FIELD_SELECTION_STRING and then call FI_CHECK_ACCOUNT_ASSIGNMENT or (read the FM source and) check value of e_sting1+10(1)
    • Raise error using macro mmpur_message_forced and mmpur_metafield of include mm_message_mac

    Perform also some search in forum, there are already many samples on this subject.

    But talk first with functionals, they are asking you to check their Customizing and master data, the fact that the field status of an account force the order to be mandatory is not part of the purchase order creation, this is not the good point of control, or is the actual requirement to prevent using those account in PO, there are other solutions like FI or CO validation that can be implemented thru Customizing without any Abap. (e.g. OKC7, if account in set and PO transaction/BAPI, then order must not be initial)

    Add comment
    10|10000 characters needed characters exceeded