Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

I need to get base salary (pa0008-ansal) from previous year

siongchao_ng
Contributor
0 Kudos

Hi all,

I need to write a alv report where it will display selected employees with base salary for current year and previous year.

Anyone knows how I can derive the base salary for previous year? Thanks. <removed by moderator>.

Currently I am using this FM, but it is not working in client system due to indirect evaluation method not allowed ( I have no idea what is that about ) :

CONCATENATE lv_previous_year '0101' INTO lv_previous_begda.

CONCATENATE lv_previous_year '1231' INTO lv_previous_endda.

LOOP AT lt_salary INTO ls_salary.

CALL FUNCTION 'RP_ANSAL_FROM_PERNR'

EXPORTING

F_DATE = lv_previous_begda

  • F_TCLAS = 'A'

F_PERNR = ls_salary-pernr

IMPORTING

F_ANSAL = lv_previous_ansal

EXCEPTIONS

INTERNAL_ERROR = 1

ERROR_READ_0001 = 2

ERROR_READ_0008 = 3

ERROR_AT_INDIRECT_EVALUATION = 4

CURRENCY_CONVERSION_ERROR = 5

OTHERS = 6

.

ls_salary-prev_salary = lv_previous_ansal.

MODIFY lt_salary FROM ls_salary TRANSPORTING prev_salary .

ENDLOOP.

Edited by: Thomas Zloch on Oct 3, 2011 10:40 AM

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Use HR_PT_GET_PAYROLL_RESULTS function module will help you to get payroll result......

Regards

Ajit

9 REPLIES 9

Former Member
0 Kudos

Use HR_PT_GET_PAYROLL_RESULTS function module will help you to get payroll result......

Regards

Ajit

0 Kudos

Hi ajitabap,

What is the result_tab typed to??

0 Kudos

PARAMETERS: P_PERNR TYPE P0000-PERNR,

P_STDATE TYPE PC261-FPBEG,

P_ENDATE TYPE PC261-FPEND.

CALL FUNCTION 'HR_PT_GET_PAYROLL_RESULTS'

EXPORTING

p_pernr = P_PERNR

FPPER_BEGDA = P_STDATE

FPPER_ENDDA = P_ENDATE

tables

result_tab = IT_RESTAB

  • EXCEPTIONS

  • NO_RESULTS = 1

  • NO_READ_AUTHORITY = 2

  • IMPORT_MISMATCH_ERROR = 3

  • T500L_ENTRY_NOT_FOUND = 4

  • OTHERS = 5

.

IF sy-subrc 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

*************************************************************************

Here result_tab Type PC207

Regards

Ajit

0 Kudos

PARAMETERS: P_PERNR TYPE P0000-PERNR,

P_STDATE TYPE PC261-FPBEG,

P_ENDATE TYPE PC261-FPEND.

CALL FUNCTION 'HR_PT_GET_PAYROLL_RESULTS'

EXPORTING

p_pernr = P_PERNR

FPPER_BEGDA = P_STDATE

FPPER_ENDDA = P_ENDATE

tables

result_tab = IT_RESTAB

  • EXCEPTIONS

  • NO_RESULTS = 1

  • NO_READ_AUTHORITY = 2

  • IMPORT_MISMATCH_ERROR = 3

  • T500L_ENTRY_NOT_FOUND = 4

  • OTHERS = 5

.

IF sy-subrc 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

*************************************************************************

Here result_tab Type PC207

Regards

Ajit

0 Kudos

Hi Ajit,

I used lt_result_tab type pc207 occurs 0.

And program will hit the dump. Error message "Perform conflict type".

Error Analysis:

An exception occurred that is explained in detail below.

The exception, which is assigned to class 'CX_SY_DYN_CALL_ILLEGAL_TYPE', was

not caught in

procedure "HR_PT_READ_PAYROLL_RESULT" "(FUNCTION)", nor was it propagated by a

RAISING clause.

Since the caller of the procedure could not have anticipated that the

exception would occur, the current program is terminated.

The reason for the exception is:

Call to FORM "IMPORT_RESULT" is incorrect:

The actual parameter no. 1 has a different data type in the

PERFORM than requested for the FORM "IMPORT_RESULT" in program "SAPL3P03".

0 Kudos

Please Define An Internal Table Which has same structure like pc207 .........

Also Provide you other FM used for this purpose..

HR_PT_READ_PAYROLL_RESULT

HR_CA_GET_ORIGINAL_PAYROLL

HR_FR_GET_PAYROLL_RESULTS

HR_GET_PAYROLL_RESULTS

HR_SE_PAYROLL_STATUS_GET

Regards

Ajit

Edited by: ajitabap on Oct 3, 2011 11:29 AM

Former Member
0 Kudos

Hi,

Use HR_READ_INFOTYPE function to read infotype 8. this function has begda and endda parameters so you can limit time and call twice.

Take care.

Çağatay

Former Member
0 Kudos

Hii,

You can use 'BAPI_BASICPAY_GETDETAIL' function module, and put begda endda with the previous year. This function module can read from indirect infotype also.

Regards

Bayu Lesmana

MarcinPciak
Active Contributor
0 Kudos

Requirement for getting base salary for particular year is ambigous to me. An employee has base salary on his/her contract. Terms of contract can change within a year i.e. in November his salary raises due to promotion. What then? I think you should already gave the answer yourself (PA0008). If last information in year matters, read last record of IT0008 and get required WT which holds base salary info.

Don't need to read clusters. Although they keep info about base salay as well, via selection of correct WT in IT008 you derive this info much easier and faster. This would be helpful only if real net pay counted.

Regards

Marcin