创建或修改PIR的"净价"“有效价格”时,维护ME_INFORECORD_MAINTAIN 参数i_eine的价格字段NET_PRICE无法正常写入
解决方案如下:
维护采购视图参数中净价的同时,必须维护价格条件数据,才可以维护成功。
同时维护如下参数:
i_eine的价格字段NET_PRICE
cond_validity
condition
DATA:
ls_eina TYPE mewieina,
ls_einax TYPE mewieinax,
ls_eine TYPE mewieine,
ls_einex TYPE mewieinex,
lt_cond_validity TYPE TABLE OF mewivalidity,
lt_condition TYPE TABLE OF mewicondition,
lt_return TYPE mewi_t_return,
lv_message TYPE string.
IF 价格 IS NOT INITIAL.
ls_eine-net_price = is_data-netpr.
ls_eine-price_unit = is_data-peinh.
ls_eine-currency = is_data-waers.
ls_eine-orderpr_un = is_data-mein1.
ls_einex-net_price = 'X'.
ls_einex-price_unit = 'X'.
ls_einex-currency = 'X'.
ls_einex-orderpr_un = 'X'.
CALL METHOD zcl_mm_i004_01=>mt_get_info_cond
EXPORTING
is_data = is_data
IMPORTING
es_konp = DATA(ls_konp).
IF ls_konp IS NOT INITIAL.
DATA(lv_flag) = 'U'.
ELSE.
lv_flag = 'I'.
ENDIF.
lt_condition = VALUE #( ( serial_id = ls_konp-knumh
cond_count = ls_konp-kopos
cond_type = 'PB00'
cond_value = is_data-netpr
currency = is_data-waers
cond_p_unt = is_data-peinh
cond_unit = is_data-mein1
change_id = lv_flag ) ).
lt_cond_validity = VALUE #( ( serial_id = ls_konp-knumh
plant = is_data-werks
valid_from = sy-datum
valid_to = '99991231' ) ).
ENDIF.
CALL FUNCTION 'ME_INFORECORD_MAINTAIN'
EXPORTING
i_eina = ls_eina
i_einax = ls_einax
i_eine = ls_eine
i_einex = ls_einex
* TESTRUN =
* IMPORTING
* E_EINA =
* E_EINE =
TABLES
* TXT_LINES =
cond_validity = lt_cond_validity
condition = lt_condition
* COND_SCALE_VALUE =
* COND_SCALE_QUAN =
return = lt_return.
CLEAR: lv_message.
LOOP AT lt_return INTO DATA(ls_return) WHERE type CA 'AEX'.
IF lv_message IS INITIAL.
lv_message = ls_return-message.
ELSE.
lv_message = |{ lv_message }/{ ls_return-message }|.
ENDIF.
ENDLOOP.
IF lv_message IS INITIAL.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
ELSE.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
ENDIF.
类:zcl_mm_i004_01=>MT_GET_INFO_COND
METHOD mt_get_info_cond.
SELECT SINGLE *
INTO @DATA(ls_a017)
FROM a017
WHERE kappl = 'M'
AND kschl = 'PB00'
AND lifnr = @is_data-lifnr
AND matnr = @is_data-matnr
AND ekorg = @is_data-ekorg
AND werks = @is_data-werks
AND esokz = '2'.
CHECK ls_a017-knumh IS NOT INITIAL.
SELECT SINGLE *
INTO CORRESPONDING FIELDS OF @es_konp
FROM konp
WHERE knumh = @ls_a017-knumh
AND kschl = 'PB00'.
ENDMETHOD.
condition维护的同时,必须维护cond_validity,根据BAPI文档可知