SAP User Exit

合集下载

ABAP开发中有关销售单据的User Exits

ABAP开发中有关销售单据的User Exits

User Exits In Sales Document ProcessingThis IMG step describes additional installation-specific processing in sales document processing. In particular, the required INCLUDES and user exits are described.Involved program componentsSystem modifications for sales document processing affect different areas. Depending on the modification, you make the changes in the program components provided:∙MV45ATZZFor entering metadata for sales document processing. User-specific metadata must start with "ZZ".∙MV45AOZZFor entering additional installation-specific modules for sales document processing which are called up by the screen and run under PBO (Process Before Output) prior to output of the screen. The modules must start with "ZZ".∙MV45AIZZFor entering additional installation-specific modules for sales document processing. These are called up by the screen and run under PAI (Process After Input) after data in put (for example, data validation). The modules must start with "ZZ".∙MV45AFZZ and MV45EFZ1For entering installation-specific FORM routines and for using user exits, which may be required and can be used if necessary. These program components are called up by the modules in MV45AOZZ or MV45AIZZ.User exits in the program MV45AFZZThe user exits which you can use for modifications in sales document processing are listed below.∙USEREXIT_DELETE_DOCUMENTThis user exit can be used for deleting data which was stored in a separate table during sales document creation, for example, if the sales document is deleted.For example, if an additional table is filled with the name of the person in charge (ERNAM) during order entry, this data can also be deleted after the sales order has been deleted.The user exit is called up at the end of the FORM routine BELEG_LOESCHEN shortly before the routine BELEG_SICHERN.∙USEREXIT_FIELD_MODIFICATIONThis user exit can be used to modify the attributes of the screen fields.To do this, the screen fields are allocated to so-called modification groups 1 - 4 and can be edited together during a modification in ABAP. If a field has no field name, it cannot be allocated to a group.The usage of the field groups (modification group 1-4) is as follows:∙Modification group 1: Automatic modification with transaction MFAW∙Modification group 2: It contains 'LOO' for step loop fields∙Modification group 3: For modifications which depend on check tables or on other fixed information∙Modification group 4: is not usedThe FORM routine is called up for every field of a screen. If you require changes to be made, you must make them in this user exit.This FORM routine is called up by the module FELDAUSWAHL.See the Screen Painter manual for further information on structuring the interface.∙USEREXIT_MOVE_FIELD_TO_VBAKUse this user exit to assign values to new fields at sales document header level. It is described in the section "Transfer of the customer master fields into the sales document".The user exit is called up at the end of the FORM routine VBAK_FUELLEN.∙USEREXIT_MOVE_FIELD_TO_VBAPUse this user exit to assign values to new fields at sales document item level. It is described in the section "Copy customer master fields into the sales document".The user exit is called up at the end of the FORM routine VBAP_FUELLEN.∙USEREXIT_MOVE_FIELD_TO_VBEPUse this user exit to assign values to new fields at the level of the sales document schedule lines.The user exit is called up at the end of the FORM routine VBEP_FUELLEN.∙USEREXIT_MOVE_FIELD_TO_VBKDUse this user exit to assign values to new fields for business data of the sales document. It is described in the section "Copy customer master fields into sale s document" .The user exit is called up at the end of the FORM routine VBKD_FUELLEN.∙USEREXIT_NUMBER_RANGEUse this user exit to define the number ranges for internal document number assignment depending on the required fields. For example, if you want to define the number range depending on the sales organization (VKORG) or on the selling company (VKBUR), use this user exit.The user exit is called up in the FORM routine BELEG_SICHERN.∙USEREXIT_PRICING_PREPARE_TKOMKUse this user exit if you want to include and assign a value to an additional header field in the communication structure KOMK taken as a basis for pricing.∙USEREXIT_PRICING_PREPARE_TKOMPUse this user exit if you want to include or assign a value to an additional item field in the communication structure KOMP taken as a basis for pricing.∙USEREXIT_READ_DOCUMENTYou use this user exit if further additional tables are to be read when importing TA01 or TA02. The user exit is called up at the end of the FORM routine BELEG_LESEN.∙USEREXIT_SAVE_DOCUMENTUse this user exit to fill user-specific statistics update tables.The user exit is called up by the FORM routine BELEG-SICHERN before the COMMIT command.NoteIf a standard field is changed, the field r185d-dataloss is set to X. The system queries this indicator at the beginning of the safety routine. This is why this indicator must also be set during the maintenance of user-specific tables that are also to be saved.∙USEREXIT_SAVE_DOCUMENT_PREPAREUse this user exit to make certain changes or checks immediately before saving a document. It is the last possibility for changing or checking a document before posting.The user exit is carried out at the beginning of the FO RM routine BELEG_SICHERN.User exits in the program MV45AFZA∙USEREXIT_MOVE_FIELD_TO_KOMKDUse this user exit to include or assign values to additional header fields in the communication structure KOMKD taken as a basis for the material determination. This is described in detail in the section "New fields for material determination".∙USEREXIT_MOVE_FIELD_TO_KOMPDUse this user exit to include or assign values to additional item fields in the communication structure KOMPD taken as a basis for the material determination. This is described in detail in the section "New fields for material determination".∙USEREXIT_MOVE_FIELD_TO_KOMKGUse this user exit to include or assign values to additional fields in the communication structure KOMKG taken as a basis for material determination and material listing. This is described in detail in the section "New fields for listing/exclusion".∙USEREXIT_MOVE_FIELD_TO_KOMPGUse this user exit to include or assign values to additional fields in the communication structure KOMPG taken as a basis for material determination and material listung. This is described in detail in the section "New fields for listing/exclusion".∙USEREXIT_REFRESH_DOCUMENTWith this user exit, you can reset certain customer-specific fields as soon as processing of a sales document is finished and before the following document is edited.For example, if the credit limit of the sold-to party is read during document processing, in each case it must be reset again before processing the next document so that the credit limit is not used for the sold-to party of the following document.The user exit is executed when a document is saved if you leave the processing of a document with F3 or F15.The user exit is called up at the end of the FORM routine BELEG_INITIALISIEREN.User-Exits in program MV45AFZB∙USEREXIT_CHECK_XVBAP_FOR_DELETIn this user exit, you can enter additional data for deletion of an item. If the criteria are met, the item is not deleted (unlike in the standard system).∙USEREXIT_CHECK_XVBEP_FOR_DELETIn this user exit, you can enter additional data for deletion of a schedule line. If the criteria are met, the schedule line is not deleted (unlike in the standard system).∙USEREXIT_CHECK_VBAKThis user exit can be used to carry out additional checks (e.g. for completion) in the document header. The system could, for example, check whether certain shipping conditions are allowed for a particular customer group.∙USEREXIT_CHECK_VBAPThis user exit can be used to carry out additional checks (e.g. for completion) at item level.∙USEREXIT_CHECK_VBKDThe user exit can be used to carry out additional checks (e.g. for completion) on the business data in the order.∙USEREXIT_CHECK_VBEPThis user exit can be use to carry out additional checks (e.g. for completion) on the schedule line. During BOM explosion, for example, you may want certain fields to be copied from the main item to the sub-items (as for billing block in the standard system).∙USEREXIT_CHECK_VBSNYou can use this user exit to carry out additional checks (e.g. for completion) on the serial number.∙USEREXIT_CHECK_XVBSN_FOR_DELET In this user exit, you can enter additional criteria for deletion of the serial number. If the criteria are m et, the serial number is not deleted (unlike in the standard system).∙USEREXIT_FILL_VBAP_FROM_HVBAPYou can use this user exit to fill additional fields in the sub-item with data from the main item.∙USEREXIT_MOVE_FIELD_TO_TVCOM_HYou can use this user exit to influence text determination for header texts. For example, you can include new fields for text determination or fill fields that already exist with a new value.∙USEREXIT_MOVE_FIELD_TO_TVCOM_IYou can use this user exit to influence text determination for item texts. For example, you can include new fields for text determination or fill fields that already exist with a new value.∙User-Exits for product allocation:The following user exits all apply to structure COBL, in which the data for account determination is copied to item level.∙USEREXIT_MOVE_FIELD_TO_COBLOption to include new fields in structure COBL.∙USEREXIT_COBL_RECEIVE_VBAKOption to assign values from the document header to the new fields.∙USEREXIT_COBL_RECEIVE_VBAPOption to supply values from the item to the new fields.∙USEREXIT_COBL_SEND_ITEMA changed field can be copied from the structure into the item. You could use the user exit to display a certain field in the account assignment block (see also MV45AFZB).∙USEREXIT_COBL_SEND_HEADERA changed field can be copied from the structure to the header (see source text MV45AFZB)∙USEREXIT_SOURCE_DETERMINATIONYou can use this user exit to determine which plant will be used for the delivery. In the standard system, the delivering plant is copied from the customer master or thecustomer-material info record. If you want to use a different rule, then you must enter it in this user exit.∙USEREXIT_MOVE_FIELD_TO_ME_REQWith this user exit you can include additional fields for the following fields:∙EBAN (purchase requisition)∙EBKN (purchase requisition-account assignment)∙USEREXIT_GET_FIELD_FROM_SDCOMOption to include new fields for the variant configuration. Fields that are included in structure SDCOM can be processed and then returned to the order.∙USEREXIT_MOVE_WORKAREA_TO_SDWAYou can use this user exit to format additional work areas for the variant configuration. You will find notes on the user exit in MV45AFZB.∙User-Exits for first data transfer:The following user exits can only be used for the first data transfer.NoteOnly use the user exits if the names/fields do NOT have the same name.∙USEREXIT_MOVE_FIELD_TO_VBAKKOMOption to include additional fields in structure VBAKKOM (communiction fields for maintaining the sales document header)∙USEREXIT_MOVE_FIELD_TO_VBAPKOMOption to include additional fields in structure VBAPKOM (communication fields for maintaining a sales item)∙USEREXIT_MOVE_FIELD_TO_VBEPKOMOption to include additional fields in structure VBEPKOM (communication fields for maintaining a sales document schedule line)∙USEREXIT_MOVE_FIELD_TO_VBSNYou can use this user exit to include fields in structure VBSN (scheduling agreement-related change status).∙USEREXIT_MOVE_FIELD_TO_KOMKHYou can use this user exit to include new fields for batch determination (document header).∙USEREXIT_MOVE_FIELD_TO_KOMPHYou can use this user exit to include new fields for batch determination (document item).∙USEREXIT_CUST_MATERIAL_READYou can use this user exit to set another customer number in the customer material info record (e.g. with a customer hierarchy)∙USEREXIT_NEW_PRICING_VBAPOption for entry of preconditions for carrying out pricing again (e.g. changes made to a certain item field could be used as the precondition for pricing to be carried out again). Further information in MV45AFZB.∙USEREXIT_NEW_PRICING_VBKDOption for entry of preconditions for carrying out pricing again (e.g. changes to the customer group or price group could be set as the preconditions for the system to carry out pricing again). Further information in MV45AFZB.∙User-Exits in Program MV45AFZD∙USEREXIT_CONFIG_DATE_EXPLOSIONThe BOM is exploded in the order with the entry date. You can use this user exit to determine which data should be used to explode the BOM (explosion with required delivery date, for example).User exits in the program FV45EFZ1∙USEREXIT_CHANGE_SALES_ORDERIn the standard SAP R/3 System, the quantity and confirmed date of the sales document schedule line is changed automatically if a purchase requisition is allocated, and it or the sales document is changed (for example, quantity, date).If you want to change this configuration in the standard system, you can define certain requirements in order to protect your sales orders from being changed automatically. Use this user exit for this purpose. Decide at this point whether the schedule lines are to be changed.User-Exits in Program RV45PFZA∙USEREXIT_SET_STATUS_VBUKIn this user exit you can you can store a specification for the reserve fields in VBUK (header status). Reserve field UVK01 could, for example, be used for an additional order status (as for rejections status, etc.).The following workareas are available for this user exit:∙VBUK (header status)∙FX VBUP (item status)∙FX VBUV (Incompletion)∙USEREXIT_SET_STATUS_VBUPIn this user exit you can you can store a specification for the reserve fields for VBUP (item status).The following workareas are available for this user exit:∙FX VBAP (Item data)∙FX VBAPF (Dynamic part of order item flow)∙FX VBUV (Incompletion)∙USEREXIT_STATUS_VBUK_INVOICEYou can use this user exit to influence billing status at header level.User exits in the screensAdditional header data is on screen SAPMV45A 0309, additional item data on screen SAPMV45A 0459. These screens contain the Include screens SAPMV45A 8309 orSAPMV45A 8459 as user exits.Fields which are also to be included in the sales document for a specific installation should be included on the Include screens for maintaining. If an application-specific check module is needed for the fields, this can be included in the Include MV45AIZZ. The module is called up in the processing logic of the Include screens.For field transports, you do not have to make changes or adjustments.ExampleA new field, VBAK-ZZKUN, should be included in table VBAK.If the check is defined via the Dictionary (fixed values or check table) the field must be included with the fullscreen editor in the Include screen SAPMV45A 8309. In this case, no change has to be made to the processing logic.User Exits in Program MV45AFZ4∙USEREXIT_MOVE_FIELD_TO_KOMKYou can use this user exit to add or edit additional header fields in the communication structure - KOMK- for free goods determination. For more information, see the New Fields for Free Goods Determination IMG activity.∙USEREXIT_MOVE_FIELD_TO_KOMPYou can use this user exit to add or edit additional item fields in the communication structure KOMP for free goods determination. For more information see the New Fields for Free Goods Determination IMG activity.User Exits in the SAPFV45PF0E and SAPFV45PF0C Programs ∙EXIT_SAPFV45P_001You can use this user exit to decide whether intercompany billing data is used in the profitability segment for cross-company code sales, or whether the data comes from external billing (external customer, sales data from the selling company code.。

统一SAP财务增强

统一SAP财务增强

S A P财务增强的统一规划作者:付鸿杰集团在实施和推广ERP大都会采用统一和集中原则,然而,由于集团业务庞杂,ERP统一和集中曲折之路往往难以避免,下面以实例简单介绍下SAP财务增强统一规划和管理思路。

一、用户增强简介SAP系统预留有3类增强:菜单增强(Menu ENTRY)、屏幕增强(SubScreen)和功能增强(Function Enhancement),顾名思义,屏幕增强,就是诸如采购订单、资产卡片或内部订单等主数据允许客户化子屏幕和相应辅助字段,扩展分析维度;而功能增强就是在事务码(Transaction Code,简称Tcode)对应标准程序中留下出口,允许用户插入自定义逻辑代码,因此这类增强亦称用户出口(User Exit)。

二、理解FICO增强FICO模块也有自己特定的增强,财务增强分为两类:替代(Substitution)和有效性检查(Validation),替代允许根据用户逻辑替换会计凭证字段的原始内容,例如,当FICO标准凭证生成功能无法满足集团对会计核算的明细需求时,就可使用替代将相应辅助核算信息填充完整,对无法手工干预的自动会计凭证来讲,替代尤为重要;而有效性检查则是根据核算需求对会计凭证内容进行“完整性”检查,预先避免不完整的核算数据进入系统形成垃圾信息。

常用的FICO增强Tcode如下:GGB0(全部有效性检查)/OB28/OKC7 :FI/CO有效性检查GGB1(全部替代)/OBBH/OKC9: FI/CO替代财务增强有特定执行顺序,不妨假设检查某核算字段内容缺失时报告错误,如果检查优先执行,则可能因内容确实报告错误,事务直接终止,而实际上该核算内容是启用替代来填入的,信息并不缺失,不应报告错误,由此推断,替代显然应该优先执行。

无论替代还是有效性检查最后都形成代码,从技术角度来看,任何管理软件无非是代码+数据库表的集合,而从代码角度,替代和有效性检查的区别仅仅在于替代可以替换内容,而检查不能,如果替代代码中只做检查,它就是有效性检查,简单理解,就是替代功能>有效检查功能,因此,财务增强统一只注重替代的统一就足够。

SAP用户登录增强

SAP用户登录增强

SAP用户登录增强对用户GUI登录有效,但对RFC访问登录(例如JCO)无效。

增强类型是CMOD/SMOD,增强出口(exit)是SUSR0001。

一、增强操作步骤1.tcode smod,”加强” 输入SUSR0001,”对象组件”选择”组件”,点击“修改”。

2.双击功能模块名”EXIT_SAPLSUSF_001″3.FUNCTION EXIT_SAPLSUSF_001中已有代码”INCLUDE ZXUSRU01″.在se80下,创建INCLUDE ZXUSRU01。

4.在ZXUSRU01中输入需要的代码5.激活增强。

在tcode smod,”加强” 输入SUSR0001,点击”测试”.选择EXIT_SAPLSUSF_001,激活。

二、增强登录数据获取在ZXUSRU01中可输入需要的代码,控制登录动作。

常见数据获取:当前登录用户的用户名:SY-UNAME当前登录用户的IP:CALL METHODCL_GUI_FRONTEND_SERVICES=>GET_IP_ADDRESS当前的全部登录:TABLE UINFO三、登录增强代码示例以下代码完成用户IP限定,即只允许用户TESTUSER从IP192.168.0.1登录,否则提示没有权限并中断登录。

DATA: IP TYPE STRING,COUNT TYPE I.CALL METHOD CL_GUI_FRONTEND_SERVICES=>GET_IP_ADDRESSRECEIVINGIP_ADDRESS = IP.IF SY-UNAME = …TESTUSER‟ AND IP <> …192.168.0.1′.MESSAGE E157(00).ENDIF.四、注意1.此增强只能拦截GUI登录,不能拦截RFC登录。

我还没找到RFC登录的Exit?谁知道请指教一二。

2.增强只有激活后,才生效。

操作见前面的步骤5.3.建立ZXUSRU01后,可以直接双击FUNCTION EXIT_SAPLSUSF_001中的”INCLUDE ZXUSRU01″进入编辑。

SAP常见问题与解决办法(转)

SAP常见问题与解决办法(转)

SAP常见问题与解决办法(转)1.A:在公司代码分配折旧表时报错?在公司代码分配折旧表时报错,提⽰是“3000 的公司代码分录不完全-参见长⽂本”希望各位⼤侠帮我看看。

3000 的公司代码分录不完全-参见长⽂本R: a.你把零进项税的代码分配给这个公司代码就可以了 .没有指定⾮税代码,OBCLb.据此可能company code 设置有问题,检查⼀下OBY62.a,维护客户科⽬组:财政供应链管理->现⾦和流转情况管理->现⾦管理->主数据->⼦分类帐科⽬->客户控制->维护客户科⽬组b,创建客户帐户编号范围:财务会计->应收帐⽬和应付帐⽬->客户帐户->主数据->创建客户主记录的准备->创建客户帐户编号范围c,对客户帐户组分配编号范围: 财务会计->应收帐⽬和应付帐⽬->客户帐户->主数据->创建客户主记录的准备->对客户帐户组分配编号范围3.MMPV 物料数据估算期间.开物料帐.4.MMRV 允许对前期记帐.5.OX19 维护成本控制范围,把公司分配给控制范围.6.OMSY 第⼀次开物料帐可以⽤OMSY所物料帐开到当前时间,以后就⽤MMPV开物料帐.7.FBN1 会计凭证号范围. VN01 SD凭证号码范围.8.定义逻辑系统:SPRO/跨应⽤组件\预定义OLE业务处理\跨应⽤业务处理\中⼼⽤户管理\中央管理的ALE强制活动\定义逻辑系统.T-CODE:SALE\基本设置\逻辑系统9.A:我在创建总帐科⽬时,总是提⽰“损益报表科⽬类型在科⽬表 LXGJ 中未定义”,怎样做呢?谢谢!R:需要在IMG中先配置Retain Earning科⽬,OB53。

我原来也碰到过这个问题,是要先定义留存收益科⽬,科⽬类型可以填X,科⽬可以填本年利润或利润分配--未分配利润的编号,⼀般直接保存不了,你要上下滚动⼏下MOUSE的滚轮使该⾏变灰就OK了.SPRO/财务会计/总帐会计/总帐科⽬/主数据/准备/定义留存收益科⽬.10.FSPO 总帐科⽬/会计科⽬表数据,DISPLAY,EDIT,NEW11.Q:为什么不能库存记账?---急!我⽤MB1C⽤移动类型521做起初余额时,系统提⽰我该物料不可能有库存记账,按F1帮助,显⽰ “该物料不可能有库存记帐”R:從信息上看還是該種material type 的某valuation area 的 Quantity update沒有被允許,或許你還是要看看這裡.R:in the configuration of material type , you can configure a material type managed on a quantity basis.12.OMWB 配置⾃动过帐.spro/物料管理/评估和科⽬设置/科⽬确定/⽆向导的科⽬确定/配置⾃动过帐13.维护类别类别: spro/sap netweaver/base/应⽤程序链接启动(ALE)/定模和实施业务处理/主数据分配/使⽤对象类别分配/维护类别类型 OR CL01 维护类别.14.配置总帐科⽬&公司代码 FS00,更改统驭科⽬的科⽬类型"必选".SPRO/财务会计/总帐会计/总帐科⽬/主数据/准备/定义科⽬组/选择总帐科⽬组/科⽬控制/设置可选输⼊项.15.控制标识不存在:spro/控制/⼀般控制/组织结构/维护成本控制范围/基本数据/激活组件&控制标识16.估价范围 7801 还没有⽣产式的物料帐簿?R:我按照提⽰去运⾏CKMSTART17.A:帐户1304006对于业务/事件代码BSX,可直接记帐..R:FS00,(创建/银⾏/利息)/公司代码的凭证创建控制/只能⾃动记帐打上勾.18.A:⾃定义货物移动类型的屏幕格式R:SPRO/物料管理/库存管理和实际库存/收货/定义屏幕格式/选择移动类型19.A: ⼯⼚⽇历丢失或错误在⼯⼚⽇历中R: OPDD 维护⼯⼚⽇历,分配⼯⼚⽇历!20.A:删除SAP*,可以⽤SQLPLUS 连接到数据库案例:R: _delete from r01 where bname="sap*" and mandt="000";commit;21.A:VK11 物料定价没有维护存取顺序.R:SPRO/销售和分销/基本功能/定价/定价控制/定义条件表OR 定义条件类型 OR 定义存取顺序定义存取顺序要点:定义字段,先选择存取顺序,双击字段可以确定存取字段.22. A:没有⽤于售达⽅的客户主记录存在R:维护客户主数据据的/销售/定价/统计/价格组和客户定价过程23. R:1、我模仿OR订单,复制了个订单类型、发货类型、开票类型,⼜定义了⾃⼰的定价过程ZHF009,定价条件类型是K007,MWST,ZHUL(我⾃⼰定义的条件类型),在前台VA01创建订单时,订单不完整,提⽰“缺少净价”,我也没在定价过程⾥定义这个条件类型,为什么在做订单时还不出现?A: 你的定价过程缺少了VPRS或者是没有通过项⽬类别定义定价,要激活才可以带出来净价的,就是成本价啦!24.R:客户000没有对功能 ZE(销售员)定义.A:SPRO/SD/主数据/业务合作伙伴/客户/客户层次/为层次类别设置合作伙伴确定/设置客户主数据的合作伙伴确定/帐户组-功能分配/新建⼀个ZE(销售员)把功能分配给帐户组->ZSE(*销售员内部)即可.25.R:销售凭证项⽬装运中/装运点&接收点不能带到装运点对应⼯⼚.A:SPRO/后勤执⾏/装运/基本发运功能/装运点和收货点确认/选择”通过销售单据类型定义发运条件”.26.R:不⼩⼼删除了⼯⼚,发现不能确定科⽬帐户.”27.A: 我在做SD出具发票时遇到的问题我在SD中做出具发票保存时,系统提⽰“凭证 90000000 保存(帐户确定出错)”,然后我在收⼊科⽬分析中发现系统提⽰“在**确定类型KOFI没有找到总账科⽬”。

SAP_常用业务数据表2

SAP_常用业务数据表2

SAP_常用业务数据表2表的要求表中使用的字段请尽量参照各模块的SAP字段标准使用习惯;例:“ZXSLRZX销售组织对应的利润中心”中的销售组织应该使用VKORG、利润中心应该使用PRCTR。

根据表的用途,需确定是否属于配置目的、还是业务目的。

配置表的建议:需要加入MANDT字段例:“ZQJQD缺件清单”就没有MANDT字段需提供相应的维护视图;例:如ZCHECK_MM01工厂和利润中心的对应为保证DEV/QAS/PRD系统的一致性,不应该对配置表提供批量维护的功能,而应该走Request传输流程;例:“ZMM_GSJJGLJ公司间物料转卖价格逻辑”就是一个失败的开发案例。

若有必要,可激活日志功能,便于对配置的更改查询;在定义表的时候,请不要偷懒使用“预定义数据类型”这种方式;业务表的建议:若无特殊目的,也请加入MANDT字段在定义关键字段的时候,请务必慎重,在理解业务需求的前提下,合理设置;(数据存在后,关键自动的变更存在较大风险)为减少系统存储空间,一般不需要激活更改日志;在定义表的时候,请不要偷懒使用“预定义数据类型”这种方式;程序的要求程序的选择屏幕,如果需要提供缺省值,请尽量通过Memory ID的方式实现,不要使用硬代码。

例:“ZPOOIS采购订单信息报表”中的公司代码(BUK)、工厂(WRK)。

程序的选择屏幕上的选择文本,如果属于标准字段,若无特殊需求,请尽量使用Dictionary,避免造成在不同语言环境中显示错误的情况。

例:ZPOOIS的选择屏幕在英文环境下完全错误,而ZJSJSNEW就相对正确。

程序变式(选择变式、输出变式)的灵活使用ALV报表,请提供变式功能(IS_VARIANT ,I_SAVE等变量);例: ZPOOIS的输出格式就无法保存。

二次开发程序中定义的自定义表,需考虑相应数据的删除及归档策略,并应该对数据量的大小有合理的估计。

金额,请考虑币别;数量,请考虑计量单位;•公司代码与工厂的关系一个工厂只能属于一个公司代码;例:3110起重机工厂只能属于3011公司代码。

SAP 常见替代错误

SAP 常见替代错误

替代问题解决重新生成程序问题Se38: RGUGBR00 重新生成替带程序,选择项见下图:有时候,你必须运行该程序重新动态生产一下,替代/有效性检查才能将新的程序重新编译插入会计凭证总程序SAPMF05A, 特别当你使用出口替代时,必需的! 现在假设出现错误.双击红色部分,可以看到详细信息.显示user exit ZP01不存在, 就是OBBH/OB28有效性检查/替代中宣布了出口ZP01,但是在RGGBS000(Tcode:GCX2中定义)中却没有定义,因此程序不能激活.检查方式:注意以下3个替代表GB921T:替代/各步骤描述GB921:替代/各步骤条件GB922:替代/各步骤被替代的内容SE16:GB922 输入ZP01查找出其对应替代名称,见下图:可以发现替代ZSHSC01这个替代用到错误的替代出口ZP01, 而且注意到其是AM模块的替代.Tcode:GGB1查看所有各模块的替代(GGB0查看所有的有效性检查),发现替代ZSHSC01步骤001使用了出口例程ZP01, 可以直接使用GGB1查看,当系统替代太多实, 才使用上面的表先快速定位, 见下图:双击退出程序ZP01,发现RGGBS000替代/有效性检查总程序中根本找不到该子例程, 因此需要删除该替代ZSHSC01下的步骤001 .将所有错误的替代步骤删除, 有效性检查错误同样处理,有效性检查请查看GB93* !为什么替代不生效?显然,俺对这个研究太深了,首先,你应该Se38: RGUGBR00,如果还不生效,请检查相关动态程序的子例程EXP_T AB_008_BKPF/ EXP_T AB_009_BSEG中的临时结构是否包含被替代的字段。

请参考:/pages/sapguru/blog/archive/2009/04/07/353528.aspx如果不包括,则替代不成功,几乎所有的会计凭证内容都可被替代,包括科目甚至金额(绝对要小心),当然这难度系数大点,这种设计思路值得ERP设计者借鉴。

user exit原理及查找方法

user exit原理及查找方法

查找user-exits的方法:1.在IMG中查找各个module下系统提供的exits2.通过cmod/smod查找3.在需要扩展出口的系统标准程式中查找源代码,通过exits的调用原理来找4.Debug源代码来查找5.SE84,输入Develop class查找6.查找BADI的源码特性: CALL METHOD cl_exithandler=>get_instance/sap-books.htmA Short T utorial on User ExitsContent Author:AbhishekUser exits :1. Introduction2. How to find user exits3. Using Project management of SAP Enhancements1. Introduction:User exits (Function module exits) are exits developed by SAP. The exit is implementerd as a call to a functionmodule. The code for the function module is writeen by the developer. You are not writing the code directly in the function module, but in the include that is implemented in the function module.The naming standard of function modules for functionmodule exits is:EXIT_<program name><3 digit suffix>The call to a functionmodule exit is implemented as:CALL CUSTOMER.-FUNCTION <3 digit suffix>Example:The program for transaction VA01 Create salesorder is SAPMV45AIf you search for CALL CUSTOMER-FUNCTION i program (SAP提供的源代碼掃描程序:RPR_ABAP_SOURCE_SCAN)SAPMV45A you will find ( Among other user exits):CALL CUSTOMER-FUNCTION '003'exportingxvbak = vbakxvbuk = vbukxkomk = tkomkimportinglvf_subrc = lvf_subrctablesxvbfa = xvbfaxvbap = xvbapxvbup = xvbup.The exit calls function module EXIT_SAPMV45A_0032. How to find user exits?(1) Display the program where you are searching for and exit and search for CALL CUSTOMER-EXIT(2) If you know the Exit name, go to transaction CMOD.(3) Choose menu Utillities->SAP Enhancements. Enter the exit name and press enter.You will now come to a screen that shows the function module exits for the exit.3. Using Project management of SAP Enhancements, we want to create a project to enahance trasnaction VA01 .- Go to transaction CMOD- Create a project called ZVA01- Choose the Enhancement assign radio button and press the Change buttonIn the first column enter V45A0002 Predefine sold-to party in sales document.Note that an enhancement can only be used in 1 project. If the enhancement is already in use, and error message will be displayedPress SavePress Components. You can now see that enhancement uses user exitEXIT_SAPMV45A_002. Double click on the exit.Now the function module is displayed. Double click on include ZXVVAU04 in the function moduleInsert the following code into the include: E_KUNNR = '2155'.Activate the include program. Go back to CMOD and activate the project.Goto transaction VA01 and craete a salesorder.Note that Sold-to-party now automatically is "2155"Field exits (SMOD/CMOD) Questions and Answers1. Field exit was created with CMOD, but is not processed when calling the screen.- Since the field exit is not processed until PAI, an action must be triggered on the screen (Return, Save, ...).- Set profile parameter abap/fieldexit to YES and restart the system.- After activating the function module FIELD_EXIT... and the field exit, leave the transaction on whose screen the field exit is to be executed. The screen is not generated until the transaction is started.- Do not work on different application servers since there may be some delay before the field exit is activated.- The profile parameter must be set on all or none of the application servers.- If the field exit is to only be active on specific screens, check whether you chose the correct program and the correct screennumber (take care with subscreens).- Using SE51 -> Field list, check that the screen field does have a reference to a data element. In the name of the field exit use the name of the data element and not the field name.- After transport, field exits are marked as active but will not be processed.Tip: First try deactivating the field exit once more and then afterwards, activate it again.2. How is performance affected by setting abap/fieldexit?- If a screen is generated and the profile parameter is set, a check is run on 2 tables (TDDIR, TDDIRS) to see whether a field exit must be generated for the respective field. In practice, the screen load is not generated until the screen is selected after anupdate. The user should not notice any difference because screen generation is very fast.3. Can you read the contents of other screen fields in the field exit?- In principle, every field exit can store its value in the global variables of the function group (TOP) and hence make themavailable to other field exits. Note here that field exits are always called and not only if an entry is made in the field or if the field is empty. In addition, it is not possible to make any assumptions about the order in which the field exits will be called in the future.4. How does the field exit behave on step loop fields ?- After the user has entered data, the field exit is called in PAI as often as there are visible fields in the step loop. The systemvariable SY-STEPL is incremented each time. If a new value is assigned to the field, it is displayed in the module between LOOP and ENDLOOP. This module is also called once for each visible step loop line.5. Can field exits be debugged ?- No. Field exits must be tested separately in the ABAP/4 Development Workbench. For errors which only occur in the screen environment, it is helpful to write interesting variable to the file system using TRANSFER... . These can then be analysed there.6. What can you do if the field contents are no longer transported to to ABAP/4.- Check whether a value is assigned to the field OUTPUT.7. When is the field exit called if a conversion exit is attached to thedata element ?- The field exit is called after the conversion exit. This means that the INPUT field receives the data in the same format as theABAP/4 program also receives it.8. Although a global field exit is inactive, a function module is called which does not exist (for example FIELD_EXIT_PROGRAMM_@)- This is an error in the kernel which no longer occurs as of 3.0C. As a temporary measure, it is useful to assign a program and a screen which do not exist to the field exit and then activate the field exit.9. Field exit is not visible in CMOD, although created.- If you want to create a field exit for a data element, a function module is proposed with the name FIELD_EXIT_. Thisfunction module must exist for the field exit to work. If you do not create this function module, but do create one with a suffix,the data element is not displayed in CMOD.10. Field exit is not executed although it is active.- Fields which do not have the 'Input field' attribute usually do not trigger a field exit. The field exit is designed to allow anextended input check. It is therefore only called for input fields - even if they are not ready for input at runtime of the application by LOOP AT SCREEN.This rule does not apply, however, if the field is located within a steploop. Here the field will be always activated, even if it isinvisible.- Field exits can only be executed for fields that are directly related tothe dictionary. If the relation is indirect, i.e. via an ABAP declaration ( LIKE ), no field exit can be executed.11. Field exits on check buttons do not work- Field exits are only intended for input fields. As check buttons count as graphical elements, you cannot install field exits onthem.12. Field exits do not work on selection screensFinding the user-exits of a SAP transaction code** Finding the user-exits of a SAP transaction code** Enter the transaction code in which you are looking for the user-exit* and it will list you the list of user-exits in the transaction code.* Also a drill down is possible which will help you to branch to SMOD.** Written by : SAP Basis, ABAP Programming and Other IMG Stuff*/*report zuserexit no standard page heading.tables : tstc, tadir, modsapt, modact, trdir, tfdir, enlfdir.tables : tstct.data : jtab like tadir occurs 0 with header line.data : field1(30).data : v_devclass like tadir-devclass.parameters : p_tcode like tstc-tcode obligatory.select single * from tstc where tcode eq p_tcode.if sy-subrc eq 0.select single * from tadir where pgmid = 'R3TR'and object = 'PROG'and obj_name = tstc-pgmna.move : tadir-devclass to v_devclass.if sy-subrc ne 0.select single * from trdir where name = tstc-pgmna.if trdir-subc eq 'F'.select single * from tfdir where pname = tstc-pgmna.select single * from enlfdir where funcname =tfdir-funcname.select single * from tadir where pgmid = 'R3TR'and object = 'FUGR'and obj_name eq enlfdir-area.move : tadir-devclass to v_devclass.endif.endif.select * from tadir into table jtabwhere pgmid = 'R3TR'and object = 'SMOD'and devclass = v_devclass.select single * from tstct where sprsl eq sy-langu andtcode eq p_tcode.format color col_positive intensified off.write:/(19) 'Transaction Code - ',20(20) p_tcode,45(50) tstct-ttext.skip.if not jtab[] is initial.write:/(95) sy-uline.format color col_heading intensified on.write:/1 sy-vline,2 'Exit Name',21 sy-vline ,22 'Description',95 sy-vline.write:/(95) sy-uline.loop at jtab.select single * from modsaptwhere sprsl = sy-langu andname = jtab-obj_name.format color col_normal intensified off.write:/1 sy-vline,2 jtab-obj_name hotspot on,21 sy-vline ,22 modsapt-modtext,95 sy-vline.endloop.write:/(95) sy-uline.describe table jtab.skip.format color col_total intensified on.write:/ 'No of Exits:' , sy-tfill.else.format color col_negative intensified on.write:/(95) 'No User Exit exists'.endif.else.format color col_negative intensified on.write:/(95) 'Transaction Code Does Not Exist'.endif.at line-selection.get cursor field field1.check field1(4) eq 'JTAB'.set parameter id 'MON' field sy-lisel+1(10).call transaction 'SMOD' and skip first screen. *---End of Program。

SAP技术名词

SAP技术名词

1.MIGO(事务代码)---是物料移动,收货,消耗等的集成例如MB1A(输入发货)、MB1C(输入其他收货)、MB31(按订单收货)的功能;可以做采购入库、入库取消、退货、后续调整(如委外加工等)2.Dynpro程序开发:SAP 为Web Dynpro提供两种开发语言:ABAP和Java,于是就有了Web Dynpro for ABAP 和Web Dynpro for Java。

Web Dynpro采用了一种高级的MVC / Data Binding 架构模式,并且提供非常友好的编程界面。

Web 界面可以使用拖拉的形式进行开发。

由于Web Dynpro运行于SAP NetWeaver平台,该平台在传统Dynpro开发上的优势也被使用的淋漓尽致。

使用Web Dynpro可以非常迅速的开发出企业级的应用程序,开发者只需要关注其业务流程,关于版本管理、质量控制、发布、性能等内容仍然由NetWeaver平台帮助完成。

SAP WEB Dynpro的实例包:Package:SWDP_TEST 里面有很多实例,可供学习。

3.Report(报表)---报表程序的主要作用是从数据库中抓取数据通过整理陈列出来,给企业高层或具有相关需求的人员查看。

如无特殊需求,此类程序一般不需客制screen、menu、title。

报表主要有一下几类:A、ABAP LIST(最简单的一种报表程序,显示在屏幕上的数据及格式都通过ABAP中的WRITE语句实现,开发工具:SE38)B、ALV REPORT(属于报表的一种高级形式,显示出来的报表整洁美观,具有很大的交互功能,屏幕上的数据及格式主要通过系统的FUNCTION实现,开发工具:SE38)C、SAPSCRIPT(属于商务报表,主要应用于商业用途或对外的报表设计,开发工具:SE38、SE71)D、SMARTFORM (属于商务报表,主要应用于商业用途或对外的报表设计,是SAPSCRIPT的升级版,包含了SAPSCRIPT的绝大多数功能,但开发起来比SAPSCRIPT更方便,快捷。

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
包括:A 功能模块出口(Function Module Exit)
• • • • •
B 屏幕出口(Screen Exit) C 菜单出口(Menu Exit) D 字段出口 (Field Exit) 第三代:采用面向对象方式实现的出口(BADI) 另:模块独有的出口(BTE会计模块专有,需要修 改R3代码)
注意事项
• 一个出口可能被多个事务调用,请注意指定 被哪个事务调用。 • 注意出口的参数是否满足业务需求,如果参 数不满足要求,请继续寻找下一个出口。
• 请注意出口执行的时间点。
出口的目的
功能出口(Function Exit) • 在标准事务运行中的某点添加业务逻辑。一般用于验证标准事 务中的字段。
屏幕出口(Screen Exit) • 为标准事务添加子屏幕。 菜单出口 (Menu Exit) • 使能或屏蔽标准事务的菜单栏。 字段出口 (Field exits) • 根据数据元素验证标准事务的某些屏幕字段。
Press Execute
Execute
Press create to create your function module and activate
现在再次回到SE38,执行RSMODPRF,但不输入数据元 素。
Execute
BADI
• 寻找BADI的方法一 1、badi对象的信息存储在SXS_INTER, SXC_EXIT, SXC_CLASS 和 SXC_ATTR 这四个表中(参见SECE包); 2、sap程序都会调用cl_exithandler=>get_instance来判断对象是否存 在,并返回实例;其实get_instance就是对上述几个表和他们 的视图(V_EXT_IMP 和 V_EXT_ACT)进行查询和搜索。 3、基于这个机理,查用ST05来监控一个TCODE来跟踪,然后选择 查找有关上述几个表和视图的操作,就可获得相关BADI。
STEP VI
STEP VII
另一个找功能出口的方法
• 转到SE38,输入程序名称,点击菜单utilities->find in source code • 搜索Call customer • 找到出口后双击进入。
Press Enter
Dbl click
Required Screen
Dbl Click
Required Screen
• 然后转到SMOD进行搜索(见前面步骤Step I和步骤 Step II)
开发程序查找用户出口
使用已有程序查找出口,详见附件。
find user exits.txt.txt
怎样找屏幕出口
• 如上述STEP I和STEP II所示到SMOD找。
Dbl click
什么是用户出口(User Exits)
R3标准事务中无法满足用户独特的需求,需要做二次增 强开发。
目的:
• 不需要修改R3标准事务代码就能增强R3的功能 • 当系统升级时,原有增强得以保留下来,不需要重新 开发。
用户出口的分类
• • •

三代用户出口: 第一代:固有的FM,需要修改R3代码,现已很少 用。 第二代:也是通过FM的方式。
例子
事务码 CO11N. 需求 • 添加一个新的子屏幕,让用户输入人力资源 (HR)数据并保存倒标准数据库表中,然后 在COOIS事务中展现出来。 • 验证执行日期字段(Execution start date)不能 超过从今天起的一个星期。
CO11N Standard Screen
Required Screen
BADI

1. 2. 3. 4.
寻找BADI的方法二
使用SE24进入Class Builder。 查看对象CL_EXITHANDLER,进入其get_instance 方法。 对get_class_name_by_interface设置断点。 Debug需要增强的事务,在断点处查看class_name即 可找到对应的BADI
STEP II Press Display Or Change
If it is not there create the new parameter
Check the parameter value
Press
保存Profile后返回
• 现在返回标准事务,取得数据元素和屏幕名称,屏幕号。 • 假设我们使用 CS03
Click
Here

CMOD
字段出口(Field Exit)
• 转到事务RZ10,在instance profile中检查abap/fieldexit 参数是否为yes. • 然后转到标准事务,取得数据元素,屏幕名称,和屏 幕号。 • 转到SE38,执行RSMODPRF。
Click
STEP I Transaction code RZ10
寻找功能出口(Function Exit)
• 首先取得标准事务对应的程序名称。 • 然后到SE38,取得程序对应的包名。(Package Name)
STEP I Tcode SMOD
STEP II
STEP III
Dbl click
STEP IV
Dbl click
STEP V
Dbl click
相关文档
最新文档