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

HR Payroll reports



 
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: Tue Jan 15, 2008 2:39 pm    Post subject: HR Payroll reports Reply with quote

What we're going to discuss here, is how get the payroll of an employee for a determined month, and that's an important thing, trust me. Without payroll, the employees don't get paid, and if they know that you are the developer and they didn't get paid because of your app...you're toast.

Anyway, don't get scared I'm gonna try and help you out. I know that there is the usual way to read the payroll, I have used it quite a lot myself.

You must remember to include the logical database PNP and the selection screen 900

Code:
TABLES: RP50G,PERNR,PYORGSCREEN,PYTIMESCREEN.

NODES: PAYROLL TYPE PAY99_RESULT.

INFOTYPES 0001.

DATA WA_RT LIKE LINE OF PAYROLL-INTER-RT.
DATA MYLIST LIKE  PC261 OCCURS 0 .
DATA WA_MYLIST LIKE LINE OF MYLIST.
DATA PAY TYPE REF TO CL_PAY.

  CREATE OBJECT PAY.
  CALL METHOD PAY->READ_RESULT IMPORTING LIST = MYLIST.
  CALL METHOD PAY->WRITE_RESULT EXPORTING LIST = MYLIST.

GET PAYROLL.

  LOOP AT PAYROLL-INTER-RT INTO WA_RT.
    CASE WA_RT-LGART.
*You read the value and stored in a variable   
    ENDCASE.
  ENDLOOP.

GET PERNR.

  PROVIDE * FROM P0001
  BETWEEN PYBEGDA AND PYENDDA.

  ENDPROVIDE.


That's great right? You have the payroll for a month, trimester or even for a year. But what happens when they tell you that, they want the payroll for a month to be compared against the payroll for 6 months back, month by month. That's what happened to me. Of course, you're not going to repeat that loop everytime for every month for every employee. You need something else, something like this.

Code:
TABLES: RP50G,PERNR,PYORGSCREEN,PYTIMESCREEN.

DATA: IN_RGDIR LIKE PC261 OCCURS 0 WITH HEADER LINE,
      WA_RT LIKE PC207 OCCURS 0 WITH HEADER LINE,
      SEQNR LIKE PC261-SEQNR,
      RESULT TYPE PAY99_RESULT.

DATA: M_START LIKE SY-DATUM,
      M_END LIKE SY-DATUM.

FORM GET_PAYROLL USING P_PERNR M_START M_END.

*This FM help us to get the Sequence number used for the
*employee on the payroll.
  CALL FUNCTION 'CU_READ_RGDIR'
       EXPORTING
            PERSNR          = P_PERNR
       TABLES
            IN_RGDIR        = IN_RGDIR
       EXCEPTIONS
            NO_RECORD_FOUND = 1
            OTHERS          = 2.

*We read it using two dates, which corresponds to the month *we need
  READ TABLE IN_RGDIR WITH KEY FPBEG = M_START
                               FPEND = M_END.
  SEQNR = IN_RGDIR-SEQNR.

*This FM actually reads the payroll and get the information
*we need.
  CALL FUNCTION 'PYXX_READ_PAYROLL_RESULT'
       EXPORTING
            CLUSTERID                    = 'XX'
*In CLUSTERID use the country of your choice
            EMPLOYEENUMBER               = P_PERNR
            SEQUENCENUMBER               = SEQNR
            READ_ONLY_INTERNATIONAL      = 'X'
       CHANGING
            PAYROLL_RESULT               = RESULT
       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
            OTHERS                       = 8.

*We just need to read the result table.
  LOOP AT RESULT-INTER-RT INTO WA_RT.
    CASE WA_RT-LGART.
      WHEN '9010'.
         MOVE WA_RT-BETRG TO T_ANYTABLE-SOMEPAY.
    ENDCASE.
  ENDLOOP.
ENDFORM.


With these two simple FM's, your days of fighting with the payroll are gone.

KeyWords: Платежная ведомость
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.