Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

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

Former Member
0 Kudos

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.

2 REPLIES 2

raymond_giuseppi
Active Contributor
0 Kudos

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)

0 Kudos

Thanks Raymond..it solved my issue..