SAP Tips – Using field PSTYV in a Pricing condition table

You want to use the field PSTYV (Sales Document Item Category) that is contained in the structure KOMP (Communication Item Pricing) as a key for a condition table.  However, when you create a condition table (transaction V/03), the system does not propose the field in the field catalog.

For technical reasons, the field PSTYV was included in the structure KOMP, but not in the structure KOMG (Allowed Fields for Condition Structures).

To solve the problem, proceed as follows:

1. Call the ABAP Dictionary (transaction SE11) and create the data type ZZPSTYV. Select PSTYV as the domain. As the short description, you can use ‘ZZ – Sales Document Item Category’ (for example) and as the field labels, you can use the field labels of the data type PSTYV. Save, check and activate your entries.

2. In the ABAP Dictionary (transaction SE11), enter the structure KOMPAZ,  switch to change mode and make the following entries:

Component             Component type

ZZPSTYV                  ZZPSTYV

Save, check and activate the change.

3. Note: Due to the changes in the structure KOMPAZ, the field ZZPSTYV is now known in the structures KOMG and KOMP because the structure KOMPAZ is included in both structures.

4. Call transaction SPRO. Go to ‘Sales and Distribution > Basic Functions > Pricing > Pricing Control’ and execute ‘Define Condition Tables’.  Select ‘Conditions: Allowed fields’ and enter ZZPSTYV as a new entry.

5. Note: When you create the condition table Axxx, you can now use the field ZZPSTYV as a key field.

6. Populate the new field you defined by including the following source code line in the user exit USEREXIT_PRICING_PREPARE_TKOMP:  MOVE xxxx-PSTYV TO TKOMP-ZZPSTYV.

In order processing, the user exit is available in the include MV45AFZZ, and in billing document processing, it is available in the  include RV60AFZZ

Remember too that you can use this technique for other user defined fields. For header fields, use the structure KOMKAZ instead of the structure KOMPAZ, and use the user exit USEREXIT_PRICING_PREPARE_TKOMK instead of the user exit USEREXIT_PRICING_PREPARE_TKOMP.

More information is available in transaction SPRO when you go to ‘Sales and Distribution > System Modifications > Create New Fields (Using Condition Technique) > New Fields for Pricing’, and in OSS Note 21040

Leave a Reply