Abaphrprograming 121218001552-phpapp02 (2)
Upcoming SlideShare
Loading in...5
×
 

Abaphrprograming 121218001552-phpapp02 (2)

on

  • 225 views

hi mpsingh

hi mpsingh

Statistics

Views

Total Views
225
Views on SlideShare
225
Embed Views
0

Actions

Likes
0
Downloads
2
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Abaphrprograming 121218001552-phpapp02 (2) Abaphrprograming 121218001552-phpapp02 (2) Presentation Transcript

  • Programming in HRHR-ABAPSAPABAP HR
  • PrerequisitesABAP ProgrammingLogical DatabaseModule pool programmingSAP ScriptsKnowledge ofSAPABAP HR
  • Training will coverBrief description of modules in SAP-HRConcept of InfotypesInfotype StructuresCreation of infotypeEnhancement of infotypeHR MacrosUse of Provide statementCluster reading for Payroll resultsExample of PA letters infotype (Customer defined)SAPABAP HR
  • Modules in SAP-HRPersonnel Management (PA)Time Management (PT)Recruitment (PB)Organizational Management (OM)Personnel Development (PD)Training & Event Management (TM)SAPABAP HR
  • InfotypeDefinitionUnits of information.SAPABAP HR
  • Uses of Infotype• To group related data fieldsPersonalDataNameDOBNationalityMarital StatusAddressesStreetCityPin codeStateINFOTYPESSAPABAP HR
  • Uses of Infotype• Maintaining Employee Information by DateSAPABAP HR
  • Infotype Numbers• Four digit number nnnn• Unique identification• 9000 to 9999 reserved for customer infotypesSAPABAP HR
  • Naming Conventions• 0000 to 0999 – HR Master data / Applicant data• 1000 to 1999 – Organizational Management• 2000 to 2999 – Time data• 4000 to 4999 – Applicant data• 9000 to 9999 – Customer definedNaming conventions for InfotypesSAPABAP HR
  • Definition of Infotype within the DataDictionaryEach infotype nnnn requires at least two structures andone table:• Structure PSnnnnStructure PSnnnn contains all of the infotype data fields.• Structure PnnnnStructure Pnnnn contains infotype key fields and all of the datafields from structure PSnnnn .• Transparent table PAnnnn and/or transparent tablePBnnnnTransparent table PAnnnn is required if you want to use an infotypewithin Personnel Administration.If you want to use an infotype within Recruitment, transparent tablePBnnnn is required.In accordance with the distribution of infotype name ranges, objectsP9nnn , PS9nnn , PA9nnn and PB9nnn are assigned to thecustomer name range.SAPABAP HR
  • Infotype Module Pool• A module pool should be used with each infotype. Thismodule pool is the main program for the maintenanceinterface for the infotype.• The name of the program is MPnnnn00. Where Pstands for Human Resources (personnel) and nnnn isthe four-digit infotype number.SAPABAP HR
  • Infotype-specific IncludesThe main program only contains INCLUDE statements. Ifyou create the main program using transaction PM01Dialogs in HR, the system also creates the following fourincludes:subroutinesMPnnnn40PAI modules for the screensMPnnnn30PBO modules for the screensMPnnnn20The PROGRAM statement andthe declaration of common data objectsMPnnnn10The include containsName of includeSAPABAP HR
  • Infotype-specific IncludesThe system also inserts INCLUDE statements in the mainprogram for the following includes:Definition of two data objects that contain thenumber of reference personnel numbers in structureP0031 or P0121MPPREF00Definition of infotype return codesMPPIRC00Standard infotype modulesMPPERS00Declaration of common data objectsMPPDAT00Declaration of common data objectsThis data area is used as a buffer for importedinfotype records and maintenance information. Thevariables specified in this area are used as export orimport parameters when the infotype dialog moduleis accessed.FP50PPSBUseName of includeSAPABAP HR
  • Infotype ScreensEach infotype has at least three screens:• An initial screen• A single screen• A list screenSAPABAP HR
  • Initial Screens• Initial screen is used as technical interface• Screen 1000 is used for all infotypes• Processed in background and not displayed• Performs general initialization proceduresSAPABAP HR
  • Initial Screens - PreviewSAPABAP HR
  • Single Screens• Its an interface between the system and the user.• It enables to create, display or maintain data records.• Screen 2000 is used for single screen.SAPABAP HR
  • Single Screen - PreviewSAPABAP HR
  • List Screen• Unables to list all records in infotye• Screen 3000 is used for list screenSAPABAP HR
  • List Screen - PreviewSAPABAP HR
  • Infotype Screen Control• Through customization some field are made hidden.• Attributes are specified during runtime.• The appearance of the screens changes depending onthe function chosen by the user.SAPABAP HR
  • Infotype Time ConstraintA time constraint indicates whether more than one infotyperecord may be available at one time. The following timeconstraint indicators are permissible:1 No overlapping and no gaps.2 No overlapping but time gaps are permitted.3 Overlapping and and time gaps are permitted.SAPABAP HR
  • Other Possible Time ConstraintA Only one record may exist, valid from 01/01/1800 to 12/31/9999.Splitting and deletion is not permissible.B Only one record may exist, valid from 01/01/1800 to 12/31/9999.Splitting is not permissible, but may be deleted.T The time constraint varies depending on the subtype.Z Refers to time management infotypes.SAPABAP HR
  • Infotype CharacteristicsThefollowingtables must bemaintainedfor eachinfotype:Name of table TaskT582A Basic infotypecharacteristics(databasetables, singlescreen, list screen, timeconstraint, dialogmodule, andsoon)T582S Infotypeshort textsT777A Technical Characteristics of Infotype(databasetable, dialogmodule, andsoon)T77ID Nameof datafieldstructure(PSnnnn)SAPABAP HR
  • Creating PA infotypesTransaction code‘PM01’.SAPABAP HR
  • Creating PA infotypes – PM01SAPABAP HR
  • Creating PA infotypes – Maintain StructureSAPABAP HR
  • Creating PA infotypes – Infotype TableSAPABAP HR
  • Creating PA info types – Infotype Table(Primary Key)SAPABAP HR
  • Creating PA infotypes – PreviewSAPABAP HR
  • Enhancement of PA Infotype1. Start the Personnel Administration infotypecopier (PM01)2. Enter the infotype number.3. Choose Enhance infotype.SAPABAP HR
  • Enhancing a Single Screen• Start transaction PM01• You access the Create Infotype screen:• Choose Enhance Infotypes.• In the Infotype no. field, enter the four-digit number of the infotype youwant to create. When you specify the infotype number, please rememberto enter any leading zeros.• In the Sub-Objects group box, flag CI Include.• Choose Create. The Dictionary: Initial Screen is displayed.• Create the Cl include.• Choose Activate.• Return to the Create Infotype screen.• Choose Create All.ResultYou have included additional fields in the standard single field for aninfotypeSAPABAP HR
  • Enhancing a Single Screen – PM01SAPABAP HR
  • Enhancing a Single Screen – MaintainStructureSAPABAP HR
  • Enhancing a Single Screen – Screen PreviewEnhanced FieldSAPABAP HR
  • Enhancing PA Infotype – CI INCLUDEOnly those PA Tables can be Enhanced, having structure CI IncludeCI_P0000SAPABAP HR
  • HR MacrosRP_PROVIDE_FROM_LASTRP_PROVIDE_FROM_FIRSTRP_SET_DATA_INTERVALRP_READ_INFOTYPESAPABAP HR
  • Macros ModulesMacro ModulesTABLES: PERNR.INFOTYPES:0001, "Organizational Assignment0002, "Personal Data0006, "Addresses....GET PERNR.RP_PROVIDE_FROM_LAST P0001 SPACE PN-BEGDA PN-ENDDA.WRITE...* * * Include program DBPNPMAC.DEFINE RP_PROVIDE_FROM_LAST.PNP-SW-FOUND = 0.. . .END-OF-DEFINITION.SAPABAP HR
  • Infotype Record ProcessingProcessing a Specific Infotype RecordData selection January DecemberTablePnnnnJanuary DecemberGET PERNR.RP_PROVIDE_FROM_LAST <Pnnnn> SPACE PN-BEGDA PN-ENDDA.IF PNP-SW-FOUND = 1.WRITE...ENDIF.SAPABAP HR
  • Infotype Record ImportingImporting Specific Infotype RecordsData selection May DecemberTablePnnnnPAnnnnSTART-OF-SELECTION.RP_SET_DATA_INTERVAL <Pnnnn> PN-BEGDA PN-ENDDA.GET PERNR.SAPABAP HR
  • Function HR_READ_INFOTYPEReading Infotypes Without Logical DB (1)PAnnnnPAnnnnINFOTYPES: <nnnn>....CALL FUNCTIONHR_READ_INFOTYPE...SAPABAP HR
  • Function HR_READ_INFOTYPEReading Infotypes Without Logical DB (2)INFOTYPES: 0002.DATA: return LIKE SY-SUBRC.CALL FUNCTION HR_READ_INFOTYPEEXPORTING. . .PERNR = <person>INFTY = 0002BEGDA = <begdat>ENDDA = <enddat>IMPORTINGSUBRC = returnTABLESINFTY_TAB = P0002EXCEPTIONSINFTY_NOT_FOUND = 1OTHERS = 2.SAPABAP HR
  • HR Macro – Summary• Many HR reports use macros. Their program codesare stored in a table or defined locally using theDEFINE keyword.• The PR_PROVIDE_FROM_LAST macro writes thelast valid record in the data selection period to theheader line of the internal info type table.• You can use the function moduleHR_READ_INFOTYPE to read the personnel data inreports which do not use an HR logical database.SAPABAP HR
  • Use of PROVIDE StatementPROVIDE – ENDPROVIDE is a loop to processPnnnn tables, within the validity period.Two or more infotypes can be processed in a singlePROVIDE – ENDPROVIDE loop.Combines JOIN and PROJECTION.Reads time-dependent table entries.SAPABAP HR
  • Logical database PNP1. Data retrieval 2. Screening3. Authorization checkFunctions of Logical Database PNPSAPABAP HR
  • Logical database PNP - ScreeningSAPABAP HR
  • Functions of Logical database PNPData Retrieval1. Create data structures for infotypes2. Fill the data structures withthe infotype records"Organizational Assignment ""Personal Data""Planned Working Time"INFOTYPES: 0001,0002,0007.GET PERNR.SAPABAP HR
  • Processing Master Data using PROVIDEProcessing Master DataTABLES: PERNR.INFOTYPES:0001, "Actions0002, "Personal Data0006, "Addresses....GET PERNR.PROVIDE * FROM P0002 BETWEEN PN-BEGDA AND PN-ENDDA.WRITE...ENDPROVIDE.SAPABAP HR
  • Processing Master Data using PROVIDELoop NestingGET PERNR.PROVIDE * FROM P0002BETWEEN PN-BEGDA AND PN-ENDDA.WRITE...ENDPROVIDE.PROVIDE * FROM P0006BETWEEN PN-BEGDA AND PN-ENDDA.WRITE...ENDPROVIDE.END-OF-SELECTION.InfotypeloopInfotypeloopEmployeeloopSAPABAP HR
  • Joins in PROVIDEJoinOrganizationalAssignment (0001)PersonalData (0002)Join / Creating IntervalsSAPABAP HR
  • Joins in PROVIDEJoin / CodingTABLES: PERNR.INFOTYPES:0001, "Organizational Assignment0002, "Personal Data0006, "Addresses....GET PERNR.PROVIDE * FROM P0001* FROM P0002BETWEEN PN-BEGDA AND PN-ENDDA.WRITE...ENDPROVIDE.SAPABAP HR
  • Joins and Projection in PROVIDEJoin and Projection / CodingTABLES: PERNR.INFOTYPES:0001, "Organizational Assignment0002, "Personal Data....GET PERNR.PROVIDE STELLENAME FROM P0001GBDAT FROM P0002BETWEEN PN-BEGDA AND PN-ENDDA.WRITE...ENDPROVIDE.SAPABAP HR
  • PA Letters Infotype – Customer DefinedBusiness Needs:A letter is to be generated after the following action in the prescribedformat:1. Hiring / Appointment Letter2. Confirmation Letter3. Promotion Letter4. Transfer Letter5. Relieving Letter on Resignation6. Retirement LetterThe generated letter should be modifiable and same is to be storedalong with each employee and action.SAPABAP HR
  • Sample format of Appointment LetterLETTER NO. REC.01 APPOINTMENT LETTERMr./Miss [Full name of Employee][Position] [Grade][Location]The management is pleased to appoint you as the [POSITION] in [GRADE] with effect from [DATE].You will report to [POSITION].Your salary & other benefits are stated in the attached compensation package sheet.You will be on probation for a period of six months. On satisfactory completion of probation you willbe confirmed in service.You shall be governed by the Services rules of the Company, a copy of which is enclosed. Asummary of Benefits & Leave Rules as applicable to you is also enclosed.Please confirm your acceptance by signing the duplicate copy of this letter & intimate the date ofjoining.This offer is valid for two months from the date of receipt of this letter.Faithfully[Signatory] / SECRETARY[Designation]SAPABAP HR
  • Structure for PA letter InfotypeStructure: PS9011Component ComponentTypeDataTypeLen DecShort TextLDATE ZLDATE DATS 8 0 Letter DateLTYPE ZLTYPE1 CHAR 50 0 Letter TypeSIGN1 ZSIGN1 CHAR 40 0 SignatoryDESGN ZDESGN CHAR 40 0 DesignationMASSN ZMASSN CHAR 2 0 Action TypeEFFDT BEGDA DATS 8 0 Start DateSUPER ZSUPER CHAR 40 0 SBU / Functional HeadSBUNM ZSBUNM CHAR 40 0 SBU NameAPDAT ZAPDAT DATS 8 0 Appointment DateRLDAT ZRLDAT DATS 8 0 Relieving DateLETTERID TDOBNAME CHAR 70 0 NameSAPABAP HR
  • ZHR_LTYPETable ZHR_LTYPE created for help drop down of fieldLTYPE of structure PS9011.Table: ZHR_LTYPEFields Field TypeDataType Len Dec Short TextINFTY INFTY CHAR 4 0 InfotypeSUBTY SUBTY_591A CHAR 4 0 SubtypeLTYPE ZLTYPE1 CHAR 50 0 Letter TypeACTION MASSN CHAR 2 0 Action TypeFRMNM ZFRMNM CHAR 30 0 Form NameSAPABAP HR
  • Screen Layout for PA Letters InfotypeSAPABAP HR
  • STD Text for Appointmnet Letter – SO10** Ref No. &itab-ref_no&** &cldate&** &itab-ename&* &itab-zdesgn&* &itab-orgtx&* &itab-name1&** &itab-first_line&*B The Management is pleased to appoint you as the &itab-zdesgn& in grade&itab-pktxt& with effect from &itab-effdt&. You will report to .....*B Your salary & other benefits are stated in the attached compensationpackage sheet.*SAPABAP HR
  • STD Text for Appointmnet Letter – SO10B You will be on probation for a period of six months. On satisfactorycompletion of probation you will be confirmed in service.*B You shall be governed by the Services rules of the Company, a copy ofwhich is enclosed. A summary of Benefits & Leave Rules as applicable toyou is also enclosed.B Please confirm your acceptance by signing the duplicate copy of thisletter & initimate the date of joining.*B This offer is valid for two months from the date of receipt of thisletter.** Faithfully** &pp9011-sign1&*P2 CC:,,Chief Personnel OfficerP2 ,,Chief Manager, Management Systems and InformationP2 ,,SAPABAP HR
  • ClustersDefinitionEach database object, for example, PCL1 or PCL2, with the typeImport/Export file consists of related areas. These areas are knownas clusters, for example. RX, RD.SAPABAP HR
  • Display of Cluster data – Payroll ResultSAPABAP HR
  • Display of Cluster data – Payroll ResultSAPABAP HR
  • Display of Cluster data – Payroll ResultSAPABAP HR
  • Display of Cluster data – Payroll ResultSAPABAP HR
  • Display of Cluster data – Payroll ResultSAPABAP HR
  • Display of Cluster data – Payroll ResultSAPABAP HR
  • Reading Cluster DirectoryReading the Cluster Directory*Table containing directoryof payroll resultsDATA: BEGIN OF RGDIR OCCURS 100.INCLUDE STRUCTURE PC261.DATA: END OF RGDIR.DATA: COUNTRY LIKE T001P-MOLGA....CALL FUNCTION CU_READ_RGDIREXPORTINGPERSNR = PERNR-PERNRIMPORTINGMOLGA = countryTABLESIN_RGDIR = RGDIREXCEPTIONSNO_RECORD_FOUND = 1OTHERS = 2.SAPABAP HRSAPABAP HR
  • Determining Last Payroll ResultDetermining Current Payroll Result (1)DATA: number LIKE PC261-SEQNR.. . .GET PERNR.. . .CALL FUNCTION CU_READ_RGDIR. . .CALL FUNCTION CD_READ_LASTEXPORTINGBEGIN_DATE = PN-BEGDAEND_DATE = PN-ENDDAIMPORTINGOUT_SEQNR = numberTABLESRGDIR = RGDIREXCEPTIONSNO_RECORD_FOUND = 1OTHERS = 2.SAPABAP HR
  • Determining Last Payroll ResultDetermining Current Payroll Result (2)DATA: result TYPE PAY99_RESULT.DATA: rt_header TYPE LINE OF HRPAY99_RT.. . .CALL FUNCTION PYXX_READ_PAYROLL_RESULTEXPORTINGCLUSTERID =RXEMPLOYEENUMBER =p0001-pernrSEQUENCENUMBER =number* READ_ONLY_BUFFER = * READ_ONLY_INTERNATIONAL = * CHECK_READ_AUTHORITY = X. . .CHANGINGPAYROLL_RESULT =resultEXCEPTIONS . .LOOP AT result-INTER-RT INTO rt_header.WRITE: / rt_header-LGART, ...ENDLOOP.SAPABAP HR
  • Structure for Payroll ResultStructure for Payroll ResultsDATA: result TYPE PAY99_RESULT.DATA: rt_header TYPE LINE OF HRPAY99_RT.. . .* Access to payroll result dataWRITE: result-INTER-VERSC-FPPER,. . .LOOP AT result-INTER-RT INTO rt_header.WRITE: / rt_header-LGART, . . .ENDLOOP.Structure: PAY99_RESULTEVPStructure PC261INTERStructure PAY99_INTERNATIONAL NATDummyfor nationalpartVERSCType PC202RTType HRPAY99_RTBTCRTType HRPAY99_CRTSAPABAP HR
  • EXERCISE (1)1. Whenever an employee is hired, it is mandatory toprovide certain documents, which will form a checkliston joining the organization.The joining checklist are as follows:a. Relieving letter from last employerb. Salary Slip of last employerc. Graduation certificated. Copy of latest qualification certificate, specifye. Income Tax certificate of last employerf. Others specify – (3 lines)Create a customer defined infotype where abovedetails are maintained.SAPABAP HR
  • EXERCISE (2)2. Eligibility for LTA allowance is one basic for a financialyear. If last year it is not claimed, it can be claimed inthe current year.• Provide and additional field to maintain year forLTA claim. (Infotype Enhancement to IT 0015)• If LTA claim is not of current year, then LTAreduces to 80% of the current basic. Built avalidation for the same.LTA is one time payment and maintained in IT0015, i.e. Additional payments & deductions.SAPABAP HR
  • EXERCISE (3)3. Generate a report to list employee with the latestaction in the given date range.Display following fields:a. Employee Numberb. Employee Namec. Action Typed. Action Texte. Action Start DateTips: Make use of HR macrosSAPABAP HR
  • EXERCISE (4)4. Generate a report to list an employment history in agiven date range.Display following fields:a. Employee Numberb. Employee Namec. Action Start Dated. Action Typee. Action TextTips: Make use of provide – endprovide loopSAPABAP HR
  • EXERCISE (5)5. Generate a Salary register which will list followingfields in matrix format.Read data from Payroll Cluster and display it in theabove format.Emp.No. Basic HRA Conv Spl.Pay000010000200100Tips: Refer to SAP standard programs in T.CodePC00_M99_CLGA09 and PC_M99_CLGV09SAPABAP HR