Application Development 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: 

passing table to subroutine

Former Member
0 Kudos

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

Former Member
0 Kudos

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

5 REPLIES 5

Former Member
0 Kudos

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

0 Kudos

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 .
....                               

0 Kudos

Hi Rob,

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

0 Kudos

Then define lt_ekbe globally.

Rob

0 Kudos

Thanks Jose,Rob...