‎2008 Jun 16 8:22 PM
Hi Friends,
Im very new to HR ABAP. I have some confusions about cluster tables. For example PCL1 contains tables like B1, G1, L1.. Cluster B1 contains table like NT1, NT2, ERT..
Now I want to see the structure of cluster B1 and also want to see the data's on NT1 table. How can I see the data's from those cluster tables.
Thanks for everyone and helps will be rewarded.
‎2008 Jun 17 11:55 AM
Hi,
You can get the data into tables NT1, NT2 and ERT using PCL1 file.
Go through the following program.
REPORT ZHR_DEMO_PCL1.
TABLES : pcl1,
pa0003.
DATA : BEGIN OF it_pcl1 OCCURS 0,
srtfd TYPE pcl1-srtfd,
END OF it_pcl1.
DATA BEGIN OF nt1 OCCURS 10.
INCLUDE STRUCTURE pdcmt.
DATA END OF nt1.
DATA BEGIN OF nt2 OCCURS 10.
INCLUDE STRUCTURE pdcmt.
DATA END OF nt2.
DATA BEGIN OF ert OCCURS 10.
INCLUDE STRUCTURE pc2b8.
DATA END OF ert.
DATA BEGIN OF b1-key.
INCLUDE STRUCTURE pdc10.
DATA END OF b1-key.
DATA: srtfdlow LIKE pcl2-srtfd.
DATA: srtfdhigh LIKE pcl2-srtfd VALUE
'9999999999999999999999999999999999999999'.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.
SELECT-OPTIONS : s_pernr FOR pa0003-pernr.
PARAMETERS: vonpernr LIKE pc2b0-pernr NO-DISPLAY,
bispernr LIKE pc2b0-pernr NO-DISPLAY.
SELECTION-SCREEN END OF BLOCK b1.
START-OF-SELECTION.
PERFORM init_sortfields.
PERFORM get_srtfd_pcl1.
PERFORM import_data.
&----
*& Form init_sortfields
&----
text
----
FORM init_sortfields .
IF vonpernr IS INITIAL.
SELECT MIN( pernr ) INTO vonpernr
FROM pa0003 WHERE pernr IN s_pernr.
IF sy-subrc = 4. "i.e. no minimum found.
vonpernr = bispernr = '00000000'.
ELSE.
SELECT MAX( pernr ) INTO bispernr
FROM pa0003 WHERE pernr IN s_pernr.
ENDIF.
ELSE.
IF bispernr IS INITIAL.
bispernr = vonpernr.
ENDIF.
ENDIF.
srtfdlow = cl_pt_cluster_util=>srtfd_low_init(
im_pernr = vonpernr
im_relid = 'B1' ).
srtfdhigh = cl_pt_cluster_util=>srtfd_high_init(
im_pernr = bispernr
im_relid = 'B1' ).
ENDFORM. " init_sortfields
&----
*& Form get_srtfd_pcl1
&----
text
----
FORM get_srtfd_pcl1 .
SELECT srtfd
FROM pcl1
INTO TABLE it_pcl1
WHERE relid EQ 'B1'
AND srtfd BETWEEN srtfdlow AND srtfdhigh
AND srtf2 EQ 0.
ENDFORM. " get_srtfd_pcl1
&----
*& Form import_data
&----
text
----
FORM import_data .
LOOP AT it_pcl1.
MOVE it_pcl1-srtfd TO b1-key.
IMPORT nt1 nt2 ert FROM DATABASE pcl1(b1) ID b1-key.
IF sy-subrc EQ 0.
LOOP AT nt1.
ENDLOOP.
LOOP AT nt2.
ENDLOOP.
ENDIF.
ENDLOOP.
ENDFORM. " import_data