SAP HR获取工资结果

 

SAP HR 获取工资核算结果的例子程序 EXAMPLE_PNP_GET_PAYROLL。很实用,稍微加工下就可以打印工资单

标准程序源代码摘抄如下: 

***********************************************************************
* 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.



  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值