Application Development 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: 

In A071 table, Sales unit (VRKME) not getting inserted through BAPI BAPI_PRICES_CONDITIONS

former_member539645
Participant
0 Kudos
390

Hi,

I Am trying to insert condition record using BAPI BAPI_PRICES_CONDITIONS but Sales unit (VRKME) field in table A071 is not getting updated its coming blank.

Below is the code snippet.

ls_bapicondct-operation = '009'.
ls_bapicondct-cond_usage = 'A'.
ls_bapicondct-table_no = '071'.
ls_bapicondct-applicatio = 'V'.
ls_bapicondct-cond_type = 'VKA0'.
CONCATENATE '6000' '10' iv_werks ls_input-matnr
INTO ls_bapicondct-varkey.
ls_bapicondct-valid_to = sy-datum.
ls_bapicondct-valid_from = sy-datum.
ls_bapicondct-cond_no = '$000000001'.
APPEND ls_bapicondct TO lt_bapicondct.

ls_bapicondhd-operation = '009'.
ls_bapicondhd-cond_no = '$000000001'.
ls_bapicondhd-created_by = sy-uname.
ls_bapicondhd-creat_date = sy-datum.
ls_bapicondhd-cond_usage = 'A'.
ls_bapicondhd-table_no = '071'.
ls_bapicondhd-applicatio = 'V'.
ls_bapicondhd-cond_type = 'VKA0'.
CONCATENATE '6000' '10' iv_werks ls_input-matnr
INTO ls_bapicondhd-varkey.
ls_bapicondhd-valid_from = sy-datum.
ls_bapicondhd-valid_to = sy-datum.
APPEND ls_bapicondhd TO lt_bapicondhd.

ls_bapicondit-operation = '009'.
ls_bapicondit-cond_no = '$000000001'.
ls_bapicondit-cond_count = '01'.
ls_bapicondit-applicatio = 'V'.
ls_bapicondit-cond_type = 'VKA0'.
ls_bapicondit-scaletype = 'A'.
ls_bapicondit-scalebasin = ''.
ls_bapicondit-scale_qty = '0'.
ls_bapicondit-calctypcon = 'C'.
ls_bapicondit-cond_value = '10.00'.
ls_bapicondit-condcurr = 'EUR'.
ls_bapicondit-cond_p_unt = '1'.
ls_bapicondit-cond_unit = 'KG'.
APPEND ls_bapicondit TO lt_bapicondit.

CALL FUNCTION 'BAPI_PRICES_CONDITIONS'
* EXPORTING
* PI_INITIALMODE = ' '
* PI_BLOCKNUMBER =
* PI_PHYSICAL_DELETION =
TABLES
ti_bapicondct = lt_bapicondct
ti_bapicondhd = lt_bapicondhd
ti_bapicondit = lt_bapicondit
ti_bapicondqs = lt_bapicondqs
ti_bapicondvs = lt_bapicondvs
to_bapiret2 = it_return
to_bapiknumhs = lt_bapiknumhs
to_mem_initial = lt_mem_initial
EXCEPTIONS
update_error = 1
OTHERS = 2.

IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
  
1 ACCEPTED SOLUTION

former_member539645
Participant
0 Kudos
329

Resolved,

The VRKEY was incorrect. Added Sales unit in the key.

CONCATENATE '6000' '10' iv_werks ls_input-matnr ls_input-vrkme
INTO lv_varkey.

The VRKEY combination can be checked in table T681E.

1 REPLY 1

former_member539645
Participant
0 Kudos
330

Resolved,

The VRKEY was incorrect. Added Sales unit in the key.

CONCATENATE '6000' '10' iv_werks ls_input-matnr ls_input-vrkme
INTO lv_varkey.

The VRKEY combination can be checked in table T681E.