Skip to Content
0
Former Member
Jun 10, 2014 at 03:50 PM

getting data from infotype

732 Views

Hello Experts!

I am a beginner in ABAP programming and I have problem with one of my task.

I would like to get all users first and last names from infotype p0002. I've created a class, and method but only thing I've found in the Internet was something like this:

DATA: lt_data TYPE REF TO data,
return LIKE sy-subrc.

FIELD-SYMBOLS: <table> TYPE STANDARD TABLE.

CREATE DATA lt_data TYPE STANDARD TABLE OF PA0002.
ASSIGN lt_data->* TO <table>.

CALL FUNCTION 'HR_READ_INFOTYPE'
EXPORTING
pernr = '3'
infty = '0002'
begda = '18000101'
endda = '99991231'
IMPORTING
subrc = return
TABLES
infty_tab = <table>
EXCEPTIONS
infty_not_found = 1
OTHERS = 2.

IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
me_it = <table>.
ENDIF.

any suggestions how I can use it for all users and how to get data from the result? or is it useless for this task? help please