7 Replies Latest reply: Dec 21, 2012 7:38 AM by babi1973 RSS

    SAP Cluster Tables (Payroll)

    Thom Mumaw

      Has anyone out there successfully extracted data from one or more of SAP Cluster tables?

      Thanks

        • Re: SAP Cluster Tables (Payroll)

          Hi!

           

          You will need a little bit of ABAP code to translate the clustered data back to regular data.

          Usually you put this ABAP code into an RFC function module and then call this BAPI with Xtract QV BAPI:

           

          http://www.theobald-software.com/en/products/xtractqv/sapr3access.htm

          (please scroll down to BAPI component)

           

          If you're interested I can try to find and publish the ABAP code. It was only a couple of lines....

           

          regards,

           

          Patrick

          • Re: SAP Cluster Tables (Payroll)

            Hello Thom,

             

            below you can find the ABAP Code/ Custom Function Module to read the Cluster Tables PCL1 and PCL2.

            If you fill in the Import Parameter "ACTIONID" with P1 , then you need the Personnel No. In the field PERNR. No additional parameters are needed. You get the result in the Table Parameter ST. If you need the payroll results of the Cluster Table PCL2, you need to fill in the ACTIONID "P2" and have to fill in a Start- and Enddate to the Parameters STARTDATE and ENDDATE. Then you get the Payroll results of the Table PCL2 in the Table parameter CRT.

            I hope this code helps you.

             

            Best regards,

             

            Ali

             

             

             

            FUNCTION Z_HR_CLUSTER_READ.

            *"----------------------------------------------------------------------

            *"*"Local Interface:

            *"  IMPORTING

            *"     VALUE(PERNR) TYPE  PC2B0-PERNR OPTIONAL

            *"     VALUE(ACTIONID) TYPE  CHAR2 DEFAULT 'P1'

            *"     VALUE(STARTDATE) TYPE  DATS OPTIONAL

            *"     VALUE(ENDDATE) TYPE  DATS OPTIONAL

            *"  TABLES

            *"      ERT STRUCTURE  PC2B8 OPTIONAL

            *"      ST STRUCTURE  PC2B5 OPTIONAL

            *"      CRT STRUCTURE  PC208 OPTIONAL

            *"----------------------------------------------------------------------

              DATA : BEGIN OF it_pcl1 OCCURS 0,

              srtfd TYPE pcl1-srtfd,

              END OF it_pcl1.



              DATA BEGIN OF b1_key.

                      INCLUDE STRUCTURE pdc10.

              DATA END OF b1_key.



              IF actionid = 'P1'.



                SELECT srtfd

                FROM pcl1

                INTO TABLE it_pcl1

                WHERE relid EQ 'B1'

                AND srtfd EQ pernr

                AND srtf2 EQ 0.







                LOOP AT it_pcl1.

                  MOVE it_pcl1-srtfd TO b1_key.



                  IMPORT st ert FROM DATABASE pcl1(b1) ID b1_key.

                  IF sy-subrc EQ 0.



                  ENDIF.

                ENDLOOP.



              ENDIF.

              IF actionid = 'P2'.



                DATA : it_rgdir TYPE TABLE OF pc261 INITIAL SIZE 0,

                       wa_rgdir LIKE LINE OF it_rgdir,

                       it_crt TYPE pay99_result-inter-crt,

                       wa_crt LIKE LINE OF it_crt,

                       wa_payrollresult TYPE pay99_result,

                       v_molga TYPE molga.





                DATA : BEGIN OF wa_out,

                        pernr TYPE pernr-pernr,

                        gross TYPE pc207-betrg, "Amount

                        net TYPE pc207-betrg,

                       END OF wa_out,

                       it_outtab LIKE TABLE OF wa_out.





               wa_out-pernr = PERNR.



                CALL FUNCTION 'CU_READ_RGDIR'

            EXPORTING

                    persnr          = PERNR

                  IMPORTING

                    molga           = v_molga

                  TABLES

                    in_rgdir        = it_rgdir

                  EXCEPTIONS

                    no_record_found = 1

                    OTHERS          = 2.

                IF sy-subrc = 0.



                  LOOP AT it_rgdir INTO wa_rgdir

                                   WHERE fpbeg GE startdate AND

                                         fpend LE enddate AND

                                         srtza EQ 'A'"Current result

                    CALL FUNCTION 'PYXX_READ_PAYROLL_RESULT'

                      EXPORTING

                        clusterid                    = 'RD'

                        employeenumber               = PERNR

                        sequencenumber               = wa_rgdir-seqnr

                        READ_ONLY_INTERNATIONAL      = 'X'

                      CHANGING

                        payroll_result               = wa_payrollresult

                      EXCEPTIONS

                        illegal_isocode_or_clusterid = 1

                        error_generating_import      = 2

                        import_mismatch_error        = 3

                        subpool_dir_full             = 4

                        no_read_authority            = 5

                        no_record_found              = 6

                        versions_do_not_match        = 7

                        error_reading_archive        = 8

                        error_reading_relid          = 9

                        OTHERS                       = 10.

                    IF sy-subrc = 0.

                      LOOP AT wa_payrollresult-inter-crt INTO wa_crt.

                        CASE wa_crt-lgart.

                          WHEN '/101'" Gross

                            APPEND wa_crt TO crt.

                        ENDCASE.

                        CLEAR wa_out.

                      ENDLOOP.

                    ENDIF.

                  ENDLOOP.

                ENDIF.





              ENDIF.

            ENDFUNCTION.

            • Re: SAP Cluster Tables (Payroll)
              s j

              I extracted data from KONV, BSEG . Never faced any issue during extraction.

                • Re: SAP Cluster Tables (Payroll)

                  Hello Sunil,

                   

                  Thom is asking about clusterd tables. The Payroll Cluster Tables are PCL1 and PCL2. BSEG and KONV aren't clustered tables, and can be extracted the "normal" way throug table extraction. PCL1 and PCL2 can also, but they include the data in LRAW fields, which make no sense to read them the normal way

                   

                  Best regards,

                   

                  Ali