sap hr abap

140
IBM Global Business Services HR ABAP Jan-2007 © 2007 IBM Corporation HR ABAP Technical Overview

Upload: ekkarad-yongsittiwat

Post on 25-Nov-2014

521 views

Category:

Documents


79 download

TRANSCRIPT

Page 1: SAP HR ABAP

IBM Global Business Services

HR ABAP Jan-2007 © 2007 IBM Corporation

HR ABAP Technical Overview

Page 2: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation2 Jan-2007HR ABAP

List of Topics

Logical DatabasesJoin & ProjectionReports / Repetitive StructuresClustersTime Data Infosets & Infoset Queries InfotypesLogical Database PCH

Page 3: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation3 Jan-2007HR ABAP

Logical Databases

Page 4: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation4 Jan-2007HR ABAP

What is a Logical Database ?

Logical databases are special ABAP programs that retrieve data and make it available to application programs. The most common use of logical databases is still to read data from database tables and linking them to executable ABAP programs while setting the program contents

Logical databases contain Open SQL statements that read data from the database. You do not therefore need to use SQL in your own programs

A logical database can read the lines of these tables one after the other into an executable program in a sequence which is normally defined by the hierarchical structure

Page 5: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation5 Jan-2007HR ABAP

Functions of the Logical Database PNP

Page 6: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation6 Jan-2007HR ABAP

Logical Databases provided by SAP 

HR Logical Databases In Human Resources (HR), the following logical databases can be used as a data source for HR InfoSets:

PNP / PNPCE PAP PCH By selecting a logical database, you determine the HR data that can be reported on

using an InfoSet. Logical Database PCH This logical database generally enables you to report on all HR infotypes. However,

you are advised not to use this logical database unless you want to report on Personnel Planning data.

Logical Database PNP Use logical database PNP to report on HR master data. It is possible to use logical

database PCH to access this data, but PNP meets such reporting requirements more quickly because it is best suited to the task of selecting persons.

Page 7: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation7 Jan-2007HR ABAP

Structure of Logical Database

StructureThe structure defines the data view of the logical database.

SelectionsThe selections define a selection screen, which forms the user interface of the executable programs that use the logical database.

Database ProgramThe database program contains the ABAP statements used to read the data and pass it to the user of the logical database.

Page 8: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation8 Jan-2007HR ABAP

Structure of Logical Database

The structure of a logical database is usually based on the foreign key relationships between hierarchical tables in the SAP System.

Logical databases have a tree-like structure

The nodes must be structures defined in the ABAP Dictionary or data types from a type group

Page 9: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation9 Jan-2007HR ABAP

Linking a Logical Database to an Executable Program

Page 10: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation10 Jan-2007HR ABAP

Logical Structures and DB Tables in PA

SAP AG 1999

Logical Structures and Database Tables in PA

Logical structures

PnnnnKEY fields

Data fields

PSnnnn

Database tables

PAnnnnPAnnnn PBnnnnPBnnnnScreenfields

Qnnnn

Selectionfields PNP

PERNR

PCLnPCLn

Page 11: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation11 Jan-2007HR ABAP

LDB : Infotype Data Structure

SAP AG 1999

Infotype - Data Structures

PA0002PA0002

DB structure PAnnnn using infotype 0002 as an example

Infotype structure Pnnnn using infotype 0002 as an example

MANDT PAKEY PSHD1 PS0002

PSKEY PSHD1 PS0002

Page 12: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation12 Jan-2007HR ABAP

LDB - Screening

Page 13: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation13 Jan-2007HR ABAP

LDB – Data Retrieval

Page 14: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation14 Jan-2007HR ABAP

Calling a Logical Database Using a Function Module 

LDB_PROCESS Function module is used to call logical databases independently from any ABAP program

Selection screen is not displayed The logical database does not trigger any GET events in the calling program, but

passes the data back to the caller in callback routines The depth to which the logical database is read is determined by specifying a

node name in the CALLBACK parameter For the GET event, the callback routine is executed directly after the data has

been read for the node, and before the subordinate nodes are processed. For the GET LATE event, the callback routine is processed after the subordinate

nodes have been processed.

Page 15: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation15 Jan-2007HR ABAP

Processing Infotypes in Logical Database

Page 16: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation16 Jan-2007HR ABAP

LDB – Processing Master Data Using Provide

SAP AG 1999

Processing Master Data

TABLES: PERNR.INFOTYPES: 0001, "Actions

0002, "Personal Data0006, "Addresses....

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

WRITE...

ENDPROVIDE.

Page 17: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation17 Jan-2007HR ABAP

LDB - Loop Nesting

SAP AG 1999

Loop Nesting

GET PERNR.PROVIDE * FROM P0002 BETWEEN PN-BEGDA

AND PN-ENDDA.WRITE...

ENDPROVIDE.

PROVIDE * FROM P0006BETWEEN PN-BEGDA AND PN-ENDDA.WRITE...

ENDPROVIDE.

END-OF-SELECTION.

Infotypeloop

Infotypeloop

Employeeloop

Page 18: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation18 Jan-2007HR ABAP

LDB – Period Based Data - 1

SAP AG 1999

JANUARY - APRIL

MAY - AUGUST

SEPTEMBER - DECEMBER

Ms YMs Y

Period-Based Data (1)

Page 19: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation19 Jan-2007HR ABAP

LDB – Period Based Data - 2

SAP AG 1999

Org.Assignment

Data Selection

January December

January December

Org.Assignment

January December

Period-Based Data (2)

Page 20: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation20 Jan-2007HR ABAP

LDB – Screening Criteria

SAP AG 1999

Screening Criteria

Data selection

Person selection

PAnnnnPAnnnn

INFOTYPES: ...

GET PERNR.

PROVIDE...

WRITE...

Page 21: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation21 Jan-2007HR ABAP

LDB – Sort Order

SAP AG 1999

Sort Order

...

GET PERNR....

190919101899

Pers.areaPerNo. Name

100010001100

Sam Hawkins David Lindsay Karl May

Page 22: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation22 Jan-2007HR ABAP

LDB – Flow Control of Logical Database

SAP AG 1999

Flow Control for Logical Database

View of HR report attributes - flow control for logical database

Program Batch Online

ZPLIST00

ZPLIST10

1

2

1

2

1

2

3

Forward select options

Array fetch is active

Array fetch active and forward select options

Page 23: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation23 Jan-2007HR ABAP

Join and Projection

Page 24: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation24 Jan-2007HR ABAP

Joins and Projection

Page 25: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation25 Jan-2007HR ABAP

Joins in PROVIDE

Page 26: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation26 Jan-2007HR ABAP

Join / Subtypes

SAP AG 1999

Join / Subtypes

TABLES: PERNR.INFOTYPES: 0001, "Organizational Assignment

0002, "Personal Data0006, "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.

Page 27: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation27 Jan-2007HR ABAP

Joins and Projection / Coding

Page 28: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation28 Jan-2007HR ABAP

Reading Time-Dependent Table Entries

SAP AG 1999

Reading Time-Dependent Table Entries

BEGDA

P0001-BEGDA

T513SENDDA

SELECT * FROM T513SWHERE SPRSL = SY-LANGUAND STELL = P0001-STELLAND ENDDA GE P0001-BEGDAAND BEGDA LE P0001-BEGDA.

ENDSELECT.

Page 29: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation29 Jan-2007HR ABAP

HR Macros

RP_PROVIDE_FROM_LAST

RP_PROVIDE_FROM_FIRST

RP_SET_DATA_INTERVAL

RP_READ_INFOTYPE

RP-READ-ALL-TIME-ITY

Page 30: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation30 Jan-2007HR ABAP

Options for Defining Modules

Macros can be defined in reports or includes using the ABAP command DEFINE

If a macro is changed, each report using this macro is automatically regenerated when it is executed

Macros can also be defined as RMAC macros. The source code of these modules is stored in the function section of the control table TRMAC

When you change an RMAC macro in the table TRMAC, the reports that use this macro are not regenerated automatically. You must regenerate them manually.

Page 31: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation31 Jan-2007HR ABAP

Macro Modules

SAP AG 1999

Macro Modules

TABLES: PERNR.INFOTYPES: 0001, "Organizational Assignment

0002, "Personal Data0006, "Addresses....

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

WRITE...

* * * Include program DBPNPMAC.

DEFINE RP_PROVIDE_FROM_LAST.PNP-SW-FOUND = '0'.. . .

END-OF-DEFINITION.

Page 32: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation32 Jan-2007HR ABAP

Processing a Specific Infotype Record

SAP AG 1999

Processing a Specific Infotype Record

Data selection January December

TablePnnnn

January December

GET PERNR.RP_PROVIDE_FROM_LAST <Pnnnn> SPACE PN-BEGDA PN-ENDDA.IF PNP-SW-FOUND = 1.

WRITE...ENDIF.

Page 33: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation33 Jan-2007HR ABAP

Reading Infotype without using LDB (1)

SAP AG 1999

Reading Infotypes Without Logical DB (1)

PAnnnnPAnnnn

INFOTYPES: <nnnn>....CALL FUNCTION'HR_READ_INFOTYPE'...

Page 34: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation34 Jan-2007HR ABAP

Reading Infotype Without Using LDB (2)

SAP AG 1999

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>

IMPORTINGSUBRC = return

TABLESINFTY_TAB = P0002

EXCEPTIONSINFTY_NOT_FOUND = 1OTHERS = 2.

Page 35: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation35 Jan-2007HR ABAP

Updating Infotype Record

SAP AG 1999

Updating Infotype Records

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

* Update infotype records

UPDATE PA0002SET NATIO = natio_nWHERE PERNR = persnumAND NATIO = natio_o.

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

ENDIF.

Page 36: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation36 Jan-2007HR ABAP

Reading Planning Infotypes with Function Module

Page 37: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation37 Jan-2007HR ABAP

Determining The Entry Date

Page 38: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation38 Jan-2007HR ABAP

Dynamic Actions

Page 39: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation39 Jan-2007HR ABAP

Indicator for Step

P Check conditions I Maintain infotype record W Set default values when creating a new record V Reference to another step F Call routine M Send mail

Tables used PSAVE To check old values of field PSPAR Transaction classes T001P Start dates and molga

Page 40: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation40 Jan-2007HR ABAP

Function character of step

02 for Change

04 for Create

06 for Change and create

08 for Delete

10 for Change and delete

12 for Create and delete

Page 41: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation41 Jan-2007HR ABAP

Calling Reports Using Dynamic Actions

Page 42: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation42 Jan-2007HR ABAP

Reports / Repetitive Structures

Page 43: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation43 Jan-2007HR ABAP

Infotype with repetitive Structure

Page 44: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation44 Jan-2007HR ABAP

Repetitive Structure / Evaluation (1)

Page 45: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation45 Jan-2007HR ABAP

Repetitive Structure / Evaluation (2)

Page 46: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation46 Jan-2007HR ABAP

ALV Data Structures

SAP AG 1999

ALV Data Structures

. . .TYPE-POOLS: SLIS.. . .DATA: alv_fieldcat TYPE slis_t_fieldcat_alv,

alv_layout TYPE slis_layout_alv.. . .

TYPES: BEGIN OF data_struc,pernr LIKE PERNR-PERNR,ename LIKE P0001-ENAME,. . .dar LIKE P0041-DAR01,. . .

END OF data_struc.

DATA: data_tab TYPE TABLE OF data_struc,data_tab_wa TYPE data_struc.

Page 47: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation47 Jan-2007HR ABAP

ALV Field Catalog

Page 48: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation48 Jan-2007HR ABAP

AVL Interface

Page 49: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation49 Jan-2007HR ABAP

Clusters

Page 50: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation50 Jan-2007HR ABAP

Clusters

Definition It is a database object, It is a file or table which link with Relid It combines the data from several tables with identical keys.

Page 51: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation51 Jan-2007HR ABAP

Clusters

Different Types Of Clusters PCL1 : Database for HR – Work Area PCL2 : Accounting Results ( Time / Payroll Results ) PCL3 : Recruitment/Applicant Tracking Data PCL4 : Documents Data PCL5 : Personnel Cost Planning

Page 52: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation52 Jan-2007HR ABAP

Clusters

PCL2 – Accounting Results table PCL2 is a Transparent table. PCL2-relid then it is called Cluster. PCL2- (XX) Where XX : - IN – India RX- International RU- USA FI- Finland RQ- Australia

Page 53: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation53 Jan-2007HR ABAP

Importing Data

Page 54: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation54 Jan-2007HR ABAP

Importing / Exporting with Macros

Page 55: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation55 Jan-2007HR ABAP

Importing/Exporting using a Buffer

SAP AG 1999

Importing/Exporting Using a Buffer

Import

Export

Program

UPDATE

PCLnPCLn

Buffer

Page 56: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation56 Jan-2007HR ABAP

Importing Using a Buffer

Page 57: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation57 Jan-2007HR ABAP

Data flow in Payroll

Page 58: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation58 Jan-2007HR ABAP

Payroll Results

SAP AG 1999

Payroll Results

Payroll result

Suzanne Werner January 19xx

WT01 Standard salary 5000 DMWT02 Bonus 300 DMWT03 Overtime 200 DM/101 Tot. gross amt 5500 DM. . . .

REPORT RPCLSTxy.

Page 59: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation59 Jan-2007HR ABAP

Reading the Cluster Directory

SAP AG 1999

Reading the Cluster Directory

*Table containing directory of payroll resultsDATA: 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.

Page 60: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation60 Jan-2007HR ABAP

Determining Current Payroll Result (1)

SAP AG 1999

Determining Current Payroll Result (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.

Page 61: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation61 Jan-2007HR ABAP

Determining Current Payroll Result (2)

SAP AG 1999

Determining Current Payroll Result (2)

DATA: result TYPE PAY99_RESULT.DATA: rt_header TYPE LINE OF HRPAY99_RT. . . .

CALL FUNCTION 'PYXX_READ_PAYROLL_RESULT' EXPORTING CLUSTERID = 'RX' EMPLOYEENUMBER = p0001-pernr SEQUENCENUMBER = number * READ_ONLY_BUFFER = ' ' * READ_ONLY_INTERNATIONAL = ' ' * CHECK_READ_AUTHORITY = 'X'

. . . CHANGING PAYROLL_RESULT = result EXCEPTIONS . .LOOP AT result-INTER-RT INTO rt_header.

WRITE: / rt_header-LGART, ...ENDLOOP.

Page 62: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation62 Jan-2007HR ABAP

Clusters – Data Structure for Payroll Result

Structure for Payroll Results

DATA: result TYPE PAY99_RESULT . DATA: rt _ header TYPE LINE OF HRPAY99_RT . . . .

* Access to payroll result data WRITE: result -INTER-VERSC-FPPER,

. . . LOOP AT result -INTER-RT INTO rt _ header .

WRITE: / rt _ header -LGART, . . . ENDLOOP.

Structure : PAY99_RESULT

EVP Structure PC261

INTER Structure PAY99_INTERNATIONAL NAT Dummy for national part

VERSC Type PC202

RT Type HRPAY99_RT

BT CRT Type HRPAY99_CRT

Page 63: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation63 Jan-2007HR ABAP

Table Types for Payroll Results (1)

SAP AG 1999

Table Type for Payroll Results (1)

Payroll result

Dictionary

Table type: HRPAY99_TAB_OF_RESULTS

Aggregated data types:

Structures (field strings)

Tables

Line type: PAY99_RESULT

EVPStructure PC261

INTER Structure PAY99_INTERNATIONAL NATVERSCType PC202

RTType HRPAY99_RT

BTCRTType HRPAY99_CRT

Page 64: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation64 Jan-2007HR ABAP

Table Types for Payroll Results (2)

SAP AG 1999

Table Type for Payroll Results (2)

DATA: result_tab TYPE HRPAY99_TAB_OF_RESULTS,result_header TYPE PAY99_RESULT.

DATA: rt_header TYPE LINE OF HRPAY99_RT.DATA: rgdir LIKE PC261 OCCURS 0 WITH HEADER LINE....CALL FUNCTION 'PYXX_GET_EVALUATION_PERIODS'

EXPORTING CLUSTERID = <Cluster>

EMPLOYEENUMBER = PERNR-PERNR INPER_MODIF = <Period parameter>

INPER = <In-period>TABLES

RGDIR = rgdirEVALUATED_PERIODS = result_tab

EXCEPTIONSNO_PAYROLL_RESULTS = 1NO_ENTRY_FOUND_ON_CU = 2.

Page 65: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation65 Jan-2007HR ABAP

Table Types for Payroll Results (1)

SAP AG 1999

Table Type for Payroll Results (3)

CALL FUNCTION 'PYXX_GET_EVALUATION_PERIODS' EXPORTING . . .

IF SY-SUBRC = 0.LOOP AT result_tab INTO result_header.

WRITE: / PERNR-PERNR, P0001-ENAME,result_header-INTER-VERSC-FPPER,. . .

LOOP AT result_header-INTER-RT INTO rt_header.WRITE: / rt_header-LGART, . . .

ENDLOOP.ENDLOOP.

ENDIF.

Page 66: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation66 Jan-2007HR ABAP

Clusters - Display of Payroll Result(PC00_M40_CLSTR)

Page 67: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation67 Jan-2007HR ABAP

Clusters - Display of Cluster data – Payroll Result

Page 68: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation68 Jan-2007HR ABAP

Clusters - Display of Cluster data – Payroll Result

Page 69: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation69 Jan-2007HR ABAP

Clusters - Important Structures to read Payroll data

1 . Payxx_result ( internal structures EVP/ INTER / NAT )

Where xx :- 99 = International DE = Germany IN = India FI = Finland 2. HRPAYxx_RT/ CRT/ WPBP……. Where xx :- 99 = International DE = Germany IN = India FI = Finland

Page 70: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation70 Jan-2007HR ABAP

Clusters - Function Modules To Read Payroll data

1. PYXX_GET_RELID_FROM_PERNR

2. CU_READ_RGDIR

3. CD_READ_LAST 4. PYXX_READ_PAYROLL_RESULT

Page 71: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation71 Jan-2007HR ABAP

Time Data

Page 72: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation72 Jan-2007HR ABAP

Time Data

SAP AG 1999

Time Data

Dependency of Time Data on Validity Period

Importing Time Data

Processing Time Data Using Internal Tables

Contents:

Page 73: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation73 Jan-2007HR ABAP

Time data and Validity Period

SAP AG 1999

Time Data and Validity Period

Leave

Data selectionperiod

15 days

PROVIDE...WRITE...

ENDPROVIDE. 15 days

Page 74: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation74 Jan-2007HR ABAP

Importing Time Data (1)

SAP AG 1999

Importing Time Data (1)

PAnnnnPAnnnn

Data selection period

INFOTYPES: 2001, "Absences2002, "Attendances2005, "Overtime2010. "Employee

Remuneration Info GET PERNR.

Page 75: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation75 Jan-2007HR ABAP

Importing Time Data (2)

SAP AG 1999

Importing Time Data (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.

Page 76: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation76 Jan-2007HR ABAP

Importing Time Data to Internal Tables

SAP AG 1999

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

Page 77: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation77 Jan-2007HR ABAP

Processing Time Data with Internal Tables

SAP AG 1999

Processing Time Data with Internal Tables

WERKSBUKRStab - BTRTL

0001

0001

0002

0002

0001

0001

0002

0002

0001

0002

0003

0004

Footer processing

Header processingEND-OF-SELECTION.LOOP AT tab.AT FIRST....ENDAT.

AT NEW bukrs....ENDAT.

AT NEW werks....ENDAT.

Single recordprocessingAT END OF werks....ENDAT.

AT END OF bukrs....ENDAT.

AT LAST....ENDAT.

ENDLOOP.

Page 78: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation78 Jan-2007HR ABAP

Infosets and Infoset Query

Page 79: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation79 Jan-2007HR ABAP

Infosets and User Groups

Page 80: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation80 Jan-2007HR ABAP

Assign Infosets to User Groups ( Transaction SQ03 )

Page 81: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation81 Jan-2007HR ABAP

Reporting on Data from PNP/PNPCE and PCH

Logical database

PNP PCH PAP

Selection of Persons Objects from Personnel Planning

Applicants

Infotypes that can be included in the InfoSet

Infotypes for Personnel

Administration (0000-0999)

Time Management (2000-2999)

Payroll infotypes Infotypes for Personnel

Planning objects that can be related to persons

If the object type is specified:

Infotypes for the object type

Infotypes for objects that can be related to the specified object type

If the object type is not specified:

All infotypes

Infotypes for Recruitment (4000-4999)

Some infotypes for Personnel Administration (such as 0001 and 0002)

Customer infotypes

Page 82: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation82 Jan-2007HR ABAP

Procedure for Creating and Changing Infosets (SQ02)

Page 83: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation83 Jan-2007HR ABAP

Initial Maintenance Screen for Reporting on Person/Applicants

Page 84: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation84 Jan-2007HR ABAP

Ad Hoc Query

Page 85: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation85 Jan-2007HR ABAP

Creating Queries II

Page 86: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation86 Jan-2007HR ABAP

Ad Hoc Query: Overview

Page 87: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation87 Jan-2007HR ABAP

Restricting Reporting Set

Page 88: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation88 Jan-2007HR ABAP

Creating Queries

Page 89: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation89 Jan-2007HR ABAP

Infotypes

Page 90: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation90 Jan-2007HR ABAP

Infotype Data Structure

Four digit number nnnn

Unique identification

9000 to 9999 reserved for customer infotypes

Page 91: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation91 Jan-2007HR ABAP

Naming Conventions for Infotypes

0000 to 0999 – HR Master data / Applicant data

1000 to 1999 – Organizational Management

2000 to 2999 – Time data

4000 to 4999 – Applicant data

5000 to 5999 – Planning Infotypes

9000 to 9999 – Customer defined

Page 92: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation92 Jan-2007HR ABAP

Personnel Administration Transparent Tables

Key Fields

Administration Fields

Custom Fields

Page 93: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation93 Jan-2007HR ABAP

Database Table For Applicant Infotypes

Page 94: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation94 Jan-2007HR ABAP

Components of an Infotype

Page 95: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation95 Jan-2007HR ABAP

subroutinesMPnnnn40

PAI modules for the screensMPnnnn30

PBO modules for the screensMPnnnn20

The PROGRAM statement andthe declaration of common data objects

MPnnnn10

The include containsName of include

Infotype specific include programs

The main program MPnnnn00 only contains INCLUDE statements. If you create the main program using transaction PM01 Dialogs in HR, the system also creates the following four includes:

Page 96: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation96 Jan-2007HR ABAP

Each infotype has at least three screens: An initial screen ( 1000 )

Initial screen is used as technical interface Processed in background and not displayed

A single screen ( 2000 ) Its an interface between the system and the user It enables to create, display or maintain data records

A list screen ( 3000 ) Enables to list all records in info type

Infotype Screens

Page 97: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation97 Jan-2007HR ABAP

Initial Screens

Initial screen is used as technical interface

Screen 1000 is used for all infotypes

Processed in background.

Performs general initialization procedures

Page 98: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation98 Jan-2007HR ABAP

Initial Screen - Preview

Page 99: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation99 Jan-2007HR ABAP

Single Screen - Preview

Page 100: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation100 Jan-2007HR ABAP

List Screen - Preview

Page 101: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation101 Jan-2007HR ABAP

Infotype Time Constraint

A time constraint indicates whether more than one infotype record may be available at one time.

The following time constraint indicators are permissible: 1 No overlapping and no gaps. Eg : Infotype 0000 - Actions

2 No overlapping but time gaps are permitted. Eg : Infotype 0021 - Family Details

3 Overlapping and and time gaps are permitted. Eg : Infotype 0019 Monitoring of Task

Page 102: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation102 Jan-2007HR ABAP

Other Possible Time Constraints

A Only one record may exist, valid from 01/01/1800 to 12/31/9999. Splitting and deletion is not permissible.

B Only one record may exist, valid from 01/01/1800 to 12/31/9999. Splitting is not permissible, but may be deleted.

T The time constraint varies depending on the subtype.

Z Refers to time management infotypes.

Page 103: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation103 Jan-2007HR ABAP

The following tables must be maintained for each infotype:

Name of table Task

T582A Basic infotype characteristics

(database tables, single screen, list screen, time constraint, dialogmodule, and so on)

T582S Infotype short texts

T777A Technical Characteristics of Infotype (database table, dialog module, andso on)

T77ID Name of data field structure (PSnnnn)

Infotype Characteristics

Page 104: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation104 Jan-2007HR ABAP

Creating Personnel Administration Infotypes – Step 1

Page 105: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation105 Jan-2007HR ABAP

Creating Personnel Administration Infotypes – Step 2

Page 106: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation106 Jan-2007HR ABAP

Creating Personnel Administration Infotypes – Step 3

Page 107: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation107 Jan-2007HR ABAP

Created Objects

Page 108: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation108 Jan-2007HR ABAP

Enhancing Personnel Administration Infotypes – Overview

Page 109: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation109 Jan-2007HR ABAP

Enhancing Personnel Administration Infotypes – Procedure

Page 110: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation110 Jan-2007HR ABAP

Enhancing Infotypes – Created Objects

Page 111: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation111 Jan-2007HR ABAP

Creating HRP info types

Transaction code : ‘PPCI’.

(Personnel Planning Infotype Copier)

Page 112: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation112 Jan-2007HR ABAP

Creating HRP info types

We can create the following kinds of info types:

Language-dependent field info types Language-independent field info types Language-dependent table info types Language-independent table info types

We can also specify whether an info type is country-specific or not

Page 113: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation113 Jan-2007HR ABAP

Creating HRP info types

Page 114: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation114 Jan-2007HR ABAP

Creating HRP info types

Start the Data Dictionary (SE11)

Select the Radio button Data Type Enter the HRI9nnn ( Where 9nnn is info type no).

Click on Create Button, and Create the required Structure

Save , Check and Activate the Structure

Page 115: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation115 Jan-2007HR ABAP

Creating HRP info types

Page 116: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation116 Jan-2007HR ABAP

Creating HRP info types

Page 117: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation117 Jan-2007HR ABAP

Creating HRP info types

Go to T Code : PPCI

Enter Info the details

Info type : 9nnn Info type name : xxxxx

Click on Create, it will display Extended screen

Page 118: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation118 Jan-2007HR ABAP

Creating HRP info types

Page 119: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation119 Jan-2007HR ABAP

Creating HRP info types

Page 120: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation120 Jan-2007HR ABAP

Creating HRP info types

♠ Here you can select Field info type / Table Info Type

♠ Language Dependent/ Independent

♠ Country Specific / not

♠ After selecting these options click on Create Button

Page 121: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation121 Jan-2007HR ABAP

Creating HRP info types

Page 122: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation122 Jan-2007HR ABAP

Creating HRP info types

After Creation of Infotype Maintain the Following Details using TCode: OOIT

Time Constraint

Infotype Per Object Type

Page 123: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation123 Jan-2007HR ABAP

Logical Database PCH(PNP)

Page 124: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation124 Jan-2007HR ABAP

Data Model

Page 125: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation125 Jan-2007HR ABAP

Relationship Between Basic Object Type

Page 126: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation126 Jan-2007HR ABAP

Table Infotype

Page 127: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation127 Jan-2007HR ABAP

Sequential Evaluation

Page 128: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation128 Jan-2007HR ABAP

Structural Evaluation

Page 129: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation129 Jan-2007HR ABAP

Evaluation Path

Page 130: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation130 Jan-2007HR ABAP

Maintaining Evaluation Path

Page 131: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation131 Jan-2007HR ABAP

Sequential Evaluation Coding

Page 132: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation132 Jan-2007HR ABAP

Structural Evaluations Coding

Page 133: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation133 Jan-2007HR ABAP

Structure Parameters

Page 134: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation134 Jan-2007HR ABAP

Setting Structure Condition

Page 135: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation135 Jan-2007HR ABAP

Filling Fields in the Selection Screen

Page 136: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation136 Jan-2007HR ABAP

Evaluating Additional Data on Relationship

Page 137: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation137 Jan-2007HR ABAP

Evaluating Table Infotype

Page 138: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation138 Jan-2007HR ABAP

Evaluating the Infotype Index

Page 139: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation139 Jan-2007HR ABAP

Questions ?

Page 140: SAP HR ABAP

IBM Global Business Services

© 2007 IBM Corporation140 Jan-2007HR ABAP

Thank You