<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic determine object and itab dynamically in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/determine-object-and-itab-dynamically/m-p/4749712#M1114041</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi there. I've got a small problem. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've got a tabstrip object with 7 tabs. &lt;/P&gt;&lt;P&gt;Each of them contains a grid. &lt;/P&gt;&lt;P&gt;In the screen there is a button. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After pressing it I need to do 2 things:&lt;/P&gt;&lt;P&gt;1) call a recently visible grid method (GET_CURRENT_CELL method) - it's not a problem&lt;/P&gt;&lt;P&gt;2) perform a READ TABLE ... from the itab which is a sourcetab for recently visible grid. - it's a problem&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;U&gt;Example:&lt;/U&gt;&lt;/P&gt;&lt;P&gt;sourcetab for GRID01 is ITAB01. analogycally for GRID02, GRID03 ... All itabs have different structure but have a common fields (2 fields that I'm interested to check)&lt;/P&gt;&lt;P&gt;Let's say we pressed TAB02 (it contains GRID02). Now I need to ...&lt;/P&gt;&lt;P&gt;1) CALL METHOD G_activegrid-&amp;gt;GET_CURRENT_CELL  - G_activegrid is a pointer to recently displayed grid / no problem&lt;/P&gt;&lt;P&gt;2) READ TABLE G_activeitab .... / &lt;STRONG&gt;PROBLEM&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;I)&lt;/STRONG&gt; ... so .... how can I detect which itab need I do the READ TABLE from? Is there some possibility to use pointers in that case? Something like ASSIGN ITAB02 TO &amp;lt;pointer&amp;gt;. Then ... READ TABLE &amp;lt;pointer&amp;gt; ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;II)&lt;/STRONG&gt; ... or maybe You know some grid method which would enables me to check the sourcetab for that grid? Something like ... &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
CALL METHOD GRID02-&amp;gt;GET_GRID_ITAB 
  IMPORTING itab = itabname_or_itabpointer_or_sth_else .
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could You give me some tip how to solve that problem?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 03 Nov 2008 14:33:15 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-11-03T14:33:15Z</dc:date>
    <item>
      <title>determine object and itab dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/determine-object-and-itab-dynamically/m-p/4749712#M1114041</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi there. I've got a small problem. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've got a tabstrip object with 7 tabs. &lt;/P&gt;&lt;P&gt;Each of them contains a grid. &lt;/P&gt;&lt;P&gt;In the screen there is a button. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After pressing it I need to do 2 things:&lt;/P&gt;&lt;P&gt;1) call a recently visible grid method (GET_CURRENT_CELL method) - it's not a problem&lt;/P&gt;&lt;P&gt;2) perform a READ TABLE ... from the itab which is a sourcetab for recently visible grid. - it's a problem&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;U&gt;Example:&lt;/U&gt;&lt;/P&gt;&lt;P&gt;sourcetab for GRID01 is ITAB01. analogycally for GRID02, GRID03 ... All itabs have different structure but have a common fields (2 fields that I'm interested to check)&lt;/P&gt;&lt;P&gt;Let's say we pressed TAB02 (it contains GRID02). Now I need to ...&lt;/P&gt;&lt;P&gt;1) CALL METHOD G_activegrid-&amp;gt;GET_CURRENT_CELL  - G_activegrid is a pointer to recently displayed grid / no problem&lt;/P&gt;&lt;P&gt;2) READ TABLE G_activeitab .... / &lt;STRONG&gt;PROBLEM&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;I)&lt;/STRONG&gt; ... so .... how can I detect which itab need I do the READ TABLE from? Is there some possibility to use pointers in that case? Something like ASSIGN ITAB02 TO &amp;lt;pointer&amp;gt;. Then ... READ TABLE &amp;lt;pointer&amp;gt; ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;II)&lt;/STRONG&gt; ... or maybe You know some grid method which would enables me to check the sourcetab for that grid? Something like ... &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
CALL METHOD GRID02-&amp;gt;GET_GRID_ITAB 
  IMPORTING itab = itabname_or_itabpointer_or_sth_else .
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could You give me some tip how to solve that problem?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Nov 2008 14:33:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/determine-object-and-itab-dynamically/m-p/4749712#M1114041</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-11-03T14:33:15Z</dc:date>
    </item>
    <item>
      <title>Re: determine object and itab dynamically</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/determine-object-and-itab-dynamically/m-p/4749713#M1114042</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't think, we have any method which gives the Output table back from the ALV in class CL_GUI_ALV_GRID. We have one protected attribute MT_OUTTAB which holds the output table but since it is protected we can't access it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Work around would be Saving the internal table name and the object reference in the internal table and read that internal table with current object. This way you will get the Table used in that ALV object.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Like:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
types: begin of ty_obj,
       tab_name type char30,
       obj   type ref to CL_GUI_ALV_GRID,
       end   of ty_obj.

data: t_obj type standard table of ty_obj,
      wa_obj type ty_obj.

  data: o_1 type ref to cl_gui_alv_grid,
       o_2 type ref to cl_gui_alv_grid.

  wa_obj-tab_name = 'ITAB1'.
  wa_obj-obj      = o_1.
  append wa_obj to t_obj.

  wa_obj-tab_name = 'ITAB2'.
  wa_obj-obj      = o_2.
  append wa_obj to t_obj.
....

* e.g for First instance
read table t_obj into wa_obj with key obj = o_1.
if sy-subrc = 0.

endif.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Naimesh Patel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Nov 2008 16:14:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/determine-object-and-itab-dynamically/m-p/4749713#M1114042</guid>
      <dc:creator>naimesh_patel</dc:creator>
      <dc:date>2008-11-03T16:14:59Z</dc:date>
    </item>
  </channel>
</rss>

