Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Problem with BAPI_PRICES_CONDITIONS

Former Member
0 Likes
8,770

I am having a problem to create pricing conditions for sales deal using BAPI_PRICES_CONDITIONS.

The BAPI returns a success message to me as the following:

Message text Record KNUMH = 0000014052, VARNUMH = 00000000000000000000000000000000: the data is consistent, UPDKZ = 'I'

New records are created in table KONH and KONP.

However, this pricing condition is not available in the sales deal. Does anyone has any idea what's happening?

Your help is very much appreciated.

Thanks.

13 REPLIES 13
Read only

Former Member
0 Likes
3,907

Hi Kah

Please let me know, what are the values you are passing to the function module

Regards

Madhan Doraikannan

Read only

0 Likes
3,907

I have worked on similar issue recently which will change sales order with the changed data. In that i have populated Bapi_condition table and passed it to SD_SALESDOCUMENT_CHANGE FM.

  • Fill Condition data

*--Rate (conditions amount or percentage)

MOVE : PR_ORDER_HEADER_IN-KBETR TO PT_BAPICOND_IN-COND_VALUE,

K_ZH36 TO PT_BAPICOND_IN-COND_TYPE,

K_X TO PT_BAPICOND_INX-COND_VALUE,

K_ZH36 TO PT_BAPICOND_INX-COND_TYPE.

*--Currency key

MOVE : PR_ORDER_HEADER_IN-WAERS TO PT_BAPICOND_IN-CURRENCY,

K_ZH36 TO PT_BAPICOND_IN-COND_TYPE,

K_X TO PT_BAPICOND_INX-CURRENCY,

K_ZH36 TO PT_BAPICOND_INX-COND_TYPE.

*-- Populate Update Flag Value

MOVE: K_U TO PT_BAPICOND_INX-UPDATEFLAG.

IF PT_BAPICOND_INX CA K_X.

APPEND PT_BAPICOND_IN.

APPEND PT_BAPICOND_INX.

ENDIF.

CLEAR :PT_BAPICOND_IN,

PT_BAPICOND_INX.

You have to pass Bapicond and Bapicondx table to the below function module

CALL FUNCTION 'SD_SALESDOCUMENT_CHANGE'

EXPORTING

SALESDOCUMENT = P_SALESDOCUMENT

ORDER_HEADER_IN = DA_ORDER_HEADER_IN

ORDER_HEADER_INX = DA_ORDER_HEADER_INX

SIMULATION = P_UPDATE

BUSINESS_OBJECT = 'BUS2032'

CALL_FROM_BAPI = K_X

IMPORTING

SALES_HEADER_OUT = R_HEADER_EX

TABLES

RETURN = PT_RETURN

ITEM_IN = PT_BAPI_ITEMS_IN

ITEM_INX = PT_BAPI_ITEMS_INX

PARTNERCHANGES = PT_BAPI_PTNRCHANGES

PARTNERADDRESSES = PT_BAPI_PTNRADDRESSE

SALES_TEXT = PT_BAPI_TEXT

CONDITIONS_IN = PT_BAPICOND_IN

CONDITIONS_INX = PT_BAPICOND_INX

EXTENSIONIN = PT_BAPI_EXTENIN.

hope this will work.

bye

srinivas

Read only

0 Likes
3,907

This message was moderated.

Read only

christian_wohlfahrt
Active Contributor
0 Likes
3,907

Hi!

Beneath KONH and KONP A-tables are important. They contain validity period and are starting point for condition determination.

In which table do you expect entries (concatenate 'A' + KONH-KOTABNR = e.g. A073, enter in SE16 and check for your entry)?

In sales deal, have a look at condition analysis. Check, if key fields in price determination are filled with same values as you are saving your conditions.

If there are some inconsistencies, then that's your problem.

Regards,

Christian

Read only

Former Member
0 Likes
3,907

Hi

you need to populate the following values

BAPICONDHD-OPERATION = '009'.

BAPICONDIT-OPERATION = '009'.

BAPICONDCT-OPERATION = '009'.

Regards

Madhan Doraikannan

Read only

0 Likes
3,907

Hi,

I'm trying to create condition records for sales contracts using BAPI_PRICES_CONDITIONS. Can you tell me what all values should I actually input to this FM when I run it. What does this input value called "OPERATION" mean. Thanks in advance for your help.

Regards,

Vijay

Read only

0 Likes
3,907

Hi,

any light on this guys....need it.

Read only

0 Likes
3,907

Hi,

Any idea on how we pass the new rate to the condition record...the KBETR field does not seem to appear in the BAPI tables...

Read only

0 Likes
3,907

Hi Vijay,

I have worked on similar issue recently which will change sales order with the changed data. In that i have populated Bapi_condition table and passed it to SD_SALESDOCUMENT_CHANGE FM.

  • Fill Condition data

*--Rate (conditions amount or percentage)

MOVE : PR_ORDER_HEADER_IN-KBETR TO PT_BAPICOND_IN-COND_VALUE,

K_ZH36 TO PT_BAPICOND_IN-COND_TYPE,

K_X TO PT_BAPICOND_INX-COND_VALUE,

K_ZH36 TO PT_BAPICOND_INX-COND_TYPE.

*--Currency key

MOVE : PR_ORDER_HEADER_IN-WAERS TO PT_BAPICOND_IN-CURRENCY,

K_ZH36 TO PT_BAPICOND_IN-COND_TYPE,

K_X TO PT_BAPICOND_INX-CURRENCY,

K_ZH36 TO PT_BAPICOND_INX-COND_TYPE.

*-- Populate Update Flag Value

MOVE: K_U TO PT_BAPICOND_INX-UPDATEFLAG.

IF PT_BAPICOND_INX CA K_X.

APPEND PT_BAPICOND_IN.

APPEND PT_BAPICOND_INX.

ENDIF.

CLEAR :PT_BAPICOND_IN,

PT_BAPICOND_INX.

You have to pass Bapicond and Bapicondx table to the below function module

CALL FUNCTION 'SD_SALESDOCUMENT_CHANGE'

EXPORTING

SALESDOCUMENT = P_SALESDOCUMENT

ORDER_HEADER_IN = DA_ORDER_HEADER_IN

ORDER_HEADER_INX = DA_ORDER_HEADER_INX

SIMULATION = P_UPDATE

BUSINESS_OBJECT = 'BUS2032'

CALL_FROM_BAPI = K_X

IMPORTING

SALES_HEADER_OUT = R_HEADER_EX

TABLES

RETURN = PT_RETURN

ITEM_IN = PT_BAPI_ITEMS_IN

ITEM_INX = PT_BAPI_ITEMS_INX

PARTNERCHANGES = PT_BAPI_PTNRCHANGES

PARTNERADDRESSES = PT_BAPI_PTNRADDRESSE

SALES_TEXT = PT_BAPI_TEXT

CONDITIONS_IN = PT_BAPICOND_IN

CONDITIONS_INX = PT_BAPICOND_INX

EXTENSIONIN = PT_BAPI_EXTENIN.

hope this will work.

bye

srinivas

Read only

Former Member
0 Likes
3,907

Hi, is it possible to use this BAPI in Java? Is there some examples ?

Thanks !

Martin

Read only

0 Likes
3,907

Kah,

Since you are able to create create condition record, I guess what might be missing is sales deal number in condition records ( Means you may not be passing sales deal number while passing data to BAPI).

Sales deal number need to be populated in TI_BAPICONDHD-SALES_DEAL.

Vijay,

OPERATION = '009', Original: First message for process (Just found out the documentation of domain behind field OPERATION). These message functions may be related to Idoc processing. '009' is for creating new records.

KBETR field must be TI_BAPICONDIT-COND_VALUE.

Lucy,

You might be able to delete condition records from by changing the OPERATION value.

Read only

Former Member
0 Likes
3,907

Hi, I have exactly the same problem: I´m filling all tables required by the bapi, and getting a similar message after the process, but only see new entries in tables KONH and KONP, but not in AXXX table (A005 in my case).

How did you solve this problem??

My code is:

  • BAPI Structure for Condition Tables

is_bapicondct-operation = c_firstm."009

is_bapicondct-table_no = c_custom."005

is_bapicondct-applicatio = c_sales."V

is_bapicondct-cond_usage = c_komg."A

is_bapicondct-cond_type = is_htab-kschl. "ZB00

"Set the varkey from A005 table key fields:

concatenate sy-mandt

is_bapicondct-applicatio

is_bapicondct-cond_type

is_htab-vkorg

is_htab-vtweg

is_htab-kunnr

is_htab-matnr

is_htab-datbi

INTO is_bapicondct-varkey.

is_bapicondct-valid_to = is_htab-datbi.

is_bapicondct-valid_from = is_htab-datab.

is_bapicondct-cond_no = '$000000001'.

        • BAPI Structure of KONH with English Field Names

is_BAPICONDHD-operation = c_firstm.

is_BAPICONDHD-cond_no = '$000000001'.

is_BAPICONDHD-created_by = sy-uname.

is_BAPICONDHD-creat_date = sy-datum.

is_BAPICONDHD-cond_usage = c_komg.

is_BAPICONDHD-table_no = c_custom.

is_BAPICONDHD-applicatio = c_sales.

is_BAPICONDHD-cond_type = is_htab-kschl.

is_BAPICONDHD-VARKEY = is_bapicondct-varkey.

is_BAPICONDHD-valid_to = is_htab-datbi.

is_BAPICONDHD-valid_from = is_htab-datab.

      • BAPI Structure of KONP with English Field Names

CLEAR is_BAPICONDIT.

is_BAPICONDIT-operation = c_firstm.

is_BAPICONDIT-cond_no = '$000000001'.

is_BAPICONDIT-cond_count = c_pos01.

is_BAPICONDIT-applicatio = c_sales.

is_BAPICONDIT-cond_type = is_htab-kschl.

is_BAPICONDIT-scaletype = c_base. "A

is_BAPICONDIT-scalebasin = c_valu. "B

ADD 1 TO is_BAPICONDIT-scale_qty.

is_BAPICONDIT-calctypcon = c_calctyp. "B

is_BAPICONDIT-COND_P_UNT = is_htab-kpein.

is_BAPICONDIT-cond_value = is_htab-kbetr.

is_BAPICONDIT-CONDCURR = is_htab-konwa. "USD

APPEND: is_BAPICONDCT TO IT_BAPICONDCT,

is_BAPICONDHD TO IT_BAPICONDHD,

is_BAPICONDIT TO IT_BAPICONDIT.

      • BAPI für Price and Rebate Usage Condition Records

CALL FUNCTION 'BAPI_PRICES_CONDITIONS'

  • EXPORTING

  • PI_INITIALMODE = 'X'

  • PI_BLOCKNUMBER =

TABLES

TI_BAPICONDCT = IT_BAPICONDCT

TI_BAPICONDHD = IT_BAPICONDHD

TI_BAPICONDIT = IT_BAPICONDIT

TI_BAPICONDQS = IT_BAPICONDQS

TI_BAPICONDVS = IT_BAPICONDVS

TO_BAPIRET2 = IT_BAPIRET2

TO_BAPIKNUMHS = IT_BAPIKNUMHS

TO_MEM_INITIAL = IT_MEM_INITIAL

EXCEPTIONS

UPDATE_ERROR = 1

OTHERS = 2.

if sy-subrc eq 0.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

WAIT = 'X'

IMPORTING

RETURN = is_bapiret2.

endif.

Thanks in advance,

Regards,

Federico Alvarez

Edited by: Federico Alvarez on Oct 2, 2008 7:40 PM

Read only

Former Member
0 Likes
3,907

Try using Function module 'RV_CONDITION_COPY'.

maintain_mode = 'A' = Add

maintain_mode = 'B' = Change