‎2009 May 21 2:16 PM
Hi Guy's,
Please help me presently i am working with this functionmodule : HR_RECOGNIZE_EMPLOYEE.
to get the p0002-tab results i wrote the code like this
REPORT ZEMPLOYEE_DATA.
tables : pa0002.
types : begin of ty_0002,
pernr type PERSNO,
NACHN type PAD_NACHN,
vorna type PAD_VORNA,
gbdat type GBDAT,
PERID type PERID,
end of ty_0002.
data : it_0002 type standard table of ty_0002,
wa_0002 type ty_0002.
data : it_result type standard table of p0002.
select-options : s_pernr for pa0002-pernr.
start-of-selection.
select pernr
nachn
vorna
gbdat
perid
from pa0002
into table it_0002
where pernr in s_pernr.
if sy-subrc = 0.
sort it_0002 by pernr.
endif.
loop at it_0002 into wa_0002.
CALL FUNCTION 'HR_RECOGNIZE_EMPLOYEE'
EXPORTING
vorna = wa_0002-vorna
nachn = wa_0002-nachn
gbdat = wa_0002-gbdat
perid = wa_0002-perid
GESCH =
EXCLUDE_PERNR = wa_0002-pernr
IMPORTING
P0002_TAB = it_result
EXCEPTIONS
NO_PERNR_FOUND = 1
LACK_OF_INPUT = 2
OTHERS = 3
.
*IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
*ENDIF.
endloop.
But every time it giving single record.
Kindly hlep me friends, based on the selection entries i nedd it_results.
Thanks and Regards,
Sai.
‎2009 May 21 2:24 PM
hi,
Create one more internal table and append the records of it_result into the internal table after calling function module HR_RECOGNIZE_EMPLOYEE inside your loop statement.
‎2009 May 21 2:24 PM
Inside loop check for sy-subrc for error and append it to an internal table to get final table with all entries.. then clear your table.
loop at it_0002 into wa_0002.
CALL FUNCTION 'HR_RECOGNIZE_EMPLOYEE'
EXPORTING
vorna = wa_0002-vorna
nachn = wa_0002-nachn
gbdat = wa_0002-gbdat
perid = wa_0002-perid
GESCH =
EXCLUDE_PERNR = wa_0002-pernr
IMPORTING
P0002_TAB = it_result
EXCEPTIONS
NO_PERNR_FOUND = 1
LACK_OF_INPUT = 2
OTHERS = 3
IF sy-subrc EQ 0.
Append it_result to an Internal Table say ITAB
clear it_result[]
ENDIF.
endloop.
‎2009 Aug 04 10:58 AM
Writing a Function Module inside a loop slows down the program !
‎2009 Aug 04 11:12 AM
Hello,
Create one more internal table of type pa0002.
After fetching the record in it_result in fuction module, Append the record in the new internal table.
Then clear the internal table it_resultin the loop itself.
Regards