SAP ABAP 信息记录批量修改

2023-10-13 14:01:05 浏览数 (1)

代码语言:javascript复制
DATA : l_activity  TYPE   c .

*  IF r1 = 'X'.
*    l_activity = 'H'.
*  ELSE.
*    l_activity = 'V'.
*  ENDIF.

   LOOP   AT  it_tab  INTO  st_tab.

**供应商主数据加前导零
     CALL   FUNCTION   'CONVERSION_EXIT_ALPHA_INPUT'
       EXPORTING
         input   = st_tab-lifnr
       IMPORTING
         output  = st_tab-lifnr.

    wa_eina-matnr = st_tab-matnr.   "物料,

    wa_eina-lifnr = st_tab-lifnr.   "供应商

    wa_eine-ekorg =  'WYPO' .         "采购组织
    wa_eine-werks =  'SH01' .         "工厂

    wa_eine-netpr = st_tab-netpr.    "单位价格

    wa_eina-lifab = st_tab-kdatb.   "有效开始日期
    wa_eina-lifbi = st_tab-kdate.   "有效结束日期

    wa_eine-norbm =  '1' .             "标准采购订单数量
    wa_eine-aplfz =  '1' .             "计划的天数内交货
    wa_eine-effpr =  '100' .           "采购信息记录中的有效价格

     CALL   FUNCTION   'ME_DIRECT_INPUT_INFORECORD'
       EXPORTING
        activity         = l_activity  "v 修改,h创建
        i_eina           = wa_eina
        i_eine           = wa_eine
        i_no_suppose     =  ''
        i_vorga          =  'A'
       IMPORTING
        e_eina           = wa_eina_new
        e_eine           = wa_eine_new
       TABLES
        t_head           = it_head
        t_line           = it_line
       EXCEPTIONS
        textname_invalid =  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 .



     CALL   FUNCTION   'ME_POST_INFORECORD'
       EXPORTING
        i_matnr  = wa_eina-matnr
        o_matnr  = wa_eina-matnr
       TABLES
        t_eina_i = it_eina.



*APPEND wa_eine_new to it_eine.
     CALL   FUNCTION   'ME_UPDATE_INFORECORD_COND'
       TABLES
        reine = it_eine.


     CALL   FUNCTION   'BAPI_TRANSACTION_COMMIT' .

   ENDLOOP 

0 人点赞