SapMaterial.com
Conditions

Transactioncodes

VK12 Change condtion records
VK13 Display condition records
VK14 Create condtion records with reference
VK15 Create condtion records

You can aslo use transaction VK31 -VK34

Tables

KONH  Condtions (Header)
KONP  Condtions (Item)
KONV  Condtions (Transaction Data)  
T681    Conditions: Structures
T681V Conditions: Usages


Reading the condtion.

In table KONH Condtions header find the condtion and read the name of the condtion table.

If we want to find kondtions K007:

Where kschl = 'K007'

The field  KVEWE Usage of the condition table contains the prefix of the table.

Field KTABNR Condition table Contains the name of the condtion table

E.g. for codition K007  KVEWE = A and KTABNR = 007, thus the condition table name is A007. Note that the condition can contain more
than one level, and therefore more than one condition table.

E.g.

Sales office  -> Table  Axxx
Sales office / Customer -> Table Ayyy
Sales office /Customer / Material -> Table Azzz

You can se the level from field KONH-VAKEY

In the condition table you find the key for the condtion and reads field KNUMH Condtion record number

For condtion K007, Salesorg 1000, Distribution channel 10, Division 00 and custome rnumber 1360 KNUMH = 9979

Now the condtion value can be read from table KONP Condtions (Item)  with key KNUMH. The value is read from field

KBETR Rate (condition amount or percentage) where no scale exists.


Example:

Reads condition ZAGE from table A510, A512, A513  and condition items from KONP, an dcreates 3 tables that contains the
key for the condition and the value.

Note that we have identified the 3 tables A510, A512, A513 beforehand by looking in table KONH.


The condition has 3 levels:
- Sales office
- Sales office / Customer
- Sales office / Customer / Material


INPUT  :  
- A510 Sales office
- A512 Sales office/customer
- A513 Sales office / Customer / Material
- KONP Conditions (Item)

OUTPUT : GI_A510 Sort: Sales office
- GI_A510 Sort: Sales office
- GI_A512 Sort: Sales office/customer

- GI_A513 Sort: Sales office / Customer / Material




TYPES:
* Condition item
BEGIN OF T_KONP,
KNUMH  LIKE KONP-KNUMH,
KBETR  LIKE KONP-KBETR,
END OF T_KONP.
* Condition table A510: Sales office
BEGIN OF T_A510,
VKORG    LIKE A510-VKORG,           "Sales organization
VKBUR    LIKE A510-VKBUR,           "Sales office
KNUMH    LIKE A510-KNUMH,           "Condition record number
KBETR    LIKE KONP-KBETR, "Rate (condition amount or percentage)
END OF T_A510,
* Condition table A512: Sales office/Customer
BEGIN OF T_A512,
VKORG    LIKE A512-VKORG,           "Sales organization
VKBUR    LIKE A512-VKBUR,           "Sales office

KUNNR    LIKE A512-KUNNR,           "Customer number
KNUMH    LIKE A512-KNUMH,           "Condition record number
KBETR    LIKE KONP-KBETR, "Rate (condition amount or percentage)
END OF T_A512,
* Condition table A513: Sales office/Customer/Material
BEGIN OF T_A513,
VKORG    LIKE A513-VKORG,           "Sales organization
VKBUR    LIKE A513-VKBUR,           "Sales office
KUNNR    LIKE A513-KUNNR,           "Customer number
MATNR    LIKE A513-MATNR,           "Material number
KNUMH    LIKE A513-KNUMH,           "Condition record number
KBETR    LIKE KONP-KBETR, "Rate (condition amount or percentage)
END OF T_A513.

DATA:
GI_KONP  TYPE T_KONP OCCURS 0,
GI_A510     TYPE T_A510         OCCURS 0,

GI_A512     TYPE T_A512         OCCURS 0,
GI_A513     TYPE T_A513         OCCURS 0.
G_A510      TYPE T_A510,
G_A512      TYPE T_A512,
G_A513      TYPE T_A513,
G_KONP   TYPE T_KONP.


* Read KONP Conditions (Item)
SELECT KNUMH KBETR
FROM KONP
INTO TABLE GI_KONP
WHERE KAPPL  = 'V' AND
KSCHL  = 'ZAGE'.

SORT GI_KONP BY KNUMH.

* Condition: Sales office
SELECT VKORG VKBUR KNUMH
FROM A510
INTO TABLE GI_A510
WHERE KAPPL  = 'V' AND
KSCHL  = 'ZAGE' AND
( DATBI => SY-DATUM AND DATAB <= SY-DATUM ).

LOOP AT GI_A510 INTO G_A510.
CLEAR G_KONP.
READ TABLE GI_KONP
WITH KEY KNUMH = G_A510-KNUMH BINARY SEARCH

INTO G_KONP.
IF SY-SUBRC = 0.
G_A510-KBETR = G_KONP-KBETR.
MODIFY GI_A510 FROM G_A510 TRANSPORTING KBETR.
ENDIF.
ENDLOOP.

SORT GI_A510 BY VKORG VKBUR.

* Condition: Sales office / Customer
SELECT VKORG VKBUR KUNNR KNUMH
FROM A512
INTO TABLE GI_A512
WHERE KAPPL  = 'V' AND
KSCHL  = 'ZAGE' AND
( DATBI => SY-DATUM AND DATAB <= SY-DATUM ).

LOOP AT GI_A512 INTO G_A512.
CLEAR G_KONP.
READ TABLE GI_KONP
WITH KEY KNUMH = G_A512-KNUMH BINARY SEARCH
INTO G_KONP.
IF SY-SUBRC = 0.
G_A512-KBETR = G_KONP-KBETR.
MODIFY GI_A512 FROM G_A512 TRANSPORTING KBETR.
ENDIF.
ENDLOOP.

SORT GI_A512 BY VKORG VKBUR KUNNR.

* Condition: Sales office / Customer / Material
SELECT VKORG VKBUR KUNNR MATNR KNUMH
FROM A513
INTO TABLE GI_A513
WHERE KAPPL  = 'V' AND
KSCHL  = 'ZAGE' AND
( DATBI => SY-DATUM AND DATAB <= SY-DATUM ).

LOOP AT GI_A513 INTO G_A513.
CLEAR G_KONP.
READ TABLE GI_KONP
WITH KEY KNUMH = G_A513-KNUMH BINARY SEARCH
INTO G_KONP.
IF SY-SUBRC = 0.
G_A513-KBETR = G_KONP-KBETR.
MODIFY GI_A513 FROM G_A513 TRANSPORTING KBETR.
ENDIF.
ENDLOOP.

SORT GI_A513 BY VKORG VKBUR KUNNR MATNR.
All of the  product names here are trademarks of their respective companies.  The site
www.allsaplinks.com no way affiliated with SAP AG. We have made every effort for the content
integrity.  Information used on this site is at your own risk.
ABAP TECHNICAL

SAP Introduction

sap abap faq

sap Tables

SAP Transaction codes

Internal tables

data dictionary

performance tuning

transports & Requests

Sap scripts

Smartforms

lsmw

reports

sap Workflow

module pool/ dialog
programming

table control

user exits

sap memory

abap memory

alv reports

ABAP ADVANCED

IDOC

ALE

BAPI

BADI

RFC


FUNCTIONAL SIDE

Materials Management

FICO

Human Resources

BIW / BW / SEM


Free Documentation
Abap Material

Ale Material

BAPI Material

BC Material

IDOC Material

R/3 Database Management

SAP material

RFC

Transport

Sales & Distribution Material

Basic Data and Function
Material

Basis (BC) Material

Billing Material

CA Material

CATT : Computer Aided Test
Tool

Capacity Evaluation and
leveling Material

Capacity Planning Material

Cross Application Material

Countries

Customer Service Material

Enterpise  Material

Financial / Controlling (FICO)

Internet Time Sheet

Inspection Material

HR Material

Material Management
Material

Payments Material

Payroll Material

Pension Fund

Production Planning and
Control

Plant Maintenance

Quality Management Material

Real Estate Material

SAP material

Wage Types