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 showing error in include program with changing parameter

naveen_inuganti2
Active Contributor
0 Likes
1,607

Hi Friends...,

Iam getting Error.....

> In "LOOP... WHERE..." the line type of the table must be statically defined.

For following code...

In function module sourse code...,

data: itab2 type standard table of <db>,

itab3 type standard table of <db>,

st1 type <db>,

st2 type <db>,

st3 type <db>.

perform sub_rt using st1

changing itab2

itab3

st2

st3.

In F1 include of that FM..,

form sub_rt using st1

changing itab2 type standard table

itab3 type standard table

st2 type <db>

st3 type <db>.

loop at itab2 into st2 where f1 = st3-f1

and f2 = st1-f1

/////////

endloop.

Plz let me know if any solutions for this..,

By removing this where conditon...

> not showing any error...

or By writing Check syntax for those two values...like

loop at itab2 into st2.

check st2-f1 = st3-f1 and st2-f2 = st1-f1.

//////

endloop.

> Also not showing any error.

Plz Let me know if u want any further clarification.

Thanks,

Naveen.I

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,576

Hi,

Try this modified code:

types : ty_<db> type standard table of <db>.

data: itab2 type ty_<db>,

itab3 type ty_<db>,

st1 type <db>,

st2 type <db>,

st3 type <db>.

perform sub_rt using st1

changing itab2

itab3

st2

st3.

In F1 include of that FM..,

form sub_rt using st1 type <db>

changing itab2 type ty_<db>

itab3 type ty_<db>

st2 type <db>

st3 type <db>.

loop at itab2 into st2 where f1 = st3-f1

and f2 = st1-f1

/////////

endloop.

endform.

Now ur code should work...

Regards,

Joy.

13 REPLIES 13
Read only

Former Member
0 Likes
1,577

Hi,

Try this modified code:

types : ty_<db> type standard table of <db>.

data: itab2 type ty_<db>,

itab3 type ty_<db>,

st1 type <db>,

st2 type <db>,

st3 type <db>.

perform sub_rt using st1

changing itab2

itab3

st2

st3.

In F1 include of that FM..,

form sub_rt using st1 type <db>

changing itab2 type ty_<db>

itab3 type ty_<db>

st2 type <db>

st3 type <db>.

loop at itab2 into st2 where f1 = st3-f1

and f2 = st1-f1

/////////

endloop.

endform.

Now ur code should work...

Regards,

Joy.

Read only

0 Likes
1,576

Hi Thanx... I will try that....

And plz find changes in above code.... ( All DB are not equal )

Iam getting Error.....

>In "LOOP... WHERE..." the line type of the table must be statically defined.

For following code...

In function module sourse code...,

data: itab2 type standard table of <db2>,

itab3 type standard table of <db3>,

st1 type <db1>,

st2 type <db2>,

st3 type <db3>.

perform sub_rt using st1

changing itab2

itab3

st2

st3.

In F1 include of that FM..,

form sub_rt using st1

changing itab2 type standard table

itab3 type standard table

st2 type <db2>

st3 type <db3>.

loop at itab2 into st2 where f1 = st3-f1

and f2 = st1-f1

/////////

endloop.

Plz let me know if any solutions for this..,

By removing this where conditon...

not showing any error...

or By writing Check syntax for those two values...like

loop at itab2 into st2.

check st2-f1 = st3-f1 and st2-f2 = st1-f1.

//////

endloop.

Also not showing any error.

Plz Let me know if u want any further clarification.

Thanks,

Naveen.I

Read only

0 Likes
1,576

Hi Naveen,

Modify ur statements like below.

perform sub_rt using st1

changing st2 st3

TABLES itab2 itab3.

Here it will assign the structure dynamically

form sub_rt using st1

changing st2 st3

TABLES itab2 itab3.

loop at itab2 into st2 where f1 = st3-f1

and f2 = st1-f1

/////////

endloop.

Try above change and get back.

Thanks,

Vinod.

Read only

0 Likes
1,576

Try this code:

types : ty_<db2> type standard table of <db2>.

types : ty_<db3> type standard table of <db3>.

data: itab2 type ty_<db2>,

itab3 type ty_<db3>,

st1 type <db1>,

st2 type <db2>,

st3 type <db3>.

perform sub_rt using st1

changing itab2

itab3

st2

st3.

In F1 include of that FM..,

form sub_rt using st1 type <db1>

changing itab2 type ty_<db2>

itab3 type ty_<db3>

st2 type <db2>

st3 type <db3>.

loop at itab2 into st2 where f1 = st3-f1

and f2 = st1-f1

/////////

endloop.

endform.

in ur code u defined the interface for itab2,itab3 in subroutine generically thats why SAP does not able to understand its components when u use

loop at itab2 into st2 where f1 = st3-f1

and f2 = st1-f1 statement.

form sub_rt using st1

changing itab2 type standard table

itab3 type standard table

st2 type <db2>

st3 type <db3>.

loop at itab2 into st2 where f1 = st3-f1

and f2 = st1-f1

/////////

endloop.

u have to define the interface parameter as specific (as I done in my code) one so that SAP can understand its components...

Regards,

Joy.

Read only

0 Likes
1,576

Hi.. Vinod....

Thanx for ur attention.

Now the error message is....

> itab2 is not an intrenal table...

If i put Type standard table.... code for that.

Showing same error as b4.

Thanks,

Naveen.i

Read only

0 Likes
1,576

Hi..Joyjit,

> ty_<db2> is unknown....

showing error in my incude program....

Thanks,

Naveen.I

Read only

0 Likes
1,576

Try to activate the program and the include at the same time....

Regards,

Joy.

Read only

0 Likes
1,576

Hi..... Friends....

Still my problem not solved....

( joyjit... Thank you for ur attention... Iam activated as u said.. but still no use yaar )

Iam searching for another ways.

Plz get back to me if any solutions....,

Thanks,

Naveen.I

Read only

0 Likes
1,576

Hi,

Pl. check this code, it is working...

types : ty_mara type standard table of mara.

types : ty_makt type standard table of makt.

data: itab2 type ty_mara,

itab3 type ty_makt,

st1 type mara,

st2 type mara,

st3 type makt.

perform sub_rt using st1

changing itab2

itab3

st2

st3.

include z_abcd.

&----


*& Include Z_ABCD

&----


form sub_rt using st1 type mara

changing itab2 type ty_mara

itab3 type ty_makt

st2 type mara

st3 type makt.

loop at itab2 into st2 where matnr = st3-matnr.

endloop.

endform.

Regards,

Joy.

Read only

0 Likes
1,576

Hi.... Joyjit....

Good effort....

Yes... it will works... no need to check.. i solved problem with that only...

Thanks..,

Naveen.I

Read only

Former Member
0 Likes
1,576

I modified the code i used <DB> as mara.

FUNCTION ztest_fun.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"----------------------------------------------------------------------


  DATA: itab2 TYPE STANDARD TABLE OF mara,
        itab3 TYPE STANDARD TABLE OF mara,
        st1 TYPE mara,
        st2 TYPE mara,
        st3 TYPE mara.

  PERFORM sub_rt USING st1
          CHANGING itab2
          itab3
          st2
          st3.


ENDFUNCTION.

and the include

FORM sub_rt  USING    p_st1 TYPE mara
             CHANGING p_itab2 TYPE mara_tt
                      p_itab3
                      p_st2
                      p_st3 TYPE mara.

  LOOP AT p_itab2 INTO p_st2 WHERE matnr = p_st3-matnr
                     AND matkl = p_st1-matkl.


  ENDLOOP.

ENDFORM.                    " sub_rt

Check and let me know..

Read only

0 Likes
1,576

When you are creating the Subroutines mention the reference types it will solve your problem.

FORM sub_rt  USING    p_st1 TYPE mara
      CHANGING p_itab2 TYPE mara_tt "This should table type 
                        p_itab3 type mara_tt
                        p_st2   type mara 
                        p_st3 TYPE mara.
 *Since it is internal table you have to give the table type 
  LOOP AT p_itab2 INTO p_st2 WHERE matnr = p_st3-matnr
                     AND matkl = p_st1-matkl.
 
 
  ENDLOOP.

Read only

naveen_inuganti2
Active Contributor
0 Likes
1,576

Hi All thanks for ur replies...,

Get back to you very soon.. with the way i solved this problem...

Thanks,

Naveen.I