bapi enhancement操作手册

合集下载

BAPI_REQUISITION_CREATE与BAPI_PR_CREATE的相关解答

BAPI_REQUISITION_CREATE与BAPI_PR_CREATE的相关解答

BAPI_REQUISITION_CREATE与BAPI_PR_CREATE的相关解答499627 2020-01-03499627 - FAQ: BAPIs for purchase requisitionsVersion 23 Type SAP NoteLanguage English Master Language GermanPriority Recommendations / Additional Info Category FAQRelease Status Released for Customer Released On 17.09.2019Component MM-PUR-REQ-BAPI ( BAPIs - Purchase requisition )Please find the original document at https:///#/notes/ 499627SymptomThis note contains a list of frequently asked questions about BAPIs for purchase requisitions.Catalog of questionsCan I use the BAPI BAPI_REQUISITION_CHANGE to add new items? 1.Is the bill of material (BOM) exploded in the purchase requisition for subcontracting items? 2.If the function module BAPI_REQUISITION_CREATE is used and the field ITEM_CAT (item category)in the table REQUISITION_ITEMS is filled with the value K (consignment), L (subcontracting), S (third-party), U (stock transfer), W (material group), or D (service), the system issues error message ME 719: "Item category ... does not exist (Please correct)".3.Can I use ALE (using IDocs/EDI) to call the BAPIs BAPI_REQUISITION_CREATE andBAPI_REQUISITION_CHANGE?4.Can I use BAPI_REQUISITION_CREATE to set the fixed indicator? 5.Can the BAPIs of the purchase requisition with the "CreateFromData" and "Change" methods cover allof the functions of the EnjoySAP purchase requisition (transactions ME51N and ME52N)?6.Can BAPI_REQUISITION_CHANGE process the customer enhancements ExtensionIn? 7.Can service items be created using BAPI_REQUISITION_CREATE or changed usingBAPI_REQUISITION_CHANGE?8.Can service items be created using BAPI_PR_CREATE or changed using BAPI_PR_CHANGE? 9.In online transaction ME51, you can assign a 35 character vendor material number to an item. However, I can maintain only 22 characters in the BAPI. Can I change this?10.I can use the user parameter CNT to maintain a cost center in the user master record;BAPI_REQUISITION_CREATE can import this cost center. What is the correct format for entering this cost center if the cost center is only numeric?11.What must I take into account when I use the BAPI BAPI_REQUISITION_CHANGE to change ordelete texts?12.Can the BAPI_PR_CREATE or BAPI_PR_CHANGE be called several times in a sequence? 13.Can I use BAPI_PR_CREATE and BAPI_PR_CHANGE to use the same material in the BAPI structure PRCOMPONENTS as a component several times?14.--------------------------1. Question:Can I use the BAPI BAPI_REQUISITION_CHANGE to add new items?Answer:No.1 of © 2020 SAP SE or an SAP affiliate company. All rights reserved6499627 2020-01-03--------------------------2. Question:Is the bill of material (BOM) exploded in the purchase requisition for subcontracting items?Answer:You cannot explode the BOM in a purchase requisition that has been created usingBAPI_REQUISITION_CREATE. However, the explosion takes place when the purchase requisition is converted into a purchase order. For more information, read Notes 182787 and 102595.As of SAP ERP 6.0, it is possible to trigger the BOM explosion for a subcontracting item.--------------------------3. Question:If the function module BAPI_REQUISITION_CREATE is used and the field ITEM_CAT (item category) in thetable REQUISITION_ITEMS is filled with the value K, L, S, U, W, or D, the system issues error message ME719:Item category ... does not exist (Please correct).Why?Answer:You must enter the internal item category instead of the external item category. You can find the assignmentin purchasing Customizing (transaction OLME) in the "Define External Representation of Item Categories"area.--------------------------4. Question:Can I use ALE (using IDocs/EDI) to call the BAPIs BAPI_REQUISITION_CREATE andBAPI_REQUISITION_CHANGE?Answer:The logical message category PREQCR is provided for the BAPI BAPI_REQUISITION_CREATE. An ALE connection is not going to be provided for BAPI_REQUISITION_CHANGE. PREQCR is only delivered with aSupport Package for Releases 4.0B to 4.6C.---------------------------5. Question:Can I use BAPI_REQUISITION_CREATE to set the fixed indicator?Answer:You cannot use the BAPI BAPI_REQUISITION_CREATE to set the fixed indicator.When the BAPI BAPI_REQUISITION_CHANGE is used to make changes, the system sets the fixed indicator2 of © 2020 SAP SE or an SAP affiliate company. All rights reserved499627 2020-01-03automatically only if the purchase requisition originates from requirements planning.For more information, refer to Note 330206.---------------------------6. Question:Can the BAPIs of the purchase requisition with the "CreateFromData1" and "Change" methods cover all ofthe functions of the EnjoySAP purchase requisition (transactions ME51N and ME52N)?Answer:The function modules BAPI_REQUISITION_CREATE and BAPI_REQUISITION_CHANGE do not cover all ofthe functions of the EnjoySAP purchase requisition transactions. This is because the two asynchronousBAPIs have been developed based on ME51 and ME52 (program SAPMM06B). The user exits from thefunction group MEREQ (for example, MEREQ001) are therefore not available.In SAP R/3 Release 4.70, two new API methods are developed that are based on the EnjoySAP technologyof the purchase requisition transactions ME51N and ME52N. The function modules BAPI_PR_CREATE andBAPI_PR_CHANGE are released in Release 6.00 (ERP2005).SAP does not provide support for this because these function modules have not been released for Releases lower than 6.00. If you use these BAPIs in customer-defined programs, you must bear in mind that you are responsible for any problems that might occur. In addition, you must read Notes 109533 and 415983.A downport to a release lower than 4.70 is not provided because developing this would involve considerabletime and effort.---------------------------7. Question:Can BAPI_REQUISITION_CHANGE process the customer enhancements ExtensionIn?Answer:See Note 584902.---------------------------8. Question:Can service items be created using BAPI_REQUISITION_CREATE or changed usingBAPI_REQUISITION_CHANGE?Answer:No, this is only possible with the new API functions for the object BUS2105. See the following point.---------------------------9. Question:Can service items be created using BAPI_PR_CREATE or changed using BAPI_PR_CHANGE?3 of © 2020 SAP SE or an SAP affiliate company. All rights reserved6499627 2020-01-03Answer:Yes. Release 6.04 (Enhancement Package 4) provides new API functions for the object BUS2105 thatinclude this function. In addition the business function LOG_MM_CI_2 or the switch MM_SFWS_SC2 mustbe active.See Note 1312947 for further information.---------------------------10. Question:In online transaction ME51, you can assign a 35 character vendor material number to an item. However, Ican maintain only 22 characters in the BAPI. Can I change this?Answer:When the BAPIs for the business object BUS2105 (PurchaseRequisiton) were developed, the field for thevendor's material number (EBAN-IDNLF) was only 22 characters long. This definition has changed in SAPR/3 Release 4.5B to include 35 characters.You cannot change the field VEND_MAT in the relevant API methods for compatibility reasons. However, the full length of this field is provided in the new API methods.---------------------------11. Question:I can use the user parameter CNT to maintain a cost center in the user master record;BAPI_REQUISITION_CREATE can import this cost center.What is the correct format for entering this cost center if the cost center is only numeric?Answer:You must enter the cost center with leading zeros. The BAPI does not convert the format.---------------------------12. Question:What must I take into account when I use the BAPI BAPI_REQUISITION_CHANGE to change or delete texts?Answer:To ensure the persistent processing of the texts, you must always call the function module COMMIT_TEXTafter BAPI_REQUISITION_CHANGE.--------------------------13. Question:Can the BAPI_PR_CREATE or BAPI_PR_CHANGE be called several times in a sequence?Answer:No. If you use the BAPIs for the same business object - for example, purchase requisitions (BUS2105) - in asequence in customer-specific programs, this may lead to the following problems:4 of © 2020 SAP SE or an SAP affiliate company. All rights reserved6499627 2020-01-03Example: Let us assume you want to update the price for several purchase requisitions. If several documents are processed in a sequence, this may lead to the dump'OBJECTS_OBJREF_NOT_ASSIGNED'.Solution: We recommend using the parameter DESTINATION 'NONE'. This has the result that the BAPIsare executed in a separate context, thus preventing the data of one BAPI from overlapping another.--------------------------14. Question:Can I use BAPI_PR_CREATE and BAPI_PR_CHANGE to use the same material in the BAPI structureAnswer:No. Due to the complexity occurring during sorting and updating of the RESB table, SA strongly recommendsNOT using the same materials in the BAPI structure PRCOMPONENTS several times.Other Terms-Reason and Prerequisites-Solution-This document refers toSAP Note/KBA Title747132 APIs in BUS2105 and vendor's material number584902 BAPI_REQUISITION_CHANGE: ExtensionIn is not connected582221 FAQ: BAPIs for purchase orders499626 FAQ: BAPIs in the service procurement485557 BAPI_REQUISITION_CREATE: 'EXTENSIONIN' customer enhancements330206 BAPI_REQUISITION_CHANGE:No fixing of PReqs from MRP182787 No planning file entry with PReqs from SD/PP/PS109533 Use of SAP function modules102595 Subcontracting Preqs generated from SD/PS have no components5 of © 2020 SAP SE or an SAP affiliate company. All rights reserved6499627 2020-01-03This document is referenced bySAPNote/KBATitle1936731 EBAN-BPUEB (Adopt Requisition Price in PO) is reset during PR creation in BAPI_PR_CREATE2406654BAPIs called in sequence returns wrong data or OBJECTS_OBJREF_NOT_ASSIGNED shortdump1638852 FMCF108 error during reassignment582221 FAQ: BAPIs for purchase orders584902 BAPI_REQUISITION_CHANGE: ExtensionIn is not connected499626 FAQ: BAPIs in the service procurement102595 Subcontracting Preqs generated from SD/PS have no components747132 APIs in BUS2105 and vendor's material number485557 BAPI_REQUISITION_CREATE: 'EXTENSIONIN' customer enhancements182787 No planning file entry with PReqs from SD/PP/PS330206 BAPI_REQUISITION_CHANGE:No fixing of PReqs from MRP6 of © 2020 SAP SE or an SAP affiliate company. All rights reserved6。

bapi使用经验与技巧

bapi使用经验与技巧

BAPI使用经验总结总结人:曾德军QQ : 25117827011.挑选需要的bapi:可以根据前台对应的事务代码到scn里查找对应的bapi,也可以到bapi浏览器里继续根据业务和参数再确认一下哪个bapi是对的,然后根据功能描述到网页上搜索一下,和业务顾问沟通一下,看对应的可能的bapi是不是自己需要的用法。

2.使用bapi:对于一个全新的没有用过的bapi,它的用法一是要找准需要输入的参数并且正确输入进去,二是要能及时解决bapi的报错。

找参数的话,每个bapi里一般都有get detail的方法,这个方法带出来的参数基本跟使用bapi时的参数是一样的,也可以参考bapi最终在标准表里应该生成的正确的结果,比对一下对应的字段的值,看看有没有对应的参数需要输入的,还可以参考bapi文档里的例子,以及网上使用的例子,或者参考系统里bapi的调用,查查别人是怎么用这个bapi的,这样基本参数都可以找到,剩下的偶尔的一些比较特殊的参数可能要多研究,多试试了。

一般bapi报错可以按顺序排查5种原因:1.输入的参数对应数据在前台也做不过去,数据有问题,需要业务顾问重新提供可用数据(这种还包含一种特殊的情况,就是BAPI对应的事务代码使用相同的数据可以实现,但是bapi执行的话就会少执行一两个步骤,导致虽然bapi 执行成功但是有些数据不对,这种一般是业务配置问题,因为不同的配置会影响其执行结果) 2.数据前台可以做过去,但是在往bapi里传参数的时候一些参数的值没有传对,需要调整下代码或者传值逻辑;3.参数的值传对了,但是bapi的传入参数多了或者少了,这时候需要根据业务顾问和报错信息来推断,尝试增加或者删除某些参数,不过如果系统里有很多已经做好了的例子的话,可以参考调用,查看别的例子里都用的哪些参数,如果例子比较多的话,也挺好找出来的。

例子不多,就要多推断,多尝试,多搜索和沟通了;4.前三种问题都排除了,那就可能是增强导致的报错,不是标准报错,这时候就需要跟踪查找增强来解决了。

sap操作中心工作操作手册64页

sap操作中心工作操作手册64页

sap操作中心工作操作手册目录一目的 (3)二适用范围 (3)三操作中心概叙及工作示意图 (3)3.1操作中心业务岗位概述 (3)3.1.1 仓储主管 (3)3.1.2 仓管员 (4)3.1.3 操作主管 (5)3.1.4 操作员 (6)3.1.5 信息组长 (7)3.1.6 制单制签信息员 (8)3.1.7 串码信息员 (8)3.1.8 WMS信息员 (9)3.1.9 调度主管 (9)3.1.10 调度员 (10)3.1.11 出港信息员 (11)3.1.12 到港信息员 (12)3.1.13 司机 (12)3.1.14 航空现场操作员 (12)3.2 员工考核指标 (13)3.3 操作中心工作示意图 (15)四术语解释 (16)五客户介绍及系统物权分类 (17)5.1 普天(包含NFD和非NFD两大类) (17)5.2 电信 (18)5.2.1 电信部门划分 (18)5.2.2 电信各部门业务关系 (18)5.2.3 物权分类表 (19)5.2.4 各物权逻辑关系 (19)六业务分类 (20)6.1 库房入库业务 (20)6.1.1入库类别定义 (20)6.1.2 入库业务流程及注意事项 (20)6.2 在库库存管理 (23)6.2.1库存管理 (23)6.2.2 盒损处理 (24)6.2.3盘点流程及注意事项 (25)6.3 库房出库业务 (26)6.3.1出库类别定义 (26)6.3.2 出库业务流程及注意事项 (26)6.4 发货运输业务 (28)6.4.1市内派送流程及注意事项 (28)6.4.2 外阜出港、到货中转流程及注意事项 (29)七库内6S与安全培训 (31)7.1 库区6S标准规范 (31)7.2 库内安全培训 (32)7.2.1 人身的安全 (32)7.2.2 物料的安全操作 (32)7.2.3 设备的安全操作 (32)7.2.4 库内叉车的安全操作 (33)八库房业务系统(WMS)和运输业务系统(TMS)的使用 (33)8.1 库房业务系统(WMS)使用 (33)8.1.1 用户登录 (33)8.1.2 入库业务 (34)8.1.2.1 正常采购入库(厂家送货上门) (34)8.1.2.2 库间调拨入库 (37)8.1.2.3 拒收退库入库 (37)8.1.2.4 回转收货 (38)8.1.3 库位移动 (39)8.1.4 出库操作 (40)8.1.5 盘点操作 (44)8.1.6 日常查询业务 (45)8.1.6.1 WMS系统库存查询 (45)8.1.6.2 库房产品台账查询 (46)8.2 运输业务系统(TMS)使用 (47)8.2.1用户登录 (47)8.2.2 发运业务 (48)8.2.2.1预调度 (48)8.2.2.2调度 (48)8.2.2.3任务管理 (51)8.2.2.4单据管理 (51)8.2.2.5出港任务管理 (53)8.2.3中转配送 (54)8.2.3.1单据管理 (54)8.2.3.2到港任务管理 (55)8.2.3.3调度 (56)8.2.4 派送任务管理 (57)8.2.5 签收任务管理 (58)8.2.6 签收异常信息录入 (59)一 目的作为操作中心人员日常工作的指导依据,明确操作中心人员架构、工作职责、操作流程、系统操作说明,使操作中心工作流程化、规范化。

BAPI操作手册

BAPI操作手册

BAPI操作手册作者:丑儿MSN: njchouer@网上看到一篇关于这样的文章,但是自己手动操作的时候还是出现了一些问题,现在把它整理成文档的形式,以供参考。

这里我非常感谢我的好朋友杜善晶,谢谢她给了我很大的帮助。

---题记(丑儿2007-10-31)1)给BAPI创建数据结构(1)事务代码:SE11- 输入结构的名称:ZBAPI_ORDER_STATUS_IMPORT输入如下的3个字段激活保存2)给BAPI创建数据结构(2)事务代码:SE11- 输入结构的名称:ZBAPISTAT输入如下字段激活保存2)创建函数事务代码:SE37创建函数组:转到—〉函数组—〉创建组输入函数组和函数组短文本保存输入Function module:Z_BAPI_GET_ORDER_STA TUSWW 点创建输入函数模块和函数组() 短文本SA VE属性选择状态如下Import输入如下的参数Export输入如下参数Tables选择参数选择goto –〉Global data 定义全局变量激活保存输入代码如下Types:begin of Type_tj02t,istat like tj02t-istat,txt04 like tj02t-txt04,txt30 like tj02t-txt30,end of type_tj02t.DATA:* Declarations for TABLE parameterT_BAPISTAT like ZBAPISTAT occurs 0, G_BAPISTAT like ZBAPISTAT,* Table for object textst_tj02t type type_tj02t occurs 0,g_tj02t type type_tj02t.* Structure for return messages DATA:BEGIN OF MESSAGE,MSGTY LIKE SY-MSGTY,MSGID LIKE SY-MSGID,MSGNO LIKE SY-MSGNO,MSGV1 LIKE SY-MSGV1,MSGV2 LIKE SY-MSGV2,MSGV3 LIKE SY-MSGV3,MSGV4 LIKE SY-MSGV4,END OF MESSAGE.Source code中增加对应代码激活保存增加的代码如下:FUNCTION Z_BAPI_GET_ORDER_STATUSWW.*"---------------------------------------------------------------------- *"*"Local interface:*" IMPORTING*" VALUE(BAPI_ORDER_STATUS_IMPORT) TYPE ZBAPI_ORDER_STATUS_IMPORT*" EXPORTING*" VALUE(RETURN) TYPE BAPIRETURN*" TABLES*" T_BAPISTAT STRUCTURE ZBAPISTAT *"---------------------------------------------------------------------- DATA:l_aufnr LIKE afko-aufnr,l_objnr LIKE jest-objnr.********************************************* Check if order exists******************************************** SELECT SINGLE aufnrFROM afkoINTO l_aufnrWHERE aufnr = BAPI_ORDER_STATUS_IMPORT-orderid.IF sy-subrc NE 0.CLEAR message.message-msgty = 'E'.message-msgid = 'Z3'.message-msgno = '000'.message-msgv1 = BAPI_ORDER_STATUS_IMPORT-orderid.PERFORM set_return_message USING messageCHANGING return.IF 1 = 2.* The only reason to include this statement, that will obviously* never execute, is that it will create a referecence so that you* can find out where a particular message is being used. This* functionality is used by the BAPIs programmed by SAPMESSAGE e000(z3).ENDIF.ENDIF.CHECK return IS INITIAL.********************************************* Read order status********************************************CONCATENATE 'OR' BAPI_ORDER_STATUS_IMPORT-orderid INTO l_objnr. IF BAPI_ORDER_STATUS_IMPORT-i_excludeinactive = 'X'.SELECT objnr stat inactFROM jestINTO TABLE t_bapistatWHERE objnr = l_objnr ANDinact <> 'X'.ELSE.SELECT objnr stat inactFROM jestINTO TABLE t_bapistatWHERE objnr = l_objnr.ENDIF.IF sy-subrc <> 0.* No object status foundCLEAR message.message-msgty = 'E'.message-msgid = 'Z3'.message-msgno = '001'.message-msgv1 = BAPI_ORDER_STATUS_IMPORT-orderid.PERFORM set_return_message USING messageCHANGING return.IF 1 = 2.MESSAGE e001(z3).ENDIF.ENDIF.CHECK return IS INITIAL.********************************************* Read order status texts********************************************SELECT istat txt04 txt30FROM tj02tINTO TABLE t_tj02tFOR ALL ENTRIES IN t_bapistatWHERE istat = t_bapistat-stat ANDspras = BAPI_ORDER_STATUS_IMPORT-i_spras.SORT t_tj02t BY istat.LOOP AT t_bapistat INTO g_bapistat.READ TABLE t_tj02tWITH KEY istat = g_bapistat-stat BINARY SEARCHINTO g_tj02t.IF sy-subrc = 0.MOVE:g_tj02t-txt04 TO g_bapistat-txt04,g_tj02t-txt30 TO g_bapistat-txt30.MODIFY t_bapistat FROM g_bapistat TRANSPORTING txt04 txt30.ENDIF.ENDLOOP.ENDFUNCTION.***INCLUDE LZBAPISTATUSF01 .*----------------------------------------------------------------------**&---------------------------------------------------------------------**& Form SET_RETURN_MESSAGE*&---------------------------------------------------------------------** This routine is used for setting the BAPI return message.* The routine is a standard routine for BAPIs that handles the message* structure for the BAPIRETURN structure. It has been copied from the* BAPI Company Code Getlist*----------------------------------------------------------------------** -->P_MESSAGE text* <--P_RETURN text*----------------------------------------------------------------------*form SET_RETURN_MESSAGE USING VALUE(P_MESSAGE) LIKE MESSAGECHANGING P_RETURN LIKE BAPIRETURN.CHECK NOT MESSAGE IS INITIAL.CALL FUNCTION 'BALW_BAPIRETURN_GET'EXPORTINGTYPE = P_MESSAGE-MSGTYCL = P_MESSAGE-MSGIDNUMBER = P_MESSAGE-MSGNOPAR1 = P_MESSAGE-MSGV1PAR2 = P_MESSAGE-MSGV2PAR3 = P_MESSAGE-MSGV3PAR4 = P_MESSAGE-MSGV4* LOG_NO = ' '* LOG_MSG_NO = ' 'IMPORTINGBAPIRETURN = P_RETURNEXCEPTIONSOTHERS = 1.endform. " SET_RETURN_MESSAG3)创建API Method事务代码:SWO1输入对象/接口类型:ZORDERSTAW 点创建输入如下的参数确定保存选择实用程序—>API方法 Add方法输入Function module:Z_BAPI_GET_ORDER_STATUSWW确定选择选择确定选择编辑—>更改版本状态—>对象类型—>To Implemented确定Note that the BAPI wizard has added a wrapper class for the function module so it can be sued as method in the business object.选择Choose menu Goto->Program to display the program4)最后一步释放事务代码:SE37释放模组事务代码:SWO1释放业务对象类型选择对象类型—>修改版本状态到—>已实现释放对象类型(把光标放在对象类型上)选择编辑—更改版本状态—对象类型—已释放Release the BAPI as a method in the BOR把光标放在zproder…ZgetOrderSt…选择编辑—更改版本状态—对象类型组件—已释放保存后退生成选择对象类型—生成成功的信息5)查看BAPI事务代码:BAPI结束附件:/abap/bapi/example.htm。

BAPI说明

BAPI说明
CALL FUNCTION 'BALW_BAPIRETURN_GET2'
EXPORTING
TYPE = 'E'
CL = 'BC_BOR'
NUMBER = 163
PAR1 = MSG1_HLP
5.SAP R/3 企业目标的目标类型(Object Type) 相当于目标设计语言中类(Class) 的概念,
其定义结构由以下几部分组成:基本数据,接口界面,键(Key Fields),方法(Methods),特征(Attributes),事件(Events)
--如何创建BAPI程序
1.定义BAPI Structure (Structure不能在BAPI中重复使用,因为一旦BAPI被释放,其Structure被冻结)
order_cfgs_value = order_cfgs_value
order_cfgs_ref = order_cfgs_ref.
把=后面要的数据收集进去就好了
畅享博客 > SAP小虫 > SAP:BAPI知识讲解 2010-4-21 22:23:38
SAP:BAPI知识讲解
1.ห้องสมุดไป่ตู้API – business application programming interface
2.它实际上是一种特殊的Remote Function Modules (RFC)是为了提供使用外部程序来进行交易活动
3.它提供的基于企业目标(Business Object) 技术的接口应用界面
CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'

BAPI_ACC_DOCUMENT_POST字段的扩展

BAPI_ACC_DOCUMENT_POST字段的扩展

BAPI_ACC_DOCUMENT_POST字段的扩展BAPI_ACC_DOCUMENT_POST字段扩展1.首先创建结构(se11->数据类型),结构中,必须包含行项目号POSNR_ACC组件类型,我这边定义的字段是ITEMNO_ACC,代码中使用,和需要扩展的数据字段,如:2.SE19实现BADI增强ACC_DOCUMENT,这个增强是用来将BAPI_ACC_DOCUMENT_POST参数表EXTENSION2传入系统表。

双击CHANGE:进入method if_ex_acc_document~change.在里面写入代码如下:(代码网上找的)data: wa_extension type bapiparex,ext_value(960) type c,wa_accit type accit,l_ref type ref to data.field-symbols: type any,type any.sort c_extension2 by structure.loop at c_extension2 into wa_extension.at new structure.create data l_ref type (wa_extension-structure).assign l_ref->* to .endat.concatenate wa_extension-valuepart1 wa_extension-valuepart2wa_extension-valuepart3 wa_extension-valuepart4into ext_value.move ext_value to .assign component 'ITEMNO_ACC' of structure to .read table c_accit with key posnr =into wa_accit.if sy-subrc is initial.move-corresponding to wa_accit.modify c_accit from wa_accit index sy-tabix.endif.endloop.测试代码如下:DATA:g_date LIKE sy-datum.DATA:gheader LIKE bapiache09,gcurrency LIKE bapiaccr09 OCCURS 0 WITH HEADER LINE,gaccount LIKE bapiacgl09 OCCURS 0 WITH HEADER LINE,gt_accountreceivable LIKE TABLE OF bapiacap09 WITH HEADER LINE,greturn LIKE bapiret2 OCCURS 0 WITH HEADER LINE.DATA: IT_EXTENSION2 TYPE STANDARD TABLE OF BAPIPAREX WITH HEADER LINE.DATA: WA_ZSTR1 LIKE ZSTR1. "*****WA_ZSTR1-ITEMNO_ACC = 1. "凭证行项目WA_ZSTR1-KIDNO = 'KIDNO 测试付款参考 '. "WA_ZSTR1-RSTGR = 'A01'. "凭证行项目原因代码IT_EXTENSION2-STRUCTURE = 'ZSTR1'. " 自建的表结构必须大写IT_EXTENSION2-VALUEPART1 = WA_ZSTR1.APPEND IT_EXTENSION2.******抬头gheader-bus_act = 'F-02'.gheader-comp_code = '9000'.gheader-doc_date = '20141209'.gheader-pstng_date = '20141209'.gheader-fisc_year = '2014'.gheader-doc_type = 'ZB'.gheader-username = sy-uname.***金额行项目1gheader-ref_doc_no = 'gt_bapi-verkf'.gcurrency-CURRENCY = 'CNY'.gcurrency-amt_doccur = '1000' .gcurrency-curr_type = '00'.gcurrency-itemno_acc = 1.APPEND gcurrency.***金额行项目2gcurrency-amt_doccur = '-1000' .gcurrency-curr_type = '00'.gcurrency-itemno_acc = 2.gcurrency-CURRENCY = 'CNY'.APPEND gcurrency.***行项目1gt_accountreceivable-itemno_acc = 1.gt_accountreceivable-vendor_no = '0003000000'.CONCATENATE '预付甲供材' '+' '0003000000' INTO gt_accountreceivable-item_text. gt_accountreceivable-wbs_element = 'J/KJ11001/01-01'.gt_accountreceivable-alloc_nmbr = '1040甲供材'.gt_accountreceivable-sp_gl_ind = '4'.gt_accountreceivable-po_number = '5700000026'.gt_accountreceivable-po_item = '00010'.APPEND gt_accountreceivable.CLEAR:gt_accountreceivable.**** 行项目2gaccount-itemno_acc = 2.gaccount-gl_account = '0016050800'.CONCATENATE '预付甲供材' '+' '0003000000' INTO gaccount-item_text. gaccount-network = '000006000052'.gaccount-activity = '0010'.gaccount-alloc_nmbr = '1040甲供材'.gaccount-po_number = '5700000026'.gaccount-po_item = '00010'.APPEND gaccount.***CALLCALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'EXPORTINGdocumentheader = gheaderTABLESaccountgl = gaccountaccountpayable = gt_accountreceivable currencyamount = gcurrencyRETURN = greturnEXTENSION2 = IT_EXTENSION2.COMMIT WORK.CLEAR: gt_accountreceivable,gcurrency,gaccount. REFRESH:gt_accountreceivable,gcurrency,greturn,gaccount.。

sap出口(增强)详解

2:为了方便我们把所有的出口名称及其描述列在文章的后面。
下面具体介绍怎样写出口程序:
为了对出口程序的修改进行管理,sap提供了专门用来管理出口程序的事务,事务代码是CMOD。
输入事务代码--CMOD进入如下界面:
输入一个项目名称:ztest003,创建一个增强项目。
点击创建进入下面的界面:输入项目描述。点击保存。
AIST0002资产主数据中的客户字段
ALE00001 ALE用户退出
ALTD0001 Individual additional checks when transferring old data
AMAV0001确定资产起息日
AMGS_001在资产报表中用户定义的转换方法
AMPL0001 AMPL上附加数据地用户子屏幕
BC621E18 Customer Function for BC621 Group 18
BC621EDX Customer Function for BC621
BDMO0001 Enhancement to the ALE distribution reference model
BG000001用户出口:担保检查
CAVC0000用户出口:变量配置:外部应用程序接口
CAWAO_TS Text Layout of Worklist
CBP00001用户由于PP-CBP退出
CCOWB001修改菜单条目的用户退出
CCT00001 User exit characteristics mgmt.: Char. data before backup
BC621E02 Customer Function for BC621 Group 02
BC621E03 Customer Function for BC621 Group 03

BAPI(1)

1. BAPI_ACC_DOCUMENT_CHECK 用于过账前的Check
*----- 抬头数据
WA_DOCUMENTHEADER-USERNAME = SY-UNAME. "系统当前用户
WA_DOCUMENTHEADER-DOC_DATE = LW_DATE1. "生成凭证的凭证日期
WA_ACCOUNTGL-GL_ACCOUNT = WA_ALV-RACCT. "科目
WA_ACCOUNTGL-PROFIT_CTR = WA_ALV-PRCTR. "利润中心
WA_ACCOUNTGL-COSTCENTER = WA_ALV-RCNTR. "成本中心
APPEND WA_EXTENSION2 TO IT_EXTENSION2.
CLEAR WA_EXTENSION2.
CALL FUNCTION 'BAPI_ACC_DOCUMENT_CHECK'
EXPORTING
DOCUMENTHEADER = WA_DOCUMENTHEADER " 录入凭证
WA_CURRENCYAMOUNT-AMT_DOCCUR = WA_A_CURRENCYAMOUNT TO IT_CURRENCYAMOUNT.
CLEAR WA_CURRENCYAMOUNT.
WA_CURRENCYAMOUNT-ITEMNO_ACC = '2'. "行项目号
CLEAR WA_CURRENCYAMOUNT.
*增强字段
*----- 记账码
WA_EXTENSION2-STRUCTURE = 'BSCHL'. "增强字段名字

ABAP-SAP增强应用实例

SAP增强应用实例SAP增强大家都很熟悉,在此不再详细讲解,下面只是通过一个实例来展示一下增强的应用。

系统增强实例为建立工单前进行校验,如没有进行标准成本发布则提示错误信息E。

T-code:CMOD通过增强程序我们可以控制相关应用,如果你不知道到底功能是用到的哪个增强,那么请看我附录上的列表。

我们以ppco0006举例如下:如图2.我们需要的是制定我们的组件,如图3.通过功能退出增加增强语句:如图4:双击程序后加入如下语句~~~~if sy-tcode <> 'CK11N' and sy-tcode <> 'CK40N'. data:begin of l_matnr,matnr like mbew-matnr,VPRSV like mbew-VPRSV,vjvpr like mbew-vjvpr,pprdl like mbew-pprdl,lplpr like mbew-lplpr,end of l_matnr.select single matnr vprsv vjvpr pprdl lplpr from mbew into l_matnrwhere matnr = CAUFVD_IMP-MATNR* and pprdl <> ''* and lplpr <> ''and bwkey = CAUFVD_IMP-WERKS.* and vjvpr = 'S'.if l_matnr-vprsv = 'V'./移动平均价exit.elseif sy-subrc <> 0 or ( l_matnr-pprdl is initial and l_matnr-lplpr is initial ).message e888(sabapdocu) with '物料' CAUFVD_IMP-MATNR'没有做成本估算, 不能创建生产订单,请通知SAP 方丈,yeah~~~!'.exit.endif.endif.OK,快去看看你增强后的效果吧~~~~~¥%&%&*(*(SAP所有模块用户出口:用户出口名称短文本描述0VRF0001 客户指定路线确定AAIC0001 IM 总结: 在选择后处理数据AAIC0002 IM 总结: 在选择后处理指定的输入项AAIP0001 IM 追溯: 实际价值对预算类别的分配AAIP0002 IM 追溯: 定义用户定义的指标AAIP0003 IM 追溯: 定义用户定义的特性AAIR0001 IM-IS: 适用请求报表中的用户值字段AAIR0002 IM-FA: 拨款申请的用户字段AAIR0003 IM: 创建拨款申请中的PM 定单时工作场所的分配AAIR0004 IM 追溯: 定义用户定义的特性AAIS0003 投资计量对资产的实际结算AAIS0004 全部计划值或预算值的结算AAPM0001 资产会计和工厂维护的集成ACBAPI01 会计核算: 对BAPI 界面的客户增强功能ACCID001 会计核算的IDoc 过程ACCID002 支出会计的IDoc 处理ACCOBL01 代码块中PAI 和PBO 的客户出口AD010001 更改对象清单及其层次AD010002 定界选择和/或过滤已定数据AD010003 创建自定义动态项目特性AD010005 创建自定义资源AD010006 菜单退出:更改动态项目值AD010007 更改DI 处理信息AFAR0001 External determination of ref. value for dep. calculationAFAR0002 External determination of depreciationAFAR0003 外部转换方式AFAR0004 报废比例值的确定AINT0001 当记帐资产时进行扩展的检查AINT0002 出入流水中冲销帐户的替代...AINT0003 定义投资支持再付款的百分比/金额AINT0004 更改某范围已过帐金额AINT0005 虚拟扩展语法检查. 不使用。

SAP增强-BOM主数据

4、BOM抬头屏幕增强(CS01/CS02/CS03)该节练习直接使用标准的CMOD进行增强。

4.1 CMOD创建/修改增强项目1、创建增强项目输入项目号“ZTESTBOM”,如果是新项目,则点击“创建”,如果项目已经存在,点击“更改”,如图4.1-1:图4.1-12、增强分配输入短文本,然后点击“增强分配”,如图4.1-2:图4.1-2F4进入增强搜索,根据业务查询对应的增强,这里选择“PSCD0003”,然后点击保存,如图4.1-3:图4.1-33、组件配置保存完后点击“组件”按钮(或者返回增强属性界面点击“组件”),进行组件维护,如图4.1-4、图4.1-5:图4.1-4图4.1-5说明:EXIT_SAPLCSDI_004 的作用是向自定义子屏幕中传入数据。

EXIT_SAPLCSDI_005 的作用是将自定义子屏幕中的数据传入主调用程序中。

保存该增强项目。

4.2 CMOD增强项目组件-出口配置4.2.1 功能出口配置(主调用程序传值给子屏幕)增强项目组件界面双击“EXIT_SAPLCSDI_004”,进入“EXIT_SAPLCSDI_004”的功能模块设计界面,点击“导入”标签页,其中参数USERDATA 为传入子屏幕的参数。

对应的结构类型CSCI_STKO(需要增加的字段就在这里),如图4.2.1-1:图4.2.1-1双击类型“CSCI_STKO”,进入“CSCI_STKO”的结构界面,其中自定义的字段就在.INCLUDE中,也就是在对应的组件类型“CI_STKO”中,所以双击组件类型“CI_STKO”进行自定义字段维护,如图4.2.1-2:图4.2.1-2这里添加了两个字段“ZVER”和“MODULENO”,如图4.2.1-3:图4.2.1-3添加完字段后就把结构“CI_STKO”激活,然后返回到出口函数EXIT_SAPLCSDI_004的属性界面,然后选择菜单转到-->全局数据,进入全局数据定义界面,如图4.2.1-4:图4.2.1-4双击包含文件“ZXCSATOP”,(如果有警告,点击回车键进行继续操作)进入到包含文件中进行全局数据定义,如图4.2.1-5:图4.2.1-5这里定义了全局变量“HLP_CI_STKO”。

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

Enhancement to the BAPI based on existing SAP database tables以下是SAP建议的步骤Actions for an Enhancement Based on ExistingSAP Database Tables对现有的sap数据库表的增强动作Purpose :目的We assume that the customer wants to append his own fields to SAP tables involved in a BAPI and/or include additional existing fields from these tables in the BAPI after the fact.我们假设客户想把自己的数据附加到sap表中,这些sap表使用了BAPI并且/或者Process FlowIn this case, the following steps are required at most:1. Extending the database tableThe customer must perform the following actions for each SAP table to append that is involved in the BAPI:a. Create a data structure that contains the customer fields that will be added tothe table.b. Then add an APPEND to the database table that includes the data structurecreated in a) above.An example is available under Appending Customer Fields.2. Identifying and/or creating the BAPI table extensionsThe customer has to make sure that each SAP table that is used for this type ofenhancement has its corresponding BAPI table extension. This is done by reading the documentation on the BAPI extension parameters. If a required table extension has not been supplied by SAP, then the customer is responsible for creating it. Make sure to observe the following guidelines:The naming convention for BAPI table extensions is<namespace>BAPI_TE_<table_name>.If you cannot follow this naming convention due to thelength restriction for structure names, reduce thename accordingly, but try to keep its context clear.Each table should only have one table extension.Therefore, if several BAPIs use the same table, theywill have to share the table extension.Excepti on:If a BAPI has two or more parameters that refer to the same database table, then a separate BAPI table extension is created for each of these BAPI parameters. Thenaming convention in this case is<namespace>BAPI_TE<table_name><consecutive_number>. In our example, ourtable extensions would be namedYBAPI_TE_STRAVELAG1,YBAPI_TE_STRAVELAG2, and so on.The structure of the BAPI table extension mustcontain all the identified key fields of the table towhich the BAPI table extension relates. The tableextension does not initially contain any other fieldsexcept the key fields.3. Enhancing the BAPI table extensionsThe APPEND technique is now used to enhance the BAPI table extensions that you identified and/or created above. As mentioned above, we can differentiate between the following cases:a. If the customer wants to add additional fields from the SAP table for the BAPItable extension, he adds these fields directly to the APPEND structure.b. If the customer has appended his own fields to the corresponding SAP table,then he should include the same data structure – with the customer fields – inthe APPEND as the one used to extend the database table.c. If you want to both add existing fields from the SAP table to the BAPI andappend customer fields, proceed as follows:First add all existing fields from the corresponding table to the APPENDstructure.Then add the INCLUDE that contains the new customer fields to the sameAPPEND structure. Please note that you have to use the same INCLUDE inboth the database table and in the corresponding BAPI table extension.4. Programming the customer exitsThe first customer exit gives customers the option of performing data checks, whilethe second exit allows the further processing of the data passed on to the BAPI (alsosee Actions by the BAPI Developer). The standard rules for customer exits apply andtransactions SMOD( SAP internal) and CMOD(customers) are used for maintainingthem.5. Filling ExtensionIn before a BAPI callBefore a BAPI that involves extended tables can be called, you have to make sure thatthe enhancements are written to parameter ExtensionIn. ExtensionIn is filled asfollows for each data record that is written to the container:o Field VALUEPART1 is first filled with the keys that identify the table lines.o Fields VALUEPART1 through VALUEPART4 are then filled with the values ofthe customer fields in the proper sequence. By structuring the container in thisway, its contents can be converted with a single MOVE command in thestructure of the BAPI table extension.The part for implementation can be described in pseudo-coding as follows:FOR every extendable table XREPEATFill ExtensionIn-VALUEPART1 with key values.Fill VALUEPART1 through VALUEPART4 with data in sequence.APPEND ExtensionIn.UNTIL table X is processedEND FORException:It is not possible to give the container a key value in Create() BAPIs withinternal number assignment, as these values are generated in the BAPI itself.In this case, you should give the container an initial key value. The BAPIdeveloper has already anticipated the assignment of the key generated in theBAPI to the BAPI table extension.A detailed programming example on filling the ExtensionIn parameter and calling theenhanced BAPI is available in the Examples.5. Evaluating ExtensionOut after a BAPI callThe conversion of the ExtensionOut container to a structure may have to beimplemented, depending on your specific situation.以下是SAP说明的实施这种方式的前提(LIB 4312)实施a(Appending customer fields to SAP tables,将数据传入标准表的自建字段中) 1 建了一个结构(ZBAPITEXT)2 将结构APPEND到MARAAPPEND 的方法参考:“E:\禹明的文档\SAP\个人总结\ABAP4\表\透明表\SE11维护DDIC\为SAP 标准表APPEND, INCLUDE 自定义结构”3 建立BAPI Table Extension作用:BAPI table extensions are help structures that allow the customer enhancement of BAPIs. They must exist for every SAP database table that is to be used in the customer enhancement concept. These BAPI table extensions are used during the data import to copy the customer enhancements from the container (ExtensionIn ) to the BAPI interface, and to fill the additional fields of the database table. During data export, the BAPI table extensions are used to copy data from a customer table extension and to place it in the ExtensionOut parameter. Places where BAPI table extensions are used and how their use must be implemented in detail are described in Actions by the BAPI Developer.• 注意事项:A separate BAPI table extension must be created for every database tablethat the BAPI developer thinks could be enhanced. Please note, however, that each table can only have one table extension. Therefore, if several BAPIs use the same table, they will have to share the table extension. BAPI Table Extension 只能用C 类型或者similar data types 的字段Exception: If a BAPI has two or more parameters that refer to the same database table,then a separate BAPI table extension is created for each of these BAPIparameters. The naming convention in this case isBAPI_TE<table_name><consecutive_number>. In our example, the BAPI table extensions would be called BAPI_TE_STRAVELAG1,BAPI_TE_STRAVELAG2, and so onSE11:BAPI_TE_MARA (这个结构SAP 已经建好了,如果没有,要自己建)表的KEY ,一定要有的要添数据的SAP 表名,如果有多个BAPI_TE 结构,以MARA1,MARA2类推4 SE11:BAPI_TE_MARAX(这个结构SAP已经建好了,如果没有,要自己建)步骤同3 (这个结构用来标识BAPI_TE_MARA的哪个字段是需要的,典型的BAPI逻辑)字段名必须是ZZTEXT,和BAPI_TE_MARA的相同,类型必须是BAPIUPDATE5 函数参数EXTENSIONIN REF的结构BAPIPAREX分析•STRUCTUREThe STRUCTURE field contains the name of the BAPI table extension to which therespective data record refers. In turn, because a table extension is allocated to exactlyone database table, the program can determine the extended table in which to savethe data record.•VALUEPART1 through VALUEPART4Each data record of the extension container contains – in addition to the name of thetable extension – the key values and the values that will be inserted in the additionaltable fields. The key values have to be passed on in order to determine the line in thedatabase table where the data in the data record will be written.Exception:It is not possible to pass on the key value(s) in Create()BAPIs with internalnumber assignment, as these values are generated in the BAPI itself. Forinformation on how to proceed in the case of Create() BAPIs, refer to Actionsfor Enhancements Based on Existing Database Tables.6 Filling ExtensionIn before a BAPI call参照程序效果实施b(Using existing database fields,读取标准表的自建字段值,与a刚好相反) 1 继续利用实施a的结构:BAPI_TE_MARA2 SE11:MARA的自建字段中存在以下数据3 通过BAPI_MATERIAL_GET_ALL会自动读取MARA-ZZTEXT字段。

相关文档
最新文档