‎2012 Feb 28 7:13 AM
Hi all,
I am new to oops.
I am trying to write a method which has 2 importing parameters-
1. Employee number.(W_pernr type persno)
2. infotype.(w_infotype type char4)
As of now the output parameter is -
3. changing t_data type table.(I am not sure about this statement at all)
The output has to be an internal table with infotype data.
Since I didn't want to use the function module"HR_READ_INFOTYPE" repeatedly to fetch data from
different infotypes I created the method.I cannot write a perform inside a method and therefore the method.
Below is the code--
method get_infotype_data.
data: w_pernr type persno,
w_infty type char6,
w_dref type ref to data.
w_pernr = w_input.
field-symbols: <t_data> type standard table."Tried any table- I am gettin error
concatenate 'PA' w_infotype into w_infty."(W_infotype can be'0000' or,'0001' or,'0002')
create data w_dref type table of (w_infty).
assign w_dref->* to <t_data>.
call function 'HR_READ_INFOTYPE'
exporting
tclas = 'A'
pernr = w_pernr
infty = w_infotype
BEGDA = '18000101'
ENDDA = '99991231'
BYPASS_BUFFER = ' '
LEGACY_MODE = ' '
IMPORTING
SUBRC =
tables
infty_tab = <t_data>
exceptions
infty_not_found = 1
others = 2.
t_data[] = <t_data>[]."I know this statement is wrong.Data gets concatenated.Cannot move data like this.
endmethod.
************
data comes till <t_data>.
i don't know how to move it to ouput.
What should the output parameter be like ?because the output internal table structure is dynamic.
Warm regards,
Hari Kiran
‎2012 Feb 28 7:58 AM
What do you mean by concatenated ? I just wrote it through function for example. it works fine.
DATA:it_mara TYPE TABLE OF mara.
FIELD-SYMBOLS:<fs> TYPE table.
ASSIGN it_mara TO <fs>.
CALL FUNCTION 'YTESTDATA'
CHANGING
t_data = <fs>.
function ytestdata.
*"----------------------------------------------------------------------
*"*"Local interface:
*" CHANGING
*" REFERENCE(T_DATA) TYPE TABLE
*"----------------------------------------------------------------------
data:it_mara type table of mara.
field-symbols:<fs> type table.
assign it_mara to <fs>.
select * from mara up to 2 rows into table <fs>.
t_data = <fs>.
endfunction.
‎2012 Feb 28 7:58 AM
What do you mean by concatenated ? I just wrote it through function for example. it works fine.
DATA:it_mara TYPE TABLE OF mara.
FIELD-SYMBOLS:<fs> TYPE table.
ASSIGN it_mara TO <fs>.
CALL FUNCTION 'YTESTDATA'
CHANGING
t_data = <fs>.
function ytestdata.
*"----------------------------------------------------------------------
*"*"Local interface:
*" CHANGING
*" REFERENCE(T_DATA) TYPE TABLE
*"----------------------------------------------------------------------
data:it_mara type table of mara.
field-symbols:<fs> type table.
assign it_mara to <fs>.
select * from mara up to 2 rows into table <fs>.
t_data = <fs>.
endfunction.
‎2012 Feb 29 10:07 AM
Hi Keshav,
What you have written is correct.
I resolved my issue by having a look at the following link.
http://wiki.sdn.sap.com/wiki/display/ABAP/HRProgramming-ReadInfotype
It does the same as you have written.
Thanks & Regards,
Hari Kiran
‎2012 Feb 28 8:02 AM