SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

Using ABAP to retrieve payroll results



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> HR
View previous topic :: View next topic  
Author Message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1639

PostPosted: Sat Oct 13, 2007 1:13 pm    Post subject: Using ABAP to retrieve payroll results Reply with quote

Example code to retirve payroll results
ABAP code to demonstrate how to retrieve payroll results (accessed via transaction PC_PAYRESULT)

Code:

*.......................................................................
*: Report:  ZPAYROLL_RESULTS                                           :
*:                                                                     :
*: Author:  www.SAPdev.co.uk                                           :
*:                                                                     :
*: Description: Demonstrate retrieving payroll results data, please    :
*:              note program does not produce any meaningful output    :
*               is simply a demonstration of how to access the data    :
*:.....................................................................:
REPORT  ZPAYROLL_RESULTS.

NODES: pernr.
INFOTYPES: 0000, 0001, 2001.

TABLES: t554s, pcl1, pcl2.

INCLUDE rpclst00.
INCLUDE rpc2rx09.                      "Payroll results datadefns-Intl.
INCLUDE rpc2rxx0.                      "Payroll results datadefns-Intl.
INCLUDE rpc2rgg0.                      "Payroll results datadefns-GB
INCLUDE rpcfdcg0.                      "Payroll results datadefns-GB
INCLUDE rpcdatg0.
INCLUDE rpc2cd00.                      "Cluster Directory defns.
INCLUDE rpc2ps00.                      "Cluster: Generierte Schematas
INCLUDE rpc2pt00.
INCLUDE rpcfdc10.
INCLUDE rpcfdc00.
INCLUDE rpppxd00.
INCLUDE rpppxd10.
INCLUDE rpcfvp09.
INCLUDE rpcfvpg0.
INCLUDE rpppxm00.

TYPES: BEGIN OF t_salrate,
    seqnr    TYPE pc261-seqnr,
    begda    TYPE p2001-begda,
    endda    TYPE p2001-endda,
    split(2) TYPE c,
    val      TYPE p DECIMALS 2,
   END OF t_salrate.
DATA: it_salrate TYPE STANDARD TABLE OF t_salrate INITIAL SIZE 0,
      wa_salrate TYPE t_salrate.


*Selection screen
SELECTION-SCREEN BEGIN OF BLOCK block1 WITH FRAME TITLE text-001.
SELECT-OPTIONS: so_awart FOR p2001-awart.
SELECTION-SCREEN END OF BLOCK block1.

************************************************************************
*START-OF-SELECTION.
START-OF-SELECTION.

GET pernr.

* get payroll results data
  rp-init-buffer.
  CLEAR rgdir. REFRESH rgdir.
  CLEAR rt. REFRESH rt.
  CLEAR: rx-key.

* set key to current pernr
  MOVE pernr-pernr(8) TO cd-key-pernr.

* retrieves payroll results for specific pernr(personnel number)
  rp-imp-c2-cd.

  IF rp-imp-cd-subrc = 0.                                "rgdir success
    rx-key-pernr = pernr-pernr.
    SORT rgdir BY seqnr ASCENDING.
    CLEAR rgdir.
  ENDIF.

  SORT rgdir BY fpbeg fpend ASCENDING seqnr DESCENDING.
* RGDIR the table where all payroll results periods are stored
  LOOP AT rgdir WHERE  abkrs IN pnpabkrs        "pay area
                  AND  srtza EQ 'A'
                  AND  void  NE 'V'.

    IF sy-subrc NE 0.
*     set key to specific payroll results period(current RGDIR loop pass)
      UNPACK rgdir-seqnr   TO   rx-key-seqno.

*     Retrieves data for specific payroll results period (current RGDIR
*     loop pass)
      rp-imp-c2-rg.

*     Loop at wpbp data for specific payroll results period
      LOOP AT wpbp.
        wa_salrate-seqnr = rgdir-seqnr.
        wa_salrate-begda = wpbp-begda.
        wa_salrate-endda = wpbp-endda.
        wa_salrate-split = wpbp-apznr.
*       loop at rt data for specific payroll results period
        LOOP AT rt WHERE lgart EQ '/010' AND             "wage type
                         apznr EQ wpbp-apznr.            "payroll split
          wa_salrate-val = ( rt-betpe * ( wpbp-adivi / wpbp-kdivi ) ).
          APPEND wa_salrate TO it_salrate.
        ENDLOOP.
      ENDLOOP.

*     Process BT table
      LOOP AT BT.
      ENDLOOP.

*     Process NIPAY table
      LOOP AT NIPAY.
      ENDLOOP.

*     etc................
    ENDIF.
  ENDLOOP.


************************************************************************
*END-OF-SELECTION.
END-OF-SELECTION.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> HR All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG.
Every effort is made to ensure content integrity. Use information on this site at your own risk.