How To Create Field in KOMP, KOMG

New Fields in Pricing

To use a field in pricing, one creates a condition table. This condition table is created using the allowed fields from the field catalog. Should the fields one requires not be included in the list of allowed fields, one can add the fields from the list of available fields. However, one may find that a new field may not be in the list of available fields. For this reason, one must create new fields for pricing. The document and item data in SD is stored in data tables, such as VBAK and VBAP (for the order transaction). Many of the fields from these tables are available in the field catalog.

The field catalog is a structure (KOMG) that consists of two tables (KOMK and KOMP). These tables contain the header and item data for pricing respectively. They are called KOM “x” because they are communications structures used to communicate the transaction data with the pricing procedure. Table KOMG contains the fields of tables KOMK and KOMP.

If you require a field that is not in KOMG, it means that it is not in KOMK or KOMP. This means that the field you require cannot be used in pricing because there is no communication of this field from the transaction to the pricing procedure via the communication structures.

To use a field not defined in the field catalog, you need to add this field to the KOMK or KOMP structures, and then write the ABAP code to transfer the data in the field from the transaction tables to the communication structure. Follow these steps:

1.     Create the field in the KOMK (header data) and KOMP (item data) tables using the standard includes provided for this requirement.
2.     Write the code in the user exit to read the transaction data and transfer it to the KOM “x” structures.

Menu Path

The menu path here is IMG, Sales and distribution, System modification, Create new fields (using the condition technique), New fields for pricing.

Adding the Field to KOMK and KOMP

This process requires some knowledge of the ABAP dictionary and how to use the ABAP dictionary to create and change fields and tables. You may have to use an ABAP skill to assist you. If the field is from the header table (for example, the order table VBAK), you’ll need to add it to the include table KOMKAZ in table KOMK. If the field is from the item table (for example, the order item table VBAP), you’ll need to add it to the include table KOMPAZ in table KOMP.

Let’s say you need to use the “base material” to define a price and the base material is not in the pricing field catalog. The base material is a field on the material master basic data screen and is defined as MARA-WRKST. Since this relates to the material, it is at the item level, so you would add the field to the KOMPAZ include table.
Note       When you add a field to these tables, it must start with “ZZ.” Therefore, the field you add would be ZZWRKST. In ABAP, when you add the field, use the same domain as in the field in the original table MARAWRKST.

After adding the field, generate the structure KOMP. This field is not available in the field catalog and can be used in condition tables.

Writing the ABAP Code

The field in the communications structure will be blank unless the ABAP code transfers the data from the material master to the field KOMPZZWRKST. Pricing occurs in the order and in the invoice, so you need to put this code in both places. For the order transaction, write the ABAP code in user exit USEREXIT_PRICING_PREPARE_TKOMP in include program MV45AFZZ. For the billing transaction, write the ABAP code in user exit USEREXIT_PRICING_PREPARE_TKOMP in RV60AFZZ.

Note :  The TKOMP is for the item level. If you are writing the code for a field at the header level, you would use the user exits that end with TKOMK. The ABAP code would select the Base material field from the material master table using the material from table VBAP/VBRP. It would then transfer this field to the structure TKOMP from MOVE MARAWRKST to TKOMP-ZZWRKST.

Get help for your SAP SD problems
SAP SD Forums - Do you have a SAP SD Question?

SAP Sales and Distribution Books
SAP SD Books  - Certification, Interview Questions and Configuration

Delivery Hints
SAP Logistics Execution

SAP Sales and Distribution Tips
SAP SD Discussion Forum and Sales/Distribution Tips

Best regards,
SAP Basis, ABAP Programming and Other IMG Stuff
http://www.erpgreat.com

All the site contents are Copyright © www.erpgreat.com and the content authors. All rights reserved.
All product names are trademarks of their respective companies.  The site www.erpgreat.com is in no way affiliated with SAP AG.
Every effort is made to ensure the content integrity.  Information used on this site is at your own risk.
 The content on this site may not be reproduced or redistributed without the express written permission of
www.erpgreat.com or the content authors.