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: 

How to get data from Infotype

Former Member
0 Kudos

I have an infotype e.g nnnn which contains the basic salary and allowances for all employees.How can I get the data from infotype for a particular employee (by unique employee no)? Can I get the example code for understanding?

Regards,

Aisha Ishrat.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

assign PNP ldb in your programe attributes and code like following

tables : pernr,

infotypes : 0000, 0001,0002,0004 .

start-of-selection.

get pernr.

provide * from p000 between pn-begda and pn-endda

  • from p0001

put your condition like where <.........>

endprovide.

or you also can get data if you dont want to use LDB.

every info type will be associated with table

ex if infotype is 0001 table name is p0001.

so you can also write select statement .

Thanks

8 REPLIES 8

Former Member
0 Kudos

assign PNP ldb in your programe attributes and code like following

tables : pernr,

infotypes : 0000, 0001,0002,0004 .

start-of-selection.

get pernr.

provide * from p000 between pn-begda and pn-endda

  • from p0001

put your condition like where <.........>

endprovide.

or you also can get data if you dont want to use LDB.

every info type will be associated with table

ex if infotype is 0001 table name is p0001.

so you can also write select statement .

Thanks

Former Member
0 Kudos

hi Alisha,

u can use table,

PA0008:basic Pay

PA0009 Bank Details

PA0015 Additional Payment

pass PERNR (employee number) and u will get all information.....

u can get details from table starting with PA*

reward point if helpful,

Regards,

Imran

Former Member
0 Kudos

Also you can use Function Module "HR_READ_INFOTYPE".

Former Member
0 Kudos

Hi

see this sample code to fetch the salary details from INfotype pa0008.

REPORT RPABAP06.

TABLES:PERNR.

INFOTYPES: 0008.

DATA: BEGIN OF WAGETYPES,

LGA LIKE P0008-LGA01,

BET LIKE P0008-BET01,

ANZ LIKE P0008-ANZ01,

EIN LIKE P0008-EIN01,

OPK LIKE P0008-OPK01,

END OF WAGETYPES.

GET PERNR.

RP_PROVIDE_FROM_LAST P0008 SPACE PN-BEGDA PN-ENDDA.

DO 20 TIMES VARYING WAGETYPES

FROM P0008-LGA01

NEXT P0008-LGA02.

IF WAGETYPES-LGA IS INITIAL.

EXIT.

ELSE.

WRITE: / WAGETYPES-LGA, WAGETYPES-BET.

ENDIF.

ENDDO.

Reward points if useful

Regards

Anji

Former Member
0 Kudos

If we want to extract data from infotype 'nnn' (Ex : 0000,0001) then the data will be available in table PA or PB nnnn table, emp number as one of the key.

Just write select quiery to extract data from PA/PB tables.

All the very best to you.

Regards

-Mohan.

Former Member
0 Kudos

Here's an example code of FM HR_READ_INFOTYPE:

DATA pernr TYPE pernr.
INFOTYPES 0008.    "Your Infotype

CALL FUNCTION 'HR_READ_INFOTYPE'
         EXPORTING
            pernr = pernr
            infty = '0008'  "Your Infotype
            begda = '18000101'
            endda = '99991231'
         TABLES
           infty_tab = p0008.

Former Member
0 Kudos

I did this as follows:

Report zinfo.

tables pa0008.

data : begin of f-tab occurs 0,

annual-salary like pa0008-ansal,

end of f-tab.

select * from pa0008.

f-tab-annual-salary = pa0008-ansal.

append f-tab to f-tab.

endselect.

loop at f-tab.

write f-tab-annual-salary.

skip.

endloop.

Former Member
0 Kudos

Hi aisha,

1. If u want to get data from infotype 0008,

then its better to use the FM

BAPI_BASICPAY_GETDETAIL

regards,

amit m.