ME11/ME12采购信息记录(PIR)无法维护"净价"“有效价格”解决方案- ME_INFORECORD_MAINTAIN

创建或修改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文档可知

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

王小磊

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值