20 in Montreal, Quebec

How to add SD Partner Functions as Characteristics in COPA for Profitability reporting

How to add SD Partner Functions as Characteristics in COPA for Profitability reporting

  • Posted by: Adrian
  • Category: COPA Characteristics, COPA Derivation, KEA5, KEDR, KUNNR, KUNWE, MCPARTUSR, PAPARTNER
There are at least 3 different ways to add SD Partner Functions in COPA that I know.

  1. This one is complex and it requires Abap code and enhancements in standard SAP programs. That one is outlined by SAP in OSS Notes (36557, 12682, 32878, 93658). 
  2. Another one is kind of similar to the one that I will recommend, but it does not work in all the cases as the Sales Rep. is not always an SAP employee (PERNR). (This one was described by Paul Ovigele in the SAP Insider blog)
  3. An easy one …. that I have used and developed through the years, that works, it’s easy and it requires minimal development (around 15 mins. ). This is the one that I will share with you in this Blog Post …

To start with we will look at a Sales Order with its Partner Functions

* For confidentialy reason, names and descriptions are masked

Here you can see that we have different Partner Functions in this Sales Order (AG – Sold To, RE Bill To, WE Ship To and a custom one ZE – Sales Representative).

The Sales Representative is a typical Custom Partner Function that SD implementation teams normally create. It is commonly used to calculate commissions, among other things. But from a Profitability Analysis perspective it is also really helpful to be able to calculate how profitable a Sales Rep. is (or his customers). So it is also a common business requirements to have it as a COPA reporting Characteristic.

The SD Partner functions in the Sales Orders can be found in Table VBPA – Sales Document: Partner

As you can see above, in our previous Sales Order, we had ZE – Sales Rep. Partner Function assigned to “Vendor” 35xxx52. We can see the record in the Table VBPA.

Now, if you know a little bit of COPA, you might see where this is going …. With a simple COPA Derivation step, we will read table VBPA (Table lookup) and get the Sales Rep. #.

But …. there is a hick here. How do I create this COPA Characteristic in a way that I will not only have the number, but also the “key description” so I can have the Sales Rep. name in my Profitability reports and not just the number? Otherwise, it will be easy just to get the Sales Rep # into a Custom Characteristic field. But people will need to know what is the name of Sales Rep. 35xxxx52, it is not practical if you have many Reps. like big companies normally have.

This is where we need to do a really small development.

All custom and additional Partner Functions that can be added in COPA, need to be added first in Structure MCPARTUSR (Additional Partners from VBPA).
The right way to do it is by doing an APPEND in this structure right after field PDUMMY. As you can see below, we added 2 fields. The one that we will use is ZSREP_LI

The Field ZSREP_LI is defined with a Check Table and all the right definition same as LFA1-LIFNR as our Sales Rep. has been defined as a Vendor by our SD Team. I have used it before defined as a Customer as a different solution.

This of course cannot be done by a Functional Consultant, it needs to be done by a quilified Abaper.

As you can see below, Structure MCPARTUSR is also an Include of Table PAPARTNER, so the new fields get added to PAPARTNER automatically after saving.

Once this is added to MCPARTUSR, then we can go to create the Custom Characteristc (Tcode KEA5) to be added later to the Operating Concern.

I will create a Characteristic based on Table PAPARTNER that will use my Appended Table MCPARTUSR fields. Ex. WWSRP

Now the added field ZSREP_LI can be used and I will call it WWSRP (In this case the image is slightly difference as this was previously done to taking the screen shoots).

There are other standard partner functions that normally do not come as part of the Operating Concern in COPA and can also be added as Characteristics. Ex. WE – Ship to. You just need to create a Characteristic using KUNWE. Similar process for RE – Bill To. (KUNRE). The difference with the Sales Rep. is that these other are SAP Standard Partner Functions and they all have their own fields and check tables that will give us all the validations and descriptions, not just the code.

Now that the Characteristic has been created, we will add it to the Operating Concern as you would add any other Characteristics.

*** Note: We will not describe this process. We assume that if you are reading this you have the basic COPA knowledge to perform it.

Finally, the Characteristic has been Added to the Operating Concern. But the way it is right now, it will not get filled with any values yet.

We need to build a Characteristic Derivation Step (Tcode KEDR) of the Type Table Lookup for Table VBPA, the one that contains the records that hold the Partner Functions of the Sales Orders.

It is important to take into consideration to have POSNR as ‘000000’ as normally the Partner Functions are at the Header Level. In case your SD design has them at the Line item level, then this will not be a constant. (See Table VBPA displayed previously)
In PARVW you will use GLOBAL-USERTEMP1 and then input RE (SAP Internal denomination for Bill-to) or ZE as per my previous example for Sales Rep.
Then the Target field will be your recently defined COPA Characteristic (Ex, KUNRE, WWSRP, etc.).

This concludes our process to Add a Custom Partner Function in COPA. As you could see it just requires a small Append in a Table that would take a good Abaper, not more than 10/15 minutes. And for sure this is 100% upgrade proof … !!!

If your Company and/or Project needs to implement this or any of the functionalities described in my Blog, do not hesitate to reach out to me and I will be happy to provide you my services.

Author: Adrian

Leave a Reply