Simplify SAP R/3 development with Excel VBA/VB RFC  
Home> UserExit>COPA0005



CO-PA: User Exits
This enhancement lets you modify how actual data is updated in Profitability Analysis via the FI/CO interface. Caution!

Using the components in this enhancement means that you are modifying the standard update of actual data from Sales and Distribution (SD), Financial Accounting (FI), or Materials Management (MM) to Profitability Analysis. To avoid data from being updated inconsistently, you need to have a solid understanding of the "FI/CO document" interface!

Make changes with extreme caution. If unsure, contact SAP!

The components comprise the following function modules:


Function module EXIT_SAPLKEII_001 is called when you create a line item in CO-PA from the FI/CO document. It is executed after the characteristics are transferred from the sender document but before the values are transferred and derivation of characteristic values is carried out.

This makes it possible to manipulate characteristics and value fields of the line item transferred (import/export parameters I/E_ITEM) using information from the FI/CO document (table parameter T_ACC*). If you set the export parameter E_INIT to "X", you can clear a line item completely so that the document item is not updated in CO-PA. Consequently, this parameter should only be used for test purposes, for example, if you are still setting up SD and therefore have not been transferring data consistently.

You should make this enhancement operating-concern-specific using the parameter I_ERKRS!

The function module EXIT_SAPLKEII_002 is processed after the line item has been created (after derivation and valuation, but before number assignment and posting). The FI/CO document (table parameters T_ACC*) and table T_ITEM are available as transfer parameters.

This makes it possible for you to add information to the line item based on information from the FI/CO document. You should make this enhancement operating-concern-specific using the parameter I_ERKRS!


You must for the operating concern (CASE I_ERKRS ...), because the user exit is active for all operating concerns as soon as you enter enhancement COPA0003 in a project and activate it.

It is essential to observe the following: Do not make changes to characteristics!

You should avoid making changes to characteristics because this systematically creates at least twice as many profitability segments per line item. This means that table CE4xxxx is at least doubled in size. SInce table CE4xxxx forms the basis for reporting in Profitability Analysis, you should avoid as far as possible making unnecessary entries, since these can have adverse effects on performance. However, if you change characteristics in the present enhancement, you automatically create unnecessary entries in this table. The following rule should therefore be applied: Do not make changes to characteristics! Instead, you should always use enhancement COPA0001 in derivation to make changes to characteristics.

Exercise caution when changing values in multiple currencies!

When making changes to value fields in component EXIT_SAPLKEII_002, ensure that you perform these changes in all currencies that are active in the operating concern. This means that you need to ensure that, once your changes are completed, table T_ITEM contains the correct values in the respective currencies (field PALEDGER).

A line item without values (parameter I_ITEM) is still available in component EXIT_SAPLKEII_001. This line item is usually used, firstly, to build a line item in the operating concern currency, or, in exceptional cases, in a trasnfer price currency (operating concern or company code) if active. This line item is then used as the basis for building additional line items in different currencies. If you want to make changes to the values here, you should use the tables T_ACCIT and T_ACCCR to determine the correct currency in each case, which should be applied when the value field is supplied with data! This usually proves difficult. For this reason, you should use the enhancement COPA0002 for valuation to supply the value fields at this stage in the processing. In this enhancement, you can use the PALEDGER field in the line item to clearly identify the available currency!

The following rule applies: In the case of changes being made to value fields, it is your responsibility to ensure that the correct currency is determined!

If you have only activated legal currencies (operating concern and company code), then only one line item is created in the operating concern currency at this stage, which circumvents the problem of establishing which currency has been processed in component EXIT_SAPLKEII_001. In EXIT_SAPLKEII_002, on the other hand, all active currencies must be supplied correctly!

You are responsible for ensuring the consistency of any changes made!
  • EXIT_SAPLKEII_001: User Exit for Processing AC-Document: Line Item Structure
  • EXIT_SAPLKEII_002: User Exit for Processing AC Document: Generated Line Items