【转载收藏】

在表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.

  1. VBAP: In your append structure you specify your ZZFIELD with the data type as needed
  2. 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
  3. BAPE_VBAPX: In the append structure add the field ZZFIELD of type BAPIUPDATE
  4. 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
  5. 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相关推荐

  1. sap abap在表VBAP和VBAK上增加新字段的标准BAPI

    在表VBAP和VBAK上增加新字段的标准BAPI  If you have custom ZZ fields on VBAP and VBAK then you can update these fi ...

  2. 使用Jackson忽略JSON对象上的新字段[复制]

    本文翻译自:Ignoring new fields on JSON objects using Jackson [duplicate] This question already has an ans ...

  3. anki模板_【授权转载】【Anki高级操作技巧】(19)-如何在模板上添加新字段

    如何在模版上添加新字段? 有些时候,我们需要为一些需要发音的是卡片添加音频,但是会碰到一个问题就是现有的字段已经填满了,没有字段再放置发音的字段,所以今天我们解决的问题就是如何为模版添加新的字段.第一 ...

  4. 如何在HP服务器上增加新的硬盘

    为了在HP服务器上增加新的硬盘,需要做两件事情:① 将新增硬盘挂到主板上: ② 在磁盘管理中,对新增的硬盘进行分区.那么我们下面介绍如何完成,上述两步. ① 将新增硬盘挂到主板上.插入新服务器硬盘,然 ...

  5. 如何在Win7电脑上增加新磁盘分区?

    我们在重装好系统Win7系统后有时会碰到需要新建磁盘分区的情况,这时我们再重装系统进行磁盘分区就有些过于麻烦了,其实我们可以利用Win7系统自身的磁盘管理功能来新建一个磁盘分区.下面好系统重装助手就来 ...

  6. 一种在旧代码上增加新需求的重构模式

    应用场景 相信大家遇到过这种场景: 旧代码中已经有一堆的if-else或者switch-case了:产品却要求在这段流程里增加一个新的功能. 这种时候大家会怎么做? 我的建议是: 重构这段代码.在重构 ...

  7. 在表中增加新字段的SQL语句

    alter table 表名 add column 字段名 varchar(50) DEFAULT NULL COMMENT '备注信息';

  8. 【笔记】WGAN GP :WGAN自己的李普西斯条件是gradient clipping(大部分weight是正负0.01),在此基础上增加新的motivation让WGAN GP实现李普西斯条件

    注: 下文作者写的不错,但是有地方搞得不是很清楚.比如误差反向传播过程是对权重和偏置求偏导,不是对输入数据.这点要搞清楚. 注: 李普西斯条件:当且仅当处处可微函数f的导函数处处有界,f满足利普希茨条 ...

  9. Mirror--如何在主库上增加文件

    由于各种原因,如磁盘不空不足,需要对主库增加数据库文件到其他磁盘上,而镜像服务器上没有对应盘符,很多人会选择删除镜像,重新完备还原来搭建镜像,这种方式耗时耗力. 在做此类操作时,需要对主服务器和镜像服 ...

最新文章

  1. AI一分钟|FF联合创始人聂天心离职;Siri联合创始人从苹果离职
  2. Python练习2-基本聊天程序-虚拟茶会话
  3. apache开源项目--Sirona
  4. electron、node
  5. HTTP,TCP, socket,RPC 与gRPC都是啥?
  6. 苹果发布 iOS 和 macOS 更新,修复已遭利用0day
  7. python代码翻译器-用python实现百度翻译的示例代码
  8. 看看ConcurrentLinkedQueue源码 in Java 9
  9. 修改MAC地址的方法(未测试)
  10. python request发送用户名密码_Python3 利用requests 库进行post携带账号密码请求数据的方法...
  11. Atitit.jsou html转换纯文本 java c# php
  12. python 等值面 插值_对离散点进行克里金插值并输出矢量等值面
  13. Educational Codeforces Round 97 (Rated for Div. 2) F. Emotional Fishermen
  14. 吴伯凡:VUCA时代的自我迭代
  15. 教你如何使用语雀提高效率
  16. 鸿蒙操作是基于安卓,华为鸿蒙系统终于发布,与安卓有何区别?随时可以应用在手机上...
  17. 虚拟机安装Ubuntu后的问题(不能全屏、不能上网;换源挂代理;安装搜狗输入法;pycharm的sudo模式启动快捷方式)
  18. php处理证件照_如何使用ps制作证件照
  19. vulnhub靶场GoldenEye靶场
  20. lombok @data 忽略属性_Lombok使用指南

热门文章

  1. java hashmap 缓存
  2. 实现table鼠标移动改变table行背景色
  3. 如何快速高效读懂1本书?|阅读
  4. PMCAFF老友会,产品圈年度最具份量的聚会
  5. [新产品发布|推广] 赠书活动来了,参与有机会得《产品经理那些事儿》图书!...
  6. WindowsPhone 7.8 Tiles 3 : 7.8的Tiles利器mangopollo
  7. The superclass javax.servlet.http.HttpServlet was not found 问题解决
  8. vue2.0路由之编程式导航
  9. Nuget添加新项目的问题
  10. Jmeter(4)Http Cookie Manager