Quantcast
Channel: SCN : All Content - ABAP Development
Viewing all articles
Browse latest Browse all 8332

Class method returning any table

$
0
0

Hi all,

Is there a way in ABAP to solve below problem?

I have a class CL with method METH which inside of itself CREATES an internal table.

Table structure and its data depends of various factors and its structure is always unexpected.

 

Class definition:

* ...

methods:
     METH
         importing
           iv_filepath type string
           changing et_table type ref to data.


Class implementation:

method METH.

* ... internal table itab already has a structure and data based on user choose

     field-symbols: <fsym> type any.
         assign itab to <fsym>.
        
et_table= <fsym>.

endmethod.

 

I need to call METH and get this table, eg.:

 

program ZPROG.

data fname type string.
field-symbols: <fs_tab> type any table.

CL=>METH( importing et_table = <fs_tab> )

or

<fs_tab> = CL=>METH(  ).

or so on.

But <fs_tab> is not assigned (and I get error) but I cannot assign <fs> not knowing table structure first (like I wrote above, structure is not known at design-time).

I'm very new in ABAP. Usually I'm coding in C#, which easly allows to return, assign to variable and iterate on rows and columns of any table in memory.


Viewing all articles
Browse latest Browse all 8332

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>