P. 1
The ABAP HR is an Integral Part of ABAP

The ABAP HR is an Integral Part of ABAP

|Views: 286|Likes:
Published by venkata_swaroop

More info:

Published by: venkata_swaroop on Nov 03, 2010
Copyright:Attribution Non-commercial


Read on Scribd mobile: iPhone, iPad and Android.
download as DOCX, PDF, TXT or read online from Scribd
See more
See less





The ABAP HR is an integral part of ABAP.

Generally in ABAP the following are done: 1) Table development 2) Date Processing 3) Report developing 4) BAPIs /RFC s 5) Data base update 6) Screens development/enhancement 7) Scripts and smart forms. 8) Function Building 9) Java connectors etc.

The following concepts are defined in ABAP HR which is different with other modules. 1) Use of Infotypes 2) The use of Logical Database 3) Use of Macros and Provide statement 4) Storage and Access of data 5) Authorization checks There is nothing much difference between abap and hr abap. The way we retrieve the data from data base is deferent. In general ABAP data is stored in Tables, but coming to HR ABAP employee data is sorted through Infotypes. The way we retrieve the data from infotypes is deferent in hr abap. In general ABAP we use Logical data base very rare, as in HR ABAP most of the programs use Logical data base to select data from Infotypes by using Get event. In ABAP we use read statement to read particular record, still in HR ABAP we do use read statement apart from that we have Macros and provide statement. Macro is pre defined code (like function module) which reads data from internal table (internal infotype) based on dates. Provide statement is like Select statement but selects data from internal table Storage and access of data in hr abap is completely deferent in hr abap comparing with ABAP. We use transaction code PA20 and PA30 to maintain data in infotypes. PA20 is display mode and PA30 is change mode. We can create, change, display, copy, and delete in Infotypes with PA30 transaction.

you can enter up to forty wage types. By scrolling. fieldname02. and the individual fields are numbered from one to forty. This. allows you to enter up to forty different wage types and their amounts.6C).For Infotypes authorizations can be maintained infotype and subtype (field) level as HR data is more sensitive and secrete. for example. The structure of the wage type line is stored in the Infotype structure P0008. But what is the repetitive structures?. Evaluating Repetitive Structures in SAP HR ABAP Programming In many master data Infotypes. like fieldname01. some fields are available multiple times with the sequence number change. one line of the repeat structure is evaluated each time the loop is executed As SAP consultant you might know the structures. A loop offers a more streamlined method of evaluation. fieldname03 etc For example In Master data Infotypes we have: Infotype 0008 (Basic Pay) Infotype 0025 (Appraisals) Infotype 0041 (Date Specifications) Infotype 0052 (Wage Maintenance) If we look at Infotype 0008 below fields are getting repeated 40 times (Lower versions of SAP only 20 times like 4. The sentence it self explains that in a structure. Here. data is entered in table form. LGA01 BET01 ANZ01 EIN01 OPK01 LGA02 BET02 ANZ02 EIN02 OPK02 Till LGA40 BET40 ANZ40 EIN40 OPK40 wage type40 wage type amount Number Time/Measurement Unit Operation Indicator for Wage Types wage type1 wage type Amount Number Time/Measurement Unit Operation Indicator for Wage Types wage type2 wage type amount Number Time/Measurement Unit Operation Indicator for Wage Types . This means that each field of the wage type table is defined.

Viz. are we going to check 40 time IF condition for each field (LGA01 to LGA40). For the above scenario wage types are stored in LGA01. Here my question is. salary non exempt (All these are wage types). salary exempt. not all Infotype records. LGA06. replace the SPACE parameter by the appropriate subtype number. LGA02.For the above scenario we have multiple wage types for one Personnel number for one particular period.. BET03. BET06. Tables: PERNR is used to get the standard selection screen as well work area. Data declarations: The required data declarations are first made at the beginning of the Report. Fields LGART and BETRG are required to read the repetitive structures. Now as a technical consultant your job starts. When a record has been successfully read. BET05. If the infotype has subtypes. BET02.. For example we need to select basic wage from Infotype 0008 and display in report. In this case. the return code PNP-SW-FOUND = 1 is returned. BET04. special allowance. Declare Tables: PERNR and press F8 you will get standard selection screen. Basic Pay. LGA04. My answer is No. LGA05. Before going forward if you are new to ABAP HR. Macros: You often only require the most recent or earliest Infotype record. How do you read the data form repetitive structure Infotypes. House rent allowance. use one of the following statements: RP_PROVIDE_FROM_LAST Pnnnn SPACE PN-BEGDA PN-ENDDA. The example determines the wage type and its amount for particular period. These statements make the most recent or earliest record in the PN/BEGDA to PN/ENDDA data selection period available in the structure Pnnnn for infotype nnnn. This is the brief overview about repetitive structures in SAP. conveyance. please go through the below Link: SAP ABAP HR Program code using LDB PNP The following Report shows you how to access these data fields. BET07. We are not sure in which field the basic wage is going to be stored like it might be in LGA01 or LGA02 or LGA03 or LGA04. We have syntax in ABAP by using that we can achieve out target very easily. when we declare Infotypes. . car allowance. LGA07. LGA03. Infotypes: when we declare tables at the runtime of program will have work area the same way. will have internal table (we call as internal Infotype) with header with the structure of associated Infotype. and its amount correspondingly BET01.

The LDB usually consists of the following components: Structure Selections Database programs Logical databases have a tree structure. How are logical database used 1. so that the user can make the necessary correction(s). Logical databases at run-time of an ABAP program At run-time. The only database-specific selections displayed on the selection screen are those needed by the program for data retrieval purposes 2. a LDB is a method by which ABAP programs read and process the data. the system processes the events in the program and in the logical database in the following order Before displaying the selection screen. In the event START-OF-SELECTION. . The logical database and the program check that the input is correct and complete.What is Logical Database? Logical database in SAP The LDB is special type of ABAP program that combines the contents of certain related database tables and retrieve some related data and make it available to application programs.) are performed for the selection screen by the logical database and the program. A logical database can contain a maximum of 300 tables SAPDBPNP is the name of the database program for the logical database PNP. certain initializations (e. the ABAP program performs any preliminary work (for ex.g. The selection screen is displayed and the user enters data in the input fields. some fields are made ready for input again. but also that the user has the appropriate authorizations. Logical databases when generating an ABAP program The selection screen generated contains the selections (SELECT-OPTIONS AND PARAMETERS) of both the logical database and the program. etc. The sequence in which the data is supplied to the program is determined by a tree structure. If an error occurs. importing files). In other words. calculating default values such as key date.

Person selection and data selection period. The data selection period delimits the time period for which data is evaluated.. exporting files). When you enter the data selection period. Any program-specific selections appear after the database selections. Hourly wage earners in a particular personnel sub area.g. You can define your own selection screens for any logical database .g. The flow logic for such screens is also generated automatically and therefore cannot be modified. You cannot delete database selections Functions of LDB: Data retrieval : The personnel data of each employee is loaded into the main memory where it can be accessed for processing. Logical Data bases in HR ABAP: . E. Screening: Employees can be selected according to the organizational criteria entered on the selection screen..g. each on a new line. Features of org. E. There are two types of screening. the system uses this screen as a model when generating. Designing the selection screens The standard selection screen of a logical database has a standard layout where SELECT-OPTIONS and PARAMETERS appear in the sequence they are declared. Person selection defines those employees for whom a report is to be run.. 3. the provide loop retrieves the infotype records whose validity period overlaps with at least one day of this period. the ABAP program performs any concluding operations (for example. If the attributes of a program include the number of its own selection screen.g. Employee status. In the event END-OF-SELECTION. E.The logical database reads the selected data and the program processes it within the GET events according to the sequence specified by the structure. Authorization check: This ensures that the person starting the evaluation Is authorized to access the report data. The system automatically generates such a screen for each program that does not have its own selection screen entered in the attributes.. Monthly wage earners in a specific personnel sub-area. Personnel number range E.g..Active or inactive. calculating totals. E. Assignment Employees who assigned to certain cost center.

Time & Payroll. Employee groups are used to generate default values for payroll accounting area and basic pay. Personnel area 100 is for employees in Karnataka. Master Data contains all employee data used in HR processing. Eg. which includes current and historical. Executives. For e. Retired employees. Employee Groups: divides or groups employees into various categories. Define public holiday calendar. address). unionized employees. Functions include: 1. you can specify whether an employee s pay should be determined on hourly or monthly basis. commonly referred to Master Data. Hourly employees. It is an organizational entity representing an area within an organization defined by specific aspects of personnel administration. Master Data is stored in Infotypes. substitution and absence and leave types can be setup for individual personnel subareas. Organizational (Position description). Personnel area is specific to HR and is a four character alphanumeric identification. The employee subgroup grouping for the payroll rule allows you to define different payroll procedures for different employee subgroups. Set groupings for Time Management.g. Employee Subgroups: are further differentiated within the employee group. Personnel Subarea: is a further subdivision of Personnel area. and the attendance or absence quota type determines the validity of time quotas. Pension). . Infotypes are tables (for user Data entry screen) that contain logically related employee data. Salaried employees. so that work schedules.PNP PNPCE PAP PCH Personnel Administration (PA): PA involves administrating employee data. Benefits (Insurance. Generate default pay scale type and area for an employee s basic pay. Master Data includes Personal (Eg. 2. Components of PA: Personnel Area: represents a division of a company code into subunits.g. Active employees. Contractors. Personnel areas are subdivided into personnel subareas. E. 200 is for Chennai.g. time management and payroll. 3. The employee subgroup grouping for the work schedule defines the validity of work schedule. It may represent geographical locations. Data can be stored for specific periods. E.

then the process is successful. It is not necessary to include logical database PNP/PNPCE in your program when you are using the macro like RP-READ-INFOTYPE A B C D E . ( same as sy-subrc but the value is in reverse case) The macro RP-READ-INFOTYPE retrieves all the data record(s) which is valid in the data selection period. check whether you have included logical database PNP in program attributes. WRITE YOUR CONDITION.( Like function modules ) Generally we use two macros in ABAP-HR or SAP-HR RP-PROVIDE-FROM-LAST RP-PROVIDE-FROM-FRST Ex: RP-PROVIDE-FROM-LAST P0000 SPACE PN-BEGDA PN-ENDDA. The macro RP-PROVIDE-FROM-LAST retrieves the last(latest) data record which is valid in the data selection period. The macro RP-PROVIDE-FROM-FRST retrieves the first(start)data record which is valid in the data selection period. IF PN-SW-FOUND = 1. then the operation is successful. where A corresponds to PERNR which describes for which personnel number you require records. If PNP-SW-FOUND = 1 .Macros in HR-ABAP programming Most commonly used Macros in ABAP-HR ? Macro contains some part of source code which it will be useful for number of applications. For every macro. If SY-SUBRC = 0 . All the Macros are stored in table TRMAC Whenever you are using the macros like RP-PROVIDE-FROM-LAST or RP-PROVIDE-FROM-FRST. . ENDIF. whether the operation was successful or not will be checked with PNP-SW-FOUND.

E corresponds to End date. C corresponds to data structure of the declared infotype (internal table like P0000 for infotype 0000) where all the records of the particular personnel number will be stored. D corresponds to Start date. .B corresponds to INFOTYPE which describes from which infotype you require records.

You're Reading a Free Preview

/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->