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

passing table to subroutine

Former Member
0 Likes
1,130

Hi all,

I have a problem passing a table into a subroutine.

Here lt_ekbe is the internal Table as declared as follows.

form Test. // The internal table lt_ekbe is declared in this subroutine.This subroutine Iam not allowed to change.
DATA: lt_ekbe  TYPE TABLE OF ekbe, 

Table is filled using the following routine.

PERFORM me_read_history TABLES lt_ekbe
                                 lt_ekbez
                          USING  ls_ekpo-ebeln
                                 ls_ekpo-ebelp.

end form.

In the following routine, I want to pass the lt_ekbe table and make a check as follows.But it shows an error that table is not defined.

form mwskz_from_rechnungsBeleg1 using ut_ekbe like lt_ekbe CHANGING fs TYPE mrer_item .
                               

data ls_ebke type ekbe.
READ TABLE ut_ebke into ls_ebke with key
                                   ebeln = fs-ebeln
				   BELNR = fs-rebzg
				   bwart = ''.

endform.

Could anyone give a hand on this..

Thanks

K

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,092

I don't think you can do this without changing the first FORM.

You could write a new FORM that does the same thing but passes the table. Pretty inefficient though.

Why can't you change the FORM?

Rob

Hi all,

I have a problem passing a table into a subroutine.

Here lt_ekbe is the internal Table as declared as follows.

form Test. // The internal table lt_ekbe is declared in this subroutine.This subroutine Iam not allowed to change.
DATA: lt_ekbe  TYPE TABLE OF ekbe, 

Table is filled using the following routine.

PERFORM me_read_history TABLES lt_ekbe
                                 lt_ekbez
                          USING  ls_ekpo-ebeln
                                 ls_ekpo-ebelp.

end form.

In the following routine, I want to pass the lt_ekbe table and make a check as follows.But it shows an error that table is not defined.

form mwskz_from_rechnungsBeleg1 using ut_ekbe like lt_ekbe CHANGING fs TYPE mrer_item .
                               

data ls_ebke type ekbe.
READ TABLE ut_ebke into ls_ebke with key
                                   ebeln = fs-ebeln
				   BELNR = fs-rebzg
				   bwart = ''.

endform.

Could anyone give a hand on this..

Thanks

K

5 REPLIES 5
Read only

Former Member
0 Likes
1,093

I don't think you can do this without changing the first FORM.

You could write a new FORM that does the same thing but passes the table. Pretty inefficient though.

Why can't you change the FORM?

Rob

Read only

0 Likes
1,092

But if you do know the specific type why don't you just use a table type such as ME_EKBE or change the FORM structure using TABLES ?


form mwskz_from_rechnungsBeleg1 using ut_ekbe type ME_EKBE  CHANGING fs TYPE mrer_item .
....                               


form mwskz_from_rechnungsBeleg1 tables ut_ekbe structure ekbe  CHANGING fs TYPE mrer_item .
....                               

Read only

0 Likes
1,092

Hi Rob,

I meant I want to call "mwskz_from_rechnungsBeleg1" from Test.No other changes other than that in subroutine "Test":)

Read only

0 Likes
1,092

Then define lt_ekbe globally.

Rob

Read only

0 Likes
1,092

Thanks Jose,Rob...