Application Development and Automation 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: 
Read only

Method changing parameter

Former Member
0 Likes
1,138

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

1 ACCEPTED SOLUTION
Read only

kesavadas_thekkillath
Active Contributor
0 Likes
1,027

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.

3 REPLIES 3
Read only

kesavadas_thekkillath
Active Contributor
0 Likes
1,028

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.

Read only

0 Likes
1,027

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

Read only

Former Member
0 Likes
1,027

Closing thread.