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

Defining attribute for internal table within class builder?

0 Likes
2,167

Hello there,

I use an function module that provides me an internal table which has the reference type of the DDIC object zml_output. Furthermore I call this function module within a global class that should keep the result of the function module into the attribute lt_result, that is declared as private and typed with


lt_result TYPE zml_output.

Even the definition of that attribute causes the following error message:

"lt_result" is not an internal table.

I don't have any clue how to type lt_result differently. Actually I would need the following type of typing "TYPE TABLE OF" but that does not exist within the class builder.

Thanks for your help in advanced!

Robert

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,239

Hello ,

Maybe you could use a table type and not an internal table.

What is the code you would like to write in the global class?

Could you provide it to me ?

6 REPLIES 6
Read only

Former Member
0 Likes
1,239

you can use the "local types" tab or "types" tab in se24 to declare your types.

Please note that if you declare your type in "local types " then that can be used as impor/export parameter of a private method only . To use the type for public method , define type in "types" tab ....

Read only

0 Likes
1,239

hey rajesh,

Thanks for your reply. I defined my type through the "Types" tab. Unfortunatelly I get now the error message that my type lt_result is unknown ("It was not defined neither in the mentioned table nor within a DATA command").

Do you have any further idea?

Read only

Former Member
0 Likes
1,240

Hello ,

Maybe you could use a table type and not an internal table.

What is the code you would like to write in the global class?

Could you provide it to me ?

Read only

0 Likes
1,239

Hi Konstantinidis ...

Of course I can provide it to you. The code of my methode load_data reads as follows:


method LOAD_DATA.

    CALL FUNCTION 'ZDATAGET'
    EXPORTING
      iv_dat    = iv_dat
      iv_time1  = iv_time1
      iv_delta  = iv_delta
    TABLES
      et_result = lt_result.

endmethod.

Especially the lt_result causes the mentioned error message

The compiler seems to expect something "TABLE" like for attribute lt_result. But whatever I tried it doesn't seem to work out.

Many thanks for help...

Read only

0 Likes
1,239

Hello,

I did a test with success.

I went to the attribute ( lt_result) and i pressed the arrow button after the "typing" column ( the column that you set the TYPE,LIKE,etc) . i wrote there a new variable of table type internal table ( for exampe tlt_result) and now i have defined a new variable which is an internal table.

An other solution is to change the lt_result in the function module and do it table type . then you need do nothing.

I hope i help you. if not let me know .

Antonis.

Read only

0 Likes
1,239

Thank your very much!

I didn't know that the green arrow can be used to declare instance attributes. Great thing!