<?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: Need help regarding Dynamic Read Table statement in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-help-regarding-dynamic-read-table-statement/m-p/6523190#M1425441</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Not sure if the above would work. However i would like to get more information on the requirement and precisely how are you creating your internal tables.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 03 Jan 2010 10:01:37 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2010-01-03T10:01:37Z</dc:date>
    <item>
      <title>Need help regarding Dynamic Read Table statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-help-regarding-dynamic-read-table-statement/m-p/6523188#M1425439</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;I know that the syntax for dymanic read table statement is &lt;/P&gt;&lt;P&gt;READ TABLE  &amp;lt;ITAB&amp;gt; WITH KEY (KEY1) = VALUE1  (KEY2) = VALUE2 .....(KEYN) = VALUEN&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is my problem..&lt;/P&gt;&lt;P&gt;I am dynamically creating an internal table based on parameter table entered by user.&lt;/P&gt;&lt;P&gt;The key for this table can be determined only at runtime.&lt;/P&gt;&lt;P&gt;The table entered might have by one field as key field or 10 key fields..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How can I use the dynamic read in this situation ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your help in advance,&lt;/P&gt;&lt;P&gt;Santosh&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Santosh Kulkarni on Jan 3, 2010 6:58 AM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Santosh Kulkarni on Jan 3, 2010 7:01 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 03 Jan 2010 05:58:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/need-help-regarding-dynamic-read-table-statement/m-p/6523188#M1425439</guid>
      <dc:creator>santoshkulkarni</dc:creator>
      <dc:date>2010-01-03T05:58:39Z</dc:date>
    </item>
    <item>
      <title>Re: Need help regarding Dynamic Read Table statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-help-regarding-dynamic-read-table-statement/m-p/6523189#M1425440</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Santhosh,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can't we get the key field details from fieldcatelog internal table(columnKEY = X)? I am not sure if we can build the WITH KEY clause into a variable and use it as we can do it for the WHERE clause of the SELECT. If this is possible, i hope your issue will be resolved.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;eg:&lt;/P&gt;&lt;P&gt;CONCATENATE 'EBELN' 'IN' 'SO_EBELN' INTO l_where SEPARATED BY space.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Select...&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;WHERE (l_where).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Similarly will the read also works like this!!!?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;READ TABLE &amp;lt;tab&amp;gt; WITH KEY (l_withkey).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just try this option and let us know. If it works, its a new learning for me too &lt;SPAN __jive_emoticon_name="happy"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Vinod.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 03 Jan 2010 07:28:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/need-help-regarding-dynamic-read-table-statement/m-p/6523189#M1425440</guid>
      <dc:creator>vinod_vemuru2</dc:creator>
      <dc:date>2010-01-03T07:28:08Z</dc:date>
    </item>
    <item>
      <title>Re: Need help regarding Dynamic Read Table statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-help-regarding-dynamic-read-table-statement/m-p/6523190#M1425441</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Not sure if the above would work. However i would like to get more information on the requirement and precisely how are you creating your internal tables.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 03 Jan 2010 10:01:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/need-help-regarding-dynamic-read-table-statement/m-p/6523190#M1425441</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-01-03T10:01:37Z</dc:date>
    </item>
    <item>
      <title>Re: Need help regarding Dynamic Read Table statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-help-regarding-dynamic-read-table-statement/m-p/6523191#M1425442</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Also you can try loop with where clause, with dynamically built where clause.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 03 Jan 2010 10:23:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/need-help-regarding-dynamic-read-table-statement/m-p/6523191#M1425442</guid>
      <dc:creator>kesavadas_thekkillath</dc:creator>
      <dc:date>2010-01-03T10:23:33Z</dc:date>
    </item>
    <item>
      <title>Re: Need help regarding Dynamic Read Table statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-help-regarding-dynamic-read-table-statement/m-p/6523192#M1425443</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi ajit,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;without logging onto system and creating a sample, I can tell you what online documentation says about [Using a Different Search Key|http://help.sap.com/saphelp_nw70/helpdata/en/fc/eb35f8358411d1829f0000e829fbfe/content.htm]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;READ TABLE itab WITH KEY k1 = f1 ... kn = fn result.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The search key consists of arbitrary table fields k1 ... kn. If you do not know the name of a component until runtime, you can specify it dynamically as the content of a field n1 ... nn using (n1) = f1 (n2) = f2 . If n1 ... nn is empty when the statement is executed, the search field is ignored.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That means that for the READ TABLE statement you should use a number of key specifications not less than the possible maximum and then dynamically fill the key variables and key values.&lt;/P&gt;&lt;P&gt;Do not forget to clear before you do the next read for another table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it works.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, this is SAP NetWeaver 7.0, I think dynamic key specification was not possible earlier.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Clemens&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 03 Jan 2010 11:18:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/need-help-regarding-dynamic-read-table-statement/m-p/6523192#M1425443</guid>
      <dc:creator>Clemenss</dc:creator>
      <dc:date>2010-01-03T11:18:01Z</dc:date>
    </item>
    <item>
      <title>Re: Need help regarding Dynamic Read Table statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-help-regarding-dynamic-read-table-statement/m-p/6523193#M1425444</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Amit&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am creating 2 internal tables dynamically based on the user entered value using the dynamic internal table creation code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;create data xxx type (p_table)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After this based on the field value of one of these internal tables, I am trying to read the other dynamic internal table using dynamic read . during this read , I am not able to code a generic read because the number of key fields are not known till the runtime.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this clarifies my doubt&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your help,&lt;/P&gt;&lt;P&gt;Santosh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 03 Jan 2010 17:56:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/need-help-regarding-dynamic-read-table-statement/m-p/6523193#M1425444</guid>
      <dc:creator>santoshkulkarni</dc:creator>
      <dc:date>2010-01-03T17:56:10Z</dc:date>
    </item>
    <item>
      <title>Re: Need help regarding Dynamic Read Table statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-help-regarding-dynamic-read-table-statement/m-p/6523194#M1425445</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Vinod&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried this but it did not work . The dynamic read does not work same as the dynamic where clause.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again for your help&lt;/P&gt;&lt;P&gt;Santosh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 03 Jan 2010 17:58:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/need-help-regarding-dynamic-read-table-statement/m-p/6523194#M1425445</guid>
      <dc:creator>santoshkulkarni</dc:creator>
      <dc:date>2010-01-03T17:58:58Z</dc:date>
    </item>
    <item>
      <title>Re: Need help regarding Dynamic Read Table statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-help-regarding-dynamic-read-table-statement/m-p/6523195#M1425446</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Clemens&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I did not know that the empty field will be ignored.. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your help&lt;/P&gt;&lt;P&gt;Santosh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 03 Jan 2010 18:01:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/need-help-regarding-dynamic-read-table-statement/m-p/6523195#M1425446</guid>
      <dc:creator>santoshkulkarni</dc:creator>
      <dc:date>2010-01-03T18:01:28Z</dc:date>
    </item>
    <item>
      <title>Re: Need help regarding Dynamic Read Table statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-help-regarding-dynamic-read-table-statement/m-p/6523196#M1425447</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Santosh,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;please check out the following solution. The program demonstrates how to use the dynamic read statement with three key field conditions. Additional key fields can be added in the same way.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
REPORT z_dynamic_read.

DATA: gt_itab TYPE REF TO data,
      ge_key_field1 TYPE char30,
      ge_key_field2 TYPE char30,
      ge_key_field3 TYPE char30,
      go_descr_ref TYPE REF TO cl_abap_tabledescr.

FIELD-SYMBOLS: &amp;lt;gt_itab&amp;gt; TYPE STANDARD TABLE,
               &amp;lt;gs_key_comp&amp;gt; TYPE abap_keydescr,
               &amp;lt;gs_result&amp;gt; TYPE ANY.

PARAMETERS: pa_table TYPE tabname16 DEFAULT 'SPFLI',
            pa_cond1 TYPE string DEFAULT sy-mandt,
            pa_cond2 TYPE string DEFAULT 'LH',
            pa_cond3 TYPE string DEFAULT '0123'.

START-OF-SELECTION.

* Create and populate internal table
  CREATE DATA gt_itab TYPE STANDARD TABLE OF (pa_table).
  ASSIGN gt_itab-&amp;gt;* TO &amp;lt;gt_itab&amp;gt;.
  SELECT * FROM (pa_table) INTO TABLE &amp;lt;gt_itab&amp;gt;.

* Get the key components into the fields ge_key_field1, ...
  go_descr_ref ?= cl_abap_typedescr=&amp;gt;describe_by_data_ref( gt_itab ).
  LOOP AT go_descr_ref-&amp;gt;key ASSIGNING &amp;lt;gs_key_comp&amp;gt;.
    CASE sy-tabix.
      WHEN 1.
        ge_key_field1 = &amp;lt;gs_key_comp&amp;gt;-name.
      WHEN 2.
        ge_key_field2 = &amp;lt;gs_key_comp&amp;gt;-name.
      WHEN 3.
        ge_key_field3 = &amp;lt;gs_key_comp&amp;gt;-name.
    ENDCASE.
  ENDLOOP.

* Finally, perform the search
  READ TABLE &amp;lt;gt_itab&amp;gt; ASSIGNING &amp;lt;gs_result&amp;gt;
          WITH KEY (ge_key_field1) = pa_cond1
                   (ge_key_field2) = pa_cond2
                   (ge_key_field3) = pa_cond3.
  IF sy-subrc = 0.
    WRITE / 'Record found.'.
  ELSE.
    WRITE / 'No record found.'.
  ENDIF.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;One note: When an internal table is created dynamically like in my program above, the table key is &lt;EM&gt;not&lt;/EM&gt; the key defined in the DDIC structure -- instead, the default key for the standard table is used (i.e. all non-numeric fields).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps,&lt;/P&gt;&lt;P&gt;David&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Jan 2010 01:06:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/need-help-regarding-dynamic-read-table-statement/m-p/6523196#M1425447</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-01-04T01:06:48Z</dc:date>
    </item>
    <item>
      <title>Re: Need help regarding Dynamic Read Table statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-help-regarding-dynamic-read-table-statement/m-p/6523197#M1425448</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello David&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks..this solution should solve my problem..One thing I did not understand though..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You are saying that the default key for the dynamically created table is all non-numeric fields in the dynamic table and not the DDIC key.. If this is true what will happen if the dynamic table created has more than 16 non-numeric fields..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks again for your help&lt;/P&gt;&lt;P&gt;Santosh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Jan 2010 01:59:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/need-help-regarding-dynamic-read-table-statement/m-p/6523197#M1425448</guid>
      <dc:creator>santoshkulkarni</dc:creator>
      <dc:date>2010-01-04T01:59:39Z</dc:date>
    </item>
    <item>
      <title>Re: Need help regarding Dynamic Read Table statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-help-regarding-dynamic-read-table-statement/m-p/6523198#M1425449</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Santosh,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I guess there is no limitation on key fields for internal tables (at least I couldn't find one in the online help). You can use class CL_ABAP_TABLEDESCR to find out:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
DATA: descr_ref TYPE REF TO cl_abap_tabledescr.
FIELD-SYMBOLS: &amp;lt;key_comp_wa&amp;gt; TYPE abap_keydescr.

descr_ref ?= cl_abap_typedescr=&amp;gt;describe_by_data_ref( your_itab_ref_here ).

WRITE: / 'Key Components:'.
LOOP AT descr_ref-&amp;gt;key ASSIGNING &amp;lt;key_comp_wa&amp;gt;.
  WRITE &amp;lt;key_comp_wa&amp;gt;-name.
ENDLOOP.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;David&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Jan 2010 08:02:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/need-help-regarding-dynamic-read-table-statement/m-p/6523198#M1425449</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-01-04T08:02:56Z</dc:date>
    </item>
    <item>
      <title>Re: Need help regarding Dynamic Read Table statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-help-regarding-dynamic-read-table-statement/m-p/6523199#M1425450</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;yet another solution for read of internal table with dynamic specified keys:&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.kerum.pl/infodepot/00033" target="test_blank"&gt;http://www.kerum.pl/infodepot/00033&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;Kris&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Feb 2012 20:27:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/need-help-regarding-dynamic-read-table-statement/m-p/6523199#M1425450</guid>
      <dc:creator>krzysztof_murkowski2</dc:creator>
      <dc:date>2012-02-28T20:27:35Z</dc:date>
    </item>
  </channel>
</rss>

