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

Subroutine changing parameters issue

naveen_inuganti2
Active Contributor
0 Likes
1,994

Hi.. Friends...

I created one function module...

In that Iam created one subroutine, that is saved in Finclude of that function group.

Here in function module source code....

data:  itab  TYPE STANDARD TABLE OF <dbtable>  WITH HEADER LINE.
/////
perform fill_data changing itab.

For this subroutine F include source code...

FORM fill_data CHANGING itab standard table.
                         
 <SELECT STATEMENT WITH ABOVE INTERNAL TABLE>

ENDFORM.

Now the problem is F inculde activating with out any errors.

But while activating FM iam getting following error message....

>>In PERFORM "FILL_DATA", the actual parameter "ITAB" and

>>formal parameter "ITAB" are incompatible. "ITAB" is

>>the header line of table "ITAB[]".

Where i did mistake.

Thanks,

Naveen.I

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,336

Hi naveen,

1. For Passing tables,

the TABLES syntax should be used normally,

instead of changing.

By using the TABLES syntax, we can also CHANGE

the tables content.

2. I tried just now, and this syntax will work.

data: itab TYPE STANDARD TABLE OF t001 WITH HEADER LINE.

*----


data: itab TYPE STANDARD TABLE OF t001 WITH HEADER LINE.

perform fill_data tables itab .

*----


FORM fill_data tables itab structure t001.

select query....

ENDFORM.

regards,

amit m.

5 REPLIES 5
Read only

Former Member
0 Likes
1,336

Hi,

Use TABLES instead of CHANGING.

perform fill_data TABLES itab.

take help of this example.

PARAMETERS: p_carr TYPE sflight-carrid,

p_conn TYPE sflight-connid.

DATA sflight_tab TYPE STANDARD TABLE OF sflight.

...

PERFORM select_sflight TABLES sflight_tab

USING p_carr p_conn.

...

FORM select_sflight TABLES flight_tab LIKE sflight_tab

USING f_carr TYPE sflight-carrid

f_conn TYPE sflight-connid.

SELECT *

FROM sflight

INTO TABLE flight_tab

WHERE carrid = f_carr AND

connid = f_conn.

ENDFORM.

hope this helps.

thanx,

dhanashri.

Edited by: Dhanashri Pawar on Aug 20, 2008 9:19 AM

Read only

Former Member
0 Likes
1,337

Hi naveen,

1. For Passing tables,

the TABLES syntax should be used normally,

instead of changing.

By using the TABLES syntax, we can also CHANGE

the tables content.

2. I tried just now, and this syntax will work.

data: itab TYPE STANDARD TABLE OF t001 WITH HEADER LINE.

*----


data: itab TYPE STANDARD TABLE OF t001 WITH HEADER LINE.

perform fill_data tables itab .

*----


FORM fill_data tables itab structure t001.

select query....

ENDFORM.

regards,

amit m.

Read only

0 Likes
1,336

HI Friends...

Function module source code....

data:  itab  TYPE STANDARD TABLE OF <dbtable>  WITH HEADER LINE.
/////
perform fill_data TABLES itab.

For this subroutine F include source code...

FORM fill_data TABLES itab standard table.
                         
 <SELECT STATEMENT WITH ABOVE INTERNAL TABLE>
 
ENDFORM.

...Is working fine.

Hi... Vinod... As I hav no.of declarations in my program, I am not tried with your code. I will get back here with my effort with your help.

Thanks,

Naveen Inuganti.

Read only

Former Member
0 Likes
1,336

You can do this when you are going for Changing parameters.


Types: ty_t_tab type standard table of sflight.
data: it_flight like table of sflight with header line,
        wa_flight type sflight.

perform test_form in program ztest_formtest2
                  using wa_flight
                 changing it_flight[].

form test_form using wa_flight type sflight
               changing flight type ty_t_tab.


endform.

Read only

Former Member
0 Likes
1,336

Hi,

When calling the subroutiene or at subroutiene declaration .... the system is considering ITAB as work area instead of table. Append [] to ITAB while calling the subroutiene so that it considers ITAB as table not as work are.

I think this solves ur problem