Você está na página 1de 5

SDN Contribution

Accessing HR Clusters

Applies to:
SAP R/3 4.7

Summary
According to SAP, cluster databases are special relational databases in the ABAP Dictionary that you can
use to store data clusters. Their line structure is divided into a standard section, containing several fields,
and one large field for the data cluster. In HR, we come across several clusters in different sub-modules like
Time Management (B2 cluster) and Payroll (PCL1, PCL2, PCL3, PCL4).
This article aims to help budding programmers access the various clusters while reporting in HR.
Author(s): Gunjan Kumar
Company: Caritor (India) Pvt. Ltd.
Created on: 11 June 2006

Author Bio
Gunjan Kumar has been working for Caritor (India) Pvt. Ltd. as technical consultant. Apart from coding, he
spends time playing guitar and listening to rock music.

2006 SAP AG

Table of Contents
Introduction ...................................................................................................................................... 2
Accessing Cluster ........................................................................................................................ 2
Accessing Time Management Cluster (B2 Cluster)..................................................................... 3
Accessing TX Cluster (Text Saved in Infotype) ........................................................................... 4
Disclaimer and Liability Notice......................................................................................................... 5

Introduction
The following diagram represents the structure of the cluster database.

Accessing Cluster
In Payroll, We come across PCL1, PCL2, PCL3, and PCL4 clusters.
File PCL1 is the basis for the HR work area data. It contains information from the time data recording, for
example, incentive wage time tickets or infotype supplement texts.
File PCL2 contains derived information, for example, payroll results. It also contains all generated payroll
schemas.
File PCL3 contains applicant data.
File PCL4 contains the change documents for HR master data and recruitment
The following Pseudo code explains the way of accessing Payroll Cluster:
Includes to be used:
INCLUDE rpc2cd09.

"Cluster CD data definition

INCLUDE rpc2ca00.

"Cluster CA Data-Definition

INCLUDE rpppxd00.

"Data Definition buffer PCL1/PCL2 Buffer

2006 SAP AG

INCLUDE rpppxd10.

"Common part buffer PCL1/PCL2

INCLUDE rpppxm00.

"Buffer handling routine

*COUNTRY SPECIFIC INCLUDE


INCLUDE pc2rxin0.

"Cluster IN data definition

INCLUDE rpc2rx09.
Pseudo code and Macros to be used in the program:
CLEAR rgdir.
Cd-key-pernr = pernr-pernr.
Rp-imp-c2-cu.
IF rp-imp-cd-subrc <> 0.
* Payroll results not found for the employee no. &
REJECT.
ENDIF.
SORT rgdir BY fpper DESCENDING.
LOOP AT rgdir WHERE fpbeg GE pn-begda AND fpend LE pn-endda
AND srtza = A.
Rx-key-seqno = rgdir-seqnr.
Rx-key-pernr = pernr-pernr.
Rp-imp-c2-in.

IF rp-imp-in-subrc <> 0.
CONTINUE.
ENDIF.
LOOP AT RT.
CASE rt-lgart.
WHEN '1000'.
ADD rt-betrg TO w_basic1.
ENDCASE.
Endloop.
Accessing Time Management Cluster (B2 Cluster)
Whenever we go about Positive Time management and Time evaluation (PT60) is run for the employee, B2
cluster comes into picture and the following part deals with accessing data from B2 cluster. The key that
needs to be passed to B2 cluster are: Personnel No, Cluster Type, Year and Month to access all the tables
for that particular period.
Includes to be used:
Include:
mpzdat02,
rpppxd00,

Work tables for daily work


R/3 data definition for PCL1 & pcl2 buffer

2006 SAP AG

rpppxd10,
pc2rxid0.

Data definition for PCL1, pcl2


Data definition, cluster IS file pcl2

rpclst00.
rpc2b200.
rptsim00.
Pseudo code and Macros to be used in the program:
B2-key-pabrj

= pdate(4).

Year

B2-key-pabrp = pdate+4(2). Month


B2-key-cltyp

= '1'.

B2-key-pernr = pernr-pernr.

Cluster Type
Personnel No

IMPORT zes FROM DATABASE pcl2 (b2) ID b2-key.


The above mentioned part will fetch the data from table ZES for the period passed. Since B2 cluster will have
several tables (Like SALDO, FEHLER, ZES etc) and for each of them IMPORT statement needs to be
written separately.
Accessing TX Cluster (Text Saved in Infotype)
While saving the data in case of infotype we have an option of maintaining text using Edit->Maintain Text in
the menu bar and the comment stored there are saved in TX cluster.
The following part deals with that:
tx-key-pernr = mpernr .
tx-key-infty = minfty .
tx-key-subty = msubty .
tx-key-endda = mendda .
tx-key-begda = mbegda .
tx-key-seqnr = mseqnr .
* -------------------------------------* READING CLUSTER TX - (Texts)
* -------------------------------------import text-version
ptext
from database pcl1(tx)
id tx-key
using pcl1_exp_imp(sapfp50p) .
if sy-subrc ne 0 .
clear:
text-version .
clear:
ptext .
refresh: ptext .
sy-subrc = 4 .
endif
.
* -------------------------------------* Writing texts retrieved
* -------------------------------------describe table ptext lines lines_of_notes .
if lines_of_notes gt 0 .
is_first = 1 .
loop at ptext .
if is_first = 1 .
2006 SAP AG

write : /2 sy-vline, 3 'Reason:' , ptext-line color col_heading.


Endif.
Endif.

Disclaimer and Liability Notice


This document may discuss sample coding or other information that does not include SAP official interfaces
and therefore is not supported by SAP. Changes made based on this information are not supported and can
be overwritten during an upgrade.
SAP will not be held liable for any damages caused by using or misusing the information, code or methods
suggested in this document, and anyone using these methods does so at his/her own risk.
SAP offers no guarantees and assumes no responsibility or liability of any type with respect to the content of
this technical article or code sample, including any liability resulting from incompatibility between the content
within this document and the materials and services offered by SAP. You agree that you will not hold, or
seek to hold, SAP responsible or liable with respect to the content of this document.

2006 SAP AG

Você também pode gostar