sitemap
ABAP HR
Concepts of Clusters (Import/Export etc.), cluster directory
Definition
Each database object, for example, PCL1 or PCL2, with the type Import/Export file consists of
related areas. These areas are known as clusters, for example. RX, RD. Cluster objects are
dependent on the super ordinate database object.
Cluster objects RX, RD, B2 can be selected for the database PCL2. If the database object has
the type master data then there will be no cluster object.
Import/Export files
They are 4 types of files.
- PCL1: Basis for HR Work area data. Contains information from time data recording.
- PCL2: Contains derived information like payroll results and generated payroll schemas.
- PCL3: Contains Applicant Data
- PCL4: Contains change documents for HR master data and recruitment.
Importing and Exporting of data is managed with the commands IMPORT and EXPORT These
commands store objects such as fields, field strings, or internal tables on the database, or
read these from the database. Data is read from and written to the database using a unique
key. RMAC provides two macros for importing and exporting data RP-IMP-Cn-xx and RP-EXP-
Cn-xx; only these macros should be used.
Export Cluster data using standard include
- The EXPORT command causes one or more 'xy' KEY data objects to be written to
cluster xy.
- The cluster definition is integrated with the INCLUDE statement.
REPORT ZHREXPRT.
TABLES: PCLn.
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.
Export Cluster data using the macro
- Export data using macro RP-EXP-Cn-xy.
- When data records are exported using macro, they are not written to the database but
to a main memory buffer.
- To save data, use the PREPARE_UPDATE routine with the USING parameter 'V'.
REPORT ZHREXPRT.
*Buffer definition
INCLUDE RPPPXD00. INCLUDE RPPPXM00. "Buffer management
DATA: BEGIN OF COMMON PART 'BUFFER'.
INCLUDE RPPPXD10.
DATA: END OF COMMON PART 'BUFFER'.
...
RP-EXP-Cn-xy.
IF SY-SUBRC EQ 0.
PERFORM PREPARE_UPDATE USING ‘V’.
ENDIF.
Importing Cluster Data using standard include
- The IMPORT command causes data objects with the specified key values to be read from
PCLn.
- If the import is successful, SY-SUBRC is 0; if not, it is 4.
REPORT RPIMPORT.
TABLES: PCLn.
INCLUDE RPCnxxy0. "Cluster definition
* Fill cluster Key
* Import record
IMPORT TABLE1 FROM DATABASE PCLn (xy) ID xy-KEY.
IF SY-SUBRC EQ 0.
* Display data object
ENDIF.
Importing Cluster data using Macro
- Import data using macro RP-IMP-Cn-xy.
- Check return code SY-SUBRC. If 0, it is successful. If 4, error.
- Need include buffer management routines RPPPXM00
Example
REPORT RPIMPORT.
*Buffer definition
INCLUDE RPPPXD00.
DATA: BEGIN OF COMMON PART 'BUFFER'.
INCLUDE RPPPXD10.
DATA: END OF COMMON PART 'BUFFER'.
*Import data to buffer
RP-IMP-Cn-xy.
....
*Buffer management routines
INCLUDE RPPPXM00.
Cluster Authorization
Simple EXPORT/IMPORT statement does not check for cluster authorization.
Use EXPORT/IMPORT via buffer, the buffer management routines check for cluster
authorization.
How to read the Payroll Results
- Payroll results are stored in cluster Rn of PCL2 as field string and internal tables.
n - Country identifier.
- Standard reports read the results from cluster Rn. Report RPCLSTRn lists all payroll
results;
- Report RPCEDTn0 lists the results on a payroll form.
The cluster definition of payroll results is stored in two INLCUDE reports:
- include: rpc2rx09. "Definition Cluster Ru (I)
- include: rpc2ruu0.”Definition Cluster Ru (II)
This first INCLUDE defines the country-independent part; the second
INCLUDE defines the country-specific part (US).
The cluster key is stored in the field string RX-KEY.
- All the field string and internal tables stored in PCL2 are defined in the ABAP/4 dictionary.
This allows you to use the same structures in different definitions and nonetheless
maintain data consistency.
- The structures for cluster definition comply with the name convention PCnnn
- Unfortunately 'nnn' can be any set of alphanumeric characters.
*Key definition
DATA: BEGIN OF RX-KEY.
INCLUDE STRUCTURE PC200.
DATA: END OF RX-KEY.
*Payroll directory
DATA: BEGIN OF RGDIR OCCURS 100.
INCLUDE STRUCTURE PC261.
DATA: END OF RGDIR.
How to retrieve Payroll results
o To read payroll results, you need two keys: pernr and seqno
o You can get SEQNO by importing the cluster directory (CD) first.
Example
REPORT ZHRIMPRT.
TABLES: PERNR, PCL1, PCL2.
INLCUDE: rpc2cd09. "Definition cluster CD
PARAMETERS: PERSON LIKE PERNR-PERNR.
...
RP-INIT-BUFFER.
*Import cluster Directory
CD-KEY-PERNR = PERNR-PERNR.
RP-IMP-C2-CU.
CHECK SY-SUBRC = 0.
LOOP AT RGDIR.
RX-KEY-PERNR = PERSON.
UNPACK RGDIR-SEQNR TO RX-KEY-SEQNO.
*Import data from PCL2
RP-IMP-C2-RU.
ENDLOOP.
Reading records from the Payroll directory
after importing the payroll directory, which record to read is up to the programmer
- Each payroll result has a status.
'P' - previous result
'A' - current (actual) result
'O' - old result
- Function module CD_EVALUATION_PERIODS will restore the payroll result status for a
period when that payroll is initially run. It also will select all the relevant periods to be
evaluated.
Example
Call function 'CD_EVALUATION_PERIODS'
exporting
bonus_date = ref_periods-bondt
inper_modif = pn-permo
inper = ref_periods-inper
pay_type = ref_periods-payty
pay_ident = ref_periods-payid
tables
rgdir = rgdir
evpdir = evp
iabkrs = pnpabkrs
exceptions
no_record_found = 1.
Authorization Check
Authorization for Persons
- In the authorization check for persons, the system determines whether the user has the
authorizations required for the organizational features of the employees selected with
GET PERNR.
- Recruits for which the user has no authorization are skipped and appear in a list at the
end of the report.
- Authorization object: 'HR: Master data'
Authorization for Data
- In the authorization check for data, the system determines whether the user is
authorized to read the infotypes specified in the report.
- If the authorization for a particular infotype is missing, the evaluation is terminated and
an error message is displayed.
Deactivating the Authorization Check
- In certain reports, it may be useful to deactivate the authorization check in order to
improve performance. (E.g. when running payroll)
- You can store this information in the object 'HR: Reporting'.
All of the product names here are trademarks of their respective companies. The site
www.allsaplinks.com no way affiliated with SAP AG. We have made every effort for the content
integrity. Information used on this site is at your own risk.