User Exits for adding another field at header/item level

Basics of modification in pricing* The following communication structures are relevant in pricing:

– KOMK (pricing communication header)

– KOMP (pricing communication item)

– KOMG (allowed fields for condition structures)

For technical reasons, the communication structure KOMG is used, which
combines KOMK and KOMP, and which contains all fields which can
generally be used for pricing. When entering new fields in KOMK or KOMG,
the fields are automatically included in KOMG.

* Fields for pricing are integrated into the following INCLUDES:

– header data in KOMKAZ (INCLUDE in KOMK or in KOMG)

– item data in KOMPAZ (INCLUDE in KOMP or in KOMG)

* The routines for assigning values to the new fields in order
processing are found in member MV45AFZZ. Use the following user exits:

– USEREXIT_PRICING_PREPARE_TKOMK (header fields)

– USEREXIT_PRICING_PREPARE_TKOMP (item fields)

* The routines for assigning values to the new fields in billing
are found in member RV60AFZZ. Use the following user exits:

– USEREXIT_PRICING_PREPARE_TKOMK (header fields)

– USEREXIT_PRICING_PREPARE_TKOMP (item fields)

Examples for using new fields in pricing

Example 1

In the first example, parts of a document field are to be used in
pricing. You want to use the first three digits of the product hierarchy
(PRODH) for pricing, for example. Proceed as follows:

1. Check the data elements in the standard system.

2. Since there is no such data element you have to create the new
data element ZZPRODH1. Also create a domain with the length “3” and the
data type “CHAR” for the new data element.

Remember that new data fields must start with the letters “ZZ” or “YY”,
since SAP reserved these letters to protect them from being overwritten
during a release upgrade.

3. Check whether the product hierarchy (PRODH) is found at header
or at item level.

In table VBAP, document field PRODH is defined as an item field.

4. Integrate the field name ZZPRODH in the communication structure
KOMP using the INCLUDE KOMPAZ and allocate the data element PRODH to it.

5. Activate the structure.

6. Check in which table the field PRODH exists.

The field is in table VBAP (sales document: item data).

7. Assign a value to the new field in the FORM routines for sales
order processing and billing using the appropriate user exits:

In sales order processing the user exit is found in member MV45AFZZ. The
complete statement is:

FORM USEREXIT_PRICING_PREPARE_TKOMP.

MOVE VBAP-PRODH(3) TO TKOMP-ZZPRODH.

ENDFORM.

The routines for assigning a value to the new fields in billing are
found in member RV60AFZZ. The statement is as follows:

FORM USEREXIT_PRICING_PREPARE_TKOMK

MOVE VBRP-PRODH(3) TO TKOMP-ZZPRODH.

ENDFORM.

8. Allocate the specifications A, V and 001 to the field ZZPRODH in
table T681F.

Example 2

In the second example, you want to use a partner function for pricing
which was created in Customizing for partner maintenance.

Assume that the partner function was created for a sales representative
of the partner type PE. Z1 is defined as a mandatory function for the
customer master record, therefore automatically set in the document and
available in the internal partner table XVBPA.

To use the new partner function for pricing, proceed in the same way as
for the previous examples.

1. Create a new data element, in this example, the data element
ZZVRTZ1 with the domain PERNR.

2. Include the field ZZVRTZ in KOMK using KOMKAZ and allocate the
data element ZZVRTZ1 to it.

For order processing, assigning a value to the field is carried out in
the user exit for member MV45AFZZ. The entries in the user exits are
protected during a release upgrade. The statement is as follows:

FORM USEREXIT_PRICING_PREPARE_TKOMK.

PERFORM XVBPA_LESEN (SAPFV45K) USING ‘Z1’ VBAP-POSNR SY_TABIX.

MOVE XVBPA-PERNR TO TKOMK-ZZVRTZ

Advertisements

One thought on “User Exits for adding another field at header/item level

  1. Christian Varela Garcia

    Hi, using the same user exit, i need to calculate the condition using the same condition, Example: For condition ZXXY the valio of the characteristic is the first 2 values, fon condition ZYYY the value of the condition is the first 4 values. In the user exit i need to include a functional module to fill the fields of the structure XKOMK, which module can i use?

    Best Regards

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s