Recently I was in a need of encoding several information into small amount of data: something that would allow system, if correctly entered, to easily identify the paid invoice, and, at the same time, allow user to get more data from the simple sequence. Among other possible solutions, I chose Classification Key implementation due to several reasons: its easy to implement, it is visible on document header and it can be used in note to payee interpretation rules.
Start point is enabling prepared enhancement. Go to IMG – Financial Accounting (New) – Contract Accounts Receivable and Payable – Program Enhancements – Prepared Enhancements – Classification Key and run the program. As always, first time run it with checked option “Only Check Enhancement” which will check wether this enhancement is already enabled/created.
After that, run the program without checked option “Only Check Enhancement” and wait for it to finish. The program will create everything needed in the system.
Note: If you are running SyBase, the database index will not be created automaticaly. The program will show that everything exists, but the index will not be created in the system. To do so, you should create the index in the database manualy: create the database index DFKKKO-Z01 in a customer package and activate the index which will create the index in the database system.
Changes on the documents
If everything was done correct (both by you and the SAP system), you have the enhancement enabled. You can check that by runing the stated program again, checking the table TFKENH or by going to transaction FPE2 (for example), choosing an existing document and checking the document header. At this point, the field Classification Key (OPORD) will exist, but it will not be populated.
Deciding about the Classification Key contents
Classification Key contents are up to you. The field is up to 35 characters long. I decided to put contract account, date and control number in it. It would fit the lenght, give me enough data and be usable for payment transactions.
Filling Classification Key field
I wanted the classification key to be filled during invoicing. Luckily, an event exists exactly for that purpose. Event R429. If youre not familiar with the FQEVENTS transaction, I would recommend this article: How to use FQEVENTS. It will give you great start and you will be able to use the events in no time.
What you need to do here is create your own function module with the ABAP code you will use.
I will give a short example of what could be the content of your custom functional module:
function ZISU_SAMPLE_R429. DATA: contract_account TYPE VKONT_KK, date TYPE FAEDN_KK, output TYPE OPORD_KK, control_number TYPE n contract_account = X_FKKVKP-VKONT. date = X_ERDK-BLDAT. control_number = 1. CONCATENATE contract_account '-' date '-' control_numberr INTO output. Y_OPORD = output. endfunction.
Depending on your need, you can implement control number generation (for example, you could use something similar to FMCA_CREATE_DIGIT_MODULO11). Displayed code will always put “1” as control number, for demonstration purposes.
Interpreting Note to payee
Assuming you printed classification key on your invoice, as a payment reference number, next step is interpreting it, once it comes on electronic bank statement or is entered manualy in payment lot.
First, add open item selection category in IMG – Financial Accounting(new) – Contract Accounts Receivable and Payable – Basic Functions – Open Item Management – Specify Selection Categories. Define a new selection category and link it to field OPORD.
Then, define interpretation rule (IMG – Financial Accoutning (New) – Contract Accounts Receivable and Payable – Business Transactions – Payments – Processing Incoming and Outgoing Payments – Define Interpretation Rules for Note to Payee). Here, you should define the length (under Structure) and selection category (under Assigned Selection Category).
Setting all this will cover the initial idea: being able to automaticaly identify invoice during payments processing and being able to identify the customer and the month just by seeing this number. Dont forget checking your settlement/clearing settings to include classification key in your variants.
Hope this helps in your implementations.