日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

【转】ABAP在表VBAP和VBAK上增加新字段的标准BAPI

發布時間:2025/3/20 编程问答 19 豆豆
生活随笔 收集整理的這篇文章主要介紹了 【转】ABAP在表VBAP和VBAK上增加新字段的标准BAPI 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

【轉載收藏】

在表VBAP和VBAK上增加新字段的標準BAPI 及實現方式:

If you have custom ZZ fields on VBAP and VBAK then you can update these fields using the standard BAPI to create or change the order and update these fields.
A lot has been spoken about this but nowhere does it spell out the pitfalls and give you an end-to-end procedure on how to do it. I even found some "SAP Experts - Ask a question" on Search SAP give a complete wrong answer!!! So here is the correct way to do it.

To do so you first need to ensure that the following 5 tables are in synch.

  • VBAP: In your append structure you specify your ZZFIELD with the data type as needed
  • BAPE_VBAP: In the append structure here also add the ZZFIELD with the data type as needed with limitations. No decimals. Try and stick to char characters
  • ?BAPE_VBAPX: In the append structure add the field ZZFIELD of type BAPIUPDATE
  • VBAPKOZ: In the append structure here also add the ZZFIELD with the data type as needed with limitations. No decimals. Try and stick to char characters
  • ?VBAPKOZX: In the append structure add the field ZZFIELD of type BAPIUPDATE
  • (NOTE: (2) and (3) must have the same number of fields in the same order)

    (NOTE: (4) and (5) must have the same number of fields in the same order)


    Similarly do for VBAK,?BAPE_VBAK,?BAPE_VBAKX, VBAKKOZ and VBAKKOZX.
    Next we get to the code to fill in the structure EXTENSIONIN
    I will demonstrate how to call the create sales order BAPI with custom fields.

    * Local definitionsDATA: wa_extensionin TYPE bapiparex,wa_bape_vbap? ?TYPE?bape_vbap,wa_bape_vbapx??TYPE?bape_vbapx,wa_bape_vbak? ?TYPE?bape_vbak,wa_bape_vbakx??TYPE?bape_vbakx,lv_posnr? ?? ? TYPE posnr. * Processing the header extensionCLEAR wa_bape_vbak.wa_bape_vbak-ZZFIELD? ???= 'HDRTEST'.wa_extensionin-structure = 'BAPE_VBAK'.wa_extensionin+30(960)? ?= wa_bape_vbak.append wa_extensionin to lt_extensionin.clear wa_extensionin. * Processing the line extension LOOP AT line_items INTO wa_lineitems.ADD 10 TO lv_posnr.? ?CLEAR wa_bape_vbap.wa_bape_vbap-ZZFIELD? ???= 'TEST'.wa_extensionin-structure = 'BAPE_VBAP'.wa_bape_vbap-posnr? ?? ? = lv_posnr.wa_extensionin+30(960)? ?= wa_bape_vbap.append wa_extensionin to lt_extensionin.clear wa_extensionin.CLEAR wa_bape_vbapx.wa_bape_vbapx-ZZFIELD? ? = 'X'.wa_extensionin-structure = 'BAPE_VBAPX'.wa_bape_vbapx-posnr? ?? ?= lv_posnr.wa_extensionin+30(960)? ?= wa_bape_vbapx.append wa_extensionin to lt_extensionin.clear wa_extensionin. ENDLOOP. * Then the call to the BAPICALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'EXPORTINGorder_header_in??= ls_order_header_inorder_header_inx = ls_order_header_inxIMPORTINGsalesdocument? ? = lv_salesdocumentTABLESreturn? ?? ?? ???= lt_ret2order_items_in? ?= lt_order_items_inorder_items_inx??= lt_order_items_inxorder_partners? ?= lt_order_partnersorder_keys? ?? ? = lt_order_keysextensionin? ?? ?= lt_extensionin.

    Note: If you have a need to force a different Business Object type or wish to see the extension return fields then use the function SD_SALESDOCUMENT_CREATE instead.

    ? ?? ?CALL FUNCTION 'SD_SALESDOCUMENT_CREATE'EXPORTINGsales_header_in? ???= ls_order_header_insales_header_inx? ? = ls_order_header_inxbusiness_object? ???= 'BUS2032'IMPORTINGsalesdocument_ex? ? = lv_salesdocumentsales_header_out? ? = lv_sales_header_outsales_header_status = lv_sales_header_statusTABLESreturn? ?? ?? ?? ???= lt_ret2sales_items_in? ?? ?= lt_order_items_insales_items_inx? ???= lt_order_items_inxsales_partners? ?? ?= lt_order_partnerssales_keys? ?? ?? ? = lt_order_keysextensionin? ?? ?? ?= lt_extensioninincomplete_log? ?? ?= lt_incomplete_logextensionex? ?? ?? ?= lt_extensionex.

    ?

    總結

    以上是生活随笔為你收集整理的【转】ABAP在表VBAP和VBAK上增加新字段的标准BAPI的全部內容,希望文章能夠幫你解決所遇到的問題。

    如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。