You are on page 1of 17

1/10/2017

DebuggingthePayrollSchemaERPHumanCapitalManagementSCNWiki
GettingStarted

CommunityWIKI

SAPCommunity

Welcome,Guest

Login

Register

Store

SearchtheCommunity

ERPHumanCapitalManagement / / FAQinPY

DebuggingthePayrollSchema
CreatedbyCarlosMartinezEscribano,lastmodifiedbyBretHalfordonJul07,2013

ThroughthisdocumentI'llshowyouhowtodebugthepayrollprocess,focusinginpayrolldriverdebugging.You'llfindheresometipsandtricksthatwillhelpyousavetime.
Asaprerequisitetounderstandthisblogyoushouldhaveabasicdebuggingknowledge.
Herearesomeinterestinglinksforgeneraldebugging:
ClassicABAPDebugger
NewABAPDebugger

UsinghardbreakpointstodebugtheSchema.
Wheneveryoucanmodifythesystemyouareanalyzing(e.g.youaredebuggingadevelopmentsystem),andyouhaveauthorizationtomodifyrulesandschemasyoucansetahardbreakpoint.
Forthis,youhavetomodifyyouruserprofileandsetanABAPprefix(AB4).

Onceyouhaveaprefixofyourown,youcansetabreakpointatacertainpointinaSchemabyeditingtheSchema(TrxPE01).Forthisyou'llusethepayrollfunctionBREAKfollowedbyyourABAPprefix.
Example:SetabreakpointinSchemaE000:

Ifyourunyourpayrolldriver,thedebuggerwillstopjustbeforeEANTschema.

https://wiki.scn.sap.com/wiki/display/ERPHCM/Debugging+the+Payroll+Schema

1/17

1/10/2017

DebuggingthePayrollSchemaERPHumanCapitalManagementSCNWiki

Nowyoucangotothenextpayrollfunctionbyexitingfunctionbreak(F7).

ThenpresskeyF5andsetasoftbreakpointatPERFORMasfunktion.

https://wiki.scn.sap.com/wiki/display/ERPHCM/Debugging+the+Payroll+Schema

2/17

1/10/2017

DebuggingthePayrollSchemaERPHumanCapitalManagementSCNWiki

YoucandisplaythecurrentfunctiontobeprocessedbydisplayinginyourdebuggerscreentableAS(Header).
TableAScontainstheSchemaanditsheadercontainsthecurrentfunctionintheschemabeingprocessed(ASFUNCO).

https://wiki.scn.sap.com/wiki/display/ERPHCM/Debugging+the+Payroll+Schema

3/17

1/10/2017

DebuggingthePayrollSchemaERPHumanCapitalManagementSCNWiki

NowyoucanstoprightbeforenextfunctiontobeprocessedinschemabypressingF8.

Inthiscase,youareabouttodebugfunctionP0092.TogetinsideitjustpressF5.

https://wiki.scn.sap.com/wiki/display/ERPHCM/Debugging+the+Payroll+Schema

4/17

1/10/2017

DebuggingthePayrollSchemaERPHumanCapitalManagementSCNWiki

Inthiscasethefunctioncodetobedebuggedisveryshort.GotothenextfunctionbypressingF8.
OfcourseyoucouldhavesetasoftbreakpointdirectlyatfunctionP0092pe04.
Youcansetabreakpointinapayrollrule,aswell.Forthisyou'llusethepayrolloperationBREAK,followedbyyourABAPprefix.

Whenapernrisrejectedinthepayrolllog.
Justsetabreakpointinthecommand"reject".Startpayrollprocessingindebuggingmode/H,thengoto...finallypressF8key,you'llreachtherejectcommand.Afterthatyouhavetotakealookat"Calls"
toguesswheretheerroriscomingfrom.
Forexample,yourunthepayrolldriveandgetaloglikethis:

Gobacktotheselectionscreenandstartpayrollindebuggingmodewith/H.

https://wiki.scn.sap.com/wiki/display/ERPHCM/Debugging+the+Payroll+Schema

5/17

1/10/2017

DebuggingthePayrollSchemaERPHumanCapitalManagementSCNWiki

Nowyouaredebuggingthepayrollandyouneedtoreachthepointofrejection:

Stopitattherejectcommand:

ThenpressF8sothatthecommand"Reject"isreached:

https://wiki.scn.sap.com/wiki/display/ERPHCM/Debugging+the+Payroll+Schema

6/17

1/10/2017

DebuggingthePayrollSchemaERPHumanCapitalManagementSCNWiki

Nowpressthe"Calls"icon:

https://wiki.scn.sap.com/wiki/display/ERPHCM/Debugging+the+Payroll+Schema

7/17

1/10/2017

DebuggingthePayrollSchemaERPHumanCapitalManagementSCNWiki

Thefollowingroutines:
FORMNEW_ABLEHNUNG
FORMFILL_MSGTAB_FINAL_STEP
FORMFILL_MSGTAB
FORMERRORS
Arecommontoalltherejectionssotheywillnotaddanyvalueinfo,sowegotothefirstrelevantform:
FUCHKPC
DoubleclickingonitwegettotheABAPcodeandsetabreakpointjustbeforetheerrorprocessistriggered(OrmaybeanalyzingtheABAPcodethattriggerstheerrorisenough):

Whenyoustartpayrollagainyou'llbeabletodebugthecodethattriggeredtherejectionwhichwillhelpyouidentifyingthecauseoftheerror.

FindoutatwhichpointofthepayrollSchema,aWageTypeisgeneratedoraWTissettoaspecificvalue.
Watchpointswillhelpyoualotonthis.IfforexampleyoufindthatWT/341equals1.375,00EURatthefinalpayrollresultsandyouwanttoknowwhereinthepayrollschemaWT/341amountwasset
to1.375,00EUR.
Startpayrollindebuggingmodebygoingtothepayrolldriverselectionscreenandsetting/Hattheokcode.ThenpressF8tostarttheprogram.

https://wiki.scn.sap.com/wiki/display/ERPHCM/Debugging+the+Payroll+Schema

8/17

1/10/2017

DebuggingthePayrollSchemaERPHumanCapitalManagementSCNWiki

Nowcreateawatchpoint.

Andfilltherequiredcondition.

Createasecondwatchpointbecausetheconditionis:itlgart=/341anditbetrg=1.375,00

Nowbothconditionhavetobelinkedbythe"And"operator.

https://wiki.scn.sap.com/wiki/display/ERPHCM/Debugging+the+Payroll+Schema

9/17

1/10/2017

DebuggingthePayrollSchemaERPHumanCapitalManagementSCNWiki

NowcontinuebypressingF8.Theprogramwillstopwhenthewatchpointconditionisfulfilled.

You'llnoticethatinthewatchpointconditionIusedWTtableITinsteadoftableRT.IfIhadsetthesameconditionfortableRT,theprogramwouldhavestoppedlateronintheschemawhenWT/341is
collectedtobestoredintableRTwhichisuseless.Sometimes,WTsaredirectlycreatedintableRTsointhatcases,settingtheconditionfortableRTmightbeuseful.Manytimes,WTsarecreatedwithina
ruleoperatedbyfunctionPITorPRT.Inthatcase,you'dbettersettheconditionfortableOT(OTLGART,OTBETRG...).Ifyoudoso,theprogramwillbestoppedattherelevantoperationwithintherule.
Toseewhichruleisit,lookinternaltableASheader.Toknowwhatoperationisit,displaythestructuredfieldOP.

https://wiki.scn.sap.com/wiki/display/ERPHCM/Debugging+the+Payroll+Schema

10/17

1/10/2017

DebuggingthePayrollSchemaERPHumanCapitalManagementSCNWiki

Bytheway,ifaWTissettoaspecificvalueinaPITruleandinsteadofsettingthewatchpointatOTtableyoudoitatITtable,thewatchpointwillstopattheendoftheruleasyoucanseeinthecode
below:

FORMfupit.
LOOPATit.
plog4_performplog_header_cycle(h99plog0)
usingitlgartcalcmolga.
MOVEccyclTOi52c5.
MOVECORRESPONDINGitTOi52c5.
ot=it.
PERFORMregel.
plog1_performplog_check_rule_performed(h99plog0).
ENDLOOP.
REFRESHit.
PERFORMotinitappend."appendstattcollect,beinhaltetrefreshot.
ENDFORM."ENDOFFUPIT
Soit'smoreaccuratetosetthewatchpointattableOTthanattableITinthesecases,butrememberthatrulesareflexibleandthereareoperationstoappendWTsdirectlytotableIT.

ProblemswithRetros.
Whentherearemanyretroperiodsinthepayrollrunyouareanalyzing,thesamepieceofcodewillbereachedonceandagainandyouhavetopresstheF8keyalotoftimesbeforeyoureachthepoint
youwheretheissuearises.TableAPERmanagestheperiodsprocessedinapayrollrunandit'sheaderholdsthecurrentlyprocessedperiod.Inthefollowingpicyoucanseethatperiod01.2008isbeing
processedinapayrollrunstartedfrominperiod01.2009.

YoucanuseAPERPAPERandAPERIAPERaswatchpointconditionssoifforexampleyousetabreakpointatfunctionEST00(WhichcalculatesSpanishtaxes)andthereare10retroperiodstobe
calculatedandyouwanttodebugjustthecurrentperiod:
1.Deactivate(Notdelete)thebreakpointatfunctionEST00.
2.SetAPERPAPER=APERIAPERasawatchpointcondition.
AsanalternativetousingtableAPER,youcanassignacountertothebreakpointsothatitstopsonlyafter"n"occurrences:
e.g.StopinfunctionEST00afterEST00beingprocessed13times:

Finally,whentheAPERPAPERissettothepayrollperiodyouwanttoanalyse(beausethewatchpointstopped),activatethebreakpointandgoahead:F8.
Reachingapayrollfunctionoroperationoncethedebuggerisstarted:
PayrollfunctionsarecodedasformFUXXXXbeingXXXXthenameofthefunction.e.g.functionwpbpiscodedasformfuwpbp.PayrollOperationsarecodedasOPXXXbeingXXXXthenameofthe
operation.KnowingthismakeseasytoreachanyFunction/Operation.

https://wiki.scn.sap.com/wiki/display/ERPHCM/Debugging+the+Payroll+Schema

11/17

1/10/2017

DebuggingthePayrollSchemaERPHumanCapitalManagementSCNWiki

ThenpressF8keyandyougettothebeginningoftheroutine.
HowtodebugaPersonnelCalculationRule:
YoualreadyknowthataPCRorcycleisnotworkingasdesiredbutdonotknowatwhatpointoftheruletheproblemis.WhenaPCRisprocessed,asequenceofpayrolloperationswillbeprocessed.You
canseehowaruleworksprocessingoneoperationineachstepandmonitortheintermediateresults.Thenyoumayrealizetheproblemisthattheruleisnotcorrectoryoucandebuginsidetheoperation.
Firstly,youhavetoreachtheruleyouaregoingtodebug.Forthatyoucansetahardbreakpointasstatedatthebeginningofthisdocumentorawatchpoint(ASPARM1=XXXXwhereXXXXisthename
oftherule)AND(OTLGART=YYYYwhereYYYYistheWTtobeprocessedbythePCR).ItisimportantthatbothwatchpointconditionsarelinkedbytheconditionAND
Example:
WearegoingtodebugPCRESPBatPayrollSchemaE000forpayrolldriverRPCALCE0.
GoingtothepayrolllogweseethatWTS121iscalculatedatPCRESPB:

https://wiki.scn.sap.com/wiki/display/ERPHCM/Debugging+the+Payroll+Schema

12/17

1/10/2017

DebuggingthePayrollSchemaERPHumanCapitalManagementSCNWiki

Sonow,letsstartthedebuggerandsetthewatchpointconditionASPARM1=ESPBandOTLGART=S121,hereishowyourdebuggerscreenwilllookwhenthewatchpointconditionsarereached:

https://wiki.scn.sap.com/wiki/display/ERPHCM/Debugging+the+Payroll+Schema

13/17

1/10/2017

DebuggingthePayrollSchemaERPHumanCapitalManagementSCNWiki

RuleESPBisprocessedbyPITFunctionwhichmeansthattableWTsintableITwillbeprocessedinaloop.EachtimeaWTisprocessedthetableITheaderwillbecopiedtoauxiliarytableOTandwithin
thePCRprocessingtheindividualoperationswillnormallyputtheirresultsintableOT.AttheendofthePCRprocessing,tableOTwillsubstitutetableIT.RelevantfieldsforITandOTare(LGART,BETRG.
BETPE,ANZHL...).
NowgoinsidePERFORMregelbypressingF8andsearchPERFORMboperwiththearrowdown

>SetabreakpointonPERFORMboper.

https://wiki.scn.sap.com/wiki/display/ERPHCM/Debugging+the+Payroll+Schema

14/17

1/10/2017

DebuggingthePayrollSchemaERPHumanCapitalManagementSCNWiki

Makesureyoudisplayatthebottomofthedebuggerscreenthefieldsyouwanttomonitor:

YoucanalsodisplaythecurrentoperationattheheaderoftableOPori52c5op1.
Nowyoucandeactivatethewatchpoint.
ClickinF8everytimeyouwanttogotothenextoperation(AndF5ifyouwanttotakeadeeperlookastohowtheoperationworksinternally):

Usingcounters:
Itmighthappenthatyousetabreakpointatacertainpartofthecodewherethepayrollexecutiongoesthroughagainandagain.Forexampleinretrocalculationorincaseyourbreakpointisinaroutine
thatisplacedinsidealoop.E.g.youplacedabreakpointinsideapieceofcodethatisexecutedwithinaloopandyouwantthedebuggertostoponlythe10thtimethatthebreakpointisreached.Youcan
specifyacounterforyourbreakpoint.
Clickonthebreakpointbutton:

Set10timesinthecount.field.

Ofcourse,ifthebreakpointisreachedlessthan10times,itwillneverstop,butyouaresupposedtoknowthnumberoftimesthebreakpointwillbereachedbeforehand.

https://wiki.scn.sap.com/wiki/display/ERPHCM/Debugging+the+Payroll+Schema

15/17

1/10/2017

DebuggingthePayrollSchemaERPHumanCapitalManagementSCNWiki

Whenanissuehappensforaspecificpernr
TheissueonlyhappenswithaspecificpernrX,howeverifyourunpayrolldriverforthepernrXindividually,youdon'tgettheerror.
1.(Optional)Youcansetthebreakpointbeforehandinthepieceofcodeyouwanttodebug.
2.(Conditional)Ifyoudidn'tdostep(1)startpayrolldriverwith/H.
3.(Conditional)Ifyoudidstep(1)deactivateallbreakpoints.
4.Setawatchpointwithconditionpernrpernr=X.
5.(Conditional).Ifyoudidstep(1)Activateallbreakpoints,otherwisesetabreakpointinthepieceofcodeyouwanttodebug.
CanallthisbeappliedtotheTimeEvaluation?.
Yes,RPTIME00workswiththerulesinthesamewayasthepayrolldriversRPCALCX0/HXXCALC0.InthiscaseyoumayfindusefultoknowthatPERplaythesameroleastableAPERforpayroll.
ThereforeyoucanusetheheaderofPERtostoptheprocessingataspecificday:
e.g.SetawatchpointatPERBEGDA=20080901orACDATE=20080901.
Goodtoknow:
YoucanexpandthepayrollantimeschemabyrunningprogramRPDASC00.
Skippingblocksofcode:
Asyoucanseeinthepicturebelow,innewreleasesyoucanskipapieceofcodebyplacingthecursorinthecodelineyouwanttojump:

ThisisnotafeaturevalidonlyforpayrollorHCMmodule.Skippingablockcodeisusefull:

*Ifyouhaveanerrorandyoususpectwhichthecoderesponsiblefortheerroris.Justskipitandyou'llknowifyoursuspicioninstrueornot.IfthecodewasintroducedbyanSAPnote,youmayhave
foundasideeffect.Andit'snotgoodtomodifyastandardprogramjusttodothiskindoftests.

*Afteralongdebugsessionyouexecutedapartofthecodethatwasimportantwithoutpayattention.Inthiscaseyoumayjumpbacktoacodelinethtawasalreadyexecutedaslongasyoudonotjump
betweendifferentesubroutinelevels.
ThefollowingSAPrelatednoteisinteresting:
https://service.sap.com/sap/support/notes/393820

Someusefulplacestosetabreakpoint:
Inthefollowingwikiarticleyouwillfindsomehints:
DebuggingPayroll.Usefulplacestosetabreakpoint.

hcm

https://wiki.scn.sap.com/wiki/display/ERPHCM/Debugging+the+Payroll+Schema

debugging

debug

payroll

hr

16/17

1/10/2017

DebuggingthePayrollSchemaERPHumanCapitalManagementSCNWiki

1ChildPage

payrollretroactivityissue

1Comment
BobShaw
IhavefoundthisarticleonPayrollSchemadebuggingtobeextremelyhelpful
Particularlygoodfeaturesarethenotesonwhatbreakpointstoset&wheretosetthem
ThanksCarlos!

ContactUs
Privacy

SAPHelpPortal
TermsofUse

LegalDisclosure

Copyright

https://wiki.scn.sap.com/wiki/display/ERPHCM/Debugging+the+Payroll+Schema

FollowSCN

17/17

You might also like