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

Class Attribute as Any Table

Former Member
0 Likes
8,144

Hi Fellows,

I got a short OO question.

Is it possible to create a class attribute that would be a table untyped,

and the value assigned to it dynamically during program execution?

When I try to type the attribute as TABLE I am getting error:

Type or field "TABLE" is generic. No table line has been specified.

I would like to use this attribute as kind of bridge between my class (that is accepting import attribute of type TABLE) and it's event handler method declared as one of class methods -

- After handling doubleclick or rows selected -

I would like to pass records chosen back to the main class and outside it later on.

This is why I would like to use the class attibute of type TABLE (any).

Would appreciate your comments on that

Regards,

bob

1 ACCEPTED SOLUTION
Read only

matt
Active Contributor
3,985

You can't have a generic table type attribute. You can have a data reference. In your calling programming you can use

method->do_stuff_involving_table( mytab ).

Where do_stuff_involving_table has one input parameter of i_tab type ANY TABLE. Within the method, you can use:

GET REFERENCE OF i_tab INTO me->r_the_current_table. Where r_the_current_table is of type REF TO DATA.

Then, in the event method, the input parameter is i_ref TYPE REF TO DATA.

FIELD-SYMBOLS: <tab> TYPE ANY TABLE.

ASSIGN i_ref->* to <tab>.

Hi Fellows,

I got a short OO question.

Is it possible to create a class attribute that would be a table untyped,

and the value assigned to it dynamically during program execution?

When I try to type the attribute as TABLE I am getting error:

Type or field "TABLE" is generic. No table line has been specified.

I would like to use this attribute as kind of bridge between my class (that is accepting import attribute of type TABLE) and it's event handler method declared as one of class methods -

- After handling doubleclick or rows selected -

I would like to pass records chosen back to the main class and outside it later on.

This is why I would like to use the class attibute of type TABLE (any).

Would appreciate your comments on that

Regards,

bob

5 REPLIES 5
Read only

matt
Active Contributor
3,986

You can't have a generic table type attribute. You can have a data reference. In your calling programming you can use

method->do_stuff_involving_table( mytab ).

Where do_stuff_involving_table has one input parameter of i_tab type ANY TABLE. Within the method, you can use:

GET REFERENCE OF i_tab INTO me->r_the_current_table. Where r_the_current_table is of type REF TO DATA.

Then, in the event method, the input parameter is i_ref TYPE REF TO DATA.

FIELD-SYMBOLS: <tab> TYPE ANY TABLE.

ASSIGN i_ref->* to <tab>.

Read only

Former Member
0 Likes
3,985

Brilliant!

That was exactly what I needed! These data references give sooo many opportunities

Thanks a lot Matthew!

Read only

hagit
Active Participant
0 Likes
3,985

matthew.billingham Your excellent answer helped me too.

Thank you

Hagit

Read only

arindam_m
Active Contributor
0 Likes
3,985

Hi,

I think generic table declarations are not possible in classes.

Cheers,

Arindam

Read only

0 Likes
3,985

It is possible as described above and it works fine.