title: Method call as a parameter for another method call?
body: <p>i'm new in abap (OO) but developed before in java and wrote a class abap "cl_caretaker" which should handle the operations on database table and the local copy (intern table) of it.</p>
  
  <p>I want to make the following method call:</p>
  
  <pre><code>caretaker-&gt;show_table( caretaker-&gt;get_users( ) ) .
  </code></pre>
  
  <p>with:</p>
  
  <pre><code> caretaker = cl_caretaker=&gt;get_instance( ). "singleton instance
  
  METHODS:
  
  "! get a list of all user which registrated for FCP
  "!
  "! @parameter rt_users    | users which are registrated for FCP
     get_users
        RETURNING value(rt_users) TYPE itty_users,
  
  
   "! shows the content of a table
   "!
   "! @parameter it_table             | the table we want to visualize
     show_table
        IMPORTING
          value(it_table) TYPE ANY TABLE.
  </code></pre>
  
  <p>if I split the call in two and store the result of get_users in a tmp variable it works.</p>
  
  <pre><code>DATA:
    gt_tmp_users TYPE caretaker-&gt;itty_users.
  
    gt_tmp_users = caretaker-&gt;get_users( ).
    caretaker-&gt;show_table( gt_tmp_users ).
  </code></pre>
  
  <p><strong>So my questions are:</strong></p>
  
  <p><strong>1)</strong> is a call like: <code>caretaker-&gt;show_table( caretaker-&gt;get_users( ) ).</code>
     possible and if how?</p>
  
  <p><strong>2)</strong> I also tried to create a generic variable, which stores all kind of tables.
     Because i don't want to create for each table kind i use a tmp/help variable.
     But i got the information that only (german: Formalparameter) dummy parameters of method definitions are allowed to of generic type (eg. TYPE any TABLE ). </p>
  
  <p>Here some stuff I already tried:</p>
  
  <pre><code>DATA:
  *    tmpanytable TYPE TABLE OF any.
  *    tmpAnyTable TYPE any.
      tmpanytable TYPE REF TO data.
  
   " needed to store a temporal table
   FIELD-SYMBOLS: &lt;tmpanytable&gt; TYPE ANY TABLE.
  
  * ASSIGN caretaker-&gt;get_users( ) TO &lt;tmpAnyTable&gt;.
  * &lt;tmpAnyTable&gt; = caretaker-&gt;get_users( ).
  * caretaker-&gt;get_users( ).
  *caretaker-&gt;show_table( &lt;tmpAnyTable&gt; ).
  *caretaker-&gt;show_table( caretaker-&gt;get_users( ) ).
  
  *CALL METHOD: caretaker-&gt;show_table( IMPORTING it_table = caretaker-&gt;get_users ).
  *CALL METHOD: caretaker-&gt;show_table( it_table = caretaker-&gt;get_users( ) ).
  
  *COMPUTE caretaker-&gt;show_table( it_table = caretaker-&gt;get_users( ) ).
  
  *ASSIGN caretaker-&gt;get_users() -&gt;* to &lt;tmpAnyTable&gt;.
  *Caretaker-&gt;show_table( &lt;tmpAnyTable&gt; ).
  
  *call METHOD caretaker-&gt;show_table
  *                Exporting It_table = caretaker-&gt;get_users( ).
  
  *  CREATE DATA tmpanytable TYPE STANDARD TABLE OF (dbtab)
  *                            WITH NON-UNIQUE DEFAULT KEY.
  *  ASSIGN tmpanytable-&gt;* TO &lt;tmpanytable&gt;.
  
  *  CREATE DATA tmpanytable TYPE tabkind OF any Table .
  *  ASSIGN tmpanytable-&gt;* TO &lt;tmpanytable&gt;.
  
  *GET REFERENCE OF caretaker-&gt;get_users() INTO tmpAnyTable.
  *caretaker-&gt;show_table( tmpAnyTable ) .
  </code></pre>