SlideShare a Scribd company logo
1 of 220
HR ABAP
Agenda

•   Overview and Features in HR programming
•   Difference between Conventional ABAP
•   Concepts of Infotypes
•   Logical Databases in HR
•   Macros in HR
•   Clusters in HR
•   Enhancement and creation of Infotype
•   Reporting in HR
•   User Exits and BAdIs
•   Authorization Objects in HR
Overview and Features in HR Programming

•   The aim in the Human Resources component is to be able to process
    employee related data according to business requirements in an
    effective structure.
•   The Human Resources module uses a system of data grouped
    together called infotypes. The Human Resources module uses a
    system of data grouped together called infotypes. And storing bulk
    data like time management and Payroll data in Cluster files. HR
    Programming involves data extraction and manipulation from these
    infotypes and clusters using LDB/MACRO and function modules.
•   Infotypes mirror a quantity of connected data records; infotypes are
    identifiable through a four character numerical string [e.g. infotype
    Addresses (0006)] .
•   You can save the infotypes as time-dependent to enable a retroactive
    evaluation of Employee data.
•   The infotypes appear as an entry screen for the user, through which
    you can maintain infotype records. Infotypes can be processed
    individually or in fast entry mode.
Difference between Conventional ABAP

•   Advanced Business Application Programming ABAP is SAP's fourth
    generation language. All of R/3's applications and even parts of its
    basic system are developed in ABAP. ABAP is used for customization
    and modification of SAP applications.
•   In HR ABAP use of select statements significantly less than in other
    areas of ABAP development, Logical databases have limited
    applications in other modules but are very useful in HR. Also, you
    really need to understand the infotype time constraint concept since
    the data organization in HR is Employee-Time based, When you
    cannot get the information that you need out of the logical DB look at
    the function modules starting with HR* and RH*. These function
    modules will provide you with multiple ways of accessing data to save
    time. Worst-case scenario, use a select statement.
•   In addition to the LDB, HR programming also involves the use of
    Macros for data extraction
•   The storage an access of data is different
•   Authorization checks
Concepts of Infotypes
An infotype represents a group of related data fields, provide
information structure, facilitates data entry, and allows time dependent
storage. In other words we can say infotypes are information units used
to enter the time dependent data of the employee.

Master data in HR is stored in infotypes .Each infotype pertains to a
specific type of data. Each infotype has a database table associated with
it.

Time constraints: Enable you to determine how the validity periods of
Infotype data records interact.
1. Time constraint 1: Exactly one valid data record of the infotype in
   question must exist for the entire time that the employee belongs to
   the enterprise.
2. Time constraint 2: No more than one valid data record of the infotype
   in question can exist at any one time.
3. Time constraint 3: Any number of valid data records of the infotype in
   question can exist at any one time.
Concepts of Infotypes
Transparent tables for infotype

•   Each infotype has a transparent table. Each logical field for an
    infotype has a corresponding physical field on the database.

•   One physical table is stored on the database for each transparent
    table. The names of the physical table and logical table definition in
    the Dictionary are compatible.

•   The following naming convention applies to infotype tables; nnnn
    stands for the infotype number:

•   PAnnnn for transparent tables in Personnel Administration
•   PBnnnn for transparent tables in Recruitment
•   HRPnnnn for transparent tables in Personnel Planning
•   Example : For Infotype 0000, the corresponding database table
    associated with it is PA0000
Concepts of Infotypes
Transparent tables for infotype

It is not true always that a Personnel Administration/Recruitment/Personnel
Planning etc has a transparent table like PAnnnn or PBnnnn or HRPnnnn. One
such example is TEVEN table for IT 2011.It is better to use the Function module
HR_INFOTYPE_DATABASETABLE_GET to get the Infotype table name for an
infotype.

CALL FUNCTION 'HR_INFOTYPE_DATABASETABLE_GET'
   EXPORTING
      INFTY      = <INFTY>
      TCLAS       = <TCLAS> “Transaction Class with values ‘A’ or ‘B’ or ‘T’
   IMPORTING
      DBNAME     = <DBTAB>
   EXCEPTIONS
      ENTRY_NOT_FOUND = 1
      OTHERS             = 2.

You can also use the database table T777D to find the database table associated
with an infotype.
Concepts of Infotypes
Technical Data Structure of Info Types

PA Infotypes

The transparent table for PA Infotype is PAnnnn where nnnn is the infotype
number.
  Structure PAKEY:
  This is nothing but primary key of transparent table PAnnnn

•   PERNR: the personnel number is the only unique key within a client for
    identifying an employee. It is used to access the display and maintenance
    screens for an employee’s master data and working time data (infotypes).

•   SUBTY: subtypes are subdivisions of infotypes. An infotype’s subtypes can
    have different time constraints and form their own histories.

•   OBJPS: the object identification is used to make a distinction between records
    with the same infotype, subtype, lock indicator, start date, and end date. For
    example, the child number in infotype 0021 Family/Related Person.
Concepts of Infotypes

•   SPRPS: the lock indicator for HR master data is used to lock and unlock data
    records, which enables the “double verification principle” to be put into
    practice. In accordance with this principle, at least two users are involved in
    the process of writing an active data record to the database. One of the users
    creates a locked infotype record, and the other user unlocks - that is, activates
    the data record.

•   ENDDA: end date.

•   BEGDA: start date.

•   SEQNR: The Sequential Number is used to make a distinction between infotype
    records that have the same key and time constraint '3' (any number of valid
    infotype data records at any one time). Unlike the object identification, it is
    assigned by the system automatically

    Note: Structure PAKEY should never be changed
Concepts of Infotypes

Structure PSHD1:

 In addition to structure PAKEY, there is another basic structure that is identical
for all infotypes in personnel administration – that is, the structure PSHD1.
Structure PSHD1 should never be changed
Concepts of Infotypes

Structure PSHDR:

This is a meta structure and contains the structures PSHDR and PSKEY.
Structure PSHDR should never be changed

Structure Pnnnn:

This structure contains the includes PSHDR and PS0002, where PSHDR in turn contains the
include structures PSKEY and PSHD1.
Concepts of Infotypes

Element   Definition   Includes         Can be changed by
                                        customer
PAKEY     Structure    -                No


PSHD1     Structure    -                No


PSHDR     Structure    PSKEY            No
                       PSHD1
PSnnnn    Structure    (field definitions) PS9nnn:Yes
                       CI_Pnnnn            PS0nnn-PS8nnn:
                                           No
Pnnnn     Structure    PSHDR            P9nnn:Yes
                       PSnnnn           P0nnn-P8nnn:No
Concepts of Infotypes

Element   Definition    Includes   Can be changed by
                                   customer


PAnnnn    Transparent   MANDT      PA9nnn:Yes
          Table         PAKEY      PA0nnn- PA8nnn
                        PSHD1      :No
                        PSnnnn
CI_nnnn   Structure     -          Yes
Concepts of Infotypes
Technical Data Structure of Info Types
Personnel Infotypes

Structure: HRIKEY

•   MANDT: This field contains the clients.
•   PLVAR: It is a two-character alphanumeric Key for the plan versions that
    enables us to differentiate between alternative plan versions.
•   OTYPE: This field contains the object type key, which is a maximum of two
    alphanumeric characters in length.
•   OBJID: This field contains an eight-digit key that represents a single object.
•   SUBTY: Contains specification of sub type
•   ISTAT: This field is one-digit numeric key in which the planning status is
    indicated. There is a status for all objects and for the infotypes that describe
    them.
•   BEGDA: This contains start date of the validity period
•   ENDDA: This contains end date of the validity period
•   VARYF: This contains the target object of a relationship
•   SEQNR: This specifies a sequence number for Infotypes of time constraint
    class 3.
Concepts of Infotypes

Structure HRIKEYL:

The structure HRIKEYL is a variant of the structure HRIKEY. This supports language-dependant
infotypes.
Concepts of Infotypes

Structure HRIADMIN:

The structure HRIADMIN is a data structure contains administrative information on each infotype.
Concepts of Infotypes

Structure HRInnnn:

The infotype-specific data fields for an infotype are defined in the structure HRInnnn. Here nnnn
stands for four-digit infotype number, as appropriate.

Transparent Table HRPnnnn:

The transparent table now contains the structures HRIKEY(key fields), HRADMIN and HRInnnn.

Logical structure Pnnnn:

Like the infotypes in Pa, the structure Pnnnn is also found in the infotypes of personnel planning.
It contains the includes HRIPKEY, HRIADMIN and HRInnnn.
Concepts of Infotypes

Table Infotypes:

Table infotypes are a special form of infotype used in personnel planning. Table infotypes are
infotypes for which the data part has a repetitive structure of arbitary length. The repetitive
structures could be texts with any number of lines, or it could, for example, be a course
schedule with any number of days. In order to provide the option of saving repetitions of any
length, the data part must have repetitive structure and it must be saved in a separate data table.
This repetition part of the table part is described in the logical structure PTnnnn and stored in
separate table HRTnnnn. While maintaining the entry in table T777D for infotypes, the table
infotype will be having the T777D-TBTAB field will be filled with HRTnnnn.
Concepts of Infotypes

External Object Types:

External Object types refer to those object types that are not stored in the data structure of
personnel planning. From a technical point of view there is no record in HRP1000 for external
objects. External Object types are only referenced in the context of a relationship record.
Technically, this means that data records on the relationship are only held in HRP1001.
For internal object types, relationships can exist in two directions, top-down (B) and bottom-up
(A). This results in the creation of two records in IT 1001, relationships. External Object types are
limited in this respect. In order to create an inverse relationship for an external object type, the
key structure of the external object type must be an eight-digit numeric string type NUMC of
length 8). It must be therefore be defined with the same type as the field object ID (HRPnnnn-
OBJID).
Whether external object types have only one relationship – or if inverse relationships are also
possible – is established for each object type in the table T77EO.
Concepts of Infotypes

External Infotypes:

Infotypes that are needed for planning purposes in personnel planning, but are not stored in
transparent infotype tables of the type HRPnnnn are referred to as external infotypes. This
information can be physically available, for example, in the tables of personnel administration.
An identifier for an external infotype appears in table T777D in the field EXT_INFTY.
Concepts of Infotypes

Element    Definition   Includes          Can be changed by
                                          customer
HRIKEY     Structure    -                 No


HRIKEYL    Structure    -                 No


HRIADMIN   Structure    -                 No


HRInnnn    Structure    (field definitions) HRI9nnn:Yes
                        CI_Pnnnn            HRI0nnn-
                                            HRI8nnn: No
Pnnnn      Structure    HRIPKEY           P9nnn:Yes
                        HRIADMIN          P0nnn-P8nnn:No
                        HRInnnn
Concepts of Infotypes

Element   Definition    Includes    Can be changed by
                                    customer
HRPnnnn   Transparent   HRIKEY or   HRP9nnn:Yes
          Table         HRIKEYL     HRP0nnn-
                        and         HRP8nnn: No
                        HRIADMIN
PTnnnn    Structure     -           PT9nnn:Yes
                                    PT0nnn-PT8nnn:
                                    No


HRTnnnn   Transparent   PTnnnn      HRT9nnn:Yes
          Table                     HRT0nnn-
                                    HRT8nnn : No
CI_nnnn   Structure     -           Yes
Logical Databases in HR
To reduce programming Efforts, it often helps to use the logical
databases when creating reports. Logical databases are special ABAP
Programs that provide selection screens, additional features and so on.
The main objects of a LDB are Structure, Selection and Database
 Program. An LDB has another advantage for the option of central
 authorization checking.
 Logical Databases used In HR:
1.   PAP
2.   PNP
3.   PNPCE - Enhanced version of PNP available form SAP Enterprise
     version onwards
4.   PCH
5.   PTRVP
The LDB PAP is for Applicant administration, PNP and PNPCE for
Personnel Management, PCH for Organisational Management and PTVRP
for Travel Management.
The Logical Databases PNP/PNPCE and PCH are mostly used.
Macros in HR
•   Like subroutines and function modules, macro modules can be
    used to modularize programs. Macro modules are frequently used
    in HR.
•   These macros are defined in program SAPDBPNP (include
    DBPNPMAC) with the keyword DEFINE. They can be used in any
    program that uses the logical database PNP.
•   If you want to use these macros in reports that do not use the
    logical database PNP, you must include program DBPNPMAC with
    the keyword INCLUDE.
•   You can also define your own macros. In accordance with the
    naming convention, the first two letters stand for the application.
•   Some macros are also stored in the Macros in ABAP Programs table
    (TRMAC)
Example of Macros are
1.  RP_PROVIDE_FROM_LAST which is available in the include
    DBPNPMAC
2.  RP-PROVIDE-FROM-FRST which is available in table TRMAC
Macros in HR
•   The RP_PROVIDE_FROM_LAST macro retrieves the last valid data
    record in the data selection period.
•   The parameters for RP_PROVIDE_FROM_LAST are: infotype,
    subtype, start date, and end date. If you do not want to specify a
    particular subtype, enter SPACE.
•   You can process not only the last valid data record in the data
    selection period, but also the first valid data record using the
    RP_PROVIDE_FROM_FRST macro.
•   The macro return code PNP-SW-FOUND has the value 1 if a suitable
    entry exists in the infotype table for the specified period. If no entry
    is found, the value is 0.
Clusters in HR
D a ta b a s e T a b le s P C L n




                                         PCLn


                                    A1          A3

                                          A2




     S A P A G 1999
Clusters in HR

•   Database tables of type PCLn are divided
    into subareas known as data clusters.
•   Data clusters can be identified by their two-
    character IDs.
•   The respective subareas within Human
    Resources work on their own cluster.
•   A separate data key is defined for each
    subarea.
•   The PCLn database tables are a type of
    import/export database table.
Clusters in HR
Clusters in HR

Cluster table PCL1:

PCL1 contains the following data areas

B1 Time events/PDC
G1 Group incentive wages
L1 Individual incentive wages
PC Personal calendar
TE Trip costs/accounting results
TC Trip costs/credit card data
TX Infotype texts
Z1 Interface PDC -> cost accounting/materials management

This table is maily used for retrieving data from the following data areas:
1. B1
2. TX
Clusters in HR

Cluster table PCL2:

PCL2 contains the following data areas:

B2 Time accounting results
CUCluster directory
PS Generated schema
PT Texts for generated schemas
RX Payroll results/international
Xy Payroll results/country-specific, whereby xy represents the relation
   ID. This is from RELID field of table T500L for the country.
ZL Personal work schedule
Clusters in HR
DB Table Adm inistration/ PCLn




              PCLn
                            IM PORT   TABLES: PCLn.

             A1    A2

                            EXPORT




1. The PCLn import/export database tables are managed by the ABAP
   commands IMPORT and EXPORT.
2. We can use these commands to store any data object - such as fields,
   structures or internal tables - on the database, or to read them from the
   database.
3. Data is read and written using a unique key.
Clusters in HR
T a b le S tru c tu re / P C L n



                 F ie ld n a m e K E Y      L e n g th    Text
                 C L IE N T        X           3          C lie n t
                 R E L ID          X           2          R e la tio n ID
                 SRTFD             X          40          W o rk a re a k e y
                 SRTF2             X          10          S o rt fie ld fo r d u p lic a te k e y




                              E x a m p le o f in te rn a tio n a l p a yro ll re s u lts :
                              R E L ID S R T F D
                              RX         00001911 00001
                              RX         00001911 00002
                              RX         00001911 00003
                              ...
Clusters in HR

   The structure of PCLn database tables provides a basic structure for
 individual subareas.
   The name of each subarea must include a two-character cluster name
  or
 relation ID.
   A key structure must also be defined; 40 bytes are available in field
 SRTFD for this purpose.
   In the international payroll results, for example, the field RELID
  contains
 the cluster name RX and the field SRTFD contains the eight-digit
 personnel number as well as a five-digit sequence number for each
 individual payroll result for a payroll period.
   To enable the import of a record from a PCLn database table, the
  RELID
field must contain the cluster identifier and the SRTFD field must contain
the cluster key. The fields CLIENT and SRTF2 are filled by the system.
Clusters in HR
  U tilitie s /D e le tin g a C lu s te r




                   U T IL IT Y                      PCLn




                                                    PCLn




Utility transaction PU00 enables us to delete payroll results in xy clusters for specific
personnel numbers.
1. Utility programs RPUPnD00 and RPUPnD10 - where n stands for database table
    PCL1 or PCL2 - enable us to delete one or more records from any cluster.
2. We can delete payroll results using the program RPUDEL20.
3. Caution:
   The deletion utilities should only be used for testing. Archiving takes place to
   reduce the amount of data in the database.
Enhancement and Creation of Infotypes

Enhancement of Infotypes
Enhancement and Creation of Infotypes

Infotype needs to be enhanced sometimes to add our own fields
to the existing infotype fields. Before Enhancing any infotype, CI_
Include must be available.
Enhancement of PA Infotypes
In PA we can enhance the Single screen as well as list screen.
Enhancing the single screen
•    Procedure
1.   Start the transaction Enhance Infotype, (transaction code
     PM01). The Create Infotype screen appears.
2.   Choose Enhance Infotype Tab
Enhancement and Creation of Infotypes
3.    In the Infotype Number field, enter the four-digit number of the
      infotype you want to enhance
         When you enter the infotype number, remember to enter any
      leading
      zeros.
      Note: It is not possible to enhance a single screen for the Actions
            infotype (0000), or the Time Management infotypes.
Enhancement and Creation of Infotypes
4.    Choose the button ‘Create All’
      The following screen appears:




5.       Press Enter. Then create the fields required on the screen. In this
       case Train Route
Enhancement and Creation of Infotypes

6.    The following screen appears.




7.    Now if we go to Infotype 0006 of any employee we can see
      the field added.
Enhancement and Creation of Infotypes
Note: While enhancing the single screen of an infotype a module pool
     program ZPnnnn00 will be created and that can be modified by
     ourselves. We have to modify the screen number 0200 for adjusting
     the screen elements and appearance of the enhanced screen.

     The module pool program of a PA Infotype will be MPnnnn00.

     For every infotype there is a dialog module associated with it. It will
     be RP_nnnn for PA infotypes.

     The single screen of an Infotype will be 2000 and the list screen will
     be 3000.

     Here nnnn denotes 4-digit infotype number.
Enhancement and Creation of Infotypes
Enhancing the single screen
•   Procedure
1.  Start the transaction Enhance Infotype, (transaction code
    PM01). The Create Infotype screen appears.
2.  Choose Enhance List screen Tab
3.  In the Infotype Number field, enter the four-digit number of the
    infotype you want to enhance the list screen.
Enhancement and Creation of Infotypes
4.   Choose the button ‘Create All’
     The following screen appears:




5.     Press Enter. Then create the fields required on the screen. In this
     example Train Route
Enhancement and Creation of Infotypes

6.   The following screen appears.




6.   Now if we go to Infotype 0006 overview screen of any
     employee we can see the field added .
Enhancement and Creation of Infotypes
Note: While enhancing the list screen of an infotype a module pool
     program ZPnnnn00 will be created (if it is not available already) with
     an include ZPnnnn40. We cannot modify the screen appearance of
     the added field since it will be directly added to the list screen 3000
     of the module pool MPnnnn00.
Enhancement and Creation of Infotypes

Enhancement of Personnel Infotypes
Use the transaction PPCI to enhance Personnel Infotypes.

Enhancing the single screen
•    Procedure
1.   Start the transaction Enhance Infotype, (transaction code PPCI). The following
     screen appears. Enter the 4 digit infotype number. Click on extend button.
Enhancement and Creation of Infotypes
 2.    The following screen appears. Click on ‘Create All’ Button.




3.    Enter the fields and activate the include CI_Pnnnn and the fields
      entered will appear in the infotype.
Enhancement and Creation of Infotypes

Enhancing the list screen
•    Procedure
1.   Start the transaction Enhance Infotype, (transaction code PPCI). The following
     screen appears. Enter the 4 digit infotype number. Select the menu Infotype
     Enhance list screen.
Enhancement and Creation of Infotypes
     2.      The following screen appears. Click on ‘Create All’ Button.




3.        Enter the fields and activate the structure ZPLISnnnn and these fields
          entered will appear in the infotype's overview screen.
Enhancement and Creation of Infotypes

Creation of Infotypes
Enhancement and Creation of Infotypes

Infotype needs to be created when you cannot store the required
information in any of the standard infotypes.

Creation of PA Infotypes
1.    Start the transaction Enhance Infotype, (transaction code PM01). The
      Create Infotype screen appears.
2.    Enter the four digit Infotype number ( starting from 9000-9999).
3.    Then click on the ‘Create All’ button.
Enhancement and Creation of Infotypes

3.   The following popup appears. Press Enter.




4.    The new screen for entering the required infotype field appears.
      Activate the structure PSnnnn and the required infotype details are
      created.
Enhancement and Creation of Infotypes
5.    Then our major duty is to maintain the infotype characteristics. For
      that from the PM01 transaction select the button ‘Infotype
      Characteristics’. Copy the entry from existing infotype to the newly
      created one and change the characteristics of our infotype
      accordingly. The characteristics can also be maintained through
      IMG or by using the customizing view V_T582A.



                                                    New Infotype
Enhancement and Creation of Infotypes

Details of customization
Enhancement and Creation of Infotypes

If you goto PA30 transaction for Infotype 9nnn you can find the infotype
fields entered.
Enhancement and Creation of Infotypes

Creation of Personnel Infotypes
Field Infotypes
For Field infotypes we have to create the structure HRI9nnn though
the transaction SE11 before we are creating the infotype.
Table Infotypes
For Table infotypes we have to create the structure HRI9nnn and
PT9nnn though the transaction SE11 before we are creating the
infotype.

Other than these the creation of both types of Infotype remain the
same.
Enhancement and Creation of Infotypes

Let us see the procedure of creating a table Infotype, 9700.
Goto SE11 transaction and create the structures HRI9700 and
PT9700
Enhancement and Creation of Infotypes

1.    Start the transaction Enhance Infotype, (transaction code PPCI). The
      Create Infotype screen appears.
2.    Enter the four digit Infotype number ( starting from 9000-9999. In our
      example it is 9700). Also enter the description of the Infotype.
3.    Then click on the ‘Create’ button. The following screen appears.
Enhancement and Creation of Infotypes

4.    Select the radio button ‘Table infotype and click on the ‘Create’
      Button. The following popup appears. Select ‘Yes’.




5.   Finally an information message appears as follows:
Enhancement and Creation of Infotypes
6.    Then our major duty is to maintain the infotype characteristics. Do
      it through IMG or by using the customizing table T777I. What we
      have to add is the Time constraint and Infotypes per object type.
Enhancement and Creation of Infotypes

I have added this to Object type O and with time constraint 2.




 Similarly I can add the infotypes per object type as follows
Enhancement and Creation of Infotypes

Finally If I goto PP01 transaction for the maintenance of Organization
Unit, I can see the infotype.
Enhancement and Creation of Infotypes
Reporting in HR

Special ABAP Statements for HR
1.    INFOTYPES
2.    PROVIDE
3.    ENDPROVIDE

1.    INFOTYPES
      The syntax for this statement is:
     INFOTYPES nnnn.
      - nnnn between 0000 and 0999: HR master data info types
      - nnnn between 1000 and 1999: HR planning data info types
      - nnnn between 2000 and 2999: HR time data info types
      - nnnn between 3000 and 8999: Not yet used
      - nnnn between 9000 and 9999: Customer-specific info types
There are some variants for INFOTYPES statement
1.    … NAME c
2.    … OCCURS n
3.    … MODE N
4.    … VALID FROM comp1 TO comp2
Reporting in HR
The effect of ‘INFOTYPES’ statement is that it will create an internal
table Pnnnn as follows:

DATA BEGIN OF Pnnnn OCCURS 10.
        INCLUDE STRUCTURE Pnnnn.
DATA END OF Pnnnn VALID BETWEEN BEGDA AND ENDDA.
(eg) INFOTYPES 0001.

Variant 1: … NAME c , c 20 character field
This will create an internal table with the name c

DATA BEGIN OF c OCCURS 10.
     INCLUDE STRUCTURE Pnnnn.
DATA END OF c VALID BETWEEN BEGDA AND ENDDA.

(eg) INFOTYPES 0006 NAME ADDRESS.
Reporting in HR

Variant 2: … OCCURS n, n    numeric value
This will create an internal table as follows:
DATA BEGIN OF Pnnnn OCCURS n.
        INCLUDE STRUCTURE Pnnnn.
DATA END OF Pnnnn VALID BETWEEN BEGDA AND ENDDA.
(eg) INFOTYPES 0005 OCCURS 2.
Variant 3: …MODE N

Applies only to the HR logical databases PNP, PNPCE and PCH.
The info type tables are not filled by GET PERNR (logical database
PNP) or GET OBJEC (logical database PCH). The effect of the
INFOTYPES statement is then the same as the data declaration of
an internal table (as described above). Generally used for Time Infotypes.
(eg) INFOTYPES 2001 MODE N.
Reporting in HR

Variant 4: … VALID FROM comp1 TO comp2
This should be used only with LDBs PNP and PNPCE

GET PERNR retrieves only those info type records which are valid
within the time range ( comp1 and comp2) specified. comp1 and
comp2 are dates with the format YYYYMMDD.

(eg) INFOTYPES 0007 VALID FROM 19910101
                          TO   19911231.
Reporting in HR

2.    PROVIDE
      The syntax for this statement is:
      PROVIDE f1 f2 … FROM itab1
                  g1 g2 … FROM itab2
                  …
                  BETWEEN f AND g.
     - We can use * instead of individual field names
     - itab1, itab2 etc will be of structure Pnnnn
     - f and g are from and to dates.
      This statement will retrieve the contents of the specified fields
      from the internal tables ( itab1, itab2, ...) and places them in the
      table header lines within the required range. Also executes the
      processing block enclosed by the PROVIDE and ENDPROVIDE
      statements for each range.
Reporting in HR


3. ENDPROVIDE

  The syntax for this statement is:
    ENDPROVIDE.
 - This statement will close the loop introduced by PROVIDE.
Reporting in HR

Data Retrieval


                   1. Create data structures for infotypes

                       INFOTYPES: 0001,
                                  0002,
                                  0007.

                                        "Organizational Assignment"
                                        "Personal Data"
                                        "Planned Working Time"



                   2. Fill the data structures with the infotype records

                       GET PERNR.




    SAP AG 1999
Reporting in HR

•   Structure PERNR contains standard selections
    for HR master data reporting. They consist of
    the personnel number, the fields of infotypes
    0000 and 0001, and a number of additional
    fields.
•   When the GET event occurs, the data structures
    of declared infotypes are filled with all of the
    records that exist for a personnel number. The
    PERNR structure is fílled with the data from the
    above infotypes. You can access the data in this
    structure for processing.
Reporting in HR
Processing M aster Data


  TABLES: PERNR.
  INFOTYPES: 0001,     "Actions
             0002,     "Personal Data
             0006,     "Addresses
             ....


  GET PERNR.
      PROVIDE * FROM P0002 BETWEEN PN-BEGDA AND PN-ENDDA.
         WRITE...


       ENDPROVIDE.




   SAP AG 1999
Reporting in HR
•   Filled infotype structures are stored in the main memory for the GET
    PERNR event keyword.
•   The infotype records are imported to internal tables Pnnnn (for example,
    P0006 for infotype 0006). These tables are then processed in a PROVIDE-
    ENDPROVIDE loop.
•   The infotype records whose validity period overlaps the period selected
    in the selection screen (PN-BEGDA and PN-ENDDA) by at least one day
    are placed one after the other in the header of the respective infotype
    table Pnnnn.
•   For example, if you choose the current year in the selection screen, PN-
    BEGDA contains the first day of the year and PN-ENDDA contains the
    last day of the year. If you do not enter any data for the period in the
    selection screen, PN-BEGDA contains the low date (01/01/1800) amd PN-
    ENDDA contains the high date (31/12/9999).
•   Note: If you have entered period date in the selection screen, the
    contents of fields Pnnnn-BEGDA and Pnnnn-ENDDA are also reset in the
    header of the infotype table Pnnnn. For example, if the date in Pnnnn-
    ENDDA is after the date in PN-ENDDA, Pnnnn-ENDDA is given the value
    from PN-ENDDA.
Reporting in HR
Loop Nesting


  GET PERNR.
      PROVIDE * FROM P0002 BETWEEN PN-BEGDA
  AND PN-ENDDA.                               Infotype
         WRITE...                             loop
      ENDPROVIDE.
  or:
      LOOP AT P0002 WHERE ENDDA GE PN-BEGDA
                     AND BEGDA LE PN-ENDDA.   Infotype
                                                         Employee
         WRITE...                             loop
                                                         loop
      ENDLOOP.

       PROVIDE * FROM P0006
          BETWEEN PN-BEGDA AND PN-ENDDA       Infotype
          WHERE P0006-SUBTY = '1'.            loop
          WRITE...
       ENDPROVIDE.

  END-OF-SELECTION.


   SAP AG 1999
Reporting in HR

•   HR data is processed in two nested loops:
•   A GET PERNR loop for all of the personnel numbers
    selected. It is concluded implicitly by the next event, for
    example, END-OF-SELECTION.
•   Subordinate loops per infotype, for the processing of all
    infotype records for the selected personnel number.
•   With this form of processing, you should note that the
    data for the Personal Data (0002) and Address (0006)
    infotypes is listed sequentially and is not linked.
•   You can also process the infotype tables with a LOOP-
    ENDLOOP.
Reporting in HR
P e r io d -B a s e d D a ta (1 )



                       J A N U A R Y - A P R IL




                                M AY - AUGUST

       Ms Y



                                     SEPTEM BER - DECEM BER




     S A P A G 1999



Infotype data is period-based, in other words, it is only valid for
   specific periods. For this reason, each record has a start date
   and an end date.
This example shows the jobs that an employee has performed
   over the course of a year.
The decision on how to retrieve data is made for each individual
   infotype.
Reporting in HR




REPORTS IN PERSONNEL ADMINISTRATION
Reporting in HR

Some important fields
1.    PERNR     Personnel Number
2.    WERKS    Personnel Area
3.    BTRTL   Personnel Subarea
4.    PERSG   Employee Group
5.    PERSK   Employee Subgroup
6.    ABKRS   Payroll Area
7.    LGART   Wage Type
8.    BETRG   Amount
9.    ANZHL    Number
10.   MOLGA   Country code
11.   BEGDA    Start Date
12.   ENDDA   End Date
13.   MOABW    Personnel subarea grouping for absence and attendance types
Reporting in HR

Report which is based on reading data from infotypes and
using LDBs

REPORT zpsol010.
*-- Declaration
TABLES: pernr.
INFOTYPES: 0002.          "Personal Data
SELECT-OPTIONS: language FOR p0002-sprsl.

*-- Selection screen
INITIALIZATION.
 pnptimed = 'D'.
Reporting in HR
*-- Processing
GET pernr.
 PROVIDE * FROM p0002 BETWEEN pn-begda AND pn-endda.
   CHECK language.
   WRITE: / p0002-pernr,
        sy-vline,
        pernr-ename,
        sy-vline,
        p0002-sprsl,
        sy-vline,
        p0002-gbdat.
 ENDPROVIDE.
Reporting in HR
Example for understanding the repetitive structure

Say, for an employee you want to know that for what all wage type
an employee is eligible for the latest period you mentioned on the
selection screen.

REPORT ZRP_REPETITIVE_STR NO STANDARD PAGE HEADING.

TABLES pernr.
INFOTYPES 0008.
*** you have to declare a structure same as repetitive structure in the
** 0008 infotype
DATA: BEGIN OF s_wagetypes,
         wagetype TYPE p0008-lga01,
         amount TYPE p0008-bet01,
         hours     TYPE p0008-anz01,
         unit      TYPE p0008-ein01,
         ind      TYPE p0008-opk01,
      END OF s_wagetypes.

GET pernr.

 DO 20 TIMES VARYING s_wagetypes FROM p0008-lga01 NEXT p0008-lga02.
  IF s_wagetypes-wagetype IS INITIAL.
   EXIT.
  ELSE.
   WRITE: / s_wagetypes-wagetype,
        s_wagetypes-amount.
  ENDIF.
 ENDDO.
Reporting in HR
Importance of Dates and Periods

•    Here is a simple ABAP example of reading DATE types stored in
     infotype 0041.
•     There can be a maximum of 12 dates stored in this
     infotype. Here is an example of an infotype 0041 record:
Reporting in HR
The date types are stored in PA0041-DAR01, PA0041-DAR02,
     etc.

In the example above, PA0041-DAR01 is “01”, PA0041-DAR02
      is “09”.

The dates themselves are stored in PA0041-DAT01, PA0041-
     DAT02, etc

To read through this in ABAP, the easiest way is to use the DO
     VARYING statement. Here is a simple demonstration
     ABAP:

Note: to print the text of the date type, e.g. “Leave year entry”
     select from table T548T.
Reporting in HR

REPORT ZDATES1 .
TABLES: PERNR.

DATA: BEGIN OF MYDATES,
  DAR LIKE P0041-DAR01,
  DAT LIKE P0041-DAT01,
END OF MYDATES.

INFOTYPES 0041.

GET PERNR.

WRITE: PERNR-PERNR, PERNR-ENAME. "show employee number and name

 RP-PROVIDE-FROM-LAST P0041 SPACE PN-BEGDA PN-ENDDA.
 IF PNP-SW-FOUND = 1.
*** Processing of repetitive structures *************
   DO 12 TIMES VARYING mydates
    FROM p0041-dar01
    NEXT p0041-dar02.
     IF mydates-dar NE space.
       WRITE: /,MYDATES-DAR, MYDATES-DAT.
     ENDIF.
   ENDDO.
 ENDIF.
Reporting in HR
M acro M o d u les



  T ABLES: PERNR .
  I NFOTYP ES: 0 001,     "Or ganiza tional Assig nment
               0 002,     "Per sonal Data
               0 006,     "Ad dresse s
               . ...


  G ET PER NR.
       R P_PROV IDE_FR OM_LA ST P00 01 SPA CE PN- BEGDA PN-EN DDA.
           W RITE.. .

                         * * * In cl ud e pr og ra m DB PN PM AC .

                         DE FI NE R P_ PR OV ID E_ FR OM _L AS T.
                             PN P- SW -F O U ND = ' 0' .
                             . . .
                         EN D- OF -D EF IN IT IO N.




   S A P A G 1999
Reporting in HR
R e ad in g th e G ro u p T a b le U sin g th e P e rso n n e l
A rea/S u b a re a F ie ld s


   TABLES: PERNR, T001P.                  P e rs o n n e l Are a /S u b a re a T a b le
   INFOTYPES: 0001,
                                          P e rs Are a   S u b a re a   G ro u p in g s . . .
              ....
                                          ...
                                          CABB           00 0 1         01           01
                                          ...




   GET PERNR.
       RP_PROVIDE_FROM_LAST P0001 SPACE PN-BEGDA PN-ENDDA.

            RP-READ-T001P P0001-WERKS P0001-BTRTL SPACE.




     S A P A G 1 99 9
Reporting in HR

•   It is often necessary to read the groupings stored in the
    Personnel Area/Subarea table because they are required
    as keys for other tables. This must take place individually
    for each personnel number to be processed.
•   Each employee's assignment to a personnel area and
    subarea is stored in infotype 0001.
•   The parameters of the macro are:
•   Personnel areas
•   Personnel subareas
•   Reaction, if no entry is found:
•   X = Termination of report with error message ‘No entry
    found in table ...’
•   SPACE = SY-SUBRC is set to 4.
•   Alternatively, if you only want to determine the country
    indicator, you can use the function module
    HR_COUNTRY_GROUPING_GET.
Reporting in HR
 R e a d in g In fo t y p e s W ith o u t L o g ic a l D B (1 )




                        P Annnn


                                                  I   N   FOTYPES: <nnnn>.
                                                  .   .   .
                                                  C   A   LL FUNCTION
                                                  '   H   R_READ_INFOTYPE'...




        SA P AG 1999




You can also read infotype records for a particular personnel number
   without using the logical database.
To do this, use the function module HR_READ_INFOTYPE. However,
   you must ensure that the internal table for the required infotype is
   declared with the INFOTYPE statement.
Reporting in HR
Reading Infotypes Without Logical DB (2)


  INFOTYPES: 0002.
  DATA: return LIKE SY-SUBRC.

  CALL FUNCTION 'HR_READ_INFOTYPE'
      EXPORTING
      . . .
         PERNR               = <person>
         INFTY               = '0002'
         BEGDA               = <begdat>
         ENDDA               = <enddat>

       IMPORTING
          SUBRC             = return
       TABLES
          INFTY_TAB         = P0002
       EXCEPTIONS
          INFTY_NOT_FOUND   = 1
          OTHERS            = 2.



   SAP AG 1999
Reporting in HR

•   The function module reads the HR infotype records for a person
    (employee or applicant) in accordance with the specified selection
    criteria. Values are returned in an internal table, the structure of which
    corresponds to the appropriate infotype table. In the calling program,
    such tables can be declared with the INFOTYPES statement, for
    example. An infotype record is selected if its validity period overlaps
    with the specified period.
•   The function module performs an authorization check.
•   The following specifications are possible for the return code:
    0: The return table contains all required records
    4: The return table contains all records, however, it is incomplete due to
    missing                 authorization
    8: The return table is empty because no records were found with the
    specified criteria
    12:           The return table is empty due to missing authorization
•   Note: You should not use this function module in reports that use the
    logical database PNP. If you want to read an infotype separately in one
    of these reports, you can call the subroutine READ-INFOTYPE directly in
    the database program SAPDBPNP (PERFORM READ-
    INFOTYPE(SAPDBPNP)). . .). If this is the case, you declare the infotypes
    in the statement INFOTYPES with supplement MODE N.
Reporting in HR
Determining the Entry Date


  INFOTYPES: 0001.
  DATA: hire_date LIKE P0016-EINDT.


  CALL FUNCTION 'RP_GET_HIRE_DATE'
      EXPORTING
         PERSNR              = P0001-PERNR
         CHECK_INFOTYPES     = '0000'
  *      DATUMSART           = '01'
  *      STATUS2             = '3'
  *      P0016_OPTIONEN      = ' '
      IMPORTING
         HIREDATE            = hire_date
      EXCEPTIONS
         OTHERS              = 1.




   SAP AG 1999
Reporting in HR

•   With this function module, you can determine the initial start
    date of an employee. You can take the following infotypes into
    account when you determine this date:
    - P0000 Actions
    - P0001 Organizational Assignment
    - P0016 Contract Elements
    - P0041 Date Specifications


•   The transfer parameter CHECK_INFOTYPES is used to
    determine which of these infotypes are taken into account. The
    employment status (parameter STATUS2) can also be specified
    for infotype P0000. In infotype P0016, only the Entry data field
    (P0016-EINDT) is taken into account. For infotype P0041, the
    corresponding date type can be given in the transfer parameter
    DATUMSART. The date type '01' is usually used for the technical
    entry date.
•   Most function modules in HR have the letters 'HR' or 'RP' in the
    first two characters of their name. To find additional modules,
    use the search function in the Function Builder.
Reporting in HR
Updating Infotype Records (1)

  DATA: return_struc TYPE BAPIRETURN1,
  . . .

  CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE'
     EXPORTING
       NUMBER                = PERNR-PERNR
     IMPORTING
       RETURN                = return_struc.

  IF NOT return_struc IS INITIAL.
     WRITE: / return_struc-TYPE,...
  ENDIF.
  . . .
  * Update Infotype Records
  . . .
  CALL FUNCTION 'BAPI_EMPLOYEE_DEQUEUE'
     EXPORTING
        NUMBER                = PERNR-PERNR
     IMPORTING
        RETURN                = return_struc.


   SAP AG 1999
Reporting in HR
•   Before you change employee data, you must lock the
    personnel number. You can do this with the function
    module BAPI_EMPLOYEE_ENQUEUE.
•   Messages are returned in the parameter RETURN. If an
    error occurs, this structure contains the following
    information:- Message type (field TYPE)- Message text
    (field MESSAGE).If the step is successful, the structure is
    blank.
•   If an employee's data has been locked, only the user who
    has locked the data can access the data records linked to
    the employee. For other users, access is denied. For this
    reason, you must remove the lock after the data has been
    changed. You can do this with the function module
    BAPI_EMPLOYEE_DEQUEUE.
Reporting in HR
Updating Infotype Records (2)

  DATA:            return_struc TYPE bapireturn1,
                   record_key   TYPE bapipakey.
  . . .
  GET PERNR.
     LOOP AT P0002 WHERE. . .

          CALL FUNCTION 'HR_INFOTYPE_OPERATION'
             EXPORTING
                    INFTY              = '0002'
                    NUMBER             = P0002-PERNR
                    LOCKINDICATOR      = P0002-SPRPS
                    VALIDITYEND        = P0002-ENDDA
                    VALIDITYBEGIN      = P0002-BEGDA
                    RECORDNUMBER       = P0002-SEQNR
                    RECORD             = P0002
                    OPERATION          = 'MOD'
                    DIALOG_MODE        = '1'
             IMPORTING
                    RETURN             = return-struc
                    KEY                = record_key.

     ENDLOOP.
   SAP A G 1999
Reporting in HR
•   With this function module, you can maintain the employee and applicant master
    data. You can specify one data record. All validations that would normally take
    place if the infotypes were maintained online with the individual maintenance
    screens are also carried out here. The module returns the same error messages as
    in the online operation. This means the error messages for the individual
    maintenance screens are displayed rather than interpreted. The update is carried
    out by a 'Call dialog' to the module pool for the infotype. This means that some
    restrictions apply to the infotypes processed in that way (see documentation for
    module).
•   The following values are amongst those available for the parameter OPERATION:
    MOD (change), COPY (copy), DEL (delete), INS (insert), LIS9 (delimit).
•   With the parameter DIALOG_MODE, you specify whether the action is generally run
    in the background or whether it only runs in the background until an error occurs,
    or whether the changes are generally carried out in the dialog mode. Possible
    values:'0' The changes are generally processed in the background. If an error
    occurs (with an E or A message), the complete step is terminated and the module
    returns the corresponding error message in the structure 'RETURN'.
    '1' The changes are generally processed in the background. If an error occurs, the
    system switches to dialog mode so that the user can correct the entries.
    '2' The changes are processed in the dialog mode.
Reporting in HR
U p d atin g In fo typ e R eco rd s (3 )


   PARAMETERS: natio_o LIKE P0002-NATIO DEFAULT 'DE',
               natio_n LIKE P0002-NATIO DEFAULT 'D'.

   * Update infotype records

   UPDATE PA0002
           SET NATIO          = natio_n
           WHERE PERNR        = P0002-PERNR
           AND NATIO          = natio_o.

   IF SY-SUBRC = 0.
      WRITE: 'Modified records', SY-DBCNT.
   ENDIF.




     S A P A G 1999
Reporting in HR

Indirect Valuation:
Some times entries in Infotype 0008, 0014, 0015
etc are stored for indirect valuation (ie the wagetype has
to be valuated indirectly). The entries
will not be stored in the infotype tables.
We have to use any of the function modules for indirect
valuation to read the data.
(Eg) HR_INDVAL_READ_INFOTYPE
Reporting in HR

Join and Projections
Joins:

•    Any number of infotypes can be linked by a JOIN.
•    Note that changing data in any one of the infotypes linked by a
     join causes a split in the selection period.
•    Joins are only possible for infotypes with time constraint 1 or 2.
•    If infotypes linked by a JOIN have subtypes, processing must be
     restricted to one subtype using a WHERE condition, in which a
     subtype is queried.
Reporting in HR
 J o in / S u b t y p e s



    TABLES: PERNR.
    INFOTYPES: 0001,         "Organizational     Assignment
               0002,         "Personal Data
               0006,         "Addresses
               ....

    GET    PERNR.
           PROVIDE      *
                       FROM P0002
                        *
                       FROM P0006
                       BETWEEN PN-BEGDA   AND   PN-ENDDA
              WHERE P0006-SUBTY = '1'.
              IF P0006_VALID = 'X'.
                WRITE...
              ENDIF.
           ENDPROVIDE.




        SAP A G 1999




Using variable Pnnnn_VALID, the system recognizes that one partial
    interval only contains incomplete data.
When the report is run, this variable is created for each Pnnnn
    infotype included in a join.
If a partial interval for infotype Pnnnn contains data, its Pnnnn_VALID
    variable is filled with X.
Reporting in HR
Projections:
•    Selecting one or more infotype fields for processing is called
     PROJECTION.
•    Using projection for specific fields enables you to specify that only the
     contents of these fields and time-based changes to the contents, are
     relevant to an evaluation.
•    Like joins, projections are logical data views concentrated on one or
     more fields within an infotype.
•    Projection is also an operation performed on the time axis. New validity
     periods are created when the contents of one of the projection fields
     change. The values stored in fields that are not included in the projection
     are in an undefined condition, which means they are no longer relevant to
     output.
•    If the contents of a field included in the projection remain unchanged in
     several data records, the validity periods of these data records are
     combined.
•    The process of combining data records during projection is called
     contraction.
•    JOIN and PROJECTION can be combined in a PROVIDE statement.
Reporting in HR
Jo in an d P ro jectio n / C o d in g



  TABLES: PERNR.
  INFOTYPES: 0001,              "Organizational Assignment
             0002,              "Personal Data

                       ....


  GET PERNR.
      PROVIDE         STELL
                      ENAME FROM P0001
                      GBDAT FROM P0002
                            BETWEEN PN-BEGDA AND PN-ENDDA.
                WRITE...

          ENDPROVIDE.




     S A P A G 1999
Reporting in HR
Calling R eports U sing D ynam ic Actions

Table of D ynam ic Actions


  IType STy. Field FC No S Variable function part

  0008___      SPRPS   06   0   _   *----------- Lock indicator set?----------------*
  0008___      SPRPS   06   1   P   P0008-SPRPS<>SPACE
  0008___      SPRPS   06   2   F   COMPUT E_DATE(ZPFORM01)
  0008___      SPRPS   06   3   I   INS,0019,10
  0008___      SPRPS   06   4   W   P0019-VTRMN=RP50D-DAT E1


 REPORT zpform01.
 TABLES: RP50D,    "Return fields for dyn. actions
          PRELP.   "HR Master Data Buffer . .
 * Calculate date
 FORM compute_date.
   RP50D-DATE1 = PRELP-BEGDA -14.
 ENDFORM.


    SA P AG 1999
Reporting in HR
•   The 'Dynamic Actions' table (T588Z) is a control table that triggers steps taken
    when an infotype record is maintained. Such steps include maintaining another
    infotype record, performing a routine, or sending a mail.
•   OP stands for a user operation where 02 stands for Change, 04 for Insert, and 08
    for Delete a record. The values can be added, for example, 06 means that an action
    is performed if the current record has been changed or inserted.
•   A stands for an action performed by the system, for example, P = Check a
    condition, F = Call a routine, I = Maintain an infotype record, W = Set default values
    when inserting a record.
•   You can call internal (defined in the module pool) and external routines. In an
    external routine, the name of the program is given in parentheses after the name of
    the routine. You cannot enter the USING parameter. The fields of the structure that
    is not used in the standard system (RP50D) are available to return the values from
    the routine. They can be filled by the routine and then used for default values (W
    statements). This structure can be enhanced with customer fields in a customer
    include.
•   In this example, the routine COMPUTE_DATE calculates a date in the subroutine
    pool ZPFORM01 and places it in field RP50D-DATE1. This date is calculated by
    subtracting 14 days from the start date of the locked record.
Reporting in HR
Calling Features from Reports


  TABLES: PME04.              "Field string for feature ABKRS
  DATA:    ret_value(2).      "Return value for feature
  * Fill decision fields for feature with values.
  PME04-PERSK = P0001-PERSK,
  . . .
  * Call feature
  CALL FUNCTION 'HR_FEATURE_BACKFIELD'
     EXPORTING
        FEATURE               = 'ABKRS'
        STRUC_CONTENT         = PME04
     IMPORTING
        BACK                  = ret_value
     EXCEPTIONS
        ERROR_OPERATION       = 2
        NO_BACKVALUE          = 3
        FEATURE_NOT_GENERATED = 4.



   SAP AG 1999
Reporting in HR
•   This function module reads the decision tree for a feature with the accompanying
    field contents and determines the return values for the field contents.
•   To identify which fields in the field string for the feature (PMEnn) are used for the
    decisions in the feature, view the structure and decision tree in feature
    maintenance (transaction PE03).
•   The field string PMEnn must be declared in the data declaration part of your
    program using a TABLES statement. Define a field to contain the return value of the
    feature.
•   In your program, enter values in the decision fields used in your feature.
•   Call the function module and enter the name of the feature to be used and the name
    of the field string. The return value for the feature is transferred to the main
    program with the BACK parameter.
•   Possible errors when processing the decision tree:
    a) An error occurred in the feature (ERROR_OPERATION)
    b) No return value is available for the current contents of the decision field
    (NO_BACKVALUE)
    c) The feature was no generated (FEATURE_NOT_GENERATED)
•   If the return value for a feature consists of a table, use the function module
    HR_FEATURE_BACKTABLE.
Reporting in HR
 T im e D a ta a n d V a lid it y P e r io d




    D a t a s e le c t io n
    p e r io d



                                               15 days
    Leave



     PROVIDE...
        WRITE...
     ENDPROVIDE.
                                               15 days




      S A P A G 1999




Note: Don’t use PROVIDE statement for Time Infotypes
Reporting in HR
Im p o r t in g T im e D a ta (1 )




                         D a ta s e le c tio n p e r io d




                INFOTYPES: 2001,                 "Absences
                           2002,                 "Attendances
                           2005,                 "Overtime
                           2010.                 "Employee
                Remuneration Info                               P A nnnn

                GET      PERNR.


       S A P A G 1999




A principle of the logical database is that all of the infotype records
     between the lowest and highest system date are read, irrespective
     of the data selection period, when the GET PERNR event occurs.
If there is a large number of time records, this gives rise to problems
     with the main memory and bad performance times.
In particular, if positive recording has been implemented, the quantity
     of infotype records soon overloads the main memory.
Reporting in HR
Im p o rt in g T im e D a ta (2 )


   INFOTYPES:          0001,
                       0002,
                       ...
                       2005 MODE N.

   GET PERNR.
      RP_PROVIDE_FROM_LAST P0001 SPACE PN-BEGDA PN-ENDDA.
      . . . .
      RP_READ_ALL_TIME_ITY PN-BEGDA PN-ENDDA.
      . . . .

        LOOP AT P2005.
           WRITE...
        ENDLOOP.




     S A P A G 1999



To control the amount of time required to read time infotypes, MODE N
   is assigned to the infotypes in the declaration. This ensures that
   infotype tables are not filled when GET PERNR occurs.
The time infotype tables are subsequently filled using the
   RP_READ_ALL_TIME_ITY macro, however, only in the specified
   period.
Reporting in HR
    Importing Time Data to Internal Tables


      TYPES: BEGIN OF overtime,
                bukrs      LIKE P0001-BUKRS,
                werks      LIKE P0001-WERKS,
                btrtl      LIKE P0001-BTRTL,
                stdaz      LIKE P2005-STDAZ,
             END OF overtime.
      DATA: tab TYPE TABLE OF overtime WITH HEADER LINE.

      GET PERNR.
       RP_PROVIDE_FROM_LAST P0001 SPACE PN-BEGDA PN-ENDDA.
       MOVE-CORRESPONDING P0001 TO tab.
       RP_READ_ALL_TIME_ITY PN-BEGDA PN-ENDDA.

      LOOP AT P2005.
       MOVE-CORRESPONDING P2005 TO tab.
       COLLECT tab. (oder: APPEND tab.)
      ENDLOOP.        bukrs werks  btrtl     stdaz   Work area(header line)



                                                     Data area



        SAP AG 1999




•   If you want to evaluate absence data according to
    organizational units, it is a good idea to use an internal table
    to group together the information from different database
    tables (PA0001 and PA2005).
Reporting in HR
P ro c e s s in g T im e D a ta w ith In te rn a l T a b le s

                                                            END-OF-SELECTION.
                                                              L O O P A T ta b .
     H ea d e r p ro c es sin g                                  A T F I R ST .
                                                                 ...
                                                                 ENDAT.
                                                                  AT NEW bukrs.
                                                                  ...
                                                                  ENDAT.
     ta b -      BUKRS        W ERKS       BTRTL                  AT NEW werks.
                                                                  ...
                    0 0 01      0 0 01      0 0 01                ENDAT.
                    0 0 01      0 0 01      0 0 02                Single record
                                                                  processing
                    0 0 02      0 0 02      0 0 03
                                                                  A T E N D O F w e rk s .
                    0 0 02      0 0 02      0 0 04                ...
                                                                  ENDAT.
                                                                  A T E N D O F b u kr s .
                                                                  ...
                                                                  ENDAT.
                                                                  A T L A S T.
                                                                  ...
                        F o o ter p ro ce ss in g                 ENDAT.
                                                                ENDLOOP.
     S A P A G 199 9
Reporting in HR
Example report using ABAP List viewer

REPORT zpsol060.

*-- declaration
TYPE-POOLS: slis.

TABLES: pernr, t548t.          "Date Types
INFOTYPES: 0001,               "Org.Assignment
     0041.                      "Date Specifications

DATA: BEGIN OF dtype,           "Workarea for IT0041
   dar LIKE p0041-dar01,
   dat LIKE p0041-dat01,
  END OF dtype.

TYPES: BEGIN OF data_struc,     "Data table structure
    pernr LIKE pernr-pernr,
    ename LIKE p0001-ename,
    eindt LIKE p0016-eindt,
    dar LIKE p0041-dar01,
    dtext LIKE t548t-dtext,
    dat LIKE p0041-dat01,
   END OF data_struc.
DATA: data_tab TYPE TABLE OF data_struc,
   data_tab_wa TYPE data_struc.

DATA: alv_fieldcat TYPE slis_t_fieldcat_alv,
  alv_layout TYPE slis_layout_alv.

DATA: filled_lines LIKE sy-index,
  stru_disvar TYPE disvariant.
Reporting in HR
SELECT-OPTIONS: datetype FOR p0041-dar01 DEFAULT '01
*-- Processing
GET pernr.
  DESCRIBE TABLE p0041 LINES filled_lines.
  IF filled_lines GT 0.
   rp_provide_from_last p0001 space pn-begda pn-endda.
   IF pnp-sw-found EQ 0.
     REJECT.
   ELSE.
     DO 12 TIMES VARYING dtype FROM p0041-dar01
                      NEXT p0041-dar02.
       IF dtype-dar IS INITIAL.
         EXIT.
       ELSE.
         IF dtype-dar IN datetype.
          rp_provide_from_last p0001 space pn-begda pn-endda
          CLEAR data_tab_wa.
          MOVE-CORRESPONDING p0001 TO data_tab_wa.
          MOVE-CORRESPONDING dtype TO data_tab_wa.
          PERFORM read_hiredate.
          PERFORM re548t USING sy-langu dtype-dar.
          MOVE t548t-dtext TO data_tab_wa-dtext.
          APPEND data_tab_wa TO data_tab.
         ENDIF.
       ENDIF.
     ENDDO.
   ENDIF.
  ENDIF.
Reporting in HR
END-OF-SELECTION.
 PERFORM fieldcat_init USING alv_fieldcat.
 alv_layout-colwidth_optimize = 'X'.
 alv_layout-zebra       = 'X'.

  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
*     I_INTERFACE_CHECK           =''
*     I_BUFFER_ACTIVE            =''
       i_callback_program      = 'ZPSOL060'
*     I_STRUCTURE_NAME            =
*     I_BACKGROUND_ID              =''
     I_GRID_TITLE            = 'Date Specifications'
*     I_GRID_SETTINGS            =
       is_layout        = alv_layout
       it_fieldcat     = alv_fieldcat

*     I_DEFAULT           = 'X'
      I_SAVE             = 'A'
      IS_VARIANT            = stru_disvar
*     IT_EVENTS           =
*     IT_EVENT_EXIT          =
*     IS_PRINT          =
*     IS_REPREP_ID          =
*     I_SCREEN_START_COLUMN = 0
*     I_SCREEN_START_LINE          =0
*     I_SCREEN_END_COLUMN           =0
*     I_SCREEN_END_LINE          =0
*     IT_ALV_GRAPHICS            =
*     IT_ADD_FIELDCAT            =
*     IT_HYPERLINK             =
*   IMPORTING
*     E_EXIT_CAUSED_BY_CALLER =
*     ES_EXIT_CAUSED_BY_USER =
              TABLES
        t_outtab       = data_tab
              EXCEPTIONS
      program_error        =1
      OTHERS             = 2.
Reporting in HR
*-------------------------------------------------------------*
*      FORM READ_HIREDATE
*-------------------------------------------------------------*
*      Retrieving hiredate from infotype 0000
*-------------------------------------------------------------*
FORM read_hiredate.
  CALL FUNCTION 'RP_GET_HIRE_DATE'
      EXPORTING
          persnr            = p0001-pernr
          check_infotypes = '0000'
      IMPORTING
          hiredate          = data_tab_wa-eindt
      EXCEPTIONS
          OTHERS                      = 1.
ENDFORM.

*-------------------------------------------------------------*
*      FORM RE548T
*      Read date specification texts
*-------------------------------------------------------------*
* --> VALUE(LANGUAGE)
* --> VALUE(DTYPE)
*-------------------------------------------------------------*
FORM re548t USING value(language)
               value(dtype).
  CHECK t548t-sprsl NE language
    OR t548t-datar NE dtype.
  SELECT SINGLE * FROM t548t
            WHERE sprsl EQ language
            AND datar EQ dtype.
  IF sy-subrc NE 0.
   CLEAR t548t.
  ENDIF.
ENDFORM.
Reporting in HR
*-------------------------------------------------------------*
*      FORM FIELDCAT_INIT
*-------------------------------------------------------------*
FORM fieldcat_init USING p_fieldcat
                           TYPE slis_t_fieldcat_alv.
  DATA: ls_fieldcat TYPE slis_fieldcat_alv.

 CLEAR ls_fieldcat.
 ls_fieldcat-fieldname = 'PERNR'.
 ls_fieldcat-ref_tabname = 'PERNR'.
 ls_fieldcat-key     = 'X'.
 APPEND ls_fieldcat TO p_fieldcat.

 CLEAR ls_fieldcat.
 ls_fieldcat-fieldname = 'ENAME'.
 ls_fieldcat-ref_tabname = 'P0001'.
 APPEND ls_fieldcat TO p_fieldcat.

 CLEAR ls_fieldcat.
 ls_fieldcat-fieldname = 'EINDT'.
 ls_fieldcat-ref_tabname = 'P0016'.
 APPEND ls_fieldcat TO p_fieldcat.

 CLEAR ls_fieldcat.
 ls_fieldcat-fieldname = 'DAR'.
 ls_fieldcat-ref_tabname = 'PERNR'.
 ls_fieldcat-ref_tabname = 'P0041'.
 APPEND ls_fieldcat TO p_fieldcat.

 CLEAR ls_fieldcat.
 ls_fieldcat-fieldname = 'DTEXT'.
 ls_fieldcat-ref_tabname = 'T548T'.
 APPEND ls_fieldcat TO p_fieldcat.

 CLEAR ls_fieldcat.
 ls_fieldcat-fieldname = 'DAT'.
 ls_fieldcat-ref_fieldname = 'DAT01'.
 ls_fieldcat-ref_tabname = 'P0041'.
 APPEND ls_fieldcat TO p_fieldcat.
ENDFORM.
Reporting in HR




REPORTS IN PERSONNEL PLANNING
Reporting in HR

D a ta M o d e l


 re p o rts to /
 is lin e
 s u p e rv is o r                                                         C o s t C e n te r A llo c a tio n
 of

                       O rg a n iz a tio n a l
                                                          b e lo n g s t o                                                      C o s t c e n te r
                                                                                                                  C o s t C e n te r
                                   in c o rp o ra te s
                                                                                                                  A llo c a tio n

                                is
                                                                                                                      b e lo n g s t o
                                d e s c rib e d
                                by
                                                         d e s c rib e s                                             in c o rp o ra te s

                                   is                       is
                Job                d e s c rib e d          d e s c rib e d            P o s itio n                                         W o rk c e n te r
                                   by                       by                                                        o c c u p ie s
                                                                                                     H o ld e r
              d e s c rib e s
                                                                             d e s c rib e s




                                                  Task                                                               P e rs o n /u s e r



       S A P A G 1999
Reporting in HR
•   Organizational Management is based on the idea of representing
    each element within an organization as a separate object with its own
    characteristics. These objects are created and maintained separately.
    Relationships are used to link one to the other (see graphic). This
    gives rise to a network that is flexible enough to facilitate personnel
    planning, projections, and evaluations.
•   The cost center is an external object type because it is not
    maintained in Organizational Management.
•   Customizing enables you to enhance the existing data model by
    defining new object types, for example, and establishing new
    relationships between the various object types. Each standard object
    type consists of two letters, whereas the customer namespace is 00
    to 99.
•   This data model (object types and relationships) also constitutes the
    basis of other applications within Personnel Planning, such as
    Training and Event Management (business event hierarchies) and
    Personnel Development (for example, qualification catalog).
Reporting in HR
Relationship Betw een Jobs and Positions



                       The job "describes" the position.
                     The position "is described by" the job.



                  Relationship
                                              Adm inistrative assistant
                    A/B 007
                                             for m arketing departm ent



                                                    Adm inistrative assistant
                                                      for executive board
       Job:
  Adm inistrative
    assistant
                                             Adm inistrative assistant
                                             for research departm ent

   SAP AG 1999
Reporting in HR

•   "Job" is used as a general classification,
    such as secretary or head of department.
•   More than one employee can have the same
    job. For example, twenty employees can
    have the job of secretary.
•   A position is the assignment of an individual
    employee in your enterprise, for example,
    sales manager, secretary in the marketing
    department. You form the structure of your
    enterprise by creating positions and linking
    them to each other.
Reporting in HR
O b je c t/In fo ty p e S ta tu s



                   O b je c t                 (In fo typ e 1 0 0 0 )

                   R e la tio n s h ip        (In fo typ e 1 0 0 1 )



                       P la n n e d
                                                       S u b m itte d


                                                                        R e je c te d
                 A c tiv e


                                         A p p ro v e d


     S A P A G 1999
Reporting in HR
A status is assigned to each object/infotype.
•    Active means that an object or infotype record can be used at
     this time.
•    Planned means that an object or infotype record has been
     proposed but is not yet active, which means it cannot be used.
•    Submitted means that an object or infotype record is currently
     being checked by a person or group of persons before it is
     approved or rejected.
•    Approved means that a submitted object/infotype record has
     been accepted.
•    Rejected means that a submitted object/infotype record has
     not been approved.
•    You can create objects with the status "planned" or "active".
Reporting in HR
Evaluation Paths


  Organizational unit                   O
                                                       Org.unit
  Job                                   C
  Position                              S
  Person                                P



                  O Org.unit

           S          O Org.unit            Position
    Position
                          S Position
          P    Person
                                            Employee
                          P    Person




   SAP AG 1999
Reporting in HR
•   An evaluation path describes a set of relationships between
    objects in a hierarchical structure. Evaluation path O-S-P, for
    example, describes the set of relationships found between
    organizational units, positions, and persons.
•   Evaluation paths are used to select objects for structural
    evaluations. You choose an evaluation path, and the system
    evaluates the structure along the evaluation path. The report
    only evaluates objects that it finds in the specified evaluation
    path.
•   Every standard report has a defined standard evaluation path.
    They are predetermined in the system and must not be
    changed. The standard selection screen enables you to
    choose evaluation paths. You can also create new evaluation
    paths to meet the particular requirements of your enterprise.
•   Report RHWEGID0 displays all possible evaluation paths
    between the starting object type and the target object type.
Reporting in HR
Available In ternal In form ation



  TABLES: OBJEC, GDSTR.
  INFOTYPES: nnnn.                  Pnnnn    Internal infotype table

  . . .

  GET OBJEC.                        O B JE C O bject inform ation
     LOOP AT Pnnnn . . .


                                    G D STR R oot of structure
      ENDLOOP.


                                    STR U C Structure inform ation




    S A P A G 1999
Reporting in HR
Sequential Evaluations-Coding


  TABLES:    OBJEC.
  INFOTYPES: 0002,                  "Personal Data
             1003,                  "Addresses
                ....

  GET OBJEC.
     LOOP AT Pnnnn
       WHERE BEGDA LE PC-ENDDA
       AND    ENDDA GE PC-BEGDA.
       WRITE...
     ENDLOOP.




   SAP AG 1999
Reporting in HR
S t r u c t u r a l E v a lu a t io n s - C o d in g


    TABLES: OBJEC, GDSTR.
    INFOTYPES: 0002,                                   "Personal Data
               1003,                                   "Addresses
                  ....

    GET OBJEC.
       LOOP AT Pnnnn
         WHERE BEGDA               LE   PC-ENDDA
         AND    ENDDA              GE   PC-BEGDA.
         WRITE...
       ENDLOOP.




      S A P A G 1999




  The only difference between a structural and sequential evaluation is
  the additional GDSTR entry in the TABLES statement.
Reporting in HR
E va lu a tin g T a b le In fo ty p e s



   INFOTYPES: 1002.                  "Description
   TABLES: OBJEC.
   DATA: ipt1002 LIKE PT1002 OCCURS 0 WITH HEADER LINE.
   . . .

   GET OBJEC.
      WRITE: / OBJEC-OTYPE, OBJEC-OBJID.
      LOOP AT P1002.
        RH-GET-TBDAT P1002-INFTY P1002-TABNR ipt1002.
        LOOP AT ipt1002.
            WRITE: / ipt1002-TLINE.
        ENDLOOP.
      ENDLOOP.




     S A P A G 1999
Reporting in HR

•   RH-GET-TBDAT is a macro for logical database
    PCH. These macros are defined in include
    DBPCHCOM. With this macro, you can import the
    data for an infotype with a repetitive structure. See
    also Table Infotypes.
•   The parameters for macro RH-GET-TBDAT are:
    Parameter 1 : Infotype
    Parameter 2 : Reference field
    Parameter 3 : Table for structure PTnnnn
•   Macros for logical database PCH must not be
    confused with macros for logical database PNP.
    Please note that you cannot use macros for logical
    databases PCH and PNP at the same time.
Reporting in HR
R ea d in g In fo typ e s W ith F u n c tio n M o d u les


   IN F OT Y PE S : 1 00 1 .                  " Re l at i on s hi p s
   DA T A: ih r ob j ec t L I KE HR O BJ E CT OC C UR S 1 0 .
   . . .
   CA L L F UN C TI O N ' RH _ RE A D_ I NF T Y'
   EX P OR T IN G
   . . .
           I NF T Y                           = ' 1 00 1 '
           B EG D A                           = < b eg d at >
           E ND D A                           = < e nd d at >
   TA B LE S
           I NN N N                           = P 1 00 1
           O BJ E CT S                        = i h ro b je c t
   EX C EP T IO N S
         A L L_ I NF T Y_ W IT H _S U BT Y    = 1
         N O TH I NG _ FO U ND                = 2
         N O _O B JE C TS                     = 3
         W R ON G _C O ND I TI O N            = 4
         O T HE R S                           = 5.



     S A P A G 1999
Reporting in HR

•   RH-GET-TBDAT is a macro for logical database
    PCH. These macros are defined in include
    DBPCHCOM. With this macro, you can import the
    data for an infotype with a repetitive structure. See
    also Table Infotypes.
•   The parameters for macro RH-GET-TBDAT are:
    Parameter 1 : Infotype
    Parameter 2 : Reference field
    Parameter 3 : Table for structure PTnnnn
•   Macros for logical database PCH must not be
    confused with macros for logical database PNP.
    Please note that you cannot use macros for logical
    databases PCH and PNP at the same time.
Reporting in HR
Example Report

REPORT zhsol010.
TABLES: objec, gdstr.
INFOTYPES: 0002, 0006, 1003.

DATA: stabs LIKE p1003-stabs,
  name LIKE p0001-ename.

INITIALIZATION.
 pchotype = 'O'.
 pchwegid = 'O-S-P'.
Reporting in HR
GET objec.
 IF objec-otype = 'S'.
  CLEAR stabs.
  LOOP AT p1003 WHERE begda LE pc-endda
            AND endda GE pc-begda.
    IF p1003-stabs = 'X'.
     stabs = 'X'.
     WRITE : / objec-objid, objec-short, objec-stext.
    ENDIF.
  ENDLOOP.
 ENDIF.
 IF objec-otype = 'P' AND stabs = 'X'.
  PROVIDE vorna nachn FROM p0002
        subty telnr FROM p0006
        BETWEEN pc-begda and pc-endda
        WHERE p0006-subty = '1'.
    IF p0006_valid = 'X'.
     CONCATENATE p0002-vorna p0002-nachn INTO name
     SEPARATED BY SPACE.
     WRITE: / name, p0006-telnr.
     SKIP.
    ENDIF.
  ENDPROVIDE.
 ENDIF.
Reporting in HR




READING CLUSTER DATA
Reporting in HR
Export
The syntax for exporting the data to cluster table is
EXPORT var1…varn itab1 itab2…itabn
       TO DATABASE dbtab(ID) [FROM wa] ID key.


Import
The syntax for exporting the data to cluster table is
IMPORT var1…varn itab1 itab2…itabn
       FROM DATABASE dbtab(ID) [TO wa ] ID key.
Reporting in HR
E x p o r tin g D a ta


   TABLES: PCLn.                               "Import/export table
   INCLUDE: RPCnxxy0.                          "Cluster definition

   *    Fill        cluster-KEY

   xy-KEY-FIELD = <VALUE>.
   . . . .
   * Fill data object

   *    Export           record

   EXPORT           TABLE1    TO   DATABASE   PCLn(xy)   ID   xy-KEY.

   IF SY-SUBRC EQ 0.
      WRITE: / 'Update               successful'.
   ENDIF.




       S A P A G 1999




The cluster definition is included using the INCLUDE statement.
The EXPORT command writes one or more data objects with xy-KEY
    to cluster xy.
If the export is successful, the return code is 0.
Reporting in HR
E x p o rt U s in g B u ffe r


 * Buffer definition
 INCLUDE:     RPPPXD00.
 DATA:    BEGIN OF COMMON PART buffer.
          INCLUDE RPPPXD10.
 DATA: END OF COMMON PART buffer.           M a in m e m o ry b u ffe r
 . . .
 * Data export to buffer
 RP-EXP-Cn-xy.
 RP-EXP-Cn-xy.
 . . .
 * Save
 PERFORM PREPARE_UPDATE USING 'V'.
 . . .
                                                     PCLn
 * Buffer Administration Routines
 INCLUDE: RPPPXM00.
                                                        xy




     S A P A G 1999
Reporting in HR

•   If data is exported using macros, the data records
    are not written directly to the database. Instead,
    they are written to a main memory buffer. The data
    is diverted by a USING parameter in the EXPORT
    statement, which accesses a buffer administration
    routine.
•   If data is exported successfully, the RP-IMP-xy-
    SUBRC = 0 return code is set.
•   At the end of the program, the buffered records
    must be saved on a PCLn database.
•   To save the data, the PREPARE_UPDATE routine
    is accessed with USING parameter V.
Reporting in HR
C L U S T E R - D e fin itio n in P r o g r a m R p c n x y z 0


   * KEY-Definition
   DATA:   BEGIN OF xy-key,
              FIELD1,
              FIELDn,
           END OF xy-key.

   * Definition of Data Objects
   DATA:   BEGIN OF table1 OCCURS 10,
              COLUMN1,
              COLUMNn,
           END OF table1.
   DATA:   BEGIN OF table2 OCCURS 10, . . .




     S A P A G 1999
Reporting in HR
•   The data definitions of a work area are stored in separate
    programs using a fixed naming convention.
•   They are defined as INCLUDE programs. Their names follow
    convention RPCnxyz0, where.
•   n =         1 or 2 for PCL1 or PCL2
•   xy =        Cluster, for example, RX
•   z =         0 for international clusters or country indicator from
    table T500L for country-specific               clusters.
•   Example: The program RPC1TX00 contains the data definition
    of cluster TX. In this cluster, the database table PCL1 contains
    the texts stored for infotypes.
•   The key structure of the cluster is stored in a field string xy-
    KEY where the personnel number is the first element.
•   The data objects (field strings and tables) are named
    individually per cluster.
Reporting in HR
Im p o r t in g D a ta



   TABLES: PCLn.                "Import/export table
   INCLUDE: RPCnxyz0.           "Cluster definition

   * Fill Cluster-KEY
   xy-KEY-FIELD1 = <VALUE>,
   . . .
   * Import Record
   IMPORT table1 table2 FROM DATABASE
            PCLn(xy) ID xy-KEY.
   * Display Data object
   IF SY-SUBRC EQ 0.
      LOOP AT table1.
         WRITE. . .
      ENDLOOP.
   ENDIF.




       S A P A G 1999




The IMPORT command reads data objects with the specified key
    values from the import/export database table.
If a record is read successfully, the return code is 0. If a record is not
    read successfully, the return code is 4.
Reporting in HR
Importing/Exporting With Macros


  Macro                           H ic PAYM ACRO

                                  DEFINE RP-IMP-Cn-xy.
  ...                                IMPORT
  RP-IMP-Cn-xy.                        table1
  ...                                  table2
                                       . . .
                                       . . .
                                     FROM DATABASE
                                     PCLn(xy)
                                     ID xy-KEY
                                     USING

                                     PCLn_EXP_IMP.
                                  END-OF-DEFINITION.




   SAP AG 1999
Reporting in HR
•   To ensure consistency when data is exported and imported, the
    IMPORT/EXPORT commands are defined as macros.
•   It is possible to import only a portion of the data objects in a
    cluster.
•   The naming conventions for the macros are RP-IMP-Cn-xy and
    RP-EXP-Cn-xy, where n is the file name and xy is the cluster
    name.
•   The macros for the import of payroll results are defined in
    include programs for the payroll driver with the name
    HicPAYMACRO (ic = ISO code, for example, HUSPAYMACRO for
    the USA) using the DEFINE keyword. These include programs
    are generated and must not be changed manually.
•   The macro for importing infotype texts to cluster TX is contained
    in the table Macros in ABAP Programs.
•   The macros use routines that carry out two tasks:
        1. Data buffering
        2. Cluster authorization check
Reporting in HR

Im p o r t in g /E x p o r t in g U s i n g a B u f f e r




    P ro g ra m

                             E x p o rt                     UPDATE

                                                                     PCLn
                             Im p o r t
                                                B u ffe r




      S A P A G 1999
Reporting in HR

•   To minimize the number of times that the
    database is accessed, import and export data is
    buffered in the main memory.
•   If a test run is performed, the database is not
    updated. However, the payroll results of the
    previous period form the basis of the calculation
    used to determine the results of the subsequent
    period. For this reason, a difference arises
    between the results of a live payroll run and the
    results of a test run if test runs are performed
    for several periods.
•   Using the buffer enables you to access the
    required results from the previous period.
Reporting in HR
Im p o rtin g U s in g a B u ffe r


  * Buffer definition
  INCLUDE: RPPPXD00.
  DATA: BEGIN OF COMMON PART BUFFER.
                 INCLUDE RPPPXD10.
  DATA:    END OF COMMON PART buffer.    M a in m e m o ry b u ffe r
  * Fill cluster KEY
  . . .
  * Data import
  RP-IMP-Cn-xy.
  . . .
  * Buffer Administration Routines
  INCLUDE: RPPPXM00.
                                                  PCLn

                                                     xy




     S A P A G 1999
Reporting in HR

•   If data is imported using macros, the data
    records are not read directly from table PCLn.
    Instead, the buffer directory is checked to
    determine whether the main memory already
    contains a record with the same key. If this is
    not the case, the record is read from PCLn to
    the buffer, and retrieved from the buffer by the
    report.
•   If data is read using a buffer, the system checks
    the cluster authorization. The standard import
    programs follow the RPCLSTxy naming
    convention, where xy = cluster name.
Reporting in HR
Example program to read data from PCL1 Cluster
This example reads long text data from Infotype 0024.

REPORT ZRP_READ_PCL1_TX.

TABLES: pernr.
INFOTYPES 0024 NAME qualifications.


INCLUDE rpc1tx00.

START-OF-SELECTION.

GET pernr.
 rp_provide_from_last qualifications space pn-begda pn-endda.

 tx-key-pernr = qualifications-pernr.
 tx-key-infty = qualifications-infty.
 tx-key-subty = qualifications-subty.
 tx-key-objps = qualifications-objps.
 tx-key-sprps = qualifications-sprps.
 tx-key-endda = qualifications-endda.
 tx-key-begda = qualifications-begda.
 tx-key-seqnr = qualifications-seqnr.

 rp-imp-c1-tx.

 LOOP AT ptext.
  WRITE ptext-line.
 ENDLOOP.
Reporting in HR
Example program to read data from PCL1 Cluster

This example reads data from PCL1 for RELID B1.

REPORT ZRP_READ_PCL1_B1.

TABLES: pernr.
INCLUDE rpc1b100.

START-OF-SELECTION.

GET pernr.
 b1-key-pernr = pernr-pernr.
* rp-imp-c1-b1.
 IMPORT nt1
      nt2
      ift1
      ift2
      ert
      nct
      qt
      st
      itp1
      itp7
      itp50
      pdppm
 FROM DATABASE pcl1(b1)
 ID b1-key.
Reporting in HR
Example program to read data from PCL2 Cluster

This example reads data from PCL2 for RELID B2.

REPORT ZRP_READ_PCL2_B2.

TABLES: pernr.
INCLUDE rpc2b200.

START-OF-SELECTION.

GET pernr.
 b2-key-pernr = pernr-pernr.
 b2-key-pabrj = pn-begda+0(4).
 b2-key-pabrp = pn-begda+4(2).
 b2-key-cltyp = '1'.
*** ZL --> Time Wage Types (Table ZL)
 IMPORT zl
     FROM DATABASE pcl2(b2)
     ID b2-key.

 LOOP AT zl.
*** Process the itab zl....
 ENDLOOP.
Reporting in HR

Payroll
International Payroll driver program: RPCALCX0
Reporting in HR
The international payroll driver program is RPCALCX0.
We are having customized payroll driver programs for most of the
countries viz:
1.   RPCALCA0 for Austria
2.   RPCALCC0 for Switzerland
3.   RPCALCD0 for Germany
4.   RPCALCE0 for Spain
5.   RPCALCG0 for Great Britain
6.   RPCALCU0 for USA
7.   HINCALC0 for India
8.   HBRCALC0 for Brazil etc.
Reporting in HR

Display Payroll results
Program: RPCLSTRX
Reporting in HR
Reporting in HR
Reporting in HR

P a y r o ll R e s u lts



       REPORT
       H99_DISPLAY_PAYRESULT      P a y r o ll r e s u lt
                                  K a th y C a lc              J a n u a ry 1 9 x x
                                  W T01       S t a n d a r d s a la r y 5 0 0 0   UNI
                                  W T02       Bonus                        300     UNI
                                  W T03       O v e r tim e                200     UNI
                                  /1 0 1      T o ta l g r o s s a m t 5 5 0 0     UNI
                                  . . . .




     S A P A G 1999
Reporting in HR

•    With this report, you can display the payroll results
     for any country. The indicator behind each name
     shows whether results exist in the selected period.
     Green: Results exist
     Red:      No results exist
     Gray:     No authorization for displaying personnel
     numbers
•    Payroll results are stored as structures and internal
     tables on the database.
•    Each payroll result has a status indicator:
    1.   A    =      Current result
    2.   P    =      Previous result
    3.   O    =      All other results
Reporting in HR

D a ta F lo w in P a y ro ll


                                     S c h e m a s & ru le s

                       PAnnnn


                                                                     PCL2
                                       RPC ALCn0
                   PCL2                                               xy

                       xy




                                               H 9 9 _ D IS P L A Y _ P A Y R E S U L T

                                                R PCE D Tn0

     S A P A G 1999
Reporting in HR

•   The payroll driver, RPCALCn0, uses HR data (stored in the
    database tables PAnnnn) and the last payroll result (stored in
    the database table PCL2) to run the payroll for the specified
    period
•   The program (payroll driver) imports the processing logic in the
    form of a schema. The schema contains functions that call the
    subroutines contained in the payroll driver. In many cases, the
    function is enhanced by rules for specific control of the
    subroutines.
•   The payroll result generated by the payroll driver is stored in
    cluster xy of the database table PCL2.
•   Report H99_DISPLAY_PAYRESULT displays the payroll results
    for PCL2 and, from Release 4.6C, replaces reports RPCLSTxy
    and HxyCLSTR. The report is used in all country versions and
    the overview of payroll results is automatically displayed
    according to the particular country.
•   Report RPCEDTn0, for example, lists the formatted result as a
    payroll form (n = HR country indicator from table T500L).
Reporting in HR
R e a d in g th e C lu s te r D ir e c to ry



   *Table containing directory of payroll results
   DATA: BEGIN OF RGDIR OCCURS 100.
           INCLUDE STRUCTURE PC261.
   DATA: END OF RGDIR.
   DATA: COUNTRY LIKE T001P-MOLGA.
   ...
   CALL FUNCTION 'CU_READ_RGDIR'
        EXPORTING
             PERSNR           = PERNR-PERNR
        IMPORTING
             MOLGA            = country
        TABLES
             IN_RGDIR         = RGDIR
        EXCEPTIONS
             NO_RECORD_FOUND  = 1
             OTHERS           = 2.



     S A P A G 1999
Reporting in HR

•   Table RGDIR contains the directory (cluster directory) for
    all of an employee's payroll results and is contained in
    cluster CU. A directory entry with the payroll area, for-
    period, in-period, status indicator, and the five-digit
    sequence number is required, together with the
    personnel number, to construct the key for each payroll
    result for an employee.
•   The function module CU_READ_RGDIR reads table
    RGDIR from cluster CU. The personnel number whose
    payroll directory is to be read is transferred to the
    function module.
•   If the MOLGA parameter is active, the function module
    returns the HR country indicator.
Reporting in HR
D eterm in in g C u rren t P a yro ll R esu lt (1 )


   DATA: number LIKE PC261-SEQNR.
   . . .
   GET PERNR.
      . . .
      CALL FUNCTION 'CU_READ_RGDIR'
      . . .

        CALL FUNCTION 'CD_READ_LAST'
         EXPORTING
              BEGIN_DATE         = PN-BEGDA
              END_DATE           = PN-ENDDA
         IMPORTING
              OUT_SEQNR          = number
         TABLES
              RGDIR              = RGDIR
         EXCEPTIONS
              NO_RECORD_FOUND    = 1
              OTHERS             = 2.




     S A P A G 1999
Reporting in HR

•   The function module CD_READ_LAST determines the current
    payroll result for a for-period to be evaluated. To determine the
    correct start date and end date of the for-period, you specify the
    period by entering the payroll period in the selection screen. If
    you specify report class XXM00004 in the attributes of your
    report, the payroll period is entered and the start date (PN-
    BEGDA) and the end date (PN-ENDDA) are determined using
    the Payroll Periods table (T549Q).
•   You enter the start and end date of the for-period for the
    evaluation as well as table RGDIR. The function module then
    gives you the sequential number (OUT_SEQNR) for the current
    (A) result of the for-period.
•   You can also use the following function modules:
    CD_READ_PREVIOUS (reads the record that precedes the
    payroll record)
    CD_READ_PREVIOUS_ORIGINAL (reads the last original result
    that precedes the original payroll result)
HR ABAP Programming Training Material | http://sapdocs.info
HR ABAP Programming Training Material | http://sapdocs.info
HR ABAP Programming Training Material | http://sapdocs.info
HR ABAP Programming Training Material | http://sapdocs.info
HR ABAP Programming Training Material | http://sapdocs.info
HR ABAP Programming Training Material | http://sapdocs.info
HR ABAP Programming Training Material | http://sapdocs.info
HR ABAP Programming Training Material | http://sapdocs.info
HR ABAP Programming Training Material | http://sapdocs.info
HR ABAP Programming Training Material | http://sapdocs.info
HR ABAP Programming Training Material | http://sapdocs.info
HR ABAP Programming Training Material | http://sapdocs.info
HR ABAP Programming Training Material | http://sapdocs.info
HR ABAP Programming Training Material | http://sapdocs.info
HR ABAP Programming Training Material | http://sapdocs.info
HR ABAP Programming Training Material | http://sapdocs.info
HR ABAP Programming Training Material | http://sapdocs.info
HR ABAP Programming Training Material | http://sapdocs.info
HR ABAP Programming Training Material | http://sapdocs.info
HR ABAP Programming Training Material | http://sapdocs.info
HR ABAP Programming Training Material | http://sapdocs.info
HR ABAP Programming Training Material | http://sapdocs.info
HR ABAP Programming Training Material | http://sapdocs.info
HR ABAP Programming Training Material | http://sapdocs.info
HR ABAP Programming Training Material | http://sapdocs.info
HR ABAP Programming Training Material | http://sapdocs.info
HR ABAP Programming Training Material | http://sapdocs.info
HR ABAP Programming Training Material | http://sapdocs.info
HR ABAP Programming Training Material | http://sapdocs.info
HR ABAP Programming Training Material | http://sapdocs.info
HR ABAP Programming Training Material | http://sapdocs.info
HR ABAP Programming Training Material | http://sapdocs.info
HR ABAP Programming Training Material | http://sapdocs.info
HR ABAP Programming Training Material | http://sapdocs.info
HR ABAP Programming Training Material | http://sapdocs.info
HR ABAP Programming Training Material | http://sapdocs.info
HR ABAP Programming Training Material | http://sapdocs.info
HR ABAP Programming Training Material | http://sapdocs.info
HR ABAP Programming Training Material | http://sapdocs.info
HR ABAP Programming Training Material | http://sapdocs.info
HR ABAP Programming Training Material | http://sapdocs.info
HR ABAP Programming Training Material | http://sapdocs.info
HR ABAP Programming Training Material | http://sapdocs.info
HR ABAP Programming Training Material | http://sapdocs.info
HR ABAP Programming Training Material | http://sapdocs.info
HR ABAP Programming Training Material | http://sapdocs.info
HR ABAP Programming Training Material | http://sapdocs.info
HR ABAP Programming Training Material | http://sapdocs.info
HR ABAP Programming Training Material | http://sapdocs.info
HR ABAP Programming Training Material | http://sapdocs.info
HR ABAP Programming Training Material | http://sapdocs.info
HR ABAP Programming Training Material | http://sapdocs.info
HR ABAP Programming Training Material | http://sapdocs.info
HR ABAP Programming Training Material | http://sapdocs.info
HR ABAP Programming Training Material | http://sapdocs.info
HR ABAP Programming Training Material | http://sapdocs.info
HR ABAP Programming Training Material | http://sapdocs.info

More Related Content

What's hot

Sap payroll schema. functions , rules and operations – an overview
Sap payroll schema. functions , rules and operations – an overviewSap payroll schema. functions , rules and operations – an overview
Sap payroll schema. functions , rules and operations – an overviewgetsarath
 
S4 HANA Business Partner Configuration@Ganesh Tarlana
S4 HANA Business Partner Configuration@Ganesh TarlanaS4 HANA Business Partner Configuration@Ganesh Tarlana
S4 HANA Business Partner Configuration@Ganesh TarlanaGanesh Tarlana
 
SAP HR AND HCM Interview questions
SAP HR AND HCM Interview questionsSAP HR AND HCM Interview questions
SAP HR AND HCM Interview questionsIT LearnMore
 
SAP HCM - Organization Management end user presentation
SAP HCM - Organization Management end user presentationSAP HCM - Organization Management end user presentation
SAP HCM - Organization Management end user presentationsteve4sap
 
SAP- HCM mini project report on - Design Enterprise Structure in Personnel Ad...
SAP- HCM mini project report on - Design Enterprise Structure in Personnel Ad...SAP- HCM mini project report on - Design Enterprise Structure in Personnel Ad...
SAP- HCM mini project report on - Design Enterprise Structure in Personnel Ad...Vijeth Karthik
 
ABAP for Beginners - www.sapdocs.info
ABAP for Beginners - www.sapdocs.infoABAP for Beginners - www.sapdocs.info
ABAP for Beginners - www.sapdocs.infosapdocs. info
 
Sap mm c onfigration guid
Sap mm c onfigration guidSap mm c onfigration guid
Sap mm c onfigration guidrajnitesh3215
 
Understanding processing classes in sap
Understanding processing classes in sapUnderstanding processing classes in sap
Understanding processing classes in sapMrityunjoy Roy
 
ABAP Programming Overview
ABAP Programming OverviewABAP Programming Overview
ABAP Programming Overviewsapdocs. info
 
SAP HR Time Management User Guide | www.sapdocs.info
SAP HR Time Management User Guide | www.sapdocs.infoSAP HR Time Management User Guide | www.sapdocs.info
SAP HR Time Management User Guide | www.sapdocs.infosapdocs. info
 
Sap mrp-configuration-pp
Sap mrp-configuration-ppSap mrp-configuration-pp
Sap mrp-configuration-ppLokesh Modem
 
Sap User Exit for Functional Consultant
Sap User Exit for Functional ConsultantSap User Exit for Functional Consultant
Sap User Exit for Functional ConsultantAnkit Sharma
 
Chapter 02 sap script forms
Chapter 02 sap script formsChapter 02 sap script forms
Chapter 02 sap script formsKranthi Kumar
 
Funds management configuration sap ag
Funds management configuration sap agFunds management configuration sap ag
Funds management configuration sap agLluckyy
 
Introduction to ABAP
Introduction to ABAPIntroduction to ABAP
Introduction to ABAPsapdocs. info
 

What's hot (20)

Abap hr programing
Abap hr programingAbap hr programing
Abap hr programing
 
Sap payroll schema. functions , rules and operations – an overview
Sap payroll schema. functions , rules and operations – an overviewSap payroll schema. functions , rules and operations – an overview
Sap payroll schema. functions , rules and operations – an overview
 
Sap hr-programming
Sap hr-programmingSap hr-programming
Sap hr-programming
 
SAP Time Management
SAP Time Management SAP Time Management
SAP Time Management
 
S4 HANA Business Partner Configuration@Ganesh Tarlana
S4 HANA Business Partner Configuration@Ganesh TarlanaS4 HANA Business Partner Configuration@Ganesh Tarlana
S4 HANA Business Partner Configuration@Ganesh Tarlana
 
SAP HR AND HCM Interview questions
SAP HR AND HCM Interview questionsSAP HR AND HCM Interview questions
SAP HR AND HCM Interview questions
 
SAP HCM - Organization Management end user presentation
SAP HCM - Organization Management end user presentationSAP HCM - Organization Management end user presentation
SAP HCM - Organization Management end user presentation
 
SAP- HCM mini project report on - Design Enterprise Structure in Personnel Ad...
SAP- HCM mini project report on - Design Enterprise Structure in Personnel Ad...SAP- HCM mini project report on - Design Enterprise Structure in Personnel Ad...
SAP- HCM mini project report on - Design Enterprise Structure in Personnel Ad...
 
ABAP for Beginners - www.sapdocs.info
ABAP for Beginners - www.sapdocs.infoABAP for Beginners - www.sapdocs.info
ABAP for Beginners - www.sapdocs.info
 
Payroll basics
Payroll basicsPayroll basics
Payroll basics
 
Payroll QRGv2
Payroll QRGv2Payroll QRGv2
Payroll QRGv2
 
Sap mm c onfigration guid
Sap mm c onfigration guidSap mm c onfigration guid
Sap mm c onfigration guid
 
Understanding processing classes in sap
Understanding processing classes in sapUnderstanding processing classes in sap
Understanding processing classes in sap
 
ABAP Programming Overview
ABAP Programming OverviewABAP Programming Overview
ABAP Programming Overview
 
SAP HR Time Management User Guide | www.sapdocs.info
SAP HR Time Management User Guide | www.sapdocs.infoSAP HR Time Management User Guide | www.sapdocs.info
SAP HR Time Management User Guide | www.sapdocs.info
 
Sap mrp-configuration-pp
Sap mrp-configuration-ppSap mrp-configuration-pp
Sap mrp-configuration-pp
 
Sap User Exit for Functional Consultant
Sap User Exit for Functional ConsultantSap User Exit for Functional Consultant
Sap User Exit for Functional Consultant
 
Chapter 02 sap script forms
Chapter 02 sap script formsChapter 02 sap script forms
Chapter 02 sap script forms
 
Funds management configuration sap ag
Funds management configuration sap agFunds management configuration sap ag
Funds management configuration sap ag
 
Introduction to ABAP
Introduction to ABAPIntroduction to ABAP
Introduction to ABAP
 

Viewers also liked

ABAP Event-driven Programming &Selection Screen
ABAP Event-driven Programming &Selection ScreenABAP Event-driven Programming &Selection Screen
ABAP Event-driven Programming &Selection Screensapdocs. info
 
ABAP Message, Debugging, File Transfer and Type Group
ABAP Message, Debugging, File Transfer and Type GroupABAP Message, Debugging, File Transfer and Type Group
ABAP Message, Debugging, File Transfer and Type Groupsapdocs. info
 
08.Abap Dialog Programming Overview
08.Abap Dialog Programming Overview08.Abap Dialog Programming Overview
08.Abap Dialog Programming Overviewsapdocs. info
 
SAP FICO BBP Sample Document PDF NEW!
SAP FICO BBP Sample Document PDF NEW!SAP FICO BBP Sample Document PDF NEW!
SAP FICO BBP Sample Document PDF NEW!sapdocs. info
 
Abap course chapter 7 abap objects and bsp
Abap course   chapter 7 abap objects and bspAbap course   chapter 7 abap objects and bsp
Abap course chapter 7 abap objects and bspMilind Patil
 
List Processing in ABAP
List Processing in ABAPList Processing in ABAP
List Processing in ABAPsapdocs. info
 
ABAP Open SQL & Internal Table
ABAP Open SQL & Internal TableABAP Open SQL & Internal Table
ABAP Open SQL & Internal Tablesapdocs. info
 
Sap hr overview 58 slides
Sap hr overview 58 slidesSap hr overview 58 slides
Sap hr overview 58 slidesBunty Jain
 
Modularization & Catch Statement
Modularization & Catch StatementModularization & Catch Statement
Modularization & Catch Statementsapdocs. info
 
SAP Accounts Reveivable Functions | http://sapdocs.info
SAP Accounts Reveivable Functions | http://sapdocs.infoSAP Accounts Reveivable Functions | http://sapdocs.info
SAP Accounts Reveivable Functions | http://sapdocs.infosapdocs. info
 
SAP Accounts Reveivable Customer Master | http://sapdocs.info
SAP Accounts Reveivable Customer Master | http://sapdocs.infoSAP Accounts Reveivable Customer Master | http://sapdocs.info
SAP Accounts Reveivable Customer Master | http://sapdocs.infosapdocs. info
 
SAP Accounts Reveivable Introduction | http://sapdocs.info
SAP Accounts Reveivable Introduction | http://sapdocs.infoSAP Accounts Reveivable Introduction | http://sapdocs.info
SAP Accounts Reveivable Introduction | http://sapdocs.infosapdocs. info
 

Viewers also liked (15)

07.Advanced Abap
07.Advanced Abap07.Advanced Abap
07.Advanced Abap
 
ABAP Event-driven Programming &Selection Screen
ABAP Event-driven Programming &Selection ScreenABAP Event-driven Programming &Selection Screen
ABAP Event-driven Programming &Selection Screen
 
ABAP Message, Debugging, File Transfer and Type Group
ABAP Message, Debugging, File Transfer and Type GroupABAP Message, Debugging, File Transfer and Type Group
ABAP Message, Debugging, File Transfer and Type Group
 
08.Abap Dialog Programming Overview
08.Abap Dialog Programming Overview08.Abap Dialog Programming Overview
08.Abap Dialog Programming Overview
 
SAP FICO BBP Sample Document PDF NEW!
SAP FICO BBP Sample Document PDF NEW!SAP FICO BBP Sample Document PDF NEW!
SAP FICO BBP Sample Document PDF NEW!
 
Abap course chapter 7 abap objects and bsp
Abap course   chapter 7 abap objects and bspAbap course   chapter 7 abap objects and bsp
Abap course chapter 7 abap objects and bsp
 
SAP ABAP Material
SAP ABAP MaterialSAP ABAP Material
SAP ABAP Material
 
List Processing in ABAP
List Processing in ABAPList Processing in ABAP
List Processing in ABAP
 
ABAP Open SQL & Internal Table
ABAP Open SQL & Internal TableABAP Open SQL & Internal Table
ABAP Open SQL & Internal Table
 
Sap hr overview 58 slides
Sap hr overview 58 slidesSap hr overview 58 slides
Sap hr overview 58 slides
 
ABAP Advanced List
ABAP Advanced ListABAP Advanced List
ABAP Advanced List
 
Modularization & Catch Statement
Modularization & Catch StatementModularization & Catch Statement
Modularization & Catch Statement
 
SAP Accounts Reveivable Functions | http://sapdocs.info
SAP Accounts Reveivable Functions | http://sapdocs.infoSAP Accounts Reveivable Functions | http://sapdocs.info
SAP Accounts Reveivable Functions | http://sapdocs.info
 
SAP Accounts Reveivable Customer Master | http://sapdocs.info
SAP Accounts Reveivable Customer Master | http://sapdocs.infoSAP Accounts Reveivable Customer Master | http://sapdocs.info
SAP Accounts Reveivable Customer Master | http://sapdocs.info
 
SAP Accounts Reveivable Introduction | http://sapdocs.info
SAP Accounts Reveivable Introduction | http://sapdocs.infoSAP Accounts Reveivable Introduction | http://sapdocs.info
SAP Accounts Reveivable Introduction | http://sapdocs.info
 

Similar to HR ABAP Programming Training Material | http://sapdocs.info

Abaphrprograming 121218001552-phpapp02 (2)
Abaphrprograming 121218001552-phpapp02 (2)Abaphrprograming 121218001552-phpapp02 (2)
Abaphrprograming 121218001552-phpapp02 (2)IT
 
Abaphrprograming 121218001552-phpapp02 (2)
Abaphrprograming 121218001552-phpapp02 (2)Abaphrprograming 121218001552-phpapp02 (2)
Abaphrprograming 121218001552-phpapp02 (2)IT
 
Lecture 1. Data Structure & Algorithm.pptx
Lecture 1. Data Structure & Algorithm.pptxLecture 1. Data Structure & Algorithm.pptx
Lecture 1. Data Structure & Algorithm.pptxArifKamal36
 
data structures and its importance
 data structures and its importance  data structures and its importance
data structures and its importance Anaya Zafar
 
System Analysis And Design
System Analysis And DesignSystem Analysis And Design
System Analysis And DesignLijo Stalin
 
Database Plan For Riordan Manufacturing Material Ordering
Database Plan For Riordan Manufacturing Material OrderingDatabase Plan For Riordan Manufacturing Material Ordering
Database Plan For Riordan Manufacturing Material OrderingDeborah Gastineau
 
DBMS CAPSTONE PPT (1).pptx
DBMS CAPSTONE PPT (1).pptxDBMS CAPSTONE PPT (1).pptx
DBMS CAPSTONE PPT (1).pptxASWINMM5
 
employee turnover prediction document.docx
employee turnover prediction document.docxemployee turnover prediction document.docx
employee turnover prediction document.docxrohithprabhas1
 
Information retrieval-systems notes
Information retrieval-systems notesInformation retrieval-systems notes
Information retrieval-systems notesBAIRAVI T
 
Unit 4 P4 Research Paper
Unit 4 P4 Research PaperUnit 4 P4 Research Paper
Unit 4 P4 Research PaperKatreka Howard
 
Data warehouse
Data warehouseData warehouse
Data warehouse_123_
 
sappresentation- By Prithwijit
sappresentation- By Prithwijit sappresentation- By Prithwijit
sappresentation- By Prithwijit PRITHWIJIT PAL
 

Similar to HR ABAP Programming Training Material | http://sapdocs.info (20)

Abaphrprograming 121218001552-phpapp02 (2)
Abaphrprograming 121218001552-phpapp02 (2)Abaphrprograming 121218001552-phpapp02 (2)
Abaphrprograming 121218001552-phpapp02 (2)
 
Abaphrprograming 121218001552-phpapp02 (2)
Abaphrprograming 121218001552-phpapp02 (2)Abaphrprograming 121218001552-phpapp02 (2)
Abaphrprograming 121218001552-phpapp02 (2)
 
Lecture 1. Data Structure & Algorithm.pptx
Lecture 1. Data Structure & Algorithm.pptxLecture 1. Data Structure & Algorithm.pptx
Lecture 1. Data Structure & Algorithm.pptx
 
data structures and its importance
 data structures and its importance  data structures and its importance
data structures and its importance
 
System Analysis And Design
System Analysis And DesignSystem Analysis And Design
System Analysis And Design
 
Bi assignment
Bi assignmentBi assignment
Bi assignment
 
Database Plan For Riordan Manufacturing Material Ordering
Database Plan For Riordan Manufacturing Material OrderingDatabase Plan For Riordan Manufacturing Material Ordering
Database Plan For Riordan Manufacturing Material Ordering
 
DBMS CAPSTONE PPT (1).pptx
DBMS CAPSTONE PPT (1).pptxDBMS CAPSTONE PPT (1).pptx
DBMS CAPSTONE PPT (1).pptx
 
Dbms
DbmsDbms
Dbms
 
Unit 2 DATABASE ESSENTIALS.pptx
Unit 2 DATABASE ESSENTIALS.pptxUnit 2 DATABASE ESSENTIALS.pptx
Unit 2 DATABASE ESSENTIALS.pptx
 
employee turnover prediction document.docx
employee turnover prediction document.docxemployee turnover prediction document.docx
employee turnover prediction document.docx
 
MS-CIT Unit 9.pptx
MS-CIT Unit 9.pptxMS-CIT Unit 9.pptx
MS-CIT Unit 9.pptx
 
SAP BI/BW
SAP BI/BWSAP BI/BW
SAP BI/BW
 
ITFT- Dbms
ITFT- DbmsITFT- Dbms
ITFT- Dbms
 
Information retrieval-systems notes
Information retrieval-systems notesInformation retrieval-systems notes
Information retrieval-systems notes
 
Advanced Database System
Advanced Database SystemAdvanced Database System
Advanced Database System
 
Unit 4 P4 Research Paper
Unit 4 P4 Research PaperUnit 4 P4 Research Paper
Unit 4 P4 Research Paper
 
Data warehouse
Data warehouseData warehouse
Data warehouse
 
sappresentation- By Prithwijit
sappresentation- By Prithwijit sappresentation- By Prithwijit
sappresentation- By Prithwijit
 
Dbms
DbmsDbms
Dbms
 

More from sapdocs. info

SAP PM Master Data Training Guide
SAP PM Master Data Training GuideSAP PM Master Data Training Guide
SAP PM Master Data Training Guidesapdocs. info
 
SAP SD Certification (C_TSCM62_66) Preparation Training Notes
SAP SD Certification (C_TSCM62_66) Preparation Training NotesSAP SD Certification (C_TSCM62_66) Preparation Training Notes
SAP SD Certification (C_TSCM62_66) Preparation Training Notessapdocs. info
 
Variant Configuration in SAP PP: Beginner's Guide
Variant Configuration in SAP PP: Beginner's GuideVariant Configuration in SAP PP: Beginner's Guide
Variant Configuration in SAP PP: Beginner's Guidesapdocs. info
 
SAP PP MRP Guide for Beginners
SAP PP MRP Guide for BeginnersSAP PP MRP Guide for Beginners
SAP PP MRP Guide for Beginnerssapdocs. info
 
SAP ECC 6.0 PM Configuration Manual - www.sapdocs.info
SAP ECC 6.0 PM Configuration Manual - www.sapdocs.infoSAP ECC 6.0 PM Configuration Manual - www.sapdocs.info
SAP ECC 6.0 PM Configuration Manual - www.sapdocs.infosapdocs. info
 
SAP PM Training Manual - www.sapdocs.info
SAP PM Training Manual - www.sapdocs.infoSAP PM Training Manual - www.sapdocs.info
SAP PM Training Manual - www.sapdocs.infosapdocs. info
 
ABAP Basico para Consultores Funcionales
ABAP Basico para Consultores FuncionalesABAP Basico para Consultores Funcionales
ABAP Basico para Consultores Funcionalessapdocs. info
 
SAP Configuration Guide for Functional Modules (Based on IDES)
SAP Configuration Guide for Functional Modules (Based on IDES)SAP Configuration Guide for Functional Modules (Based on IDES)
SAP Configuration Guide for Functional Modules (Based on IDES)sapdocs. info
 
SAP FI-AP TCODES & MENU PATHS
SAP FI-AP TCODES & MENU PATHSSAP FI-AP TCODES & MENU PATHS
SAP FI-AP TCODES & MENU PATHSsapdocs. info
 
SAP FI-AR TCODES & MENU PATHS
SAP FI-AR TCODES & MENU PATHSSAP FI-AR TCODES & MENU PATHS
SAP FI-AR TCODES & MENU PATHSsapdocs. info
 
SAP CO Configuration Guide - Exclusive Document
SAP CO Configuration Guide - Exclusive DocumentSAP CO Configuration Guide - Exclusive Document
SAP CO Configuration Guide - Exclusive Documentsapdocs. info
 
SAP PP End User Document - www.sapdocs.info
SAP PP End User Document - www.sapdocs.infoSAP PP End User Document - www.sapdocs.info
SAP PP End User Document - www.sapdocs.infosapdocs. info
 
SAP MM Configuration - Real Project Documentation
SAP MM Configuration - Real Project DocumentationSAP MM Configuration - Real Project Documentation
SAP MM Configuration - Real Project Documentationsapdocs. info
 
SAP FI AP: Configuration & End User Guide
SAP FI AP: Configuration & End User GuideSAP FI AP: Configuration & End User Guide
SAP FI AP: Configuration & End User Guidesapdocs. info
 
SAP FI AR: End User Guide for Beginners
SAP FI AR: End User Guide for BeginnersSAP FI AR: End User Guide for Beginners
SAP FI AR: End User Guide for Beginnerssapdocs. info
 
SAP FI AP: End User Guide for Beginners
SAP FI AP: End User Guide for BeginnersSAP FI AP: End User Guide for Beginners
SAP FI AP: End User Guide for Beginnerssapdocs. info
 
SAP FI Asset Accounting: End User Guide for Beginners
SAP FI Asset Accounting: End User Guide for BeginnersSAP FI Asset Accounting: End User Guide for Beginners
SAP FI Asset Accounting: End User Guide for Beginnerssapdocs. info
 
Variant Configurition in SAP: Beginners Guide | www.sapdocs.info
Variant Configurition in SAP: Beginners Guide | www.sapdocs.infoVariant Configurition in SAP: Beginners Guide | www.sapdocs.info
Variant Configurition in SAP: Beginners Guide | www.sapdocs.infosapdocs. info
 
Exclusive SAP Basis Training Book | www.sapdocs.info
Exclusive SAP Basis Training Book | www.sapdocs.infoExclusive SAP Basis Training Book | www.sapdocs.info
Exclusive SAP Basis Training Book | www.sapdocs.infosapdocs. info
 
SAP Plant Maintenance Training Material | www.sapdocs.info
SAP Plant Maintenance Training Material | www.sapdocs.infoSAP Plant Maintenance Training Material | www.sapdocs.info
SAP Plant Maintenance Training Material | www.sapdocs.infosapdocs. info
 

More from sapdocs. info (20)

SAP PM Master Data Training Guide
SAP PM Master Data Training GuideSAP PM Master Data Training Guide
SAP PM Master Data Training Guide
 
SAP SD Certification (C_TSCM62_66) Preparation Training Notes
SAP SD Certification (C_TSCM62_66) Preparation Training NotesSAP SD Certification (C_TSCM62_66) Preparation Training Notes
SAP SD Certification (C_TSCM62_66) Preparation Training Notes
 
Variant Configuration in SAP PP: Beginner's Guide
Variant Configuration in SAP PP: Beginner's GuideVariant Configuration in SAP PP: Beginner's Guide
Variant Configuration in SAP PP: Beginner's Guide
 
SAP PP MRP Guide for Beginners
SAP PP MRP Guide for BeginnersSAP PP MRP Guide for Beginners
SAP PP MRP Guide for Beginners
 
SAP ECC 6.0 PM Configuration Manual - www.sapdocs.info
SAP ECC 6.0 PM Configuration Manual - www.sapdocs.infoSAP ECC 6.0 PM Configuration Manual - www.sapdocs.info
SAP ECC 6.0 PM Configuration Manual - www.sapdocs.info
 
SAP PM Training Manual - www.sapdocs.info
SAP PM Training Manual - www.sapdocs.infoSAP PM Training Manual - www.sapdocs.info
SAP PM Training Manual - www.sapdocs.info
 
ABAP Basico para Consultores Funcionales
ABAP Basico para Consultores FuncionalesABAP Basico para Consultores Funcionales
ABAP Basico para Consultores Funcionales
 
SAP Configuration Guide for Functional Modules (Based on IDES)
SAP Configuration Guide for Functional Modules (Based on IDES)SAP Configuration Guide for Functional Modules (Based on IDES)
SAP Configuration Guide for Functional Modules (Based on IDES)
 
SAP FI-AP TCODES & MENU PATHS
SAP FI-AP TCODES & MENU PATHSSAP FI-AP TCODES & MENU PATHS
SAP FI-AP TCODES & MENU PATHS
 
SAP FI-AR TCODES & MENU PATHS
SAP FI-AR TCODES & MENU PATHSSAP FI-AR TCODES & MENU PATHS
SAP FI-AR TCODES & MENU PATHS
 
SAP CO Configuration Guide - Exclusive Document
SAP CO Configuration Guide - Exclusive DocumentSAP CO Configuration Guide - Exclusive Document
SAP CO Configuration Guide - Exclusive Document
 
SAP PP End User Document - www.sapdocs.info
SAP PP End User Document - www.sapdocs.infoSAP PP End User Document - www.sapdocs.info
SAP PP End User Document - www.sapdocs.info
 
SAP MM Configuration - Real Project Documentation
SAP MM Configuration - Real Project DocumentationSAP MM Configuration - Real Project Documentation
SAP MM Configuration - Real Project Documentation
 
SAP FI AP: Configuration & End User Guide
SAP FI AP: Configuration & End User GuideSAP FI AP: Configuration & End User Guide
SAP FI AP: Configuration & End User Guide
 
SAP FI AR: End User Guide for Beginners
SAP FI AR: End User Guide for BeginnersSAP FI AR: End User Guide for Beginners
SAP FI AR: End User Guide for Beginners
 
SAP FI AP: End User Guide for Beginners
SAP FI AP: End User Guide for BeginnersSAP FI AP: End User Guide for Beginners
SAP FI AP: End User Guide for Beginners
 
SAP FI Asset Accounting: End User Guide for Beginners
SAP FI Asset Accounting: End User Guide for BeginnersSAP FI Asset Accounting: End User Guide for Beginners
SAP FI Asset Accounting: End User Guide for Beginners
 
Variant Configurition in SAP: Beginners Guide | www.sapdocs.info
Variant Configurition in SAP: Beginners Guide | www.sapdocs.infoVariant Configurition in SAP: Beginners Guide | www.sapdocs.info
Variant Configurition in SAP: Beginners Guide | www.sapdocs.info
 
Exclusive SAP Basis Training Book | www.sapdocs.info
Exclusive SAP Basis Training Book | www.sapdocs.infoExclusive SAP Basis Training Book | www.sapdocs.info
Exclusive SAP Basis Training Book | www.sapdocs.info
 
SAP Plant Maintenance Training Material | www.sapdocs.info
SAP Plant Maintenance Training Material | www.sapdocs.infoSAP Plant Maintenance Training Material | www.sapdocs.info
SAP Plant Maintenance Training Material | www.sapdocs.info
 

Recently uploaded

Practical Research 1: Lesson 8 Writing the Thesis Statement.pptx
Practical Research 1: Lesson 8 Writing the Thesis Statement.pptxPractical Research 1: Lesson 8 Writing the Thesis Statement.pptx
Practical Research 1: Lesson 8 Writing the Thesis Statement.pptxKatherine Villaluna
 
The basics of sentences session 10pptx.pptx
The basics of sentences session 10pptx.pptxThe basics of sentences session 10pptx.pptx
The basics of sentences session 10pptx.pptxheathfieldcps1
 
Diploma in Nursing Admission Test Question Solution 2023.pdf
Diploma in Nursing Admission Test Question Solution 2023.pdfDiploma in Nursing Admission Test Question Solution 2023.pdf
Diploma in Nursing Admission Test Question Solution 2023.pdfMohonDas
 
P4C x ELT = P4ELT: Its Theoretical Background (Kanazawa, 2024 March).pdf
P4C x ELT = P4ELT: Its Theoretical Background (Kanazawa, 2024 March).pdfP4C x ELT = P4ELT: Its Theoretical Background (Kanazawa, 2024 March).pdf
P4C x ELT = P4ELT: Its Theoretical Background (Kanazawa, 2024 March).pdfYu Kanazawa / Osaka University
 
5 charts on South Africa as a source country for international student recrui...
5 charts on South Africa as a source country for international student recrui...5 charts on South Africa as a source country for international student recrui...
5 charts on South Africa as a source country for international student recrui...CaraSkikne1
 
DUST OF SNOW_BY ROBERT FROST_EDITED BY_ TANMOY MISHRA
DUST OF SNOW_BY ROBERT FROST_EDITED BY_ TANMOY MISHRADUST OF SNOW_BY ROBERT FROST_EDITED BY_ TANMOY MISHRA
DUST OF SNOW_BY ROBERT FROST_EDITED BY_ TANMOY MISHRATanmoy Mishra
 
Quality Assurance_GOOD LABORATORY PRACTICE
Quality Assurance_GOOD LABORATORY PRACTICEQuality Assurance_GOOD LABORATORY PRACTICE
Quality Assurance_GOOD LABORATORY PRACTICESayali Powar
 
Practical Research 1 Lesson 9 Scope and delimitation.pptx
Practical Research 1 Lesson 9 Scope and delimitation.pptxPractical Research 1 Lesson 9 Scope and delimitation.pptx
Practical Research 1 Lesson 9 Scope and delimitation.pptxKatherine Villaluna
 
Drug Information Services- DIC and Sources.
Drug Information Services- DIC and Sources.Drug Information Services- DIC and Sources.
Drug Information Services- DIC and Sources.raviapr7
 
Maximizing Impact_ Nonprofit Website Planning, Budgeting, and Design.pdf
Maximizing Impact_ Nonprofit Website Planning, Budgeting, and Design.pdfMaximizing Impact_ Nonprofit Website Planning, Budgeting, and Design.pdf
Maximizing Impact_ Nonprofit Website Planning, Budgeting, and Design.pdfTechSoup
 
Education and training program in the hospital APR.pptx
Education and training program in the hospital APR.pptxEducation and training program in the hospital APR.pptx
Education and training program in the hospital APR.pptxraviapr7
 
How to Solve Singleton Error in the Odoo 17
How to Solve Singleton Error in the  Odoo 17How to Solve Singleton Error in the  Odoo 17
How to Solve Singleton Error in the Odoo 17Celine George
 
2024.03.23 What do successful readers do - Sandy Millin for PARK.pptx
2024.03.23 What do successful readers do - Sandy Millin for PARK.pptx2024.03.23 What do successful readers do - Sandy Millin for PARK.pptx
2024.03.23 What do successful readers do - Sandy Millin for PARK.pptxSandy Millin
 
General views of Histopathology and step
General views of Histopathology and stepGeneral views of Histopathology and step
General views of Histopathology and stepobaje godwin sunday
 
How to Add a many2many Relational Field in Odoo 17
How to Add a many2many Relational Field in Odoo 17How to Add a many2many Relational Field in Odoo 17
How to Add a many2many Relational Field in Odoo 17Celine George
 
Philosophy of Education and Educational Philosophy
Philosophy of Education  and Educational PhilosophyPhilosophy of Education  and Educational Philosophy
Philosophy of Education and Educational PhilosophyShuvankar Madhu
 
How to Manage Cross-Selling in Odoo 17 Sales
How to Manage Cross-Selling in Odoo 17 SalesHow to Manage Cross-Selling in Odoo 17 Sales
How to Manage Cross-Selling in Odoo 17 SalesCeline George
 
Human-AI Co-Creation of Worked Examples for Programming Classes
Human-AI Co-Creation of Worked Examples for Programming ClassesHuman-AI Co-Creation of Worked Examples for Programming Classes
Human-AI Co-Creation of Worked Examples for Programming ClassesMohammad Hassany
 
Clinical Pharmacy Introduction to Clinical Pharmacy, Concept of clinical pptx
Clinical Pharmacy  Introduction to Clinical Pharmacy, Concept of clinical pptxClinical Pharmacy  Introduction to Clinical Pharmacy, Concept of clinical pptx
Clinical Pharmacy Introduction to Clinical Pharmacy, Concept of clinical pptxraviapr7
 

Recently uploaded (20)

Practical Research 1: Lesson 8 Writing the Thesis Statement.pptx
Practical Research 1: Lesson 8 Writing the Thesis Statement.pptxPractical Research 1: Lesson 8 Writing the Thesis Statement.pptx
Practical Research 1: Lesson 8 Writing the Thesis Statement.pptx
 
The basics of sentences session 10pptx.pptx
The basics of sentences session 10pptx.pptxThe basics of sentences session 10pptx.pptx
The basics of sentences session 10pptx.pptx
 
Diploma in Nursing Admission Test Question Solution 2023.pdf
Diploma in Nursing Admission Test Question Solution 2023.pdfDiploma in Nursing Admission Test Question Solution 2023.pdf
Diploma in Nursing Admission Test Question Solution 2023.pdf
 
P4C x ELT = P4ELT: Its Theoretical Background (Kanazawa, 2024 March).pdf
P4C x ELT = P4ELT: Its Theoretical Background (Kanazawa, 2024 March).pdfP4C x ELT = P4ELT: Its Theoretical Background (Kanazawa, 2024 March).pdf
P4C x ELT = P4ELT: Its Theoretical Background (Kanazawa, 2024 March).pdf
 
5 charts on South Africa as a source country for international student recrui...
5 charts on South Africa as a source country for international student recrui...5 charts on South Africa as a source country for international student recrui...
5 charts on South Africa as a source country for international student recrui...
 
DUST OF SNOW_BY ROBERT FROST_EDITED BY_ TANMOY MISHRA
DUST OF SNOW_BY ROBERT FROST_EDITED BY_ TANMOY MISHRADUST OF SNOW_BY ROBERT FROST_EDITED BY_ TANMOY MISHRA
DUST OF SNOW_BY ROBERT FROST_EDITED BY_ TANMOY MISHRA
 
Quality Assurance_GOOD LABORATORY PRACTICE
Quality Assurance_GOOD LABORATORY PRACTICEQuality Assurance_GOOD LABORATORY PRACTICE
Quality Assurance_GOOD LABORATORY PRACTICE
 
Practical Research 1 Lesson 9 Scope and delimitation.pptx
Practical Research 1 Lesson 9 Scope and delimitation.pptxPractical Research 1 Lesson 9 Scope and delimitation.pptx
Practical Research 1 Lesson 9 Scope and delimitation.pptx
 
Drug Information Services- DIC and Sources.
Drug Information Services- DIC and Sources.Drug Information Services- DIC and Sources.
Drug Information Services- DIC and Sources.
 
Prelims of Kant get Marx 2.0: a general politics quiz
Prelims of Kant get Marx 2.0: a general politics quizPrelims of Kant get Marx 2.0: a general politics quiz
Prelims of Kant get Marx 2.0: a general politics quiz
 
Maximizing Impact_ Nonprofit Website Planning, Budgeting, and Design.pdf
Maximizing Impact_ Nonprofit Website Planning, Budgeting, and Design.pdfMaximizing Impact_ Nonprofit Website Planning, Budgeting, and Design.pdf
Maximizing Impact_ Nonprofit Website Planning, Budgeting, and Design.pdf
 
Education and training program in the hospital APR.pptx
Education and training program in the hospital APR.pptxEducation and training program in the hospital APR.pptx
Education and training program in the hospital APR.pptx
 
How to Solve Singleton Error in the Odoo 17
How to Solve Singleton Error in the  Odoo 17How to Solve Singleton Error in the  Odoo 17
How to Solve Singleton Error in the Odoo 17
 
2024.03.23 What do successful readers do - Sandy Millin for PARK.pptx
2024.03.23 What do successful readers do - Sandy Millin for PARK.pptx2024.03.23 What do successful readers do - Sandy Millin for PARK.pptx
2024.03.23 What do successful readers do - Sandy Millin for PARK.pptx
 
General views of Histopathology and step
General views of Histopathology and stepGeneral views of Histopathology and step
General views of Histopathology and step
 
How to Add a many2many Relational Field in Odoo 17
How to Add a many2many Relational Field in Odoo 17How to Add a many2many Relational Field in Odoo 17
How to Add a many2many Relational Field in Odoo 17
 
Philosophy of Education and Educational Philosophy
Philosophy of Education  and Educational PhilosophyPhilosophy of Education  and Educational Philosophy
Philosophy of Education and Educational Philosophy
 
How to Manage Cross-Selling in Odoo 17 Sales
How to Manage Cross-Selling in Odoo 17 SalesHow to Manage Cross-Selling in Odoo 17 Sales
How to Manage Cross-Selling in Odoo 17 Sales
 
Human-AI Co-Creation of Worked Examples for Programming Classes
Human-AI Co-Creation of Worked Examples for Programming ClassesHuman-AI Co-Creation of Worked Examples for Programming Classes
Human-AI Co-Creation of Worked Examples for Programming Classes
 
Clinical Pharmacy Introduction to Clinical Pharmacy, Concept of clinical pptx
Clinical Pharmacy  Introduction to Clinical Pharmacy, Concept of clinical pptxClinical Pharmacy  Introduction to Clinical Pharmacy, Concept of clinical pptx
Clinical Pharmacy Introduction to Clinical Pharmacy, Concept of clinical pptx
 

HR ABAP Programming Training Material | http://sapdocs.info

  • 2. Agenda • Overview and Features in HR programming • Difference between Conventional ABAP • Concepts of Infotypes • Logical Databases in HR • Macros in HR • Clusters in HR • Enhancement and creation of Infotype • Reporting in HR • User Exits and BAdIs • Authorization Objects in HR
  • 3. Overview and Features in HR Programming • The aim in the Human Resources component is to be able to process employee related data according to business requirements in an effective structure. • The Human Resources module uses a system of data grouped together called infotypes. The Human Resources module uses a system of data grouped together called infotypes. And storing bulk data like time management and Payroll data in Cluster files. HR Programming involves data extraction and manipulation from these infotypes and clusters using LDB/MACRO and function modules. • Infotypes mirror a quantity of connected data records; infotypes are identifiable through a four character numerical string [e.g. infotype Addresses (0006)] . • You can save the infotypes as time-dependent to enable a retroactive evaluation of Employee data. • The infotypes appear as an entry screen for the user, through which you can maintain infotype records. Infotypes can be processed individually or in fast entry mode.
  • 4. Difference between Conventional ABAP • Advanced Business Application Programming ABAP is SAP's fourth generation language. All of R/3's applications and even parts of its basic system are developed in ABAP. ABAP is used for customization and modification of SAP applications. • In HR ABAP use of select statements significantly less than in other areas of ABAP development, Logical databases have limited applications in other modules but are very useful in HR. Also, you really need to understand the infotype time constraint concept since the data organization in HR is Employee-Time based, When you cannot get the information that you need out of the logical DB look at the function modules starting with HR* and RH*. These function modules will provide you with multiple ways of accessing data to save time. Worst-case scenario, use a select statement. • In addition to the LDB, HR programming also involves the use of Macros for data extraction • The storage an access of data is different • Authorization checks
  • 5. Concepts of Infotypes An infotype represents a group of related data fields, provide information structure, facilitates data entry, and allows time dependent storage. In other words we can say infotypes are information units used to enter the time dependent data of the employee. Master data in HR is stored in infotypes .Each infotype pertains to a specific type of data. Each infotype has a database table associated with it. Time constraints: Enable you to determine how the validity periods of Infotype data records interact. 1. Time constraint 1: Exactly one valid data record of the infotype in question must exist for the entire time that the employee belongs to the enterprise. 2. Time constraint 2: No more than one valid data record of the infotype in question can exist at any one time. 3. Time constraint 3: Any number of valid data records of the infotype in question can exist at any one time.
  • 6. Concepts of Infotypes Transparent tables for infotype • Each infotype has a transparent table. Each logical field for an infotype has a corresponding physical field on the database. • One physical table is stored on the database for each transparent table. The names of the physical table and logical table definition in the Dictionary are compatible. • The following naming convention applies to infotype tables; nnnn stands for the infotype number: • PAnnnn for transparent tables in Personnel Administration • PBnnnn for transparent tables in Recruitment • HRPnnnn for transparent tables in Personnel Planning • Example : For Infotype 0000, the corresponding database table associated with it is PA0000
  • 7. Concepts of Infotypes Transparent tables for infotype It is not true always that a Personnel Administration/Recruitment/Personnel Planning etc has a transparent table like PAnnnn or PBnnnn or HRPnnnn. One such example is TEVEN table for IT 2011.It is better to use the Function module HR_INFOTYPE_DATABASETABLE_GET to get the Infotype table name for an infotype. CALL FUNCTION 'HR_INFOTYPE_DATABASETABLE_GET' EXPORTING INFTY = <INFTY> TCLAS = <TCLAS> “Transaction Class with values ‘A’ or ‘B’ or ‘T’ IMPORTING DBNAME = <DBTAB> EXCEPTIONS ENTRY_NOT_FOUND = 1 OTHERS = 2. You can also use the database table T777D to find the database table associated with an infotype.
  • 8. Concepts of Infotypes Technical Data Structure of Info Types PA Infotypes The transparent table for PA Infotype is PAnnnn where nnnn is the infotype number. Structure PAKEY: This is nothing but primary key of transparent table PAnnnn • PERNR: the personnel number is the only unique key within a client for identifying an employee. It is used to access the display and maintenance screens for an employee’s master data and working time data (infotypes). • SUBTY: subtypes are subdivisions of infotypes. An infotype’s subtypes can have different time constraints and form their own histories. • OBJPS: the object identification is used to make a distinction between records with the same infotype, subtype, lock indicator, start date, and end date. For example, the child number in infotype 0021 Family/Related Person.
  • 9. Concepts of Infotypes • SPRPS: the lock indicator for HR master data is used to lock and unlock data records, which enables the “double verification principle” to be put into practice. In accordance with this principle, at least two users are involved in the process of writing an active data record to the database. One of the users creates a locked infotype record, and the other user unlocks - that is, activates the data record. • ENDDA: end date. • BEGDA: start date. • SEQNR: The Sequential Number is used to make a distinction between infotype records that have the same key and time constraint '3' (any number of valid infotype data records at any one time). Unlike the object identification, it is assigned by the system automatically Note: Structure PAKEY should never be changed
  • 10. Concepts of Infotypes Structure PSHD1: In addition to structure PAKEY, there is another basic structure that is identical for all infotypes in personnel administration – that is, the structure PSHD1. Structure PSHD1 should never be changed
  • 11. Concepts of Infotypes Structure PSHDR: This is a meta structure and contains the structures PSHDR and PSKEY. Structure PSHDR should never be changed Structure Pnnnn: This structure contains the includes PSHDR and PS0002, where PSHDR in turn contains the include structures PSKEY and PSHD1.
  • 12. Concepts of Infotypes Element Definition Includes Can be changed by customer PAKEY Structure - No PSHD1 Structure - No PSHDR Structure PSKEY No PSHD1 PSnnnn Structure (field definitions) PS9nnn:Yes CI_Pnnnn PS0nnn-PS8nnn: No Pnnnn Structure PSHDR P9nnn:Yes PSnnnn P0nnn-P8nnn:No
  • 13. Concepts of Infotypes Element Definition Includes Can be changed by customer PAnnnn Transparent MANDT PA9nnn:Yes Table PAKEY PA0nnn- PA8nnn PSHD1 :No PSnnnn CI_nnnn Structure - Yes
  • 14. Concepts of Infotypes Technical Data Structure of Info Types Personnel Infotypes Structure: HRIKEY • MANDT: This field contains the clients. • PLVAR: It is a two-character alphanumeric Key for the plan versions that enables us to differentiate between alternative plan versions. • OTYPE: This field contains the object type key, which is a maximum of two alphanumeric characters in length. • OBJID: This field contains an eight-digit key that represents a single object. • SUBTY: Contains specification of sub type • ISTAT: This field is one-digit numeric key in which the planning status is indicated. There is a status for all objects and for the infotypes that describe them. • BEGDA: This contains start date of the validity period • ENDDA: This contains end date of the validity period • VARYF: This contains the target object of a relationship • SEQNR: This specifies a sequence number for Infotypes of time constraint class 3.
  • 15. Concepts of Infotypes Structure HRIKEYL: The structure HRIKEYL is a variant of the structure HRIKEY. This supports language-dependant infotypes.
  • 16. Concepts of Infotypes Structure HRIADMIN: The structure HRIADMIN is a data structure contains administrative information on each infotype.
  • 17. Concepts of Infotypes Structure HRInnnn: The infotype-specific data fields for an infotype are defined in the structure HRInnnn. Here nnnn stands for four-digit infotype number, as appropriate. Transparent Table HRPnnnn: The transparent table now contains the structures HRIKEY(key fields), HRADMIN and HRInnnn. Logical structure Pnnnn: Like the infotypes in Pa, the structure Pnnnn is also found in the infotypes of personnel planning. It contains the includes HRIPKEY, HRIADMIN and HRInnnn.
  • 18. Concepts of Infotypes Table Infotypes: Table infotypes are a special form of infotype used in personnel planning. Table infotypes are infotypes for which the data part has a repetitive structure of arbitary length. The repetitive structures could be texts with any number of lines, or it could, for example, be a course schedule with any number of days. In order to provide the option of saving repetitions of any length, the data part must have repetitive structure and it must be saved in a separate data table. This repetition part of the table part is described in the logical structure PTnnnn and stored in separate table HRTnnnn. While maintaining the entry in table T777D for infotypes, the table infotype will be having the T777D-TBTAB field will be filled with HRTnnnn.
  • 19. Concepts of Infotypes External Object Types: External Object types refer to those object types that are not stored in the data structure of personnel planning. From a technical point of view there is no record in HRP1000 for external objects. External Object types are only referenced in the context of a relationship record. Technically, this means that data records on the relationship are only held in HRP1001. For internal object types, relationships can exist in two directions, top-down (B) and bottom-up (A). This results in the creation of two records in IT 1001, relationships. External Object types are limited in this respect. In order to create an inverse relationship for an external object type, the key structure of the external object type must be an eight-digit numeric string type NUMC of length 8). It must be therefore be defined with the same type as the field object ID (HRPnnnn- OBJID). Whether external object types have only one relationship – or if inverse relationships are also possible – is established for each object type in the table T77EO.
  • 20. Concepts of Infotypes External Infotypes: Infotypes that are needed for planning purposes in personnel planning, but are not stored in transparent infotype tables of the type HRPnnnn are referred to as external infotypes. This information can be physically available, for example, in the tables of personnel administration. An identifier for an external infotype appears in table T777D in the field EXT_INFTY.
  • 21. Concepts of Infotypes Element Definition Includes Can be changed by customer HRIKEY Structure - No HRIKEYL Structure - No HRIADMIN Structure - No HRInnnn Structure (field definitions) HRI9nnn:Yes CI_Pnnnn HRI0nnn- HRI8nnn: No Pnnnn Structure HRIPKEY P9nnn:Yes HRIADMIN P0nnn-P8nnn:No HRInnnn
  • 22. Concepts of Infotypes Element Definition Includes Can be changed by customer HRPnnnn Transparent HRIKEY or HRP9nnn:Yes Table HRIKEYL HRP0nnn- and HRP8nnn: No HRIADMIN PTnnnn Structure - PT9nnn:Yes PT0nnn-PT8nnn: No HRTnnnn Transparent PTnnnn HRT9nnn:Yes Table HRT0nnn- HRT8nnn : No CI_nnnn Structure - Yes
  • 23. Logical Databases in HR To reduce programming Efforts, it often helps to use the logical databases when creating reports. Logical databases are special ABAP Programs that provide selection screens, additional features and so on. The main objects of a LDB are Structure, Selection and Database Program. An LDB has another advantage for the option of central authorization checking. Logical Databases used In HR: 1. PAP 2. PNP 3. PNPCE - Enhanced version of PNP available form SAP Enterprise version onwards 4. PCH 5. PTRVP The LDB PAP is for Applicant administration, PNP and PNPCE for Personnel Management, PCH for Organisational Management and PTVRP for Travel Management. The Logical Databases PNP/PNPCE and PCH are mostly used.
  • 24. Macros in HR • Like subroutines and function modules, macro modules can be used to modularize programs. Macro modules are frequently used in HR. • These macros are defined in program SAPDBPNP (include DBPNPMAC) with the keyword DEFINE. They can be used in any program that uses the logical database PNP. • If you want to use these macros in reports that do not use the logical database PNP, you must include program DBPNPMAC with the keyword INCLUDE. • You can also define your own macros. In accordance with the naming convention, the first two letters stand for the application. • Some macros are also stored in the Macros in ABAP Programs table (TRMAC) Example of Macros are 1. RP_PROVIDE_FROM_LAST which is available in the include DBPNPMAC 2. RP-PROVIDE-FROM-FRST which is available in table TRMAC
  • 25. Macros in HR • The RP_PROVIDE_FROM_LAST macro retrieves the last valid data record in the data selection period. • The parameters for RP_PROVIDE_FROM_LAST are: infotype, subtype, start date, and end date. If you do not want to specify a particular subtype, enter SPACE. • You can process not only the last valid data record in the data selection period, but also the first valid data record using the RP_PROVIDE_FROM_FRST macro. • The macro return code PNP-SW-FOUND has the value 1 if a suitable entry exists in the infotype table for the specified period. If no entry is found, the value is 0.
  • 26. Clusters in HR D a ta b a s e T a b le s P C L n PCLn A1 A3 A2  S A P A G 1999
  • 27. Clusters in HR • Database tables of type PCLn are divided into subareas known as data clusters. • Data clusters can be identified by their two- character IDs. • The respective subareas within Human Resources work on their own cluster. • A separate data key is defined for each subarea. • The PCLn database tables are a type of import/export database table.
  • 29. Clusters in HR Cluster table PCL1: PCL1 contains the following data areas B1 Time events/PDC G1 Group incentive wages L1 Individual incentive wages PC Personal calendar TE Trip costs/accounting results TC Trip costs/credit card data TX Infotype texts Z1 Interface PDC -> cost accounting/materials management This table is maily used for retrieving data from the following data areas: 1. B1 2. TX
  • 30. Clusters in HR Cluster table PCL2: PCL2 contains the following data areas: B2 Time accounting results CUCluster directory PS Generated schema PT Texts for generated schemas RX Payroll results/international Xy Payroll results/country-specific, whereby xy represents the relation ID. This is from RELID field of table T500L for the country. ZL Personal work schedule
  • 31. Clusters in HR DB Table Adm inistration/ PCLn PCLn IM PORT TABLES: PCLn. A1 A2 EXPORT 1. The PCLn import/export database tables are managed by the ABAP commands IMPORT and EXPORT. 2. We can use these commands to store any data object - such as fields, structures or internal tables - on the database, or to read them from the database. 3. Data is read and written using a unique key.
  • 32. Clusters in HR T a b le S tru c tu re / P C L n F ie ld n a m e K E Y L e n g th Text C L IE N T X 3 C lie n t R E L ID X 2 R e la tio n ID SRTFD X 40 W o rk a re a k e y SRTF2 X 10 S o rt fie ld fo r d u p lic a te k e y E x a m p le o f in te rn a tio n a l p a yro ll re s u lts : R E L ID S R T F D RX 00001911 00001 RX 00001911 00002 RX 00001911 00003 ...
  • 33. Clusters in HR The structure of PCLn database tables provides a basic structure for individual subareas. The name of each subarea must include a two-character cluster name or relation ID. A key structure must also be defined; 40 bytes are available in field SRTFD for this purpose. In the international payroll results, for example, the field RELID contains the cluster name RX and the field SRTFD contains the eight-digit personnel number as well as a five-digit sequence number for each individual payroll result for a payroll period. To enable the import of a record from a PCLn database table, the RELID field must contain the cluster identifier and the SRTFD field must contain the cluster key. The fields CLIENT and SRTF2 are filled by the system.
  • 34. Clusters in HR U tilitie s /D e le tin g a C lu s te r U T IL IT Y PCLn PCLn Utility transaction PU00 enables us to delete payroll results in xy clusters for specific personnel numbers. 1. Utility programs RPUPnD00 and RPUPnD10 - where n stands for database table PCL1 or PCL2 - enable us to delete one or more records from any cluster. 2. We can delete payroll results using the program RPUDEL20. 3. Caution: The deletion utilities should only be used for testing. Archiving takes place to reduce the amount of data in the database.
  • 35. Enhancement and Creation of Infotypes Enhancement of Infotypes
  • 36. Enhancement and Creation of Infotypes Infotype needs to be enhanced sometimes to add our own fields to the existing infotype fields. Before Enhancing any infotype, CI_ Include must be available. Enhancement of PA Infotypes In PA we can enhance the Single screen as well as list screen. Enhancing the single screen • Procedure 1. Start the transaction Enhance Infotype, (transaction code PM01). The Create Infotype screen appears. 2. Choose Enhance Infotype Tab
  • 37. Enhancement and Creation of Infotypes 3. In the Infotype Number field, enter the four-digit number of the infotype you want to enhance When you enter the infotype number, remember to enter any leading zeros. Note: It is not possible to enhance a single screen for the Actions infotype (0000), or the Time Management infotypes.
  • 38. Enhancement and Creation of Infotypes 4. Choose the button ‘Create All’ The following screen appears: 5. Press Enter. Then create the fields required on the screen. In this case Train Route
  • 39. Enhancement and Creation of Infotypes 6. The following screen appears. 7. Now if we go to Infotype 0006 of any employee we can see the field added.
  • 40. Enhancement and Creation of Infotypes Note: While enhancing the single screen of an infotype a module pool program ZPnnnn00 will be created and that can be modified by ourselves. We have to modify the screen number 0200 for adjusting the screen elements and appearance of the enhanced screen. The module pool program of a PA Infotype will be MPnnnn00. For every infotype there is a dialog module associated with it. It will be RP_nnnn for PA infotypes. The single screen of an Infotype will be 2000 and the list screen will be 3000. Here nnnn denotes 4-digit infotype number.
  • 41. Enhancement and Creation of Infotypes Enhancing the single screen • Procedure 1. Start the transaction Enhance Infotype, (transaction code PM01). The Create Infotype screen appears. 2. Choose Enhance List screen Tab 3. In the Infotype Number field, enter the four-digit number of the infotype you want to enhance the list screen.
  • 42. Enhancement and Creation of Infotypes 4. Choose the button ‘Create All’ The following screen appears: 5. Press Enter. Then create the fields required on the screen. In this example Train Route
  • 43. Enhancement and Creation of Infotypes 6. The following screen appears. 6. Now if we go to Infotype 0006 overview screen of any employee we can see the field added .
  • 44. Enhancement and Creation of Infotypes Note: While enhancing the list screen of an infotype a module pool program ZPnnnn00 will be created (if it is not available already) with an include ZPnnnn40. We cannot modify the screen appearance of the added field since it will be directly added to the list screen 3000 of the module pool MPnnnn00.
  • 45. Enhancement and Creation of Infotypes Enhancement of Personnel Infotypes Use the transaction PPCI to enhance Personnel Infotypes. Enhancing the single screen • Procedure 1. Start the transaction Enhance Infotype, (transaction code PPCI). The following screen appears. Enter the 4 digit infotype number. Click on extend button.
  • 46. Enhancement and Creation of Infotypes 2. The following screen appears. Click on ‘Create All’ Button. 3. Enter the fields and activate the include CI_Pnnnn and the fields entered will appear in the infotype.
  • 47. Enhancement and Creation of Infotypes Enhancing the list screen • Procedure 1. Start the transaction Enhance Infotype, (transaction code PPCI). The following screen appears. Enter the 4 digit infotype number. Select the menu Infotype Enhance list screen.
  • 48. Enhancement and Creation of Infotypes 2. The following screen appears. Click on ‘Create All’ Button. 3. Enter the fields and activate the structure ZPLISnnnn and these fields entered will appear in the infotype's overview screen.
  • 49. Enhancement and Creation of Infotypes Creation of Infotypes
  • 50. Enhancement and Creation of Infotypes Infotype needs to be created when you cannot store the required information in any of the standard infotypes. Creation of PA Infotypes 1. Start the transaction Enhance Infotype, (transaction code PM01). The Create Infotype screen appears. 2. Enter the four digit Infotype number ( starting from 9000-9999). 3. Then click on the ‘Create All’ button.
  • 51. Enhancement and Creation of Infotypes 3. The following popup appears. Press Enter. 4. The new screen for entering the required infotype field appears. Activate the structure PSnnnn and the required infotype details are created.
  • 52. Enhancement and Creation of Infotypes 5. Then our major duty is to maintain the infotype characteristics. For that from the PM01 transaction select the button ‘Infotype Characteristics’. Copy the entry from existing infotype to the newly created one and change the characteristics of our infotype accordingly. The characteristics can also be maintained through IMG or by using the customizing view V_T582A. New Infotype
  • 53. Enhancement and Creation of Infotypes Details of customization
  • 54. Enhancement and Creation of Infotypes If you goto PA30 transaction for Infotype 9nnn you can find the infotype fields entered.
  • 55. Enhancement and Creation of Infotypes Creation of Personnel Infotypes Field Infotypes For Field infotypes we have to create the structure HRI9nnn though the transaction SE11 before we are creating the infotype. Table Infotypes For Table infotypes we have to create the structure HRI9nnn and PT9nnn though the transaction SE11 before we are creating the infotype. Other than these the creation of both types of Infotype remain the same.
  • 56. Enhancement and Creation of Infotypes Let us see the procedure of creating a table Infotype, 9700. Goto SE11 transaction and create the structures HRI9700 and PT9700
  • 57. Enhancement and Creation of Infotypes 1. Start the transaction Enhance Infotype, (transaction code PPCI). The Create Infotype screen appears. 2. Enter the four digit Infotype number ( starting from 9000-9999. In our example it is 9700). Also enter the description of the Infotype. 3. Then click on the ‘Create’ button. The following screen appears.
  • 58. Enhancement and Creation of Infotypes 4. Select the radio button ‘Table infotype and click on the ‘Create’ Button. The following popup appears. Select ‘Yes’. 5. Finally an information message appears as follows:
  • 59. Enhancement and Creation of Infotypes 6. Then our major duty is to maintain the infotype characteristics. Do it through IMG or by using the customizing table T777I. What we have to add is the Time constraint and Infotypes per object type.
  • 60. Enhancement and Creation of Infotypes I have added this to Object type O and with time constraint 2. Similarly I can add the infotypes per object type as follows
  • 61. Enhancement and Creation of Infotypes Finally If I goto PP01 transaction for the maintenance of Organization Unit, I can see the infotype.
  • 62. Enhancement and Creation of Infotypes
  • 63. Reporting in HR Special ABAP Statements for HR 1. INFOTYPES 2. PROVIDE 3. ENDPROVIDE 1. INFOTYPES The syntax for this statement is: INFOTYPES nnnn. - nnnn between 0000 and 0999: HR master data info types - nnnn between 1000 and 1999: HR planning data info types - nnnn between 2000 and 2999: HR time data info types - nnnn between 3000 and 8999: Not yet used - nnnn between 9000 and 9999: Customer-specific info types There are some variants for INFOTYPES statement 1. … NAME c 2. … OCCURS n 3. … MODE N 4. … VALID FROM comp1 TO comp2
  • 64. Reporting in HR The effect of ‘INFOTYPES’ statement is that it will create an internal table Pnnnn as follows: DATA BEGIN OF Pnnnn OCCURS 10. INCLUDE STRUCTURE Pnnnn. DATA END OF Pnnnn VALID BETWEEN BEGDA AND ENDDA. (eg) INFOTYPES 0001. Variant 1: … NAME c , c 20 character field This will create an internal table with the name c DATA BEGIN OF c OCCURS 10. INCLUDE STRUCTURE Pnnnn. DATA END OF c VALID BETWEEN BEGDA AND ENDDA. (eg) INFOTYPES 0006 NAME ADDRESS.
  • 65. Reporting in HR Variant 2: … OCCURS n, n numeric value This will create an internal table as follows: DATA BEGIN OF Pnnnn OCCURS n. INCLUDE STRUCTURE Pnnnn. DATA END OF Pnnnn VALID BETWEEN BEGDA AND ENDDA. (eg) INFOTYPES 0005 OCCURS 2. Variant 3: …MODE N Applies only to the HR logical databases PNP, PNPCE and PCH. The info type tables are not filled by GET PERNR (logical database PNP) or GET OBJEC (logical database PCH). The effect of the INFOTYPES statement is then the same as the data declaration of an internal table (as described above). Generally used for Time Infotypes. (eg) INFOTYPES 2001 MODE N.
  • 66. Reporting in HR Variant 4: … VALID FROM comp1 TO comp2 This should be used only with LDBs PNP and PNPCE GET PERNR retrieves only those info type records which are valid within the time range ( comp1 and comp2) specified. comp1 and comp2 are dates with the format YYYYMMDD. (eg) INFOTYPES 0007 VALID FROM 19910101 TO 19911231.
  • 67. Reporting in HR 2. PROVIDE The syntax for this statement is: PROVIDE f1 f2 … FROM itab1 g1 g2 … FROM itab2 … BETWEEN f AND g. - We can use * instead of individual field names - itab1, itab2 etc will be of structure Pnnnn - f and g are from and to dates. This statement will retrieve the contents of the specified fields from the internal tables ( itab1, itab2, ...) and places them in the table header lines within the required range. Also executes the processing block enclosed by the PROVIDE and ENDPROVIDE statements for each range.
  • 68. Reporting in HR 3. ENDPROVIDE The syntax for this statement is: ENDPROVIDE. - This statement will close the loop introduced by PROVIDE.
  • 69. Reporting in HR Data Retrieval 1. Create data structures for infotypes INFOTYPES: 0001, 0002, 0007. "Organizational Assignment" "Personal Data" "Planned Working Time" 2. Fill the data structures with the infotype records GET PERNR.  SAP AG 1999
  • 70. Reporting in HR • Structure PERNR contains standard selections for HR master data reporting. They consist of the personnel number, the fields of infotypes 0000 and 0001, and a number of additional fields. • When the GET event occurs, the data structures of declared infotypes are filled with all of the records that exist for a personnel number. The PERNR structure is fílled with the data from the above infotypes. You can access the data in this structure for processing.
  • 71. Reporting in HR Processing M aster Data TABLES: PERNR. INFOTYPES: 0001, "Actions 0002, "Personal Data 0006, "Addresses .... GET PERNR. PROVIDE * FROM P0002 BETWEEN PN-BEGDA AND PN-ENDDA. WRITE... ENDPROVIDE.  SAP AG 1999
  • 72. Reporting in HR • Filled infotype structures are stored in the main memory for the GET PERNR event keyword. • The infotype records are imported to internal tables Pnnnn (for example, P0006 for infotype 0006). These tables are then processed in a PROVIDE- ENDPROVIDE loop. • The infotype records whose validity period overlaps the period selected in the selection screen (PN-BEGDA and PN-ENDDA) by at least one day are placed one after the other in the header of the respective infotype table Pnnnn. • For example, if you choose the current year in the selection screen, PN- BEGDA contains the first day of the year and PN-ENDDA contains the last day of the year. If you do not enter any data for the period in the selection screen, PN-BEGDA contains the low date (01/01/1800) amd PN- ENDDA contains the high date (31/12/9999). • Note: If you have entered period date in the selection screen, the contents of fields Pnnnn-BEGDA and Pnnnn-ENDDA are also reset in the header of the infotype table Pnnnn. For example, if the date in Pnnnn- ENDDA is after the date in PN-ENDDA, Pnnnn-ENDDA is given the value from PN-ENDDA.
  • 73. Reporting in HR Loop Nesting GET PERNR. PROVIDE * FROM P0002 BETWEEN PN-BEGDA AND PN-ENDDA. Infotype WRITE... loop ENDPROVIDE. or: LOOP AT P0002 WHERE ENDDA GE PN-BEGDA AND BEGDA LE PN-ENDDA. Infotype Employee WRITE... loop loop ENDLOOP. PROVIDE * FROM P0006 BETWEEN PN-BEGDA AND PN-ENDDA Infotype WHERE P0006-SUBTY = '1'. loop WRITE... ENDPROVIDE. END-OF-SELECTION.  SAP AG 1999
  • 74. Reporting in HR • HR data is processed in two nested loops: • A GET PERNR loop for all of the personnel numbers selected. It is concluded implicitly by the next event, for example, END-OF-SELECTION. • Subordinate loops per infotype, for the processing of all infotype records for the selected personnel number. • With this form of processing, you should note that the data for the Personal Data (0002) and Address (0006) infotypes is listed sequentially and is not linked. • You can also process the infotype tables with a LOOP- ENDLOOP.
  • 75. Reporting in HR P e r io d -B a s e d D a ta (1 ) J A N U A R Y - A P R IL M AY - AUGUST Ms Y SEPTEM BER - DECEM BER  S A P A G 1999 Infotype data is period-based, in other words, it is only valid for specific periods. For this reason, each record has a start date and an end date. This example shows the jobs that an employee has performed over the course of a year. The decision on how to retrieve data is made for each individual infotype.
  • 76. Reporting in HR REPORTS IN PERSONNEL ADMINISTRATION
  • 77. Reporting in HR Some important fields 1. PERNR Personnel Number 2. WERKS Personnel Area 3. BTRTL Personnel Subarea 4. PERSG Employee Group 5. PERSK Employee Subgroup 6. ABKRS Payroll Area 7. LGART Wage Type 8. BETRG Amount 9. ANZHL Number 10. MOLGA Country code 11. BEGDA Start Date 12. ENDDA End Date 13. MOABW Personnel subarea grouping for absence and attendance types
  • 78. Reporting in HR Report which is based on reading data from infotypes and using LDBs REPORT zpsol010. *-- Declaration TABLES: pernr. INFOTYPES: 0002. "Personal Data SELECT-OPTIONS: language FOR p0002-sprsl. *-- Selection screen INITIALIZATION. pnptimed = 'D'.
  • 79. Reporting in HR *-- Processing GET pernr. PROVIDE * FROM p0002 BETWEEN pn-begda AND pn-endda. CHECK language. WRITE: / p0002-pernr, sy-vline, pernr-ename, sy-vline, p0002-sprsl, sy-vline, p0002-gbdat. ENDPROVIDE.
  • 80. Reporting in HR Example for understanding the repetitive structure Say, for an employee you want to know that for what all wage type an employee is eligible for the latest period you mentioned on the selection screen. REPORT ZRP_REPETITIVE_STR NO STANDARD PAGE HEADING. TABLES pernr. INFOTYPES 0008. *** you have to declare a structure same as repetitive structure in the ** 0008 infotype DATA: BEGIN OF s_wagetypes, wagetype TYPE p0008-lga01, amount TYPE p0008-bet01, hours TYPE p0008-anz01, unit TYPE p0008-ein01, ind TYPE p0008-opk01, END OF s_wagetypes. GET pernr. DO 20 TIMES VARYING s_wagetypes FROM p0008-lga01 NEXT p0008-lga02. IF s_wagetypes-wagetype IS INITIAL. EXIT. ELSE. WRITE: / s_wagetypes-wagetype, s_wagetypes-amount. ENDIF. ENDDO.
  • 81. Reporting in HR Importance of Dates and Periods • Here is a simple ABAP example of reading DATE types stored in infotype 0041. • There can be a maximum of 12 dates stored in this infotype. Here is an example of an infotype 0041 record:
  • 82. Reporting in HR The date types are stored in PA0041-DAR01, PA0041-DAR02, etc. In the example above, PA0041-DAR01 is “01”, PA0041-DAR02 is “09”. The dates themselves are stored in PA0041-DAT01, PA0041- DAT02, etc To read through this in ABAP, the easiest way is to use the DO VARYING statement. Here is a simple demonstration ABAP: Note: to print the text of the date type, e.g. “Leave year entry” select from table T548T.
  • 83. Reporting in HR REPORT ZDATES1 . TABLES: PERNR. DATA: BEGIN OF MYDATES, DAR LIKE P0041-DAR01, DAT LIKE P0041-DAT01, END OF MYDATES. INFOTYPES 0041. GET PERNR. WRITE: PERNR-PERNR, PERNR-ENAME. "show employee number and name RP-PROVIDE-FROM-LAST P0041 SPACE PN-BEGDA PN-ENDDA. IF PNP-SW-FOUND = 1. *** Processing of repetitive structures ************* DO 12 TIMES VARYING mydates FROM p0041-dar01 NEXT p0041-dar02. IF mydates-dar NE space. WRITE: /,MYDATES-DAR, MYDATES-DAT. ENDIF. ENDDO. ENDIF.
  • 84. Reporting in HR M acro M o d u les T ABLES: PERNR . I NFOTYP ES: 0 001, "Or ganiza tional Assig nment 0 002, "Per sonal Data 0 006, "Ad dresse s . ... G ET PER NR. R P_PROV IDE_FR OM_LA ST P00 01 SPA CE PN- BEGDA PN-EN DDA. W RITE.. . * * * In cl ud e pr og ra m DB PN PM AC . DE FI NE R P_ PR OV ID E_ FR OM _L AS T. PN P- SW -F O U ND = ' 0' . . . . EN D- OF -D EF IN IT IO N.  S A P A G 1999
  • 85. Reporting in HR R e ad in g th e G ro u p T a b le U sin g th e P e rso n n e l A rea/S u b a re a F ie ld s TABLES: PERNR, T001P. P e rs o n n e l Are a /S u b a re a T a b le INFOTYPES: 0001, P e rs Are a S u b a re a G ro u p in g s . . . .... ... CABB 00 0 1 01 01 ... GET PERNR. RP_PROVIDE_FROM_LAST P0001 SPACE PN-BEGDA PN-ENDDA. RP-READ-T001P P0001-WERKS P0001-BTRTL SPACE.  S A P A G 1 99 9
  • 86. Reporting in HR • It is often necessary to read the groupings stored in the Personnel Area/Subarea table because they are required as keys for other tables. This must take place individually for each personnel number to be processed. • Each employee's assignment to a personnel area and subarea is stored in infotype 0001. • The parameters of the macro are: • Personnel areas • Personnel subareas • Reaction, if no entry is found: • X = Termination of report with error message ‘No entry found in table ...’ • SPACE = SY-SUBRC is set to 4. • Alternatively, if you only want to determine the country indicator, you can use the function module HR_COUNTRY_GROUPING_GET.
  • 87. Reporting in HR R e a d in g In fo t y p e s W ith o u t L o g ic a l D B (1 ) P Annnn I N FOTYPES: <nnnn>. . . . C A LL FUNCTION ' H R_READ_INFOTYPE'...  SA P AG 1999 You can also read infotype records for a particular personnel number without using the logical database. To do this, use the function module HR_READ_INFOTYPE. However, you must ensure that the internal table for the required infotype is declared with the INFOTYPE statement.
  • 88. Reporting in HR Reading Infotypes Without Logical DB (2) INFOTYPES: 0002. DATA: return LIKE SY-SUBRC. CALL FUNCTION 'HR_READ_INFOTYPE' EXPORTING . . . PERNR = <person> INFTY = '0002' BEGDA = <begdat> ENDDA = <enddat> IMPORTING SUBRC = return TABLES INFTY_TAB = P0002 EXCEPTIONS INFTY_NOT_FOUND = 1 OTHERS = 2.  SAP AG 1999
  • 89. Reporting in HR • The function module reads the HR infotype records for a person (employee or applicant) in accordance with the specified selection criteria. Values are returned in an internal table, the structure of which corresponds to the appropriate infotype table. In the calling program, such tables can be declared with the INFOTYPES statement, for example. An infotype record is selected if its validity period overlaps with the specified period. • The function module performs an authorization check. • The following specifications are possible for the return code: 0: The return table contains all required records 4: The return table contains all records, however, it is incomplete due to missing authorization 8: The return table is empty because no records were found with the specified criteria 12: The return table is empty due to missing authorization • Note: You should not use this function module in reports that use the logical database PNP. If you want to read an infotype separately in one of these reports, you can call the subroutine READ-INFOTYPE directly in the database program SAPDBPNP (PERFORM READ- INFOTYPE(SAPDBPNP)). . .). If this is the case, you declare the infotypes in the statement INFOTYPES with supplement MODE N.
  • 90. Reporting in HR Determining the Entry Date INFOTYPES: 0001. DATA: hire_date LIKE P0016-EINDT. CALL FUNCTION 'RP_GET_HIRE_DATE' EXPORTING PERSNR = P0001-PERNR CHECK_INFOTYPES = '0000' * DATUMSART = '01' * STATUS2 = '3' * P0016_OPTIONEN = ' ' IMPORTING HIREDATE = hire_date EXCEPTIONS OTHERS = 1.  SAP AG 1999
  • 91. Reporting in HR • With this function module, you can determine the initial start date of an employee. You can take the following infotypes into account when you determine this date: - P0000 Actions - P0001 Organizational Assignment - P0016 Contract Elements - P0041 Date Specifications • The transfer parameter CHECK_INFOTYPES is used to determine which of these infotypes are taken into account. The employment status (parameter STATUS2) can also be specified for infotype P0000. In infotype P0016, only the Entry data field (P0016-EINDT) is taken into account. For infotype P0041, the corresponding date type can be given in the transfer parameter DATUMSART. The date type '01' is usually used for the technical entry date. • Most function modules in HR have the letters 'HR' or 'RP' in the first two characters of their name. To find additional modules, use the search function in the Function Builder.
  • 92. Reporting in HR Updating Infotype Records (1) DATA: return_struc TYPE BAPIRETURN1, . . . CALL FUNCTION 'BAPI_EMPLOYEE_ENQUEUE' EXPORTING NUMBER = PERNR-PERNR IMPORTING RETURN = return_struc. IF NOT return_struc IS INITIAL. WRITE: / return_struc-TYPE,... ENDIF. . . . * Update Infotype Records . . . CALL FUNCTION 'BAPI_EMPLOYEE_DEQUEUE' EXPORTING NUMBER = PERNR-PERNR IMPORTING RETURN = return_struc.  SAP AG 1999
  • 93. Reporting in HR • Before you change employee data, you must lock the personnel number. You can do this with the function module BAPI_EMPLOYEE_ENQUEUE. • Messages are returned in the parameter RETURN. If an error occurs, this structure contains the following information:- Message type (field TYPE)- Message text (field MESSAGE).If the step is successful, the structure is blank. • If an employee's data has been locked, only the user who has locked the data can access the data records linked to the employee. For other users, access is denied. For this reason, you must remove the lock after the data has been changed. You can do this with the function module BAPI_EMPLOYEE_DEQUEUE.
  • 94. Reporting in HR Updating Infotype Records (2) DATA: return_struc TYPE bapireturn1, record_key TYPE bapipakey. . . . GET PERNR. LOOP AT P0002 WHERE. . . CALL FUNCTION 'HR_INFOTYPE_OPERATION' EXPORTING INFTY = '0002' NUMBER = P0002-PERNR LOCKINDICATOR = P0002-SPRPS VALIDITYEND = P0002-ENDDA VALIDITYBEGIN = P0002-BEGDA RECORDNUMBER = P0002-SEQNR RECORD = P0002 OPERATION = 'MOD' DIALOG_MODE = '1' IMPORTING RETURN = return-struc KEY = record_key. ENDLOOP.  SAP A G 1999
  • 95. Reporting in HR • With this function module, you can maintain the employee and applicant master data. You can specify one data record. All validations that would normally take place if the infotypes were maintained online with the individual maintenance screens are also carried out here. The module returns the same error messages as in the online operation. This means the error messages for the individual maintenance screens are displayed rather than interpreted. The update is carried out by a 'Call dialog' to the module pool for the infotype. This means that some restrictions apply to the infotypes processed in that way (see documentation for module). • The following values are amongst those available for the parameter OPERATION: MOD (change), COPY (copy), DEL (delete), INS (insert), LIS9 (delimit). • With the parameter DIALOG_MODE, you specify whether the action is generally run in the background or whether it only runs in the background until an error occurs, or whether the changes are generally carried out in the dialog mode. Possible values:'0' The changes are generally processed in the background. If an error occurs (with an E or A message), the complete step is terminated and the module returns the corresponding error message in the structure 'RETURN'. '1' The changes are generally processed in the background. If an error occurs, the system switches to dialog mode so that the user can correct the entries. '2' The changes are processed in the dialog mode.
  • 96. Reporting in HR U p d atin g In fo typ e R eco rd s (3 ) PARAMETERS: natio_o LIKE P0002-NATIO DEFAULT 'DE', natio_n LIKE P0002-NATIO DEFAULT 'D'. * Update infotype records UPDATE PA0002 SET NATIO = natio_n WHERE PERNR = P0002-PERNR AND NATIO = natio_o. IF SY-SUBRC = 0. WRITE: 'Modified records', SY-DBCNT. ENDIF.  S A P A G 1999
  • 97. Reporting in HR Indirect Valuation: Some times entries in Infotype 0008, 0014, 0015 etc are stored for indirect valuation (ie the wagetype has to be valuated indirectly). The entries will not be stored in the infotype tables. We have to use any of the function modules for indirect valuation to read the data. (Eg) HR_INDVAL_READ_INFOTYPE
  • 98. Reporting in HR Join and Projections Joins: • Any number of infotypes can be linked by a JOIN. • Note that changing data in any one of the infotypes linked by a join causes a split in the selection period. • Joins are only possible for infotypes with time constraint 1 or 2. • If infotypes linked by a JOIN have subtypes, processing must be restricted to one subtype using a WHERE condition, in which a subtype is queried.
  • 99. Reporting in HR J o in / S u b t y p e s TABLES: PERNR. INFOTYPES: 0001, "Organizational Assignment 0002, "Personal Data 0006, "Addresses .... GET PERNR. PROVIDE * FROM P0002 * FROM P0006 BETWEEN PN-BEGDA AND PN-ENDDA WHERE P0006-SUBTY = '1'. IF P0006_VALID = 'X'. WRITE... ENDIF. ENDPROVIDE.  SAP A G 1999 Using variable Pnnnn_VALID, the system recognizes that one partial interval only contains incomplete data. When the report is run, this variable is created for each Pnnnn infotype included in a join. If a partial interval for infotype Pnnnn contains data, its Pnnnn_VALID variable is filled with X.
  • 100. Reporting in HR Projections: • Selecting one or more infotype fields for processing is called PROJECTION. • Using projection for specific fields enables you to specify that only the contents of these fields and time-based changes to the contents, are relevant to an evaluation. • Like joins, projections are logical data views concentrated on one or more fields within an infotype. • Projection is also an operation performed on the time axis. New validity periods are created when the contents of one of the projection fields change. The values stored in fields that are not included in the projection are in an undefined condition, which means they are no longer relevant to output. • If the contents of a field included in the projection remain unchanged in several data records, the validity periods of these data records are combined. • The process of combining data records during projection is called contraction. • JOIN and PROJECTION can be combined in a PROVIDE statement.
  • 101. Reporting in HR Jo in an d P ro jectio n / C o d in g TABLES: PERNR. INFOTYPES: 0001, "Organizational Assignment 0002, "Personal Data .... GET PERNR. PROVIDE STELL ENAME FROM P0001 GBDAT FROM P0002 BETWEEN PN-BEGDA AND PN-ENDDA. WRITE... ENDPROVIDE.  S A P A G 1999
  • 102. Reporting in HR Calling R eports U sing D ynam ic Actions Table of D ynam ic Actions IType STy. Field FC No S Variable function part 0008___ SPRPS 06 0 _ *----------- Lock indicator set?----------------* 0008___ SPRPS 06 1 P P0008-SPRPS<>SPACE 0008___ SPRPS 06 2 F COMPUT E_DATE(ZPFORM01) 0008___ SPRPS 06 3 I INS,0019,10 0008___ SPRPS 06 4 W P0019-VTRMN=RP50D-DAT E1 REPORT zpform01. TABLES: RP50D, "Return fields for dyn. actions PRELP. "HR Master Data Buffer . . * Calculate date FORM compute_date. RP50D-DATE1 = PRELP-BEGDA -14. ENDFORM.  SA P AG 1999
  • 103. Reporting in HR • The 'Dynamic Actions' table (T588Z) is a control table that triggers steps taken when an infotype record is maintained. Such steps include maintaining another infotype record, performing a routine, or sending a mail. • OP stands for a user operation where 02 stands for Change, 04 for Insert, and 08 for Delete a record. The values can be added, for example, 06 means that an action is performed if the current record has been changed or inserted. • A stands for an action performed by the system, for example, P = Check a condition, F = Call a routine, I = Maintain an infotype record, W = Set default values when inserting a record. • You can call internal (defined in the module pool) and external routines. In an external routine, the name of the program is given in parentheses after the name of the routine. You cannot enter the USING parameter. The fields of the structure that is not used in the standard system (RP50D) are available to return the values from the routine. They can be filled by the routine and then used for default values (W statements). This structure can be enhanced with customer fields in a customer include. • In this example, the routine COMPUTE_DATE calculates a date in the subroutine pool ZPFORM01 and places it in field RP50D-DATE1. This date is calculated by subtracting 14 days from the start date of the locked record.
  • 104. Reporting in HR Calling Features from Reports TABLES: PME04. "Field string for feature ABKRS DATA: ret_value(2). "Return value for feature * Fill decision fields for feature with values. PME04-PERSK = P0001-PERSK, . . . * Call feature CALL FUNCTION 'HR_FEATURE_BACKFIELD' EXPORTING FEATURE = 'ABKRS' STRUC_CONTENT = PME04 IMPORTING BACK = ret_value EXCEPTIONS ERROR_OPERATION = 2 NO_BACKVALUE = 3 FEATURE_NOT_GENERATED = 4.  SAP AG 1999
  • 105. Reporting in HR • This function module reads the decision tree for a feature with the accompanying field contents and determines the return values for the field contents. • To identify which fields in the field string for the feature (PMEnn) are used for the decisions in the feature, view the structure and decision tree in feature maintenance (transaction PE03). • The field string PMEnn must be declared in the data declaration part of your program using a TABLES statement. Define a field to contain the return value of the feature. • In your program, enter values in the decision fields used in your feature. • Call the function module and enter the name of the feature to be used and the name of the field string. The return value for the feature is transferred to the main program with the BACK parameter. • Possible errors when processing the decision tree: a) An error occurred in the feature (ERROR_OPERATION) b) No return value is available for the current contents of the decision field (NO_BACKVALUE) c) The feature was no generated (FEATURE_NOT_GENERATED) • If the return value for a feature consists of a table, use the function module HR_FEATURE_BACKTABLE.
  • 106. Reporting in HR T im e D a ta a n d V a lid it y P e r io d D a t a s e le c t io n p e r io d 15 days Leave PROVIDE... WRITE... ENDPROVIDE. 15 days  S A P A G 1999 Note: Don’t use PROVIDE statement for Time Infotypes
  • 107. Reporting in HR Im p o r t in g T im e D a ta (1 ) D a ta s e le c tio n p e r io d INFOTYPES: 2001, "Absences 2002, "Attendances 2005, "Overtime 2010. "Employee Remuneration Info P A nnnn GET PERNR.  S A P A G 1999 A principle of the logical database is that all of the infotype records between the lowest and highest system date are read, irrespective of the data selection period, when the GET PERNR event occurs. If there is a large number of time records, this gives rise to problems with the main memory and bad performance times. In particular, if positive recording has been implemented, the quantity of infotype records soon overloads the main memory.
  • 108. Reporting in HR Im p o rt in g T im e D a ta (2 ) INFOTYPES: 0001, 0002, ... 2005 MODE N. GET PERNR. RP_PROVIDE_FROM_LAST P0001 SPACE PN-BEGDA PN-ENDDA. . . . . RP_READ_ALL_TIME_ITY PN-BEGDA PN-ENDDA. . . . . LOOP AT P2005. WRITE... ENDLOOP.  S A P A G 1999 To control the amount of time required to read time infotypes, MODE N is assigned to the infotypes in the declaration. This ensures that infotype tables are not filled when GET PERNR occurs. The time infotype tables are subsequently filled using the RP_READ_ALL_TIME_ITY macro, however, only in the specified period.
  • 109. Reporting in HR Importing Time Data to Internal Tables TYPES: BEGIN OF overtime, bukrs LIKE P0001-BUKRS, werks LIKE P0001-WERKS, btrtl LIKE P0001-BTRTL, stdaz LIKE P2005-STDAZ, END OF overtime. DATA: tab TYPE TABLE OF overtime WITH HEADER LINE. GET PERNR. RP_PROVIDE_FROM_LAST P0001 SPACE PN-BEGDA PN-ENDDA. MOVE-CORRESPONDING P0001 TO tab. RP_READ_ALL_TIME_ITY PN-BEGDA PN-ENDDA. LOOP AT P2005. MOVE-CORRESPONDING P2005 TO tab. COLLECT tab. (oder: APPEND tab.) ENDLOOP. bukrs werks btrtl stdaz Work area(header line) Data area  SAP AG 1999 • If you want to evaluate absence data according to organizational units, it is a good idea to use an internal table to group together the information from different database tables (PA0001 and PA2005).
  • 110. Reporting in HR P ro c e s s in g T im e D a ta w ith In te rn a l T a b le s END-OF-SELECTION. L O O P A T ta b . H ea d e r p ro c es sin g A T F I R ST . ... ENDAT. AT NEW bukrs. ... ENDAT. ta b - BUKRS W ERKS BTRTL AT NEW werks. ... 0 0 01 0 0 01 0 0 01 ENDAT. 0 0 01 0 0 01 0 0 02 Single record processing 0 0 02 0 0 02 0 0 03 A T E N D O F w e rk s . 0 0 02 0 0 02 0 0 04 ... ENDAT. A T E N D O F b u kr s . ... ENDAT. A T L A S T. ... F o o ter p ro ce ss in g ENDAT. ENDLOOP.  S A P A G 199 9
  • 111. Reporting in HR Example report using ABAP List viewer REPORT zpsol060. *-- declaration TYPE-POOLS: slis. TABLES: pernr, t548t. "Date Types INFOTYPES: 0001, "Org.Assignment 0041. "Date Specifications DATA: BEGIN OF dtype, "Workarea for IT0041 dar LIKE p0041-dar01, dat LIKE p0041-dat01, END OF dtype. TYPES: BEGIN OF data_struc, "Data table structure pernr LIKE pernr-pernr, ename LIKE p0001-ename, eindt LIKE p0016-eindt, dar LIKE p0041-dar01, dtext LIKE t548t-dtext, dat LIKE p0041-dat01, END OF data_struc. DATA: data_tab TYPE TABLE OF data_struc, data_tab_wa TYPE data_struc. DATA: alv_fieldcat TYPE slis_t_fieldcat_alv, alv_layout TYPE slis_layout_alv. DATA: filled_lines LIKE sy-index, stru_disvar TYPE disvariant.
  • 112. Reporting in HR SELECT-OPTIONS: datetype FOR p0041-dar01 DEFAULT '01 *-- Processing GET pernr. DESCRIBE TABLE p0041 LINES filled_lines. IF filled_lines GT 0. rp_provide_from_last p0001 space pn-begda pn-endda. IF pnp-sw-found EQ 0. REJECT. ELSE. DO 12 TIMES VARYING dtype FROM p0041-dar01 NEXT p0041-dar02. IF dtype-dar IS INITIAL. EXIT. ELSE. IF dtype-dar IN datetype. rp_provide_from_last p0001 space pn-begda pn-endda CLEAR data_tab_wa. MOVE-CORRESPONDING p0001 TO data_tab_wa. MOVE-CORRESPONDING dtype TO data_tab_wa. PERFORM read_hiredate. PERFORM re548t USING sy-langu dtype-dar. MOVE t548t-dtext TO data_tab_wa-dtext. APPEND data_tab_wa TO data_tab. ENDIF. ENDIF. ENDDO. ENDIF. ENDIF.
  • 113. Reporting in HR END-OF-SELECTION. PERFORM fieldcat_init USING alv_fieldcat. alv_layout-colwidth_optimize = 'X'. alv_layout-zebra = 'X'. CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' EXPORTING * I_INTERFACE_CHECK ='' * I_BUFFER_ACTIVE ='' i_callback_program = 'ZPSOL060' * I_STRUCTURE_NAME = * I_BACKGROUND_ID ='' I_GRID_TITLE = 'Date Specifications' * I_GRID_SETTINGS = is_layout = alv_layout it_fieldcat = alv_fieldcat * I_DEFAULT = 'X' I_SAVE = 'A' IS_VARIANT = stru_disvar * IT_EVENTS = * IT_EVENT_EXIT = * IS_PRINT = * IS_REPREP_ID = * I_SCREEN_START_COLUMN = 0 * I_SCREEN_START_LINE =0 * I_SCREEN_END_COLUMN =0 * I_SCREEN_END_LINE =0 * IT_ALV_GRAPHICS = * IT_ADD_FIELDCAT = * IT_HYPERLINK = * IMPORTING * E_EXIT_CAUSED_BY_CALLER = * ES_EXIT_CAUSED_BY_USER = TABLES t_outtab = data_tab EXCEPTIONS program_error =1 OTHERS = 2.
  • 114. Reporting in HR *-------------------------------------------------------------* * FORM READ_HIREDATE *-------------------------------------------------------------* * Retrieving hiredate from infotype 0000 *-------------------------------------------------------------* FORM read_hiredate. CALL FUNCTION 'RP_GET_HIRE_DATE' EXPORTING persnr = p0001-pernr check_infotypes = '0000' IMPORTING hiredate = data_tab_wa-eindt EXCEPTIONS OTHERS = 1. ENDFORM. *-------------------------------------------------------------* * FORM RE548T * Read date specification texts *-------------------------------------------------------------* * --> VALUE(LANGUAGE) * --> VALUE(DTYPE) *-------------------------------------------------------------* FORM re548t USING value(language) value(dtype). CHECK t548t-sprsl NE language OR t548t-datar NE dtype. SELECT SINGLE * FROM t548t WHERE sprsl EQ language AND datar EQ dtype. IF sy-subrc NE 0. CLEAR t548t. ENDIF. ENDFORM.
  • 115. Reporting in HR *-------------------------------------------------------------* * FORM FIELDCAT_INIT *-------------------------------------------------------------* FORM fieldcat_init USING p_fieldcat TYPE slis_t_fieldcat_alv. DATA: ls_fieldcat TYPE slis_fieldcat_alv. CLEAR ls_fieldcat. ls_fieldcat-fieldname = 'PERNR'. ls_fieldcat-ref_tabname = 'PERNR'. ls_fieldcat-key = 'X'. APPEND ls_fieldcat TO p_fieldcat. CLEAR ls_fieldcat. ls_fieldcat-fieldname = 'ENAME'. ls_fieldcat-ref_tabname = 'P0001'. APPEND ls_fieldcat TO p_fieldcat. CLEAR ls_fieldcat. ls_fieldcat-fieldname = 'EINDT'. ls_fieldcat-ref_tabname = 'P0016'. APPEND ls_fieldcat TO p_fieldcat. CLEAR ls_fieldcat. ls_fieldcat-fieldname = 'DAR'. ls_fieldcat-ref_tabname = 'PERNR'. ls_fieldcat-ref_tabname = 'P0041'. APPEND ls_fieldcat TO p_fieldcat. CLEAR ls_fieldcat. ls_fieldcat-fieldname = 'DTEXT'. ls_fieldcat-ref_tabname = 'T548T'. APPEND ls_fieldcat TO p_fieldcat. CLEAR ls_fieldcat. ls_fieldcat-fieldname = 'DAT'. ls_fieldcat-ref_fieldname = 'DAT01'. ls_fieldcat-ref_tabname = 'P0041'. APPEND ls_fieldcat TO p_fieldcat. ENDFORM.
  • 116. Reporting in HR REPORTS IN PERSONNEL PLANNING
  • 117. Reporting in HR D a ta M o d e l re p o rts to / is lin e s u p e rv is o r C o s t C e n te r A llo c a tio n of O rg a n iz a tio n a l b e lo n g s t o C o s t c e n te r C o s t C e n te r in c o rp o ra te s A llo c a tio n is b e lo n g s t o d e s c rib e d by d e s c rib e s in c o rp o ra te s is is Job d e s c rib e d d e s c rib e d P o s itio n W o rk c e n te r by by o c c u p ie s H o ld e r d e s c rib e s d e s c rib e s Task P e rs o n /u s e r  S A P A G 1999
  • 118. Reporting in HR • Organizational Management is based on the idea of representing each element within an organization as a separate object with its own characteristics. These objects are created and maintained separately. Relationships are used to link one to the other (see graphic). This gives rise to a network that is flexible enough to facilitate personnel planning, projections, and evaluations. • The cost center is an external object type because it is not maintained in Organizational Management. • Customizing enables you to enhance the existing data model by defining new object types, for example, and establishing new relationships between the various object types. Each standard object type consists of two letters, whereas the customer namespace is 00 to 99. • This data model (object types and relationships) also constitutes the basis of other applications within Personnel Planning, such as Training and Event Management (business event hierarchies) and Personnel Development (for example, qualification catalog).
  • 119. Reporting in HR Relationship Betw een Jobs and Positions The job "describes" the position. The position "is described by" the job. Relationship Adm inistrative assistant A/B 007 for m arketing departm ent Adm inistrative assistant for executive board Job: Adm inistrative assistant Adm inistrative assistant for research departm ent  SAP AG 1999
  • 120. Reporting in HR • "Job" is used as a general classification, such as secretary or head of department. • More than one employee can have the same job. For example, twenty employees can have the job of secretary. • A position is the assignment of an individual employee in your enterprise, for example, sales manager, secretary in the marketing department. You form the structure of your enterprise by creating positions and linking them to each other.
  • 121. Reporting in HR O b je c t/In fo ty p e S ta tu s O b je c t (In fo typ e 1 0 0 0 ) R e la tio n s h ip (In fo typ e 1 0 0 1 ) P la n n e d S u b m itte d R e je c te d A c tiv e A p p ro v e d  S A P A G 1999
  • 122. Reporting in HR A status is assigned to each object/infotype. • Active means that an object or infotype record can be used at this time. • Planned means that an object or infotype record has been proposed but is not yet active, which means it cannot be used. • Submitted means that an object or infotype record is currently being checked by a person or group of persons before it is approved or rejected. • Approved means that a submitted object/infotype record has been accepted. • Rejected means that a submitted object/infotype record has not been approved. • You can create objects with the status "planned" or "active".
  • 123. Reporting in HR Evaluation Paths Organizational unit O Org.unit Job C Position S Person P O Org.unit S O Org.unit Position Position S Position P Person Employee P Person  SAP AG 1999
  • 124. Reporting in HR • An evaluation path describes a set of relationships between objects in a hierarchical structure. Evaluation path O-S-P, for example, describes the set of relationships found between organizational units, positions, and persons. • Evaluation paths are used to select objects for structural evaluations. You choose an evaluation path, and the system evaluates the structure along the evaluation path. The report only evaluates objects that it finds in the specified evaluation path. • Every standard report has a defined standard evaluation path. They are predetermined in the system and must not be changed. The standard selection screen enables you to choose evaluation paths. You can also create new evaluation paths to meet the particular requirements of your enterprise. • Report RHWEGID0 displays all possible evaluation paths between the starting object type and the target object type.
  • 125. Reporting in HR Available In ternal In form ation TABLES: OBJEC, GDSTR. INFOTYPES: nnnn. Pnnnn Internal infotype table . . . GET OBJEC. O B JE C O bject inform ation LOOP AT Pnnnn . . . G D STR R oot of structure ENDLOOP. STR U C Structure inform ation  S A P A G 1999
  • 126. Reporting in HR Sequential Evaluations-Coding TABLES: OBJEC. INFOTYPES: 0002, "Personal Data 1003, "Addresses .... GET OBJEC. LOOP AT Pnnnn WHERE BEGDA LE PC-ENDDA AND ENDDA GE PC-BEGDA. WRITE... ENDLOOP.  SAP AG 1999
  • 127. Reporting in HR S t r u c t u r a l E v a lu a t io n s - C o d in g TABLES: OBJEC, GDSTR. INFOTYPES: 0002, "Personal Data 1003, "Addresses .... GET OBJEC. LOOP AT Pnnnn WHERE BEGDA LE PC-ENDDA AND ENDDA GE PC-BEGDA. WRITE... ENDLOOP.  S A P A G 1999 The only difference between a structural and sequential evaluation is the additional GDSTR entry in the TABLES statement.
  • 128. Reporting in HR E va lu a tin g T a b le In fo ty p e s INFOTYPES: 1002. "Description TABLES: OBJEC. DATA: ipt1002 LIKE PT1002 OCCURS 0 WITH HEADER LINE. . . . GET OBJEC. WRITE: / OBJEC-OTYPE, OBJEC-OBJID. LOOP AT P1002. RH-GET-TBDAT P1002-INFTY P1002-TABNR ipt1002. LOOP AT ipt1002. WRITE: / ipt1002-TLINE. ENDLOOP. ENDLOOP.  S A P A G 1999
  • 129. Reporting in HR • RH-GET-TBDAT is a macro for logical database PCH. These macros are defined in include DBPCHCOM. With this macro, you can import the data for an infotype with a repetitive structure. See also Table Infotypes. • The parameters for macro RH-GET-TBDAT are: Parameter 1 : Infotype Parameter 2 : Reference field Parameter 3 : Table for structure PTnnnn • Macros for logical database PCH must not be confused with macros for logical database PNP. Please note that you cannot use macros for logical databases PCH and PNP at the same time.
  • 130. Reporting in HR R ea d in g In fo typ e s W ith F u n c tio n M o d u les IN F OT Y PE S : 1 00 1 . " Re l at i on s hi p s DA T A: ih r ob j ec t L I KE HR O BJ E CT OC C UR S 1 0 . . . . CA L L F UN C TI O N ' RH _ RE A D_ I NF T Y' EX P OR T IN G . . . I NF T Y = ' 1 00 1 ' B EG D A = < b eg d at > E ND D A = < e nd d at > TA B LE S I NN N N = P 1 00 1 O BJ E CT S = i h ro b je c t EX C EP T IO N S A L L_ I NF T Y_ W IT H _S U BT Y = 1 N O TH I NG _ FO U ND = 2 N O _O B JE C TS = 3 W R ON G _C O ND I TI O N = 4 O T HE R S = 5.  S A P A G 1999
  • 131. Reporting in HR • RH-GET-TBDAT is a macro for logical database PCH. These macros are defined in include DBPCHCOM. With this macro, you can import the data for an infotype with a repetitive structure. See also Table Infotypes. • The parameters for macro RH-GET-TBDAT are: Parameter 1 : Infotype Parameter 2 : Reference field Parameter 3 : Table for structure PTnnnn • Macros for logical database PCH must not be confused with macros for logical database PNP. Please note that you cannot use macros for logical databases PCH and PNP at the same time.
  • 132. Reporting in HR Example Report REPORT zhsol010. TABLES: objec, gdstr. INFOTYPES: 0002, 0006, 1003. DATA: stabs LIKE p1003-stabs, name LIKE p0001-ename. INITIALIZATION. pchotype = 'O'. pchwegid = 'O-S-P'.
  • 133. Reporting in HR GET objec. IF objec-otype = 'S'. CLEAR stabs. LOOP AT p1003 WHERE begda LE pc-endda AND endda GE pc-begda. IF p1003-stabs = 'X'. stabs = 'X'. WRITE : / objec-objid, objec-short, objec-stext. ENDIF. ENDLOOP. ENDIF. IF objec-otype = 'P' AND stabs = 'X'. PROVIDE vorna nachn FROM p0002 subty telnr FROM p0006 BETWEEN pc-begda and pc-endda WHERE p0006-subty = '1'. IF p0006_valid = 'X'. CONCATENATE p0002-vorna p0002-nachn INTO name SEPARATED BY SPACE. WRITE: / name, p0006-telnr. SKIP. ENDIF. ENDPROVIDE. ENDIF.
  • 134. Reporting in HR READING CLUSTER DATA
  • 135. Reporting in HR Export The syntax for exporting the data to cluster table is EXPORT var1…varn itab1 itab2…itabn TO DATABASE dbtab(ID) [FROM wa] ID key. Import The syntax for exporting the data to cluster table is IMPORT var1…varn itab1 itab2…itabn FROM DATABASE dbtab(ID) [TO wa ] ID key.
  • 136. Reporting in HR E x p o r tin g D a ta TABLES: PCLn. "Import/export table INCLUDE: RPCnxxy0. "Cluster definition * Fill cluster-KEY xy-KEY-FIELD = <VALUE>. . . . . * Fill data object * Export record EXPORT TABLE1 TO DATABASE PCLn(xy) ID xy-KEY. IF SY-SUBRC EQ 0. WRITE: / 'Update successful'. ENDIF.  S A P A G 1999 The cluster definition is included using the INCLUDE statement. The EXPORT command writes one or more data objects with xy-KEY to cluster xy. If the export is successful, the return code is 0.
  • 137. Reporting in HR E x p o rt U s in g B u ffe r * Buffer definition INCLUDE: RPPPXD00. DATA: BEGIN OF COMMON PART buffer. INCLUDE RPPPXD10. DATA: END OF COMMON PART buffer. M a in m e m o ry b u ffe r . . . * Data export to buffer RP-EXP-Cn-xy. RP-EXP-Cn-xy. . . . * Save PERFORM PREPARE_UPDATE USING 'V'. . . . PCLn * Buffer Administration Routines INCLUDE: RPPPXM00. xy  S A P A G 1999
  • 138. Reporting in HR • If data is exported using macros, the data records are not written directly to the database. Instead, they are written to a main memory buffer. The data is diverted by a USING parameter in the EXPORT statement, which accesses a buffer administration routine. • If data is exported successfully, the RP-IMP-xy- SUBRC = 0 return code is set. • At the end of the program, the buffered records must be saved on a PCLn database. • To save the data, the PREPARE_UPDATE routine is accessed with USING parameter V.
  • 139. Reporting in HR C L U S T E R - D e fin itio n in P r o g r a m R p c n x y z 0 * KEY-Definition DATA: BEGIN OF xy-key, FIELD1, FIELDn, END OF xy-key. * Definition of Data Objects DATA: BEGIN OF table1 OCCURS 10, COLUMN1, COLUMNn, END OF table1. DATA: BEGIN OF table2 OCCURS 10, . . .  S A P A G 1999
  • 140. Reporting in HR • The data definitions of a work area are stored in separate programs using a fixed naming convention. • They are defined as INCLUDE programs. Their names follow convention RPCnxyz0, where. • n = 1 or 2 for PCL1 or PCL2 • xy = Cluster, for example, RX • z = 0 for international clusters or country indicator from table T500L for country-specific clusters. • Example: The program RPC1TX00 contains the data definition of cluster TX. In this cluster, the database table PCL1 contains the texts stored for infotypes. • The key structure of the cluster is stored in a field string xy- KEY where the personnel number is the first element. • The data objects (field strings and tables) are named individually per cluster.
  • 141. Reporting in HR Im p o r t in g D a ta TABLES: PCLn. "Import/export table INCLUDE: RPCnxyz0. "Cluster definition * Fill Cluster-KEY xy-KEY-FIELD1 = <VALUE>, . . . * Import Record IMPORT table1 table2 FROM DATABASE PCLn(xy) ID xy-KEY. * Display Data object IF SY-SUBRC EQ 0. LOOP AT table1. WRITE. . . ENDLOOP. ENDIF.  S A P A G 1999 The IMPORT command reads data objects with the specified key values from the import/export database table. If a record is read successfully, the return code is 0. If a record is not read successfully, the return code is 4.
  • 142. Reporting in HR Importing/Exporting With Macros Macro H ic PAYM ACRO DEFINE RP-IMP-Cn-xy. ... IMPORT RP-IMP-Cn-xy. table1 ... table2 . . . . . . FROM DATABASE PCLn(xy) ID xy-KEY USING PCLn_EXP_IMP. END-OF-DEFINITION.  SAP AG 1999
  • 143. Reporting in HR • To ensure consistency when data is exported and imported, the IMPORT/EXPORT commands are defined as macros. • It is possible to import only a portion of the data objects in a cluster. • The naming conventions for the macros are RP-IMP-Cn-xy and RP-EXP-Cn-xy, where n is the file name and xy is the cluster name. • The macros for the import of payroll results are defined in include programs for the payroll driver with the name HicPAYMACRO (ic = ISO code, for example, HUSPAYMACRO for the USA) using the DEFINE keyword. These include programs are generated and must not be changed manually. • The macro for importing infotype texts to cluster TX is contained in the table Macros in ABAP Programs. • The macros use routines that carry out two tasks: 1. Data buffering 2. Cluster authorization check
  • 144. Reporting in HR Im p o r t in g /E x p o r t in g U s i n g a B u f f e r P ro g ra m E x p o rt UPDATE PCLn Im p o r t B u ffe r  S A P A G 1999
  • 145. Reporting in HR • To minimize the number of times that the database is accessed, import and export data is buffered in the main memory. • If a test run is performed, the database is not updated. However, the payroll results of the previous period form the basis of the calculation used to determine the results of the subsequent period. For this reason, a difference arises between the results of a live payroll run and the results of a test run if test runs are performed for several periods. • Using the buffer enables you to access the required results from the previous period.
  • 146. Reporting in HR Im p o rtin g U s in g a B u ffe r * Buffer definition INCLUDE: RPPPXD00. DATA: BEGIN OF COMMON PART BUFFER. INCLUDE RPPPXD10. DATA: END OF COMMON PART buffer. M a in m e m o ry b u ffe r * Fill cluster KEY . . . * Data import RP-IMP-Cn-xy. . . . * Buffer Administration Routines INCLUDE: RPPPXM00. PCLn xy  S A P A G 1999
  • 147. Reporting in HR • If data is imported using macros, the data records are not read directly from table PCLn. Instead, the buffer directory is checked to determine whether the main memory already contains a record with the same key. If this is not the case, the record is read from PCLn to the buffer, and retrieved from the buffer by the report. • If data is read using a buffer, the system checks the cluster authorization. The standard import programs follow the RPCLSTxy naming convention, where xy = cluster name.
  • 148. Reporting in HR Example program to read data from PCL1 Cluster This example reads long text data from Infotype 0024. REPORT ZRP_READ_PCL1_TX. TABLES: pernr. INFOTYPES 0024 NAME qualifications. INCLUDE rpc1tx00. START-OF-SELECTION. GET pernr. rp_provide_from_last qualifications space pn-begda pn-endda. tx-key-pernr = qualifications-pernr. tx-key-infty = qualifications-infty. tx-key-subty = qualifications-subty. tx-key-objps = qualifications-objps. tx-key-sprps = qualifications-sprps. tx-key-endda = qualifications-endda. tx-key-begda = qualifications-begda. tx-key-seqnr = qualifications-seqnr. rp-imp-c1-tx. LOOP AT ptext. WRITE ptext-line. ENDLOOP.
  • 149. Reporting in HR Example program to read data from PCL1 Cluster This example reads data from PCL1 for RELID B1. REPORT ZRP_READ_PCL1_B1. TABLES: pernr. INCLUDE rpc1b100. START-OF-SELECTION. GET pernr. b1-key-pernr = pernr-pernr. * rp-imp-c1-b1. IMPORT nt1 nt2 ift1 ift2 ert nct qt st itp1 itp7 itp50 pdppm FROM DATABASE pcl1(b1) ID b1-key.
  • 150. Reporting in HR Example program to read data from PCL2 Cluster This example reads data from PCL2 for RELID B2. REPORT ZRP_READ_PCL2_B2. TABLES: pernr. INCLUDE rpc2b200. START-OF-SELECTION. GET pernr. b2-key-pernr = pernr-pernr. b2-key-pabrj = pn-begda+0(4). b2-key-pabrp = pn-begda+4(2). b2-key-cltyp = '1'. *** ZL --> Time Wage Types (Table ZL) IMPORT zl FROM DATABASE pcl2(b2) ID b2-key. LOOP AT zl. *** Process the itab zl.... ENDLOOP.
  • 151. Reporting in HR Payroll International Payroll driver program: RPCALCX0
  • 152. Reporting in HR The international payroll driver program is RPCALCX0. We are having customized payroll driver programs for most of the countries viz: 1. RPCALCA0 for Austria 2. RPCALCC0 for Switzerland 3. RPCALCD0 for Germany 4. RPCALCE0 for Spain 5. RPCALCG0 for Great Britain 6. RPCALCU0 for USA 7. HINCALC0 for India 8. HBRCALC0 for Brazil etc.
  • 153. Reporting in HR Display Payroll results Program: RPCLSTRX
  • 156. Reporting in HR P a y r o ll R e s u lts REPORT H99_DISPLAY_PAYRESULT P a y r o ll r e s u lt K a th y C a lc J a n u a ry 1 9 x x W T01 S t a n d a r d s a la r y 5 0 0 0 UNI W T02 Bonus 300 UNI W T03 O v e r tim e 200 UNI /1 0 1 T o ta l g r o s s a m t 5 5 0 0 UNI . . . .  S A P A G 1999
  • 157. Reporting in HR • With this report, you can display the payroll results for any country. The indicator behind each name shows whether results exist in the selected period. Green: Results exist Red: No results exist Gray: No authorization for displaying personnel numbers • Payroll results are stored as structures and internal tables on the database. • Each payroll result has a status indicator: 1. A = Current result 2. P = Previous result 3. O = All other results
  • 158. Reporting in HR D a ta F lo w in P a y ro ll S c h e m a s & ru le s PAnnnn PCL2 RPC ALCn0 PCL2 xy xy H 9 9 _ D IS P L A Y _ P A Y R E S U L T R PCE D Tn0  S A P A G 1999
  • 159. Reporting in HR • The payroll driver, RPCALCn0, uses HR data (stored in the database tables PAnnnn) and the last payroll result (stored in the database table PCL2) to run the payroll for the specified period • The program (payroll driver) imports the processing logic in the form of a schema. The schema contains functions that call the subroutines contained in the payroll driver. In many cases, the function is enhanced by rules for specific control of the subroutines. • The payroll result generated by the payroll driver is stored in cluster xy of the database table PCL2. • Report H99_DISPLAY_PAYRESULT displays the payroll results for PCL2 and, from Release 4.6C, replaces reports RPCLSTxy and HxyCLSTR. The report is used in all country versions and the overview of payroll results is automatically displayed according to the particular country. • Report RPCEDTn0, for example, lists the formatted result as a payroll form (n = HR country indicator from table T500L).
  • 160. Reporting in HR R e a d in g th e C lu s te r D ir e c to ry *Table containing directory of payroll results DATA: BEGIN OF RGDIR OCCURS 100. INCLUDE STRUCTURE PC261. DATA: END OF RGDIR. DATA: COUNTRY LIKE T001P-MOLGA. ... CALL FUNCTION 'CU_READ_RGDIR' EXPORTING PERSNR = PERNR-PERNR IMPORTING MOLGA = country TABLES IN_RGDIR = RGDIR EXCEPTIONS NO_RECORD_FOUND = 1 OTHERS = 2.  S A P A G 1999
  • 161. Reporting in HR • Table RGDIR contains the directory (cluster directory) for all of an employee's payroll results and is contained in cluster CU. A directory entry with the payroll area, for- period, in-period, status indicator, and the five-digit sequence number is required, together with the personnel number, to construct the key for each payroll result for an employee. • The function module CU_READ_RGDIR reads table RGDIR from cluster CU. The personnel number whose payroll directory is to be read is transferred to the function module. • If the MOLGA parameter is active, the function module returns the HR country indicator.
  • 162. Reporting in HR D eterm in in g C u rren t P a yro ll R esu lt (1 ) DATA: number LIKE PC261-SEQNR. . . . GET PERNR. . . . CALL FUNCTION 'CU_READ_RGDIR' . . . CALL FUNCTION 'CD_READ_LAST' EXPORTING BEGIN_DATE = PN-BEGDA END_DATE = PN-ENDDA IMPORTING OUT_SEQNR = number TABLES RGDIR = RGDIR EXCEPTIONS NO_RECORD_FOUND = 1 OTHERS = 2.  S A P A G 1999
  • 163. Reporting in HR • The function module CD_READ_LAST determines the current payroll result for a for-period to be evaluated. To determine the correct start date and end date of the for-period, you specify the period by entering the payroll period in the selection screen. If you specify report class XXM00004 in the attributes of your report, the payroll period is entered and the start date (PN- BEGDA) and the end date (PN-ENDDA) are determined using the Payroll Periods table (T549Q). • You enter the start and end date of the for-period for the evaluation as well as table RGDIR. The function module then gives you the sequential number (OUT_SEQNR) for the current (A) result of the for-period. • You can also use the following function modules: CD_READ_PREVIOUS (reads the record that precedes the payroll record) CD_READ_PREVIOUS_ORIGINAL (reads the last original result that precedes the original payroll result)