首页 > 其他分享 >ABAP HR 获取薪酬

ABAP HR 获取薪酬

时间:2023-08-16 10:34:28浏览次数:44  
标签:rt HR rgdir detail 薪酬 ABAP lt ls alv

  1 DATA:
  2     l_index           LIKE sy-tabix,
  3     lt_rgdir          TYPE TABLE OF pc260,  "payroll cluster
  4     lw_rgdir          LIKE LINE OF lt_rgdir,
  5     lt_rgdir_a        TYPE TABLE OF pc260,  "payroll cluster
  6     lw_rgdir_a        LIKE LINE OF lt_rgdir,
  7     lv_relid          TYPE relid_pcl,         "cluster id
  8     lw_molga          TYPE molga,         "country grouping
  9 *    ls_payroll_result TYPE pay99_result,         "pay result
 10     lt_hr_crt         TYPE   hrpay99_crt,
 11     ls_hr_crt         TYPE LINE OF   hrpay99_crt,
 12     ls_payroll_result TYPE paycn_result,         "pay result
 13     lt_rt             LIKE LINE OF payroll-inter-rt,
 14     lt_rt2            LIKE LINE OF payroll-inter-rt,
 15     lt_rt3            LIKE LINE OF payroll-inter-rt,
 16     lt_tcrt           TYPE LINE OF paycn_result-nat-tcrt,
 17     l_taxgp           TYPE p0531-taxgp,
 18     l_lastday         LIKE sy-datum,
 19     lv_field          TYPE string,
 20     lv_seqnr          TYPE pc260-seqnr.
 21 
 22   DATA : lt_pa0531 TYPE TABLE OF pa0531 WITH HEADER LINE  .
 23   DATA:lv_inper(6) TYPE c.
 24   lv_inper = p_year && p_month.
 25 
 26   LOOP AT lt_pernr INTO ls_pernr.
 27     l_index  = sy-tabix.
 28     REFRESH  lt_rgdir.
 29     CLEAR:lv_relid,lw_molga,l_lastday,lv_seqnr.
 30 *获取人员的工资存储的簇表ID
 31     CALL FUNCTION 'CD_READ_RGDIR'     " 获取当前员工编号的工资项
 32       EXPORTING
 33         persnr          = ls_pernr-pernr
 34       TABLES
 35         in_rgdir        = lt_rgdir
 36       EXCEPTIONS
 37         no_record_found = 1
 38         OTHERS          = 2.
 39 *删除不符合当前月份的数据。
 40     LOOP AT lt_rgdir INTO lw_rgdir.
 41       IF lw_rgdir-inper EQ '000000' OR lw_rgdir-fpper EQ '000000'.
 42         IF lw_rgdir-fpbeg IS NOT INITIAL.
 43           lw_rgdir-inper = lw_rgdir-fpbeg+0(6).
 44           lw_rgdir-fpper =  lw_rgdir-fpbeg+0(6).
 45         ENDIF.
 46       ENDIF.
 47       MODIFY lt_rgdir FROM lw_rgdir.
 48     ENDLOOP.
 49     DELETE lt_rgdir WHERE fpper <> lv_inper.
 50     DELETE lt_rgdir WHERE inper <> lv_inper.
 51 *    delete lt_rgdir where srtza <> 'A' or payty ne space.
 52     DELETE lt_rgdir WHERE srtza <> 'A'.
 53     IF lt_rgdir[] IS INITIAL.
 54       DELETE lt_pernr INDEX l_index.
 55       CONTINUE.
 56     ENDIF.
 57     READ TABLE   lt_rgdir INTO lw_rgdir INDEX 1.
 58     IF sy-subrc EQ 0.
 59       IF lw_rgdir-abkrs NOT IN pnpabkrs.
 60         DELETE lt_pernr INDEX l_index.
 61         CONTINUE.
 62       ENDIF.
 63     ENDIF.
 64 
 65 *获取当前员工的
 66     CALL FUNCTION 'PYXX_GET_RELID_FROM_PERNR'  " 获取当前员工编号的工资项
 67       EXPORTING
 68         employee                    = ls_pernr-pernr
 69       IMPORTING
 70         relid                       = lv_relid
 71         molga                       = lw_molga
 72       EXCEPTIONS
 73         error_reading_infotype_0001 = 1
 74         error_reading_molga         = 2
 75         error_reading_relid         = 3
 76         OTHERS                      = 4.
 77 
 78 
 79     CLEAR:ls_alv_detail.
 80     MOVE-CORRESPONDING ls_pernr TO ls_alv_detail.
 81 
 82     SELECT SINGLE kst01 INTO ls_alv_detail-kostl FROM pa0027 WHERE pernr = ls_pernr-pernr AND begda <= lv_begin AND endda >= lv_end.
 83     IF ls_alv_detail-kostl IS INITIAL.
 84       SELECT SINGLE kostl INTO ls_alv_detail-kostl FROM pa0001 WHERE pernr = ls_pernr-pernr AND begda <= lv_begin AND endda >= lv_end.
 85     ENDIF.
 86 
 87     ls_alv_detail-zhrssnd = p_year."年度
 88     ls_alv_detail-zhrssyf = p_month. "月份
 89     ls_alv_detail-waers = 'RMB'."货币码
 90 
 91 
 92     LOOP AT lt_rgdir INTO lw_rgdir .
 93 *取工资相关。
 94       CLEAR  ls_payroll_result .
 95       CALL FUNCTION 'PYXX_READ_PAYROLL_RESULT'
 96         EXPORTING
 97           clusterid                    = lv_relid
 98           employeenumber               = ls_pernr-pernr
 99           sequencenumber               = lw_rgdir-seqnr
100 *         read_only_international      = 'X'
101 *         check_read_authority         = 'X'
102         CHANGING
103           payroll_result               = ls_payroll_result
104         EXCEPTIONS
105           illegal_isocode_or_clusterid = 1
106           error_generating_import      = 2
107           import_mismatch_error        = 3
108           subpool_dir_full             = 4
109           no_read_authority            = 5
110           no_record_found              = 6
111           versions_do_not_match        = 7
112           error_reading_archive        = 8
113           error_reading_relid          = 9
114           OTHERS                       = 10.
115       CLEAR tax.
116 
117       LOOP AT ls_payroll_result-inter-rt INTO lt_rt.
118         CASE lt_rt-lgart.
119           WHEN '/314'.
120             ls_alv_detail-zhryldwjn = ls_alv_detail-zhryldwjn + lt_rt-betrg."养老金单位缴纳
121           WHEN '9003'.
122             ls_alv_detail-zhryldwbj = ls_alv_detail-zhryldwbj + lt_rt-betrg."养老单位补缴
123           WHEN '/313'.
124             ls_alv_detail-zhrylgrjn = ls_alv_detail-zhrylgrjn + lt_rt-betrg."养老个人缴纳
125           WHEN '9004'.
126             ls_alv_detail-zhrylgrbj = ls_alv_detail-zhrylgrbj + lt_rt-betrg."养老个人补缴
127           WHEN '/334'.
128             ls_alv_detail-zhryldwjn1 = ls_alv_detail-zhryldwjn1 + lt_rt-betrg."医疗单位缴纳
129           WHEN '9013'.
130             ls_alv_detail-zhryldwbj1 = ls_alv_detail-zhryldwbj1 + lt_rt-betrg."医疗单位补缴
131           WHEN '/333'.
132             ls_alv_detail-zhrylgrjn1 = ls_alv_detail-zhrylgrjn1 + lt_rt-betrg."医疗个人缴纳
133           WHEN '9014'.
134             ls_alv_detail-zhrylgrbj1 = ls_alv_detail-zhrylgrbj1 + lt_rt-betrg."医疗个人补缴
135           WHEN '/324'.
136             ls_alv_detail-zhrsydwjn = ls_alv_detail-zhrsydwjn + lt_rt-betrg."失业单位缴纳
137           WHEN '9023'.
138             ls_alv_detail-zhrsydwbj = ls_alv_detail-zhrsydwbj + lt_rt-betrg."失业单位补缴
139           WHEN '/323'.
140             ls_alv_detail-zhrsygrjn = ls_alv_detail-zhrsygrjn + lt_rt-betrg."失业个人缴纳
141           WHEN '9024'.
142             ls_alv_detail-zhrsygrbj = ls_alv_detail-zhrsygrbj + lt_rt-betrg."失业个人补缴
143           WHEN '/344'.
144             ls_alv_detail-zhrgsdwjn = ls_alv_detail-zhrgsdwjn + lt_rt-betrg."工伤单位缴纳
145           WHEN '9032'.
146             ls_alv_detail-zhrgsdwbj = ls_alv_detail-zhrgsdwbj + lt_rt-betrg."工伤单位补缴
147           WHEN '/354'.
148             ls_alv_detail-zhrsydwjn1 = ls_alv_detail-zhrsydwjn1 + lt_rt-betrg."生育单位缴纳
149           WHEN '9042'.
150             ls_alv_detail-zhrsydwbj1 = ls_alv_detail-zhrsydwbj1 + lt_rt-betrg."生育单位补缴
151           WHEN '/363'.
152             ls_alv_detail-zhrzfdwjn = ls_alv_detail-zhrzfdwjn + lt_rt-betrg."住房公积金单位缴纳
153           WHEN '9053'.
154             ls_alv_detail-zhrzfdwbj = ls_alv_detail-zhrzfdwbj + lt_rt-betrg."住房公积金单位补缴
155           WHEN '/362'.
156             ls_alv_detail-zhrzfgrjn = ls_alv_detail-zhrzfgrjn + lt_rt-betrg."住房公积金个人缴纳
157           WHEN '9054'.
158             ls_alv_detail-zhrzfgrbj = ls_alv_detail-zhrzfgrbj + lt_rt-betrg."住房公积金个人补缴
159           WHEN '/CRR'.
160             ls_alv_detail-zhrnjdwjn = ls_alv_detail-zhrnjdwjn + lt_rt-betrg."年金单位缴纳
161           WHEN '9063'.
162             ls_alv_detail-zhrnjdwbj = ls_alv_detail-zhrnjdwbj + lt_rt-betrg."年金单位补缴
163           WHEN '/CRE'.
164             ls_alv_detail-zhrnjgrjn = ls_alv_detail-zhrnjgrjn + lt_rt-betrg."年金个人缴纳
165           WHEN '9064'.
166             ls_alv_detail-zhrnjgrbj = ls_alv_detail-zhrnjgrbj + lt_rt-betrg."年金个人补缴
167           WHEN '7A34'.
168             ls_alv_detail-zhrbcyldwjn = ls_alv_detail-zhrbcyldwjn + lt_rt-betrg."补充医疗单位缴纳
169           WHEN '9073'.
170             ls_alv_detail-zhrbcyldwbj = ls_alv_detail-zhrbcyldwbj + lt_rt-betrg."补充医疗单位补缴
171           WHEN '/3S4'.
172             ls_alv_detail-zhrdbdwjn = ls_alv_detail-zhrdbdwbj + lt_rt-betrg."大病统筹单位缴纳
173           WHEN '9082'.
174             ls_alv_detail-zhrdbdwbj = ls_alv_detail-zhryldwjn1 + lt_rt-betrg."大病统筹单位补缴
175           WHEN '7A35'.
176             ls_alv_detail-zhrdbgrjn = ls_alv_detail-zhrdbgrjn + lt_rt-betrg."大病统筹个人缴纳
177           WHEN '7A20'.
178             ls_alv_detail-zhrzfbt = ls_alv_detail-zhrdbgrjn + lt_rt-betrg."住房补贴单位缴纳(/3H3)
179         ENDCASE.
180 
181         IF lt_rt-lgart = '/403' OR lt_rt-lgart = '/404'.
182           ls_alv_detail-zhrgs = ls_alv_detail-zhrgs + lt_rt-betrg."个人所得税
183         ENDIF.
184 
185       ENDLOOP.
186 
187     ENDLOOP.
188     "公司
189     ls_alv_detail-ac01 = ls_alv_detail-zhryldwjn + ls_alv_detail-zhryldwbj."养老保险
190     ls_alv_detail-ac02 = ls_alv_detail-zhryldwjn1 + ls_alv_detail-zhryldwbj1."医疗保险
191     ls_alv_detail-ac03 = ls_alv_detail-zhrsydwjn + ls_alv_detail-zhrsydwbj."失业保险
192     ls_alv_detail-ac04 = ls_alv_detail-zhrgsdwjn + ls_alv_detail-zhrgsdwbj."工伤保险
193     ls_alv_detail-ac05 = ls_alv_detail-zhrsydwjn1 + ls_alv_detail-zhrsydwbj1."生育保险
194     ls_alv_detail-ac06 = ls_alv_detail-zhrzfdwjn + ls_alv_detail-zhrzfdwbj."公积金
195     ls_alv_detail-ac07 = ls_alv_detail-zhrnjdwjn + ls_alv_detail-zhrnjdwbj."企业年金
196     ls_alv_detail-ac08 = ls_alv_detail-zhrbcyldwjn + ls_alv_detail-zhrbcyldwbj."补充医疗保险
197     ls_alv_detail-ac09 = ls_alv_detail-zhrdbdwjn + ls_alv_detail-zhrdbdwbj."大病统筹
198     ls_alv_detail-ac10 = ls_alv_detail-zhrzfbt."住房单位缴纳
199     "个人
200     ls_alv_detail-ap01 = ls_alv_detail-zhrylgrjn + ls_alv_detail-zhrylgrbj."养老保险
201     ls_alv_detail-ap02 = ls_alv_detail-zhrylgrjn1 + ls_alv_detail-zhrylgrbj1."医疗保险
202     ls_alv_detail-ap03 = ls_alv_detail-zhrsygrjn + ls_alv_detail-zhrsygrbj."失业保险
203     ls_alv_detail-ap06 = ls_alv_detail-zhrzfgrjn + ls_alv_detail-zhrzfgrbj."公积金
204     ls_alv_detail-ap07 = ls_alv_detail-zhrnjgrjn + ls_alv_detail-zhrnjgrbj."企业年金
205     ls_alv_detail-ap09 = ls_alv_detail-zhrdbgrjn."大病统筹
206 
207     ls_alv_detail-az01 = ls_alv_detail-zhrgs.
208 
209 
210     APPEND ls_alv_detail TO lt_alv_detail.
211 
212   ENDLOOP.
213   SORT lt_alv_detail BY zhrfxdw zhrdjdw.
View Code

 

标签:rt,HR,rgdir,detail,薪酬,ABAP,lt,ls,alv
From: https://www.cnblogs.com/coderfarmer/p/17633311.html

相关文章

  • ThreadLocal的学习心得
    ThreadLocal是Java提供的线程本地存储机制,可以实现多线程环境下数据的隔离。主要特点是:每个线程都有自己的实例副本,实现了线程的数据隔离。ThreadLocal中存储的值对其他线程都不可见。通过get()和set()来读写当前线程的实例副本,避免了线程安全问题。本地线程副本通过弱......
  • 软件测试|Chrome 115之后的版本,如何更新driver?
    2023年8月,chrome自动更新到115版本了,而从https://registry.npmmirror.com/binary.html?path=chromedriver/处只能下载114版本的driver,无法工作。参考:https://blog.csdn.net/Tester_muller/article/details/132086996  找到https://googlechromelabs.github.io/chrome-for......
  • 自定义实现可跨线程(线程池)的ThreadLocal
    packageTest0814;importcom.google.common.collect.Maps;importjava.util.HashMap;importjava.util.Map;importjava.util.WeakHashMap;publicclassMyThreadLocal<T>extendsInheritableThreadLocal<T>{//方法1publicstaticfinalInherita......
  • ABAP EXCEL批导和查看自建表样板
    结果:  内文:  源代码:ZHMRFI017:*&---------------------------------------------------------------------**&ReportZHMRFI017*&*&---------------------------------------------------------------------**&*&*&-------------......
  • 字节码角度看synchronized和反射的实现原理
    前几天,关于字节码技术,我们讲了字节码的基础,常见的字节码框架以及在软件破解和APM链路监控方面的一些应用.今天我们回到Java本身,看下我们常用的synchronized关键字和反射在字节码层面是如何实现的.synchronized代码块级别的synchronized如下方法的内部使用了synchronized......
  • C++11时间日期库chrono的使用
    chrono是C++11中新加入的时间日期操作库,可以方便地进行时间日期操作,主要包含了:duration,time_point,clock。时钟与时间点chrono中用time_point模板类表示时间点,其支持基本算术操作;不同时钟clock分别返回其对应类型的时间点。clock时钟是从一个时点开始,按照某个刻度的计数;chrono同......
  • Python中threading模块 lock、Rlock的使用
    一、概述在使用多线程的应用下,如何保证线程安全,以及线程之间的同步,或者访问共享变量等问题是十分棘手的问题,也是使用多线程下面临的问题,如果处理不好,会带来较严重的后果,使用python多线程中提供Lock、Rlock、Semaphore、Event、Condition用来保证线程之间的同步,后者保证访问......
  • synchronized的作用?synchronized的原理?
    引言​在并发编程中,为了保证线程安全和数据一致性,Java提供了synchronized关键字来实现对共享资源的同步访问。synchronized关键字可以应用于方法和代码块,它在多线程环境下起到了重要的作用。本文将深入探讨synchronized的作用和原理,并给出相应的代码示例。synchronized的作用sy......
  • SAP ABAP Lock 的 Collision Check 机制介绍
    SAPABAP系统使用CollisionCheck机制来检查锁请求是否与现有锁冲突。如果发生冲突,对话事务的用户会收到一条消息,指示所请求的对象当前已被不同的用户锁定。注意:对于非对话工作进程(在批量输入中),稍后会再次发出锁定请求。SAP官方文档中对collisioncheck机制的描述:There......
  • SAP ABAP 系统 SM51 事务码的作用
    副标题:SAPABAP系统中事务码SM51的作用:深入探究系统进程与资源管理SM51是SAP系统中的一个重要事务码,用于监控和管理系统中运行的后台工作进程和应用服务器资源。在本文中,我将详细解释SM51的功能,探讨其作用,并通过案例说明其在实际场景中的应用。SM51事务码的功能SM51事务......