<?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 Re: Issue with determing table name runtime in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/issue-with-determing-table-name-runtime/m-p/6416582#M1408604</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;so i have to find out the table name and declare a work area and then pass that to Get_component_list FM*&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Why not field symbol instead of work area. Field symbol type any&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 20 Nov 2009 16:12:34 GMT</pubDate>
    <dc:creator>former_member191735</dc:creator>
    <dc:date>2009-11-20T16:12:34Z</dc:date>
    <item>
      <title>Issue with determing table name runtime</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/issue-with-determing-table-name-runtime/m-p/6416581#M1408603</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a problem in determing the table name during runtime&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;TABLES : ekko.

DATA : test TYPE REF TO lcl_test.
DATA : itab TYPE STANDARD TABLE OF ekko.

IF test IS INITIAL.
    CREATE OBJECT test.
  ENDIF.
test-&amp;gt;cmeth( EXPORTING itab1 = itab ).&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;CLASS lcl_test DEFINITION.

  PUBLIC SECTION.

    METHODS : cmeth IMPORTING itab1 TYPE STANDARD TABLE.

ENDCLASS.                    


*----------------------------------------------------------------------*
*       CLASS lcl_test IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS lcl_test IMPLEMENTATION.

METHOD test.

*Here i have to know the table name of the importing internal data itab1 (In this particular case its EKKO)

*In general it can be any table 

*Is there a way to determine a table name (as EKKO) in this method

*My problem is i need to find out the field of that internal table

*to find out the fields of the  table i'm using 

CALL FUNCTION 'GET_COMPONENT_LIST'
EXPORTING
program = sy-repid
fieldname = 'I need to pass header of the internal table something like wa_ekko'
TABLES
components = icomp.


** so i have to find out the table name and declare a work area and then pass that to Get_component_list FM*


OR 


I CAN USE BELOW CODE AS WELL

data:
    wa_ref        type ref to data,
    desc_table    type ref to cl_abap_tabledescr,
    desc_struc    type ref to cl_abap_structdescr.
  field-symbols:
    &amp;lt;p_data&amp;gt;      type any,
    &amp;lt;p_field&amp;gt;     type any,
    &amp;lt;p_component&amp;gt; type abap_compdescr.




** The probelm  here is it_data has s tructure defined in class unlike mine  with is type standard table*
create data wa_ref like line of it_data.
  assign wa_ref-&amp;gt;* to &amp;lt;p_data&amp;gt;.
 desc_table ?= cl_abap_tabledescr=&amp;gt;describe_by_data( it_data ).
  desc_struc ?= desc_table-&amp;gt;get_table_line_type( ).


loop at it_data assigning &amp;lt;p_data&amp;gt;.
    loop at desc_struc-&amp;gt;components assigning &amp;lt;p_component&amp;gt;.
 
        assign component &amp;lt;p_component&amp;gt;-name of structure &amp;lt;p_data&amp;gt; to &amp;lt;p_field&amp;gt;.
    endloop.
  endloop.

endmethod.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope i'm clear &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;David&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Nov 2009 15:56:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/issue-with-determing-table-name-runtime/m-p/6416581#M1408603</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-11-20T15:56:49Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with determing table name runtime</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/issue-with-determing-table-name-runtime/m-p/6416582#M1408604</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;so i have to find out the table name and declare a work area and then pass that to Get_component_list FM*&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Why not field symbol instead of work area. Field symbol type any&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Nov 2009 16:12:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/issue-with-determing-table-name-runtime/m-p/6416582#M1408604</guid>
      <dc:creator>former_member191735</dc:creator>
      <dc:date>2009-11-20T16:12:34Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with determing table name runtime</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/issue-with-determing-table-name-runtime/m-p/6416583#M1408605</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does the attribute ABSOLUTE_NAME of class CL_ABAP_STRUCTDESCR / CL_ABAP_TABLEDESCR be of any help?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I added this line to Max's code &amp;amp; works (but you need a lil' formatting):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;WRITE: desc_struc-&amp;gt;absolute_name.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Output:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;\TYPE=EKKO&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So may be if you format you will get EKKO &lt;SPAN __jive_emoticon_name="wink"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR,&lt;/P&gt;&lt;P&gt;Suhas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Nov 2009 16:23:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/issue-with-determing-table-name-runtime/m-p/6416583#M1408605</guid>
      <dc:creator>SuhaSaha</dc:creator>
      <dc:date>2009-11-20T16:23:30Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with determing table name runtime</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/issue-with-determing-table-name-runtime/m-p/6416584#M1408606</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Perhaps something like this can help you:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;TABLES : EKKO.


DATA : ITAB TYPE STANDARD TABLE OF EKKO.
*
CLASS LCL_TEST DEFINITION.

  PUBLIC SECTION.

    METHODS : CMETH IMPORTING ITAB1 TYPE STANDARD TABLE.

ENDCLASS.                    "lcl_test DEFINITION
*
CLASS LCL_TEST IMPLEMENTATION.

  METHOD CMETH.
    DATA: MY_WA       TYPE REF TO DATA.
    DATA: DESC_TABLE    TYPE REF TO CL_ABAP_TABLEDESCR,
          DESC_STRUC    TYPE REF TO CL_ABAP_STRUCTDESCR.
    FIELD-SYMBOLS:
         &amp;lt;P_DATA&amp;gt;      TYPE ANY,
         &amp;lt;P_FIELD&amp;gt;     TYPE ANY,
         &amp;lt;P_COMPONENT&amp;gt; TYPE ABAP_COMPDESCR.


    CREATE DATA MY_WA LIKE LINE OF ITAB1.
    ASSIGN MY_WA-&amp;gt;* TO &amp;lt;P_DATA&amp;gt;.

    DESC_STRUC ?= CL_ABAP_TYPEDESCR=&amp;gt;DESCRIBE_BY_DATA( &amp;lt;P_DATA&amp;gt; ).

    LOOP AT DESC_STRUC-&amp;gt;COMPONENTS ASSIGNING &amp;lt;P_COMPONENT&amp;gt;.
      WRITE: / &amp;lt;P_COMPONENT&amp;gt;-NAME.
    ENDLOOP.
  ENDMETHOD.                    "test
ENDCLASS.                    "lcl_test IMPLEMENTATION


DATA : TEST TYPE REF TO LCL_TEST.

START-OF-SELECTION.

  IF TEST IS INITIAL.
    CREATE OBJECT TEST.
  ENDIF.

  TEST-&amp;gt;CMETH( EXPORTING ITAB1 = ITAB ).&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Max&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Nov 2009 16:25:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/issue-with-determing-table-name-runtime/m-p/6416584#M1408606</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-11-20T16:25:23Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with determing table name runtime</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/issue-with-determing-table-name-runtime/m-p/6416585#M1408607</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you all for your help&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Nov 2009 16:40:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/issue-with-determing-table-name-runtime/m-p/6416585#M1408607</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-11-20T16:40:01Z</dc:date>
    </item>
  </channel>
</rss>

