2013 May 11 2:06 PM
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
2013 May 12 6:52 AM
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
2013 May 12 6:52 AM
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>.
2013 May 28 8:32 AM
Brilliant!
That was exactly what I needed! These data references give sooo many opportunities
Thanks a lot Matthew!
2021 Feb 09 9:28 AM
matthew.billingham Your excellent answer helped me too.
Thank you
Hagit
2013 May 12 6:55 AM
Hi,
I think generic table declarations are not possible in classes.
Cheers,
Arindam
2023 Sep 25 10:11 AM
| User | Count |
|---|---|
| 5 | |
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |