SD Price Condition Tables

light111SD Price Condition Tables and BAPI to create price condition

This post talks about a little the DB table names in SD that store price condition record number, condition record header/item/scales and the API(BAPI) which can be used in some cases to create condition record. Any way Tx- VK11/VK12/VK13 can be used to create/change/display condition record for any condition type.

Let’s talk an example- In SD if the condition table name is [004] and when the condition table is generated then it created a DB table [A004].


Below is the DB table for the condition table 004.


KONH- is the condition header


KONP- is the condition item


KONM/KONW- is the condition scales(quantity/value)


When a condition record is created it is stored in the corresponding table with relation key as KNUMH- condition record number.


In some cases it is required to crate condition record via API but not using dialog screen. In such a case BAPI- ‘BAPI_PRICES_CONDITIONS’ can be used for this.


 A sample code:

DATAlt_bapicondct  TYPE TABLE OF bapicondct,
            lt_bapicondhd  TYPE TABLE OF bapicondhd,
            lt_bapicondit  TYPE TABLE OF bapicondit,
            lt_bapicondqs  TYPE TABLE OF bapicondqs,
            lt_bapicondvs  TYPE TABLE OF bapicondvs,
             lt_bapiret2    TYPE TABLE OF bapiret2,
            lt_bapiknumhs  TYPE TABLE OF bapiknumhs,
             lt_mem_initial TYPE TABLE OF cnd_mem_initial.

<fs_bapicondct>operation   ‘009’. ” create mode
<fs_bapicondct>table_no    ‘004’.
<fs_bapicondct>applicatio  ‘V’.
<fs_bapicondct>cond_usage  ‘A’.
<fs_bapicondct>cond_type   ‘PR00’.
<fs_bapicondct>valid_to    ‘99991231’.
<fs_bapicondct>valid_from  ‘20190301’.
<fs_bapicondct>cond_no     ‘$000000001’.
<fs_bapicondct>varkey     ‘202010SP_CLOUD_STORAGE’” combination of sales org/dist chnl and material for the cond table 004

“bapi structure of konh with english field names
<fs_bapicondhd>operation   ‘009’.
<fs_bapicondhd>cond_no     ‘$000000001’.
<fs_bapicondhd>created_by  syuname.
<fs_bapicondhd>creat_date  sydatum.
<fs_bapicondhd>cond_usage  ‘A’.
<fs_bapicondhd>table_no    ‘004’.
<fs_bapicondhd>applicatio  ‘V’.
<fs_bapicondhd>cond_type   ‘PR00’.
<fs_bapicondhd>varkey      <fs_bapicondct>varkey.
<fs_bapicondhd>valid_to    ‘99991231’.
<fs_bapicondhd>valid_from  ‘20190301’.

<fs_bapicondit>operation   ‘009’.
<fs_bapicondit>cond_no     ‘$000000001’.
<fs_bapicondit>cond_count  ’01’.
<fs_bapicondit>applicatio  ‘V’.
<fs_bapicondit>cond_type   ‘PR00’.
<fs_bapicondit>-scaletype   = ‘A’.
<fs_bapicondit>-scalebasin  = ‘C’.
<fs_bapicondit>-cond_unit   = ‘TO’.
ADD 1 TO <fs_bapicondit>-scale_qty.
<fs_bapicondit>calctypcon  ‘C’.
<fs_bapicondit>cond_p_unt  ‘1’.
<fs_bapicondit>cond_value  ‘111’.
<fs_bapicondit>condcurr    ‘USD’.

    pi_initialmode ‘X’
    ti_bapicondct  lt_bapicondct
    ti_bapicondhd  lt_bapicondhd
    ti_bapicondit  lt_bapicondit
    ti_bapicondqs  lt_bapicondqs
    ti_bapicondvs  lt_bapicondvs
    to_bapiret2    lt_bapiret2
    to_bapiknumhs  lt_bapiknumhs
    to_mem_initial lt_mem_initial
    update_error   1
    OTHERS         2.
IF sysubrc 0.
      wait ‘X’.
  LOOP AT lt_bapiknumhs ASSIGNING FIELDSYMBOL(<fs_bapiknumhs>).
    WRITE:/  |Condition Record Number:|<fs_bapiknumhs>cond_no_new.


Leave a Reply

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

You are commenting using your 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 )

Connecting to %s