SAP开发SD相关的增强BADIWord下载.docx
- 文档编号:20952285
- 上传时间:2023-01-26
- 格式:DOCX
- 页数:101
- 大小:70.76KB
SAP开发SD相关的增强BADIWord下载.docx
《SAP开发SD相关的增强BADIWord下载.docx》由会员分享,可在线阅读,更多相关《SAP开发SD相关的增强BADIWord下载.docx(101页珍藏版)》请在冰豆网上搜索。
这类增强都需要修改sap的标准代码。
示例:
USEREXIT..inSAPMV45A
2、第二代
sap提供的是CUSTOMER-FUNCTION,它是通过SMOD和CMOD完成实现。
参见我的
3、第三代
sap提供的第三代的用户出口就是BADI,他的调用方式是CALLMETHOD(instance),(相关的TCODE是SE18和SE19),你可以通过EXIT_HANDLER这个单词查找BADI。
另外还有一种出口叫BTE
相关TCODE:
FIBF
BusinessTransactionEvents(OpenFI)
TheOpenFIenhancementtechniquewasdevelopedintheFinancialAccountingcomponent.OpenFIisbaseduponthefollowingprinciples:
Applicationdevelopersmustdefinetheirinterfaceinafunctionmodule,anassignmenttableisreadintheaccompanying(generated)code,andthecustomermodulesassignedarecalleddynamically.
Thistechniquedifferentiatesbetweenenhancementsthatareonlyallowedtohaveoneimplementationandenhancementsthatcancallmultipleimplementationsinanysequencedesired.Bothindustry-specificandcountry-specificenhancementsmaybedefined.
TheconceptsbehindtheBusinessAdd-InsenhancementtechniqueandOpenFIarebasicallythesame.However,thetwoenhancementtechniquesdodifferfromeachotherinthefollowingpoints:
∙OpenFIcanonlybeusedtomakeprogramenhancements,thatis,youcanonlyenhancesourcecodeusingOpenFI.YoucannotenhanceuserinterfaceelementswithOpenFIlikeyoucanwithBusinessAdd-Ins.
∙OpenFIassumesthatenhancementwillonlytakeplaceonthreelevels(SAP-partners-customers),whereaswithBusinessAdd-Insyoucancreateandimplementenhancementsinasmanysoftwarelayersasyoulike.
∙OpenFIusesfunctionmodulesforprogramenhancements.WithBusinessAdd-Ins,ABAPObjectsisusedtoenhanceprograms.
如何使用SMOD和CMOD进行SD的用户增强
1、关于增强的简单介绍
1.1
SMOD包含具体的增强,而CMOD是包含一组SMOD编写的增强.
1.2Userexits(Functionmoduleexits)是sap提供出口,它的命名规则如下:
EXIT_<
programname>
<
3digitsuffix>
sd的VA01事务,对应的程序是SAPMV45A,你会在程序里查到(用CALLCUSTOMER-FUNCTION字符串)如下代码:
CALLCUSTOMER-FUNCTION'
003'
exporting
xvbak
=vbak
xvbuk
=vbuk
xkomk
=tkomk
importing
lvf_subrc=lvf_subrc
tables
xvbfa=xvbfa
xvbap=xvbap
xvbup=xvbup.
则exitcallsfunctionmodule的名称就是:
EXIT_SAPMV45A_003
2、先试用SMOD建立一个SAP增强
2.1、选择一个增强,如:
SDVFX001
,点击修改,进入sap增强维护屏幕;
2.2、点击“组件”按钮,进入组件维护屏;
2.3、将光标移到“功能模块名”,输入模块名,如:
EXIT_SAPLV60B_001;
2.4、选择“代码修改”按钮进入函数模块;
2.5、双击函数模块的包含单元,进入包含单元加入自定义代码并激活保存;
3、使用CMOD建立增强项目
3.1、输入自定义的项目名,点击“创建”;
3.2、进入增强项目,选择“配置增强”,进入增强配置屏幕;
3.3、输入增强名如:
SDVFX001
3.4、保存,并退出;
4、使用CMOD将增强项目激活,便大工告成。
如何查找
*判断是否存在相应增强的定义(SMOD)
selectsinglenamefrommodsapaintomod0-name
wherename
='
PPCO0002'
.
ifsy-subrc=0.
endif.
selectsingle*fromtadirintops_tadir_db
wherepgmid
=
'
R3TR'
and
object
SMOD'
obj_name
*判断是否存在相应增强项目的定义(CMOD)
SELECTSINGLEnameFROMMODATTRintomod0-name
WHERENAME
..
*提取增强的定义的组件(可以用此反查增强定义)
select*frommodsap
wherename='
*判断该增强是否移植到BADI实现
*Enhancement&
hasalreadybeenmigratedinBusinessAdd-Indefinition
selectsinglemigratedbadi_def
into(migrated,exit_name)
frommodsapawherename=modname.
ifsy-subrc=0andmigrated=seex_true.
messages621withmodnameexit_name.
checkmodene'
CHAM'
MODTYP类型:
E:
功能退出
S:
屏幕
T:
表
C:
GUI代码
sap增强存在MODSAP表内
*获取增强组件的参见函数MOD_SAP_MEMBER_TEXT
*获得退出功能模块的信息
selectsingle*fromtftit
where"
SPRAS"
1'
AND"
FUNCNAME"
EXIT_SAPLCORE_001'
*值得学习的函数
MOD_KUN_ACTIVATE(会操作相关报表)
如何从SAP中查找BADI
BADI作为SAP的第三代用户出口,他的应用也越来越广泛,但如何找到合适的badi是许多abap程序员的困惑。
我这里就介绍一下我个人的应用的经验,供大家参考。
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。
4、se18查找接口,se19实现接口就可以实现用户增强。
用LE_SHP_DELIVERY_PROC控制跨月Cancel
METHODIF_EX_LE_SHP_DELIVERY_PROC~CHANGE_DELIVERY_HEADER.
data:
thismonth
(2)typec.
wa_likptypelineofSHP_LIKP_T.
wa_logtypelineofSHP_BADI_ERROR_LOG_T.
clearct_log[],thismonth.
thismonth=sy-datum+4
(2)."
----->
這一個月的月份
loopatit_xlikpintowa_likp.
checkIS_V50AGL-WARENAUSG_STORNO='
X'
."
--->
代表作GIcancel
ifwa_likp-WADAT_IST+4
(2)<
thismonth.
wa_log-VBELN=cs_likp-vbeln.
wa_log-MSGTY='
E'
."
錯誤訊息
wa_log-MSGID='
ZDN_ERROR'
這一個class要自己建
wa_log-MSGNO='
001'
appendwa_logtoct_log."
Errorlog寫入
endif.
endloop.
ENDMETHOD.
如何实现标准TCODE的屏幕增强(HOWTO:
ImplementascreenexittoastandardSAPtransaction)
Introduction
SAPprovidesstandardtransactionstoenterdataintodatabase.ButaclientmaywanttomaintainsomeadditionalinformationinSAPotherthanwhatisprovided.
Tomakeprovisionsforthis,additionalscreenshavetobeprovidedandadditionalfieldsmustbeaddedintoappropriatedatabasetable.
Topavewayforthis,SAPhasprovidedtheoptionforscreenexits.Usually,SAPprovidesthefollowing:
1.Anappendstructureinthedatabasetablewiththenewfields.
2.Asubscreenareaintothestandardscreen–wheretheprogrammercanattachhissubscreenofhisownprogramwiththenewfields.
3.Afunctiongroupunderwhichthenewsubscreenhastobecreatedwiththenewfields.
4.FunctionexitstosynchronizethePBOandPAIofthestandardSAPprogramwiththePBOandPAIofthesubscreen–sothatdatacanflowbackandforthbetweenthestandardSAPprogramandtheprogramwrittenbythedeveloperforthesubscreen.Thesefunctionmodulesalsoexistinthesamefunctiongroupunderwhichthesubscreenwillhavetobedeveloped.
Finally,alinkagehastobedonebetweenthesubscreenareaofstandardSAPscreenwiththecustomsubscreenconstructedbythedeveloper.
Typically,SAPprovidesanenhancementinwhichthedevelopercancreateanappendstructure,usethefunctionexitstosynchronizethePBOandPAIofthestandardSAPprogramandthecustomsubscreenprogram,andmakethenecessarylinking(asmentionedaboveinstep4.But,again,thisisnotahardandfastrule.Linkinginsomecase,isalsodonebyconfigurations.)SAPalsousuallyprovidesthenameofthefunctiongroupunderwhichthesubscreenhastobedeveloped.
NecessaryguidanceaboutimplementingascreenexitdevelopmentisusuallyavailableintheDocumentationsectionoftheenhancement(canbeavailedbytransactionSMOD).
Pre-Requisites
Thedevelopertoworkonscreenexitshouldhaveessentialknowledgeonthefollowing:
∙DDICconcepts,includingtheknowledgeofappendstructure.
∙ConceptofSAPEnhancementsandimplementingthemusingProjects.
∙Conceptoffunctionexits.
∙KnowledgeonModulePool–includingsubscreens,Tabstripcontrolsetc.
Steps
Guidelines
So,adevelopercanfollowtheguidelinesmentionedbelowtoimplementascreenexittoastandardSAPtransaction,asandwhenrequired:
FindouttheRequiredEnhancements
1.GotoSMOD.PressF4intheEnhancementfield.Inthenextpopupwindow,clickpushbutton‘SAPApplications’.Alistwillappearthatcontainsinformationonalltheenhancements,categorizedunderfunctionalareas.Developermustsearchfortheenhancementsrelevanttohisfunctionalareaofinterest–fore.g.,Purchasing,AssetAccounting,etc.
2.Notedowntheenhancements.Then,cometotheinitialscreenofSMODandviewthedocumentationofeachenhancementtofindoutwhichoneisrequiredforyourdevelopment.
UtilizetheEnhancementinaProject
Afteryouhavefoundone,doasdirectedinthedocumentation.Generally,thestepsareasfollows:
1.CreateaprojectusingCMODincludingyourenhancement.
2.Createtheappendstructurewithnewfields.
3.Gotothedesiredfunctiongroupandcreateasubscreenwiththenewfields.WritePBOandPAIforthesubscreen,ifrequired.
4.UsethefunctionexitsintheenhancementtolinkthePBOandPAIofthesubscreenwiththatofthemainSAPprogramsupportingtheSAPtransaction.
5.MaintainnecessarylinkagebetweenthesubscreenareaofstandardSAPprogramwiththecustomsubscreendevelopedalongwiththecustomprogramname.Thiscanbedoneintheproject(developedbyCMODincludingtheenhancement)oroutsideasapartofconfiguration.
6.Activatetheproject.
7.Testtoensurethatrequiredfunctionalityaremet.
CaseStudy1
AddthreenewcustomfieldsforAssetmasterandmaintaininformationforthem
Requirement
ThreefieldsinthelegacysystemhavetobemaintainedinAssetmaster.Thesefieldsare:
1.OriginalAssetnumber–20characters
2.Location2–15Characters.
3.Modelno–20characters
Location2shouldstartwith‘L’.
Pre-Analysis
FindingouttheEnhancement
Asdescribedabove,theenhancementisdetermined.Itwasfound,thatenhancementAIST0002willservethepurpose.Itcontainsthefollowingcomponents(canbeviewedbytransactionSMOD):
ExitTypeDescriptionEXIT_SAPL1022_001FunctionExitCheckofUser-DefinedFieldswhenUsingCreateandChangeBAPIEXIT_SAPLAIST_002FunctionExitTransferDataforUserSubscreensinPBO.EXIT_SAPLAIST_003FunctionExitTransferofUser-DefinedFieldstoSAPMasterDataTransact
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- SAP 开发 SD 相关 增强 BADI