Read SAP HR Infotype text from cluster PCL1

original: http://www.erki.net/node/29
Retrieve long text from Infotype 2002 (Attendance) in HR

Infotype 2002 (Attendances) has maintain text area (F9) lines that can be used to store comments regarding the attendance types assigned to employee. This text is not directly stored in the database table PA2002. This data is stored in the ‘PCL1′ cluster with Cluster ID ‘TX’.

Since this text is stored in PCL1 cluster, READ_TEXT function module cannot be used to retrieve it. Instead, make use of one of the 2 ways mentioned below to retrieve this text.

1. Make use of IMPORT ptext FROM DATABASE pcl1(tx) command
2. Use RP-IMP-C1-TX macro stored in TRMAC table.

Sample program Using IMPORT statement

REPORT ZHR_READ_CLUSTER.
TYPES:
BEGIN OF t_pa2002,
pernr TYPE persno,
*subty TYPE subty,
objps TYPE objps,
sprps TYPE sprps,
endda TYPE endda,
begda TYPE begda,
seqnr TYPE seqnr,
itxex TYPE itxex,
END OF t_pa2002,

BEGIN OF t_text,
line(72),
END OF t_text.

DATA:
gt_pa2002 TYPE STANDARD TABLE OF t_pa2002,
gw_pa2002 TYPE t_pa2002,
ptext TYPE STANDARD TABLE OF t_text INITIAL SIZE 10,
gw_text TYPE t_text,
gw_key TYPE pskey.

SELECTION-SCREEN BEGIN OF BLOCK abc WITH FRAME TITLE text-001.
PARAMETERS:
p_pernr LIKE pernr-pernr,
subty like pa2002-subty,
Start like pa2002-begda,
End like pa2002-endda.
SELECTION-SCREEN END OF BLOCK abc.

START-OF-SELECTION.
SELECT pernr objps sprps endda begda seqnr itxex
FROM pa2002
INTO TABLE gt_pa2002
WHERE pernr EQ p_pernr and
subty EQ subty and
begda GE Start and
endda LE End .

LOOP AT gt_pa2002 INTO gw_pa2002 WHERE itxex EQ ‘X’.
MOVE-CORRESPONDING gw_pa2002 TO gw_key.
gw_key-infty = ‘2002’.
gw_key-subty = subty.
IMPORT ptext FROM DATABASE pcl1(tx) ID gw_key.
LOOP AT ptext INTO gw_text.
write : p_pernr ,’-‘, subty.
Write / gw_text-line .
ENDLOOP.
ENDLOOP.

Hope it will be helpfull In Shaa’ Allah

Done!

Advertisements

2 thoughts on “Read SAP HR Infotype text from cluster PCL1

  1. Thomas August 9, 2017 / 10:48 PM

    Great post ! 🙂 Have nice day ! 2a4a445o1h

    Like

    • menoshet August 10, 2017 / 7:05 AM

      Thanks 🙂

      Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s