Professional Documents
Culture Documents
Visualizacion Técnica ABAP
Visualizacion Técnica ABAP
Visualizacion Técnica ABAP
HR ABAP
Technical Overview
List of Topics
Logical Databases
Join & Projection
Reports / Repetitive Structures
Clusters
Time Data
Infosets & Infoset Queries
Infotypes
Logical Database PCH
Logical Databases
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
Structure
The structure defines the data view
of the logical database.
Selections
The selections define a selection
screen, which forms the user
interface of the executable
programs that use the logical
database.
Database Program
The database program contains the
ABAP statements used to read the
data and pass it to the user of the
logical database.
Logical
Logical Structures andDatabase
Structures and DB Tables in PA
Tables in PA
Data fields
Selection PCLn
PSnnnn fields PNP
PERNR
LDB : Infotype
Infotype - Data Data Structure
Structures
LDB - Screening
INFOTYPES: 0001,
0002,
0007.
GET PERNR.
GET PERNR.
PROVIDE * FROM P0002 BETWEEN PN-BEGDA AND PN-ENDDA.
WRITE...
ENDPROVIDE.
Loop Nesting
LDB - Loop Nesting
GET PERNR.
PROVIDE * FROM P0002 BETWEEN PN-BEGDA
AND PN-ENDDA. Infotype
WRITE... loop
ENDPROVIDE.
Employee
PROVIDE * FROM P0006 loop
BETWEEN PN-BEGDA AND PN-ENDDA. Infotype
WRITE... loop
ENDPROVIDE.
END-OF-SELECTION.
LDB – Period
Period-Based
BasedDataData
(1) -1
JANUARY - APRIL
MAY - AUGUST
Ms Y
SEPTEMBER - DECEMBER
SAP AG 1999
18 HR ABAP Jan-2007 © 2007 IBM Corporation
IBM Global Business Services
January December
Data
Selection
January December
Org.
Assignment
January December
Org.
Assignment
– Screening
LDBScreening Criteria Criteria
Data selection
Person selection
INFOTYPES: ...
GET PERNR.
PAnnnn
PROVIDE...
WRITE...
SAP AG 1999
...
GET PERNR.
...
SAP AG 1999
ZPLIST00 1 1
ZPLIST10 2 2
22 SAP AG 1999
HR ABAP Jan-2007 © 2007 IBM Corporation
IBM Global Business Services
Joins Join
and/ Projection
Creating Intervals
Personal
Data (0002)
Organizational
Assignment (0001)
Join
Joins inJoin
PROVIDE
/ Coding
TABLES: PERNR.
INFOTYPES:0001, "Organizational Assignment
0002, "Personal Data
0006, "Addresses
....
GET PERNR.
PROVIDE * FROM P0001
* FROM P0002
BETWEEN PN-BEGDA AND PN-ENDDA.
WRITE...
ENDPROVIDE.
Join / Subtypes
Join / Subtypes
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.
26 SAP AG
HR1999
ABAP Jan-2007 © 2007 IBM Corporation
IBM Global Business Services
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.
P0001-BEGDA
BEGDA ENDDA
T513S
HR Macros
RP_PROVIDE_FROM_LAST
RP_PROVIDE_FROM_FIRST
RP_SET_DATA_INTERVAL
RP_READ_INFOTYPE
RP-READ-ALL-TIME-ITY
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.
Macro Modules
Macro Modules
TABLES: PERNR.
INFOTYPES: 0001, "Organizational Assignment
0002, "Personal Data
0006, "Addresses
....
GET PERNR.
RP_PROVIDE_FROM_LAST P0001 SPACE PN-BEGDA PN-ENDDA.
WRITE...
DEFINE RP_PROVIDE_FROM_LAST.
PNP-SW-FOUND = '0'.
. . .
END-OF-DEFINITION.
31 SAP AG
HR1999
ABAP Jan-2007 © 2007 IBM Corporation
IBM Global Business Services
January December
Table
Pnnnn
GET PERNR.
RP_PROVIDE_FROM_LAST <Pnnnn> SPACE PN-BEGDA PN-ENDDA.
IF PNP-SW-FOUND = 1.
WRITE...
ENDIF.
SAP AG 1999
32 HR ABAP Jan-2007 © 2007 IBM Corporation
IBM Global Business Services
Reading InfotypeWithout
Reading Infotypes withoutLogical
using DB
LDB
(1)(1)
PAnnnn
INFOTYPES: <nnnn>.
...
CALL FUNCTION
'HR_READ_INFOTYPE'...
33 SAP AG 1999
HR ABAP Jan-2007 © 2007 IBM Corporation
IBM Global Business Services
Reading Infotypes Without Logical DB (2)
Reading Infotype Without Using LDB (2)
INFOTYPES: 0002.
DATA: return LIKE SY-SUBRC.
IMPORTING
SUBRC = return
TABLES
INFTY_TAB = P0002
EXCEPTIONS
INFTY_NOT_FOUND = 1
OTHERS = 2.
UPDATE PA0002
SET NATIO = natio_n
WHERE PERNR = persnum
AND NATIO = natio_o.
IF SY-SUBRC = 0.
WRITE: 'Modified records', SY-DBCNT.
ENDIF.
Dynamic Actions
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
02 for Change
04 for Create
08 for Delete
. . .
TYPE-POOLS: SLIS.
. . .
DATA: alv_fieldcat TYPE slis_t_fieldcat_alv,
alv_layout TYPE slis_layout_alv.
. . .
SAP AG 1999
46 HR ABAP Jan-2007 © 2007 IBM Corporation
IBM Global Business Services
AVL Interface
Clusters
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.
Clusters
Clusters
Importing Data
Program
Export UPDATE
PCLn
Import
Buffer
Payroll Results
Payroll Results
REPORT RPCLSTxy.
Payroll result
Suzanne Werner January 19xx
WT01 Standard salary 5000 DM
WT02 Bonus 300 DM
WT03 Overtime 200 DM
/101 Tot. gross amt 5500 DM
....
SAP AG 1999
58 HR ABAP Jan-2007 © 2007 IBM Corporation
IBM Global Business Services
SAP AG 1999
60 HR ABAP Jan-2007 © 2007 IBM Corporation
IBM Global Business Services
Determining Current Payroll Result (2)
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.
SAP AG 1999
61 HR ABAP Jan-2007 © 2007 IBM Corporation
IBM Global Business Services
Structure: PAY99_RESULT
EVP INTER Structure PAY99_INTERNATIONAL NAT
Structure PC261 Dummy
VERSC RT CRT BT for national
Type PC202 Type HRPAY99_RT Type HRPAY99_CRT part
Payroll result
Structures (field strings)
Tables
SAP AG 1999
63 HR ABAP Jan-2007 © 2007 IBM Corporation
IBM Global Business Services
IF SY-SUBRC = 0.
LOOP AT result_tab INTO result_header.
WRITE: / PERNR-PERNR, P0001-ENAME,
result_header-INTER-VERSC-FPPER,
. . .
Where xx :-
99 = International
DE = Germany
IN = India
FI = Finland
Where xx :-
99 = International
DE = Germany
IN = India
FI = Finland
1. PYXX_GET_RELID_FROM_PERNR
2. CU_READ_RGDIR
3. CD_READ_LAST
4. PYXX_READ_PAYROLL_RESULT
Time Data
Time Data
Contents:
Dependency of Time Data on Validity Period
Importing Time Data
Processing Time Data Using Internal Tables
SAP AG 1999
Data selection
period
15 days
Leave
PROVIDE...
WRITE...
ENDPROVIDE.
15 days
73 SAP AGHR
1999
ABAP Jan-2007 © 2007 IBM Corporation
IBM Global Business Services
Importing Time
Importing DataData
Time (1) (1)
GET PERNR.
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.
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
76 SAP AGHR
1999
ABAP Jan-2007 © 2007 IBM Corporation
IBM Global Business Services
Customer infotypes
Ad Hoc Query
Creating Queries II
Creating Queries
Infotypes
Unique
identification
9000 to 9999
reserved for
customer infotypes
Key
Fields
Administration
Fields
Custom Fields
Components of an Infotype
Infotype Screens
Initial Screens
Processed in background.
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
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.
Infotype Characteristics
Created Objects
Select the Radio button Data Type Enter the HRI9nnn ( Where 9nnn is
info type no).
Go to T Code : PPCI
♠ Here you can select Field info type / Table Info Type
After Creation of Infotype Maintain the Following Details using TCode: OOIT
Time Constraint
Data Model
Table Infotype
Sequential Evaluation
Structural Evaluation
Evaluation Path
Structure Parameters
Questions ?
Thank You