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

Get payroll



 
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: 1640

PostPosted: Mon Oct 08, 2007 4:07 pm    Post subject: Get payroll Reply with quote

This program is used 'PNP' Logical Database
Code:
***********************************************************************
* EXAMPLE Report  EXAMPLE_PNP_GET_PAYROLL                             *
* PNP: New event: GET PAYROLL for access to payroll results           *
*                                                                     *
* Use '900' as selection screen (report attributes)                   *
*                                                                     *
* The selection screen can be customized by assigning a PNP payroll   *
* reportclass to this report (the default is PY_DEF): Go to ->        *
* report properties -> Button HR reportclass -> check the box "Payroll*
*-reportclass -> Press create to enter the customizing view.           *
*                                                                     *
*  4.6C VRM Small changes                                             *
*                                                                     *
*  4.6A VRM New report                                                *
*                                                                     *
***********************************************************************
REPORT EXAMPLE_PNP_GET_PAYROLL.

* These three tables need to be declared for the selection screen-.
* Currently, the declarations of  pyorgscreen, pytimescreen HAS to
* be done in addition to setting selection screen = 900 .
TABLES: pernr,pyorgscreen, pytimescreen.

* Declare the country specific structure:
* payXX_result with  XX = country code, e.g. payDE_result for Germany
* Country = 99 is an exception: If this structure is used, the
* international part of every payroll result is returned regardless
* of country code. In the other case, pernr's whose country code do
* not fit the structure are skipped.
NODES: payroll TYPE pay99_result.

* this section is example specific
TABLES: t512t.
DATA: wa_rt LIKE LINE OF payroll-inter-rt.
DATA: wa_crt LIKE LINE OF payroll-inter-crt.
DATA: wa_wpbp LIKE LINE OF payroll-inter-wpbp.
Data: g_result_counter type i.

* Declarations for modifying the result list after GET PERNR
DATA mylist LIKE  pc261 OCCURS 0 .
DATA wa_mylist LIKE LINE OF mylist.
DATA pay TYPE REF TO cl_pay.  "global class

INITIALIZATION.
* nothing to do here

*----------------------------------------
GET pernr.
* A progress indicator based on the number of pernrs processed / total
* number of selected pernrs is automatically calculated & displayed.


  WRITE: / 'Currently working on:'(021), pernr-pernr.
  g_result_counter = 0.

* The infotypes could be accessed here as in any other PNP
* based report. The same holds true for the infotype based
* authorizations.



* You can use the methods of class "pay" to read and modify
* the list of payroll result that is going to be processed at
* the <get payroll> event. However, these method calls might
* change with the next release.

  CREATE OBJECT pay.
* pay->LDB = 'SAPDB_MY_OWN_LDB'. "only if you copied the LDB PNP

  CALL METHOD pay->read_result IMPORTING list = mylist.

 "delete mylist index 2. "For example: Remove an unwanted payroll result

  CALL METHOD pay->write_result EXPORTING list = mylist.

*--------------------------------------
* After all payroll results for ONE pernr are processed, the event GET
* LATE is triggered. A good place to e. g. sum up results.
GET pernr LATE.

  SKIP 1.
  WRITE: / 'Found'(022), g_result_counter, 'results for #'(023),
pernr-pernr.
  if g_result_counter = 0.
write: /
'No results ? Did you assign the right structure to node PAYROLL?'(024).
  endif.
  ULINE.

*--------------------------------------
GET payroll.
* At the event <payroll> the complex struture payroll is filled
* with the payroll result for the specific person. The structure
* of payroll is as declared above.

 g_result_counter =  g_result_counter + 1.

* Print some parts of the result (ignore splits for simplicity)
  WRITE: / '*****************************************************'.
  WRITE: / 'Seqnr = '(014),    payroll-evp-seqnr,
           'In period ='(015),   payroll-inter-versc-inper,
           'For period ='(016),  payroll-inter-versc-fpper,
           'Pay date ='(017),  payroll-inter-versc-paydt.

  LOOP AT payroll-inter-wpbp INTO wa_wpbp.
    WRITE:   / 'Personal Area ='(018),  wa_wpbp-werks,
               'Sub Area ='(019),  wa_wpbp-btrtl.
  ENDLOOP.
  SKIP 1.

  LOOP AT payroll-inter-rt INTO wa_rt.
    SELECT SINGLE * FROM t512t
                WHERE sprsl EQ sy-langu
                AND   molga EQ payroll-inter-versc-molga
                AND   lgart EQ wa_rt-lgart.
    WRITE: / wa_rt-lgart,
             t512t-lgtxt,
             wa_rt-betrg CURRENCY   payroll-inter-versc-waers.
  ENDLOOP.
  SKIP 1.

  WRITE: / 'Cumulations:'(020).
  LOOP AT payroll-inter-crt INTO wa_crt.
    SELECT SINGLE * FROM t512t
                WHERE sprsl EQ sy-langu
                AND   molga EQ payroll-inter-versc-molga
                AND   lgart EQ wa_crt-lgart.
    WRITE: / wa_crt-lgart,
             t512t-lgtxt,
             wa_crt-betrg CURRENCY   payroll-inter-versc-waers.
  ENDLOOP.
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.