Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

How to Use Bapi - " BAPI_PRICES_CONDITIONS "

Hi Gurus,

Can any one please let us know how we can use <b>BAPI_PRICES_CONDITIONS</b> for either creating or changing Price Conditions.

Please see my code below for creating Price condition :-

Please correct it and send me the code for both <b>changing</b> and <b>creating</b> price condition.

&----


*& Report ZAVI_BAPI_TEST

*&

&----


*&

*&

&----


REPORT zavi_bapi_test.

DATA: table1 TYPE STANDARD TABLE OF bapicondct,

table2 TYPE STANDARD TABLE OF bapicondhd,

table3 TYPE STANDARD TABLE OF bapicondit,

table4 TYPE STANDARD TABLE OF bapicondqs,

table5 TYPE STANDARD TABLE OF bapicondvs,

table6 TYPE STANDARD TABLE OF bapiret2,

table7 TYPE STANDARD TABLE OF bapiknumhs,

table8 TYPE STANDARD TABLE OF cnd_mem_initial,

ret TYPE STANDARD TABLE OF bapiret2 WITH HEADER LINE.

DATA: wtable1 TYPE bapicondct,

wtable2 TYPE bapicondhd,

wtable3 TYPE bapicondit,

wtable4 TYPE bapicondqs,

wtable5 TYPE bapicondvs,

wtable6 TYPE bapiret2,

wtable7 TYPE bapiknumhs,

wtable8 TYPE cnd_mem_initial.

wtable1-table_no = '305'.

wtable1-applicatio = 'V'.

wtable1-cond_type = 'ZFOR'.

wtable1-operation = '004'.

wtable1-varkey = '13001001EUR 000000000050068946'.

*wtable1-varkey = '0001010000000017000000000000000096'.

wtable1-valid_to = '99991231'.

wtable1-valid_from = '20071017'.

wtable1-cond_no = '0000007269'.

APPEND wtable1 TO table1.

wtable2-operation = '004'.

wtable2-cond_no = '0000007269'.

wtable2-created_by = sy-uname.

wtable2-creat_date = '20071017'.

wtable2-cond_usage = 'A'.

wtable2-table_no = '305'.

wtable2-applicatio = 'V'.

wtable2-cond_type = 'ZFOR'.

wtable2-varkey = '13001001EUR 000000000050068946'.

*wtable1-varkey = '0001010000000017000000000000000096'.

wtable2-valid_from = '20071017'.

wtable2-valid_to = '99981231'.

APPEND wtable2 TO table2.

wtable3-operation = '004'.

wtable3-cond_no = '0000007269'.

wtable3-cond_count = '01'.

wtable3-applicatio = 'V'.

wtable3-cond_type = 'ZFOR'.

wtable3-scaletype = 'A'.

wtable3-scalebasin = 'C'.

wtable3-scale_qty = '1'.

wtable3-cond_p_unt = '1'.

wtable3-cond_unit = 'EA'.

wtable3-calctypcon = 'C'.

wtable3-cond_value = '444'.

wtable3-condcurr = 'EUR'.

APPEND wtable3 TO table3.

CALL FUNCTION 'BAPI_PRICES_CONDITIONS'

  • EXPORTING

  • PI_initialmode = 'X'

  • PI_BLOCKNUMBER =

TABLES

ti_bapicondct = table1

ti_bapicondhd = table2

ti_bapicondit = table3

ti_bapicondqs = table4

ti_bapicondvs = table5

to_bapiret2 = table6

to_bapiknumhs = table7

to_mem_initial = table8

EXCEPTIONS

update_error = 1

OTHERS = 2

.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

READ TABLE table6 WITH KEY type = 'E' TRANSPORTING NO FIELDS.

IF sy-subrc = 0.

LOOP AT table6 INTO ret.

WRITE: / ret-type, ret-message, ret-id, ret-log_no, ret-log_msg_no,

ret-message_v1, ret-message_v2, ret-message_v3, ret-message_v4,

ret-parameter,ret-row,ret-field.

ENDLOOP.

ELSE.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

*EXPORTING

  • WAIT =

IMPORTING

return = ret

.

ENDIF.

Tags:
Former Member
Not what you were looking for? View more on this topic or Ask a question