You are on page 1of 6

GettingStarted Newsletters

Hi,Guest

LogOn

JoinUs

Products

Services&Support

AboutSCN

Downloads

Industries

Training&Education

Partnership

DeveloperCenter

Activity

LinesofBusiness

UniversityAlliances

Events&Webinars

Innovation

Browse

BADItoDefaultvaluesinPAInfotypes

Version12

createdbyVineetLakheraonDec11,201410:28AM,lastmodifiedbyVineetLakheraonApr13,20155:50AM

Share

Tweet

Inthistutorial,wewillseehowtouseBADItodefaultvaluesinPAInfotypes.Thistutorialwillshowhowwewilldefault
valuesusingaBADIandwewillbeusingthesamebusinessscenarioasusedearlierinthe UserExittoDefault
valuesinPAInfotypestutorial,wherewehaveusedcustomerexittodefaultvaluesinPAinfotype.

In SAP HR, we have a BADI HRPAD00INFTY, which can be used to default the values in PA Infotype as well as
performadditionalcheckifrequired(inPAIeventwhileperforminganyaction).
ThisBADIimplementationcontainsthefollowingmethodwhichcanbeimplementedasperourrequirement.

Method
Description(Usage)
BEFORE_OUTPUT ThismethodiscalledatthePBOevent,i.ewhentheinfotypescreenisrenderedfordisplay.
AFTER_INPUT

ThismethodiscalledatthePAIevent,i.e.whenuserperformssomeactionintherendered
infoypescreen.

IN_UPDATE

Store

SearchtheCommunity

ThismethodiscallduringupdatewhenthereisupdatetaskisbeingcarriedinPAinfotpe.

WecanusefirsttwomethodsoftheaboveBADItodefaultthevaluebycallingacustomfunctionmoduleorglobal
classmethod.Thiswillensurethatwhentheinfotypescreenisfirstrendered(PBO)aswellwhenuserperformsome
actionsalsothevaluesremainconsistent(PAI).

Wewillnowseeonerealtimeexamplewhereinweneedtodefaulttheinfotype0015begindatetopayrollperiod
begindatebasedonthecurrentsystemdate.

Herearethestepsthatneedtobefollowedtowriteauserexitcodingtodefaultinfotype0015values:

1. Go to transaction SE19, create implementation of classic BADI HRPAD00INFTY and give implementation name
(nameshouldbeinSAPcustomernamespace,i.eshouldstartfrom'Y'or'Z').

Pressing'CreateImpl.'button,popupwindowtriggers,enterthenameofimplementation(incustomernamespace)
andenter.

Communications

Actions


2.ClickonactivatebuttontosaveandactivatetheBADIimplementation.

Oncesuccessfullyactivated,RuntimeBehaviortextchangesto'Implementationwillbecalled'.

3.Goto'Interface'tabofourimplementation,followingmethodsoftheBADIimplementationisavailableforcoding.


4. Double click on the method name to write our custom logic in the implementation. Add below code in the
BEFORE_OUTPUTandAFTER_INPUTmethodofourimplementation.
ClassZCL_IM_DEF_0015iscreatedbySAPandisbasedonthenameofourimplementationinstep1(ZDEF_0015).

InthecodeitisimportanttounderstandthatwearedirectlyfetchingtheruntimevalueofIT0015recordthroghthe
standard program associated (MP001500) and storing it in field symbol and changing field symbol later so that
changesreflecttoinfotyperecordaswell.
Thisisrequiredasunlikeuserexitalltheparametersavailableforthismethodareimportingparameterandthereare
nochangingparameteravailableasbelow.

5.Whenwetrycreatingnewentryininfotype15usingPA30,outputisasperourrequirement.

Pressingcreatebutton,dateoforigin(begda)valueisdefaultedwithcorrectvalue.[Basedoncurrentdate13apr
2015,payperiodbegindate01apr2015isdefaulted].

6.ThisBADItriggersforPA20/PA30/PA40transactions.ButforanexistingPA20record,thereseemstobeanissue
encounteredhere.
OutputbeforeactivatingBADI(PA20):

OutputafteractivatingBADI(PA20):

Thisisincorrectandoursystemshoulddisplaythesamevalueasstoredinthebackendtable(whichisinfirstscreen
shot10jan2015).Toresolvethisissuewewillneedtoaddsomelogicwhichwillonlychangetheinfotypefielddata
whenthereisanychangeoperationbeingcarriedout.
To determine which operation is currently happening in the Infotype, importing parameter IPSYST is of much
importance. This structure parameter have a field called IOPER which determines the Infotype operation. following
valesareexpectedinthisfield.
IOPERValues

MeaningandSignificance

DIS

DISPLAY

DIS2

DISPLAY_NO_LIST

MOD

MODIFY

INS

INSERT

COP

COPY

DEL

DELETE

LIS0

LIST_DISPLAY

LIS1

LIST_MODIFY

LIS9

LIST_DELIMIT

ENQ

ENQUEUE_RECORD

7.Finalcodelogicwillbeasbelow.

Now,displayingsamepernrwithBADIactivatedgivescorrectresults.

Categories:CorePersonnelAdministrationandOrganizationalManagement
1293Views
Tags:hr_badi,hrpad00infty,pa20_enhancement,defaut_pa_infotypes,pa30_enhacement

AverageUserRating
(14ratings)

Share

Tweet

1Comment
manthanjoshiApr14,20158:16AM

Greatworkvineet.
Like(1)

SiteIndex
Privacy

ContactUs
TermsofUse

SAPHelpPortal
LegalDisclosure

Copyright

FollowSCN

You might also like