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.
Only the fields defined in the tables KOMG, KOMK and KOMP are allowed for conditions table and access sequences.
The fields of table KOMG as key fields for condition tables. The fields in tables KOMK and KOMP can be used for the definition of access sequences, and this fields are valid as the definition of access sequences ONLY and NOT as a key field for condition tables, therefore it does not appear in the selection list of condition key field.
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 Annn, 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.
Note that you can also use this note as a reference if you want to use other customer-specific fields as key fields in a condition table. 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 Note 21040.