‎2005 Dec 11 7:59 AM
I want to know how to retrieve the latest infotype for a particular employee or a list of employees. What is the shortcut. Can somebody give a sample code?
Thanks
‎2005 Dec 11 3:46 PM
You can use HR_READ_INFOTYPE too.
If the requirement is to read the most current Infotype, you have to pass sy-datum as the BEGDA & ENDDA in this FM.
If the requirement is to read the last Infotype record, you have to pass '18000101' as the BEGDA & '99991231' ENDDA, then sort the Return itab by BEGDA Descending, so that the first record is the Last Infotype record.
CALL FUNCTION 'HR_READ_INFOTYPE'
EXPORTING
pernr = Pernr
infty = '9010' (example)
begda = <begin date>
endda = <end date.
TABLES
infty_tab = p9010
EXCEPTIONS
infty_not_found = 1
OTHERS = 2.
‎2005 Dec 11 8:15 AM
Hi Rane,
Using logincal database you can do this
Ex: PNP
*Main Prog.
Get Pernr
form
rp-provide-from-last p0000 0000 pnpbegde pnpbegda.
if pnp-sw-found eq 1.
<your process>
endif.
Best Regards,
Aslam Riaz
‎2005 Dec 11 8:27 AM
This will require declaring INFOTYPE: 0001. Statement.
This is obsolete now so how can one retrieve the data without declaring Infotypes. Please email me a sample Infotype program at paragrane@yahoo.com.
‎2005 Dec 12 1:31 PM
INFOTYPES statement is not obsolete (at least in 4.7). It cannot be used in ABAP OO context. But most of HR reports use PNP (or PNPCE) logical databases, and therefore use INFOTYPES statement.
Message was edited by: Sergei Korolev
‎2005 Dec 12 1:46 PM
Hi,
just want to add on to what Sergei mentioned..
Basically, the statement INFOTYPES: 0001 declares an internal table of structure p0001 with header line. And in ABAP Objects declaring tables in this way is not allowed. Hence INFOTYPEs statement cannot be used in ABAP Objects but is not 'Obsolete'.
hope this is clear..
Regards,
Suresh Datti
‎2005 Dec 13 5:02 AM
‎2005 Dec 11 2:22 PM
Are you sure, declaring INFOTYPE is become obselete? We are still using in 4.7 and never had any probelm, never got any warning messages. Are you working on 5.0 and is it obselete in that version?
‎2005 Dec 13 4:42 AM
‎2005 Dec 11 2:34 PM
Try using this sample code, if it helps, please close the issue with appropriate points.
Good luck.
DATA: gs_return TYPE bapireturn1,
gs_key TYPE bapipakey OCCURS 0 WITH HEADER LINE.
CALL FUNCTION 'HR_INFOTYPE_GETLIST'
EXPORTING
infty = '0001'
number = '1009'
SUBTYPE =
timeintervallow = '20051212'
timeintervalhigh = '20051212'
tclas = 'A'
IMPORTING
return = gs_return
TABLES
key = gs_key
.
LOOP AT gs_key.
WRITE:/ gs_key.
ENDLOOP.
‎2005 Dec 13 4:55 AM
I need to get an internal table for a range of employees passed to the bapi thru an internal table
‎2005 Dec 13 5:06 AM
It does not return the latest infotype but returns all data for the employee. I want only latest and for a range of employees passed thru an internal table.
‎2005 Dec 11 3:46 PM
You can use HR_READ_INFOTYPE too.
If the requirement is to read the most current Infotype, you have to pass sy-datum as the BEGDA & ENDDA in this FM.
If the requirement is to read the last Infotype record, you have to pass '18000101' as the BEGDA & '99991231' ENDDA, then sort the Return itab by BEGDA Descending, so that the first record is the Last Infotype record.
CALL FUNCTION 'HR_READ_INFOTYPE'
EXPORTING
pernr = Pernr
infty = '9010' (example)
begda = <begin date>
endda = <end date.
TABLES
infty_tab = p9010
EXCEPTIONS
infty_not_found = 1
OTHERS = 2.
‎2005 Dec 12 9:21 AM
hi
use hr_read_infotype and pass the relevant date u'll get the data!!
PLease reward points for this post if it helps!!
regards
gunjan
‎2005 Dec 13 5:00 AM
I need to pass an internal table having many Employees and get an internale table in return for a particulat employee.
‎2005 Dec 12 11:08 AM
Hi Parag,
Even I didnt see any problem using infotypes
declaration in 4.7 version.
Please let us know which version you r working?
Meanwhile u can use the function module
<b>'HR_READ_INFOTYPE'</b>.
Thanks&Regards,
Siri.
‎2005 Dec 12 2:09 PM
Hi,
As I explained in my prvious reploy you can use
CALL FUNCTION 'HR_INFOTYPE_GETLIST' or you can also use HR_READ_INFOTYPE suggested by our co forum Gurus.
It should work.
Good luck.
Venu
‎2005 Dec 13 5:08 AM
Hi Parag,
Just repeating what others have already said.
But this is the BEST way to work
with HR programming and its infotypes
rather than using logical database
and keyword infotypes.
1. Declare Internal table in this fashion
and use the FM recommended by SAP
2. Data : P0001 Like table of P0001 with header line.
CALL FUNCTION 'HR_READ_INFOTYPE'
EXPORTING
TCLAS = 'A'
pernr = '55'
infty = '0001'
BEGDA = '18000101'
ENDDA = '99991231'
BYPASS_BUFFER = ' '
LEGACY_MODE = ' '
IMPORTING
SUBRC =
tables
infty_tab = P0001
EXCEPTIONS
INFTY_NOT_FOUND = 1
OTHERS = 2
.
Regards,
Amit M.