EXTENSIONIN structures of BAPI_GOODSMVT_CREATE.

you can update LSMNG quantity using EXTENSIONIN structures of BAPI_GOODSMVT_CREATE.

The steps are the following:

Add LSMNG field in BAPI_TE_XMSEG structure create an appending structure (char field)

By SE19 transaction create the Enhancement Spot starting from MB_GOODSMOVEMENT

Define the Badi Implementation choosing MB_BAPI_GOODSMVT_CREATE Badi Definition implementing a new customer class.

Remember to choose to copy the class with the source code of methods.

In The method IF_EX_MB_Hi, you can update LSMNG quantity using EXTENSIONIN structures of BAPI_GOODSMVT_CREATE. The steps are the following: Add LSMNG field in BAPI_TE_XMSEG structure create an appending structure (char field) By SE19 transaction create the Enhancement Spot starting from MB_GOODSMOVEMENT Define the Badi Implementation choosing MB_BAPI_GOODSMVT_CREATE Badi Definition implementing a new customer class.

Remember to choose to copy the class with the source code of methods.

In the method IF_EX_MB_BAPI_GOODSMVT_CREATE~EXTENSIONIN_TO_MATDOC you will find the following source code:

  DATA:     c_lenstruc          TYPE i VALUE 30,    

   wa_bapi_mb_header   TYPE bapi_te_xmkpf,    

   wa_bapi_mb_item     TYPE bapi_te_xmseg,    

   wa_extension_in     TYPE bapiparex.  

   FIELD-SYMBOLS:               TYPE imseg.  

   CHECK NOT extension_in[] IS INITIAL.

  * Analyze IMSEG for document structure and assign LINE_IDs if necessary  

   CALL METHOD cl_mmim_line_id_manager=>analyze_mb_create    

          CHANGING       ct_imseg          = ct_imseg[]    

             EXCEPTIONS       duplicate_line_id = 1      

             OTHERS            = 2.  

  LOOP AT extension_in INTO wa_extension_in.    

     CASE wa_extension_in-structure.

* extension of MKPF      

     WHEN 'BAPI_TE_XMKPF'.        

     MOVE wa_extension_in+c_lenstruc TO wa_bapi_mb_header.        

     MOVE-CORRESPONDING wa_bapi_mb_header TO cs_imkpf.

* extension of MSEG      

    WHEN 'BAPI_TE_XMSEG'.        

    MOVE wa_extension_in+c_lenstruc TO wa_bapi_mb_item.        

    READ TABLE ct_imseg           WITH KEY line_id = wa_bapi_mb_item-matdoc_itm           ASSIGNING   <fs_imseg>.        

      IF sy-subrc EQ 0.          

         MOVE-CORRESPONDING wa_bapi_mb_item TO   <fs_imseg>.       

       ENDIF.   

     ENDCASE.  

    ENDLOOP.

Then you have to call BAPI_GOODSMVT_CREATE using extensionin in the following way:

* Fill   goodsmvt_header structures

  goodsmvt_header-........

* Fill    goodsmvt_item-position

  Loop at it_position.

         goodsmvt_item-..........

          wf_line_id = wf_line_id + 1.

          goodsmvt_item-line_id wf_line_id.

          APPEND goodsmvt_item.

        CLEAR extensionin.
        MOVE 'BAPI_TE_XMSEG'    TO extensionin-structure.
        MOVE wf_line_id+2(4)    TO extensionin-valuepart1+14(4).
        MOVE LSMNG              TO extensionin-valuepart1+18(16).
        APPEND extensionin.

endloop.

        CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
        EXPORTING
          goodsmvt_header               goodsmvt_header
          goodsmvt_code                 goodsmvt_code
*         TESTRUN                       = ' '
          goodsmvt_ref_ewm              goodsmvt_ref_ewm
        IMPORTING
*         GOODSMVT_HEADRET              =
          materialdocument              materialdocument
          matdocumentyear               matdocumentyear
        TABLES
          goodsmvt_item                 goodsmvt_item
*         GOODSMVT_SERIALNUMBER         =
          return                        return
          extensionin                   extensionin.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

ChampaignWolf

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

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

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

打赏作者

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

抵扣说明:

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

余额充值