版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
资料来源于网络收集及个人经验总结资料来源于网络收集及个人经验总结
SAP各种场景下的Debug方法
Contents直接在程序中设断点 2BackgroundJob的Debug 2在程序运行界面进入Debug 3正在运行的程序debug 3CallFunctioninUpdateTaske的debug 4SM13ErrorMessageDebug 4RFCDebug 5针对弹窗的DEBUG 7SE16/SE16N修改表内容 8SE16 8SE16N 11修改Debug模式为经典/新 11SAPscript的Debug 14使用StepSize 15Debug返回已经执行过的语句 15Watchpoint-SLAD 16Smartforms的debug 17DebuggingSmartformsandSAPScriptinABAP 181)DEBUGSmartforms 182)DEBUGSAPScript 21DebuggingtipsforSAPSmartFormsdocuments 22SmartForms 22DebuggingTips 22SmartForms–FunctionModuleNames 22SmartForms-ProgramNames 23WhereSAPstoresyourABAPCodeinSmartForms 23SettingBreakpointsintheABAPDebugger 23Conclusion 24Note: 24SAPscript、Smartform区别/调试方法 25DebugIDOC 25HowtodebuganIDOC 28Purpose 28Overview 28Step1-
DisplayIDOCwitherrorintransactionWE02 28Step2-
View
PartnerprofilesintransactionWE20 30Step3-
SetbreakpointonIDOC_INPUT_INVOIC_MRMandotherrelevantfunctionmodules
forissueconcernedviaSE37 33Step
4-UsetransactionBD87todebug
IDOCconcerned. 34修改IDOC并重新传送 35DebuganOutboundidoc 37
直接在程序中设断点这种方式想必大家都知道了,在se38里面打上breakpoint,程序运行到该处即进入debug模式
BackgroundJob的Debug进入SM37查找到自己想要debug的后台程序,这里运行完毕或者正在运行的均可进入debug查找到后打中job前面的勾然后在控制框输入JDBG回车,即进入debug
在程序运行界面进入Debug在程序的控制框输入/H并回车,接着继续运行程序的时候就会进入debug
正在运行的程序debug进入sm50找到需要进入debug的process然后点工具栏Program/Mode->program->debuging即可进入Debug
CallFunctioninUpdateTaske的debug
我们在updatetask的function里面设断点的话正常是进不去debug的我们在debugger里面路径setting->Display/changedebuggersettings这里面会有updatedebugging
选上以后我们运行到updatetask的function后会自动开辟新的session进行debug
SM13ErrorMessageDebug
有些时候我们在程序运行的时候会报一些update的errormessage
进入sm13可以找到相应的item就可以进行debug双击我们需要的debug进去有个debug的按钮就可以进去debug了
RFCDebug
在RFC所在系统用RFC连接所用的用户账号去设断点然后再进行debug就可以了
针对弹窗的DEBUG方法1,可能有时候我们程序运行过程中会出现一些弹出窗口没有输入/H的地方,但是我们要debug怎么办?新建一个txt文档内容如下,当我们需要debug某个窗口的时候直接把这个txt文档拖入对应窗口即可实现debug[FUNCTION]Command=/HTitle=DebuggerType=SystemCommand方法2,
保存到桌面
打开这个弹出窗口的界面之后,然后在桌面双击刚才保存的,就可以进入相应的command(刚才的是debug)界面。
SE16/SE16N修改表内容
SE16IlearnedthisABAPdebuggingtricktoadd,edit,deleteorupdateatablerecordduringmystayinmypreviouscompany.Thistrickwillworkaslongasyouhavetheauthorizationtoforcevalueintovariablesduringdebugging,which,usuallyanABAPerwillhaveinDevelopmentorQASserver.Let’sgointoSE16.TakeSalesOrdertableVBAKforexample.Doubleclickanylineandgoesintothedetailssinglerecordview,type/handhitentertwice.ThevariableCODEwasoriginallyhavingavalueof‘SHOW’.Youcaneditthevalueofthevariableto‘EDIT’,‘INSR’,‘DELE’and‘ANVO’.Thenameofthevalueisquiteselfexplanatory,ANVOisforeditingtherecordincludingthekeys(whichI’veneverused).HitF8andthere,you’reintheEDITmode.RemembertohittheSavebuttonwhenyou’redonethou.It’susefultousethistrickwhenyou’retryingtomaintainatablewhenyoucan’tuseSM30todoit.ThisisoneofmyfavouriteABAPtrick
原理:LSETBF01在里面的代码设定断点通过对SE16debug修改某条数据(这个方法比较靠谱):(这个方法和SM30一样只能修改非key值的字段)查看到对应SO单号数据后,运行事务码‘/h’进去debug状态,然后双击对应的数据行。但是这个方法我一直都找不到那段代码,经常是每次进去哦都市不同的代码,很难找到对应的代码。然后我就根据以往的成功经验,找到了对应的程序:
LSETBF01
在里面的代码设定断点。
然后去runse16,但是不是双击,是点击查看:
就可以进入代码部分:
SE16NInSAPECC6.0EHP6,thefunctioncode&SAP_EDIT,whichenablesthechangemodeoftransactionSE16N,isdeactivated(SAPNote1420281)duetosecuritybreachesthatweredetected.Inordertoactivateit(temporarily),followthestepsbelow:GotoSE16N,asusual,andtypethetableforwhichyouwanttomakemodifications.Insteadoftyping&SAP_EDITinthecommandfield,type/Handpress“Enter”keytoactivatedebugging.PressF8keytoenterthedatabrowserfortheabovetable.IfyouareusingEHP6,thenyoumayneedtopressF7forseveraltimestoreachtotheScreen100ofprogramSAPLSE16NWhileindebuggingmode&onceyouareinScreen100,enterthetwovariablesGD-EDITandGD-SAPEDITandpress“Enter”key.Foreachvariable,clickonthechangebutton,changethevaluetoanuppercase“X”andpress“Enter”key.PressF8keytoexitdebuggingandenterthetableinchangemode.HereishowtheEntrytobechangedinthedebugmode.Pleasebecarefulwhileusingthistrick.Cheers,BharatBajaj
修改Debug模式为经典/新SE38选择一个程序进入
经典界面
新界面
SAPscript的Debug
Doyoueverfindyourselfworkingontransactioncodesthathavemultipleoutputformsandneedtomakechangestomultipleformssimultaneously?Trythesesuggestions.Onewaytostartthescriptdebuggeris:Se71->utilities->activatedebugger.
Thismaybeatime-consumingprocess.Instead,openasessionandexecutetheprogramRSTXDBUG.Evenifyoufollowtheabovemenupathtoactivatethescript,itwillinternallyexecutetheprogramRSTXDBUG.Soyouaresavingsometimeingoingthroughalloftheaboveprocesses.Anotheradvantageofusingthisprogram:whenadeveloperworksinthesupportenvironmentandtheclientrequeststomakessomechangestoaform,butdoesn'tknowwhichform,hecanjustshowtheformoutputandrequestforchanges.Example:TransactionCodeHRBEN0001.Thiscontainsaconfirmationform,benefitsformandothers.Inthisscenario,justopentheothersessionandruntheprogramRSTXDBUGprogram,clickapushbuttononthetransactioncodeandifaformisassociatedwiththatbuttonitisautomaticallyopenedindebugmode.Oncetheformisindebugmodeyoucanfindtheformnamethenopenonemoresessionandmakethechangestotheformwhiledebuggingit.
使用StepSize条件断点,例如在一个内表数据非常大的时候,而我需要的数据是1000条里面的第670条,在loop里面就可以设置一个条件断点:
然后直接F8就进入第18条数据。Debug返回已经执行过的语句debug过程中,当手快跳过了某条语句,可以直接返回到之前的语句:
Watchpoint-SLAD设置watchpoint,就是前面说的,watchpoint只有对当前程序的变量才可以设置,不可以对call的function里面的变量进行设watchpoint。但是我们可以利用SLAD实现这个功能。
Smartforms的debug可以通过FM:SSF_FUNCTION_MODULE_NAME设断点,然后通过打印预览进入之后可以准确的查看到使用的是那个smartforms(有时通过nace查看的不一定就是打印使用的form)
DebuggingSmartformsandSAPScriptinABAP
Itisoftenrequiredtodebugthemassprintingforms,tochecktoaccuracyorlocate/correcttheerror.BothSAPScriptandSmartformshavedifferentwaysfordebugging.Letslookatthestepsforeachdebeggingoptions.1)DEBUGSmartformsa)UseT-CodeSFTRACE–UsingtheSmartFormtrace,youcantracehowaSmartFormwasprocessedduringprinting.Youcanthensee,forexample,thesequenceinwhichthenodeswererunorthepointatwhichprocessingterminatedduetoanerror.b)HardcodetheBREAK-POINT:WejusthavetoputtheBREAK-POINTstatementwhereeverwewanttostopthecodeandlookinsideinDebugger.c)BreakpointusingBREAKuser-name:Wecanputthebreakpointusingthestatmentusernameadditiontothebreakcommand,forexampleBREAKNAVEEN.ThesebreakpointswouldnotstopanyotheruserswhowouldrunthisSmartform.d)Breakpointonthefly:Toputabreakpointonthefly,wecanfollowthesesimplestepstoputabreakpointasrequired.Step1:OpenyourSmartformandCopythetextaswhichyouwanttoputabreakpointandpresstheTestButton.ItwillbringyoutheFunctionBuilder.SAPScriptDebuggingstep1Step2:Pressthedisplaybuttontoopenthecodeofthefunction.SAPScriptDebuggingstep2Step3:PresstheFind(control+F)button.SAPScriptDebuggingstep3Step4:Inthefindscreen,pastethecopiedtext(control+V)intheText.Selecttheoption“InmainProgram”PressEnterSAPScriptDebuggingstep4Step5:Fromthehitlist,gotothesourcecodebydoingdoubleclickonthesearchresults.Now,putaCursoronthelineandpressthe“SetBreakpoint”button.SAPScriptDebuggingstep5That’sit.So,whenyouruntheapplicationitwillstoptothisbreakpoint.SAPScriptDebuggingstep6
2)DEBUGSAPScriptTheyaretwowaystodebugtheSAPScript.a).UseTools–>WordProcessing–>LayoutSet(SE71).EnternameoflayoutsetandthenUtilities–>ActivateDebugger.ActivateSAPScriptDebuggerItisofnoconsequencewhichlayoutsetyouenterwhenselectingtheSAPscriptdebugger.(Menupath:Tools–>Wordprocessing–>Forms,Utilities–>ActivateDebugger)Thenextlayoutsetcalledwillinvokethedebugger.b).AnotherwaytosettheSAPScriptdebuggeristorunprogramRSTXDBUG.WhenyoudebugPrintprogramitissameasyoudebuganyotherABAPprogram.WhilewhenyoudebugSAPScript,youactuallydebugthecode(scripting)youhavewrittenSAPScriptForm.
DebuggingtipsforSAPSmartFormsdocuments
IfyouarenotfamiliarwiththeABAPdebuggerorifyouarejustgettingstartedusingit,thenyoumightfinditchallengingtolocatetheABAPcodethatyouhavewritteninyourSmartFormsdocuments.
ThepurposeofthisarticleistoprovidesomeinformationandafewtipsonusingthedebuggertohelptroubleshootproblemsintheABAPcodeinSmartFormsdocuments.
SmartForms
TherearemanyadvantagestousingSmartFormsovertraditionalSAPScriptsforyourSAPdocuments.Whiletheinterfacemakesiteasiertodesignandimplementtheoveralllayoutofthedocument,youalsohavetheabilitytoincorporateABAPcodeatstrategicplacesrightintheSmartFormwithouthavingtomodifytheprintprogram.
However,therearetimeswhenyouneedtodebugtheABAPcodethatyouhavewrittenwithinyourSmartFormsdocument.
DebuggingTips
ThosewhohaveusedtheABAPdebuggerknowthatitcansometimesbedifficulttofindthespecificlinesofcodethatyouarelookingfor.Infact,itcansometimesbelikelookingforaneedleinahaystack.Attheveryleast,youcanspendasignificantamountoftimesteppingthroughlayerafterlayerofprograms,includesandfunctionmodules.
However,byknowingafewsimpletipsyoucanstopdocumentprintingatjusttherightlocationsothatyoucanfindanddebugtheABAPcodethatyouhavewritteninyourSmartFormsdocument.
SmartForms–FunctionModuleNames
Firstofall,itisimportanttorealizethatallSmartFormsdocumentsarecompiledintotheirfinalrun-timeprogramswhentheyareactivated.SAPdynamicallycreatesauniqueprogramnamewithassociatedincludesandfunctionmoduleswhentheSmartFormisactivated.
WhileinyourSmartFormsdocumentgotothemenuoptionEnvironment–>FunctionModuleName.ThereyouwillfindthefunctionmodulenamethatSAPcreatedforyourSmartFormsdocument.Thenameofthefunctionmodulewilllooksomethinglike:/1BCDWB/SF00000015.
SmartForms-ProgramNames
ThenextstepistofindthenameoftheSmartFormsprogramnamewhichcanbedonebyusingtransactioncodeSE37–FunctionBuilderandenteringtheFunctionModuleNamethatyoufoundinthepreviousstep.
GototheAttributesTabandthereyouwillfindtheprogramnamewhichlookssomethinglikethis:/1BCDWB/SAPLSF00000015.NoticethatthewordSAPhasbeenaddedtotheFunctionModuleNametocreatetheProgramName.
WhereSAPstoresyourABAPCodeinSmartForms
TofindtheABAPcodethatyouhavewritteninsideyourSmartFormsdocumentsimplydouble-clickontheprogramnamewhichwilltakeyouinsidetheprogram.Thereyouwillseeseveralincludestatementsintwodifferentsections:1.System-definedInclude-files/1BCDWB/LSF00000015TOP"GlobalData/1BCDWB/LSF00000015UXX"FunctionModules2.User-definedInclude-files/1BCDWB/LSF00000015F01"UserCode
YourABAPcodewillbefoundwithinaFORMwithneartheendoftheUser-definedInclude-files/1BCDWB/LSF00000015F01.AdifferentFORMisgeneratedforeachsectionofcodethatyouhavewrittenintheSmartFormsdocument.EachFORMnameisgeneratedwiththeformat%C##.ForexampleyourABAPcodewillbelocatedinaFORMthatisnamed%C01,%C02,C03andsoforth.
SettingBreakpointsintheABAPDebugger
NowthatyouknowwheretofindyourABAPcodeintheSmartFormsgeneratedprogramsyouarereadytogetstartedusingtheABAPDebugger.YoucanstartbycreatinganoutputforyourSmartFormsdocument.Atthispointjustbeforesavingthedocumentwiththenewoutput,simplyenter/handpressexecute.Thiswillactivatethedebuggerwhichwillpop-upaftersavingthedocument.
Note:IfyouhappentoactivatethedebuggerbeforethedocumentissavedthenthedebuggerwillstartplacingyouintheABAPcodebeforethedocumentsavecodebeginsandnotwherethedocumentprintingbegins.IfthishappensthensimplypresstheContinuebuttonsothatitwilljumppastthedocumentsavecodeandstopagainwherethedocumentprintcodebegins.Ifthedocumentprintswithoutthedebuggerstoppingatthedocumentprintcodethenyouwillhavetobeginagain.
OncethedebuggerstartsyoucanquicklysetabreakpointusingtheProgramNameandtheUser-IncludefilesothatthedebuggerwillstopexactlyatthepointwhereyourABAPcodeislocatedintheSmartFormsdocument.
UsethemenupathBreakpoints–>Breakpointat–>SourceCodeandentertheProgramNameandIncludefilenameyoufoundearlier.YouwillalsoneedtoentertheprogramlineintheRowfieldinordertospecifytheexactlocationwhereyouwantthedebuggertostop.ProgramName:/1BCDWB/SAPLSF00000015Include:/1BCDWB/LSF00000015F01Row:####-"Linenumberofyourcodewhereitappearsintheincludefile
Onceyouhavethebreakpointset,presstheContinuebutton.ThiswillstoptheSmartFormexecutionattheexactpointwhereyouwanttostartdebuggingyouABAPcode.Atthispointyoucancheckvaluesofvariables,lookattablecontentsandstepthroughyourABAPcodetofindoutwhereproblemsexist.
Conclusion
WithoutknowingafewbasictipsabouthowtofindyourABAPcodeinaSmartFormsdocument,youcanspendalotoftimesteppingthroughstandardABAPcodeinSAP.Whileobjectorientedcodehaschangedtheworldofprogramming,itcanalsopresentchallengeswhenyoudon’tknowwheretolooktofindthespecificcodethatyouwanttotroubleshoot.
Note:TheProgramNameandtheIncludeFilenamesofyourSmartFormsdocumentwillbedifferentineachsysteminyourSAPlandscapesincetheywillbedynamicallyrecreatedwhentheyaretransportedtoeachsystem.Therefore,ifyouwanttousethedebuggeronthesameSmartFormsdocumentbutinadifferentSAPsystem,youwillhavetolookuptheProgramNameandIncludefilesnamesinthatsystem.
SAPscript、Smartform区别/调试方法
1,smartform在激活的时候会自动地创建一个功能模块,而SAPscript则不会;2,smartform可以直接书写子程序,使用"ProgramLine"节点,而SAPscript则只能使用控制命令语句PERFORM调用subroutine;3,SAPscript是基于client的,而smartform不区分在任何client;4,smartform的字体可以应用color,而SAPscript则不能;5,SAPscript的每个page都只能统一按照横向和竖向页面格式,而smartform则可以不统一格式;
下面我讲一下,它们的DEBUG,这个属于没用的时候很没用,有用的时候很有用的东西。SAPScript:T-codese71->Utilities->ActivateDebugger这样就可以DebugForm,如果在出问题的字段‘WRITEFORM’加上断点,效率会更高。SMARTFORM:T-codeSMARTFORMS如果你在SMARTFORM中加了代码,编辑器是不会允许你设置断点的。一种方法就是,你在代码中加入断点语句,缺点是,每想设一个断点,就需要写一段代码。所以,我要说一下,后一种方法。
你自己加的CODE,都会自带出一个名字的比如‘%code14’。Environment->FunctionModuleName,Thefunctionthatgeneratedforthissmartformsis‘/1BCDWB/SF00000227’(自动生成的SMARTFORM程序名)T-codese37->/1BCDWB/SF00000227->Goto->MainProgram最后一个INCLUDE是对DEBUG最有用的,双击进入用‘FIND’去找你要Debug的代码,Find中的关键字是‘%code14’
DebugIDOCWE02查看MessageTypeWE20找到MessageType
双击MessageType双击ProcessCode
找到对应的Functionmodule:IDOC_INPUT_ORDRSPSE37调试(或者直接双击functionmodule),添加断点/watchpoint等调试
HowtodebuganIDOCPurposeThiswikiprovidesademonstration
ofhowtodebuganIDOC.OverviewThe
IDOC
giveninthis
exampleisbasedon
invoiceinmaterialsmanagement
onatestsystem.Step1-
DisplayIDOCwitherrorintransactionWE02DoubleclickontheControlRecord.ViewinformationontabTypinfo:
SelecttabPartner.
ForinboundprocessingchecktheSenderinformation..Step2-
View
PartnerprofilesintransactionWE20Usingtheinformationfromstep1:PartnertypeLI,PartnerNumberCP-CP01,MessagetypeINVOIC,MessageVariantMMIntransactionWE20Openfolderfor
PartnerTypeLIDoubleclickonpartnernumberCP-CP01
Intheinboundparameters,doubleclickonMessagetypeINVOIC(MessagevariantMM)Double
clickonProcesscode
Hereyoufindthefunctioncodeidentification,inthisinstanceIDOC_INPUT_INVOIC_MRMStep3-
SetbreakpointonIDOC_INPUT_INVOIC_MRMandotherrelevantfunctionmodules
forissueconcernedviaSE37
Step
4-UsetransactionBD87todebug
IDOCconcerned.IntransactionBD87enterconcernedIDOCandexecute.
SelectButtonProcess(F8).Yhisexampleon
functionmoduleIDOC_INPUT_INVOIC_MRM
UseF8
togototheother
relevantBreakpointsyouhaveset.
修改IDOC并重新传送WE02查找出错的IDOC双击文本图标
修改后保存,然后BD87重新传送
DebuganOutboundidocManytimeswegets
issuesfordebuggingof
IdocwhichusedtobeinerrorstateThisdocumentwillhelpyouinunderstandthesteps
indebuggingofOutboundidocDebuggingofOutboundidocTheoutboundidocistheonewhichweusetosendfromonesystemtoanothersystemanditbecomesinboundidocforthetargetsystem
fromour
sendersystem.Wheneveryougetsanyidocwitherror,gotoWE02andentertheidocnumber.bydefaultsystemgivescurrentdatesremovecreationdate,systemwillidentifyidocbyjustidocnumberonexecutingit,youwillgetthedetailsofidoc
likethreesections.1.Firstoneiscontrolrecordwhich
containtheinformationofcreatorofidoc,whoisthesender,whoisreceiverlikealltheseidocadministrationdetails.2.SecondsectionisDhis,therewillbesomanysegmentslikeE1EDK01,E1EDP01
etc.Thefirstdatarecordcontainsthedocumentnumberwhoseinformationcameandappearingindifferentdifferentsegments.3.Thirdsectionwillbestatusrecrdanditwillcontainsallthestatuslikeidocprocessedsuccessfully(53status,s
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 《2024年 青岛历史文化名城价值评价与文化生态保护更新》范文
- 《2024年 第二代测序技术的发展及应用》范文
- DB13-T 3043-2024 碳普惠项目减排量核算技术规范 低碳出行
- 【人教版】二年级数学下册导学案设计《第3课时 旋转》
- 出版行业数字化转型与内容营销策略
- 红星照耀中国第11章读书笔记
- 农业行业智能农业种植技术培训与推广计划方案
- 防溺水安全教育主题教学设计41
- 七年级英语上册第02讲 人称代词(原卷版)
- 车辆定点维修方案投标方案(技术方案)
- 新七年级音标练习题
- 曼昆《经济学原理》(微观经济学分册)第8版 全部答案
- 不同PH值溶液混合后PH的计算
- 髋关节翻修ppt课件
- MT框架断路器..
- 数据标注工程PPT课件
- 翻板闸设计说明
- 工程延期管理流程图
- 教育科学出版社小学科学六年级上册教案(全册)
- 全员育人的内涵、意义与策略
- 订单评审表样本
评论
0/150
提交评论