<?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: What is wrong in this simple code? in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/what-is-wrong-in-this-simple-code/m-p/11938624#M1965379</link>
    <description>&lt;P&gt;Hi Dip, as Matthew said, without complete code We can't help you. &lt;/P&gt;&lt;P&gt;You cant't access to field pfld3 as you maked. You're accessing on an internal table. You can use READ or Loop statement, not SELECT.&lt;/P&gt;</description>
    <pubDate>Fri, 21 Jun 2019 05:55:59 GMT</pubDate>
    <dc:creator>Raffaele</dc:creator>
    <dc:date>2019-06-21T05:55:59Z</dc:date>
    <item>
      <title>What is wrong in this simple code?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/what-is-wrong-in-this-simple-code/m-p/11938617#M1965372</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;
  &lt;P&gt;Can anyone please tell me what is wrong in this following line of code-&lt;/P&gt; 
  &lt;PRE&gt;&lt;CODE&gt;REPORT ztest1.&lt;/CODE&gt;&lt;/PRE&gt; 
  &lt;PRE&gt;&lt;CODE&gt;types: begin of t1,&lt;/CODE&gt;&lt;/PRE&gt; 
  &lt;PRE&gt;&lt;CODE&gt;  fld1 type N,&lt;/CODE&gt;&lt;/PRE&gt; 
  &lt;PRE&gt;&lt;CODE&gt;  fld2 type C,&lt;/CODE&gt;&lt;/PRE&gt; 
  &lt;PRE&gt;&lt;CODE&gt; pfld3 type N,&lt;/CODE&gt;&lt;/PRE&gt; 
  &lt;PRE&gt;&lt;CODE&gt;  end of t1.&lt;/CODE&gt;&lt;/PRE&gt; 
  &lt;PRE&gt;&lt;CODE&gt;&amp;lt;br&amp;gt;  types: begin of t2,&lt;/CODE&gt;&lt;/PRE&gt; 
  &lt;PRE&gt;&lt;CODE&gt;  fld3 type N,&lt;/CODE&gt;&lt;/PRE&gt; 
  &lt;PRE&gt;&lt;CODE&gt;  end of t2.&lt;/CODE&gt;&lt;/PRE&gt; 
  &lt;PRE&gt;&lt;CODE&gt;data : tab1 TYPE  t1,&lt;/CODE&gt;&lt;/PRE&gt; 
  &lt;PRE&gt;&lt;CODE&gt;  wa_tab1 TYPE t1.&lt;/CODE&gt;&lt;/PRE&gt; 
  &lt;PRE&gt;&lt;CODE&gt;&amp;lt;br&amp;gt; data : tab2 type t2,&lt;/CODE&gt;&lt;/PRE&gt; 
  &lt;PRE&gt;&lt;CODE&gt;  wa_tab2 type t2.&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;&lt;BR /&gt;Actually I want to declare a structure 't1' with fields - fld1 as type 'Numeric', fld2 as type 'char' etc.&lt;/P&gt;
  &lt;P&gt; Then I want to create an internal table 'tab2' of same line type as 't1' ie having the same fields of type fld1,fld2 , pfld3 etc.&lt;/P&gt;
  &lt;P&gt;Similarly, for the 2nd int. table tab2 based on the structure type 't2'.&lt;/P&gt;
  &lt;P&gt;But I'm getting following syntax error - ' Unknown column name "FLD1" field list'&lt;/P&gt;
  &lt;P&gt;Where am I going wrong?&lt;/P&gt;
  &lt;P&gt;Any help would be appreciated.&lt;/P&gt;
  &lt;P&gt;Thanks &amp;amp; Regards&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jun 2019 16:20:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/what-is-wrong-in-this-simple-code/m-p/11938617#M1965372</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2019-06-20T16:20:56Z</dc:date>
    </item>
    <item>
      <title>Re: What is wrong in this simple code?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/what-is-wrong-in-this-simple-code/m-p/11938618#M1965373</link>
      <description>&lt;P&gt;When do you receive this error? At activation of code or at runtime? How do you access to theese fields?&lt;/P&gt;&lt;P&gt;Try using table of (or standard table of) declaration :&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;data: tab1 TYPE TABLE OF t1,&lt;/CODE&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;CODE&gt;  wa_tab1 TYPE t1.&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 20 Jun 2019 16:39:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/what-is-wrong-in-this-simple-code/m-p/11938618#M1965373</guid>
      <dc:creator>Raffaele</dc:creator>
      <dc:date>2019-06-20T16:39:37Z</dc:date>
    </item>
    <item>
      <title>Re: What is wrong in this simple code?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/what-is-wrong-in-this-simple-code/m-p/11938619#M1965374</link>
      <description>&lt;P&gt;Other that horrific naming choices, I don't see anything wrong. I copy-pasted your code into an ABAP 7.31 system and it passes the syntax check. On which line are you getting an error? I suspect you're not sharing all the code with us...&lt;/P&gt;&lt;P&gt;Try to understand what the code does. You did declare a structure t1 but there are no table declarations. Internal tables are declared using TYPE &amp;lt;kind of table&amp;gt; TABLE OF. &lt;/P&gt;&lt;P&gt;Refer to ABAP documentation for keyword TYPE for your version (ABAPDOCU transaction or F1 in ABAP Editor).&lt;/P&gt;&lt;P&gt;P.S. As a side note - seriously though, please get into a habit of giving variables descriptive names and drop the prefixes like wa_. It doesn't matter if this is your first program. Names like these are never OK.&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jun 2019 21:20:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/what-is-wrong-in-this-simple-code/m-p/11938619#M1965374</guid>
      <dc:creator>Jelena_Perfiljeva</dc:creator>
      <dc:date>2019-06-20T21:20:57Z</dc:date>
    </item>
    <item>
      <title>Re: What is wrong in this simple code?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/what-is-wrong-in-this-simple-code/m-p/11938620#M1965375</link>
      <description>&lt;P&gt;Hi Jelena,&lt;/P&gt;&lt;P&gt; I gave the prefix 'wa'  as I was creating a work area.&lt;/P&gt;&lt;P&gt;Also, I know the naming is not proper but since I was trying a basic 'test' program so I gave those naming.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Dip&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jun 2019 04:35:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/what-is-wrong-in-this-simple-code/m-p/11938620#M1965375</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2019-06-21T04:35:07Z</dc:date>
    </item>
    <item>
      <title>Re: What is wrong in this simple code?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/what-is-wrong-in-this-simple-code/m-p/11938621#M1965376</link>
      <description>&lt;P&gt;The error was during syntax check (Ctrl+ F2) /activation. &lt;/P&gt;</description>
      <pubDate>Fri, 21 Jun 2019 04:36:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/what-is-wrong-in-this-simple-code/m-p/11938621#M1965376</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2019-06-21T04:36:15Z</dc:date>
    </item>
    <item>
      <title>Re: What is wrong in this simple code?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/what-is-wrong-in-this-simple-code/m-p/11938622#M1965377</link>
      <description>&lt;P&gt;Hi Jelena &amp;amp; Raffaele,&lt;/P&gt;&lt;P&gt;I changed the code as per your advice but I'm still getting the same error!&lt;/P&gt;&lt;P&gt;Here is the modified code :&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;REPORT  ZTEST1.
types: begin of str1,
   fld1 type N,
  fld2 type C,
 pfld3 type N,
  end of str1.

  TYPES: begin of str2,
   fld3 type N,
    end of str2.
    
DATA : tab1 TYPE TABLE OF str1,
        wa_tab1 TYPE str1.

 DATA: tab2 TYPE TABLE OF str2,
        wa_tab2 type str2.

SELECT fld1 fld2 FROM tab1 WHERE fld3 = pfld3.

WRITE: /1 tab1-fld1, tab1-fld2.

ENDSELECT.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The error when doing Syntax Check or Activation is the same as earlier  viz. :&lt;/P&gt;&lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/1697498-error-ztest1.jpg" /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jun 2019 04:46:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/what-is-wrong-in-this-simple-code/m-p/11938622#M1965377</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2019-06-21T04:46:35Z</dc:date>
    </item>
    <item>
      <title>Re: What is wrong in this simple code?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/what-is-wrong-in-this-simple-code/m-p/11938623#M1965378</link>
      <description>&lt;P&gt;First of all, don't post answers to your own question. Use the comment button.&lt;/P&gt;&lt;P&gt;Second you didn't give us the complete code in the first place.&lt;/P&gt;&lt;P&gt;Thirdly, this is basic ABAP; go and read the &lt;A href="https://help.sap.com/doc/abapdocu_750_index_htm/7.50/en-US/abapselect.htm" target="_blank"&gt;abap help documentation for SELECT&lt;/A&gt;, and the &lt;A href="https://help.sap.com/doc/abapdocu_750_index_htm/7.50/en-US/abapselect.htm" target="_blank"&gt;abap help documentation for processing Internal Tables&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jun 2019 05:16:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/what-is-wrong-in-this-simple-code/m-p/11938623#M1965378</guid>
      <dc:creator>matt</dc:creator>
      <dc:date>2019-06-21T05:16:46Z</dc:date>
    </item>
    <item>
      <title>Re: What is wrong in this simple code?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/what-is-wrong-in-this-simple-code/m-p/11938624#M1965379</link>
      <description>&lt;P&gt;Hi Dip, as Matthew said, without complete code We can't help you. &lt;/P&gt;&lt;P&gt;You cant't access to field pfld3 as you maked. You're accessing on an internal table. You can use READ or Loop statement, not SELECT.&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jun 2019 05:55:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/what-is-wrong-in-this-simple-code/m-p/11938624#M1965379</guid>
      <dc:creator>Raffaele</dc:creator>
      <dc:date>2019-06-21T05:55:59Z</dc:date>
    </item>
    <item>
      <title>Re: What is wrong in this simple code?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/what-is-wrong-in-this-simple-code/m-p/11938625#M1965380</link>
      <description>&lt;P&gt;Sir,&lt;/P&gt;&lt;P&gt;I already wrote in my 2nd post , that, that is the COMPLETE code!!&lt;/P&gt;&lt;P&gt;I have written this program myself based on a question that i saw in an exam paper set in an institute.&lt;/P&gt;&lt;P&gt;The question was like these - &lt;/P&gt;&lt;P&gt;The following code indicates: A&lt;BR /&gt;
SELECT fld1 fld2 FROM tab1 APPENDING TABLE itab WHERE fld1 IN sfld1.
&lt;STRONG&gt;A: Add rows to the existing rows of itab.&lt;/STRONG&gt;&lt;BR /&gt;
B: Add rows to itab after first deleting any existing rows of itab.&lt;BR /&gt;
C: Select rows from tab1 for matching itab entries.&lt;BR /&gt;
D: Nothing, this is a syntax error.&lt;/P&gt;&lt;P&gt;Based on this question, I wrote this program to test what should be the correct answer. But the error was not in the 'Select" statement as pointed out by Raffaele .&lt;/P&gt;&lt;P&gt;The error is in creating the structure. That is what my question is about. Can we NOT create structures with fields having elementary data type like Char, integer etc?&lt;/P&gt;&lt;P&gt;Here that is what I was trying. I used 'TYPES' keyword instead of 'DATA'. maybe that is why I'm getting the error?&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jun 2019 06:41:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/what-is-wrong-in-this-simple-code/m-p/11938625#M1965380</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2019-06-21T06:41:53Z</dc:date>
    </item>
    <item>
      <title>Re: What is wrong in this simple code?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/what-is-wrong-in-this-simple-code/m-p/11938626#M1965381</link>
      <description>&lt;P&gt;The error &lt;STRONG&gt;is&lt;/STRONG&gt; in the select statement. That's exactly what those error messages mean. &lt;/P&gt;&lt;P&gt;As far as the structure is concerned, yes, there is an error there. Go read about&lt;A href="https://help.sap.com/doc/abapdocu_750_index_htm/7.50/en-US/abenbuilt_in_types_generic.htm" target="_blank"&gt; generic types&lt;/A&gt; to understand what it is.&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jun 2019 07:05:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/what-is-wrong-in-this-simple-code/m-p/11938626#M1965381</guid>
      <dc:creator>matt</dc:creator>
      <dc:date>2019-06-21T07:05:26Z</dc:date>
    </item>
    <item>
      <title>Re: What is wrong in this simple code?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/what-is-wrong-in-this-simple-code/m-p/11938627#M1965382</link>
      <description>&lt;P&gt;Thanks Mathew.&lt;/P&gt;&lt;P&gt;Can you please tell me what should be the correct way to write this program?&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jun 2019 07:36:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/what-is-wrong-in-this-simple-code/m-p/11938627#M1965382</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2019-06-21T07:36:35Z</dc:date>
    </item>
    <item>
      <title>Re: What is wrong in this simple code?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/what-is-wrong-in-this-simple-code/m-p/11938628#M1965383</link>
      <description>&lt;P&gt;In order to declare an internal table you should use:&lt;/P&gt;&lt;P&gt;- Type table of&lt;/P&gt;&lt;P&gt;- Like standard table of&lt;/P&gt;&lt;P&gt;Regards.&lt;BR /&gt;Umberto&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jun 2019 07:44:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/what-is-wrong-in-this-simple-code/m-p/11938628#M1965383</guid>
      <dc:creator>umberto_panico</dc:creator>
      <dc:date>2019-06-21T07:44:55Z</dc:date>
    </item>
    <item>
      <title>Re: What is wrong in this simple code?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/what-is-wrong-in-this-simple-code/m-p/11938629#M1965384</link>
      <description>&lt;A href="https://answers.sap.com/users/190184/pradipchoudhary.html"&gt;Dip Choudhury&lt;/A&gt; Prefixing with "wa" was used a long time ago but is not advised anymore because "work area" doesn't apply to the variable, but to the way it is used in a short list of statements like LOOP AT ... INTO wa (where wa can be an elementary or structured variable, object or an internal table).Nowadays, some of preferred "prefixes" are "s" if the work area is a structure, etc. (dixit &lt;A href="https://help.sap.com/doc/abapdocu_753_index_htm/7.53/en-US/index.htm?file=abenprog_intern_names_guidl.htm"&gt;ABAP documentation&lt;/A&gt;: "Similarly, "s" and "t" as prefixes stand for "structures" and internal "tables"")</description>
      <pubDate>Fri, 21 Jun 2019 07:50:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/what-is-wrong-in-this-simple-code/m-p/11938629#M1965384</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2019-06-21T07:50:26Z</dc:date>
    </item>
    <item>
      <title>Re: What is wrong in this simple code?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/what-is-wrong-in-this-simple-code/m-p/11938630#M1965385</link>
      <description>&lt;P&gt;Or some people hold you put the s on the end of the table name.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;LOOP AT things INTO thing.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;instead of&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;LOOP AT t_thing INTO s_thing.&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 21 Jun 2019 08:19:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/what-is-wrong-in-this-simple-code/m-p/11938630#M1965385</guid>
      <dc:creator>matt</dc:creator>
      <dc:date>2019-06-21T08:19:06Z</dc:date>
    </item>
    <item>
      <title>Re: What is wrong in this simple code?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/what-is-wrong-in-this-simple-code/m-p/11938631#M1965386</link>
      <description>&lt;P&gt;Hi, &lt;/P&gt;&lt;P&gt;Here is the correct code.&lt;/P&gt;&lt;P&gt; wa_tab1-fld1 = 1.&lt;BR /&gt;
 wa_tab1-fld2 = 'A'.&lt;BR /&gt;
 APPEND wa_tab1 TO tab1.&lt;BR /&gt;
&lt;BR /&gt;
 wa_tab1-fld1 = 2.&lt;BR /&gt;
 wa_tab1-fld2 = 'B'.&lt;BR /&gt;
 APPEND wa_tab1 TO tab1.&lt;BR /&gt;
&lt;BR /&gt;
SELECT&lt;BR /&gt;
 fld1,&lt;BR /&gt;
 fld2&lt;BR /&gt;
 FROM @tab1 AS a&lt;BR /&gt;
 WHERE fld1 = 1&lt;BR /&gt;
 INTO @DATA(output) .&lt;BR /&gt;
&lt;BR /&gt;
WRITE: /1 output-fld1, output-fld2.&lt;BR /&gt;
&lt;BR /&gt;
ENDSELECT.&lt;/P&gt;&lt;P&gt;&lt;A href="https://answers.sap.com/storage/attachments/1698500-code.png"&gt;code.png&lt;/A&gt;&lt;A href="https://answers.sap.com/storage/attachments/1698501-output.png"&gt;output.png&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Guru Prasad.&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jun 2019 09:47:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/what-is-wrong-in-this-simple-code/m-p/11938631#M1965386</guid>
      <dc:creator>former_member288834</dc:creator>
      <dc:date>2019-06-21T09:47:44Z</dc:date>
    </item>
    <item>
      <title>Re: What is wrong in this simple code?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/what-is-wrong-in-this-simple-code/m-p/11938632#M1965387</link>
      <description>&lt;A href="https://answers.sap.com/users/190184/pradip.choudhary.html"&gt;Dip Choudhury&lt;/A&gt; when you use SELECT, you must indicate in which variable (INTO/APPENDING ...) you store the row(s) returned by the database. There are also lots of demo programs in the ABAP documentation, so you shouldn't have difficulties to understand what is wrong.</description>
      <pubDate>Fri, 21 Jun 2019 10:59:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/what-is-wrong-in-this-simple-code/m-p/11938632#M1965387</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2019-06-21T10:59:57Z</dc:date>
    </item>
    <item>
      <title>Re: What is wrong in this simple code?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/what-is-wrong-in-this-simple-code/m-p/11938633#M1965388</link>
      <description>&lt;P&gt;Your types are generic types. You can't define DATA against generic types.Type C for example is a generic type.&lt;/P&gt;&lt;P&gt;You can't select from an internal table (except possibly in the latest versions of ABAP).&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jun 2019 11:01:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/what-is-wrong-in-this-simple-code/m-p/11938633#M1965388</guid>
      <dc:creator>matt</dc:creator>
      <dc:date>2019-06-21T11:01:30Z</dc:date>
    </item>
    <item>
      <title>Re: What is wrong in this simple code?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/what-is-wrong-in-this-simple-code/m-p/11938634#M1965389</link>
      <description>&lt;P&gt;Let me arrange &lt;A href="https://answers.sap.com/users/190184/pradipchoudhary.html"&gt;Dip Choudhury&lt;/A&gt; question by placing the actual code (from his comment) close to the question:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;REPORT  ZTEST1.
types: begin of str1,
         fld1  TYPE N,
         fld2  TYPE C,
         fld3  TYPE N,
       end of str1,
       begin of str2,
         fld3  TYPE N,
       end of str2.
    
DATA : tab1     TYPE TABLE OF str1,
       wa_tab1  TYPE str1,
       tab2     TYPE TABLE OF str2,
       wa_tab2  TYPE str2.

SELECT fld1 fld2 FROM tab1 WHERE fld3 = pfld3.
  WRITE: /1 tab1-fld1, tab1-fld2.  " &amp;lt;=== SYNTAX ERRORS 1 &amp;amp; 2
ENDSELECT.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Syntax errors:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;Type "TAB1" is a table without a header line and therefore does not have a 
component called "FLD1".

Type "TAB1" is a table without a header line and therefore does not have a 
component called "FLD2".&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 21 Jun 2019 11:35:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/what-is-wrong-in-this-simple-code/m-p/11938634#M1965389</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2019-06-21T11:35:51Z</dc:date>
    </item>
    <item>
      <title>Re: What is wrong in this simple code?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/what-is-wrong-in-this-simple-code/m-p/11938635#M1965390</link>
      <description>&lt;P&gt;It might be "correct" but not a good code, sorry. Combination of new syntax with old syntax looks very odd. It's better to be consistent. It also does not explain to OP the difference between internal table and DB table + the fact that this won't work in &amp;lt;7.4 version even if SELECT statement is rewritten in the old syntax.&lt;/P&gt;&lt;P&gt;Please try to offer better written code when advising others, even as an example.&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jun 2019 19:48:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/what-is-wrong-in-this-simple-code/m-p/11938635#M1965390</guid>
      <dc:creator>Jelena_Perfiljeva</dc:creator>
      <dc:date>2019-06-21T19:48:53Z</dc:date>
    </item>
    <item>
      <title>Re: What is wrong in this simple code?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/what-is-wrong-in-this-simple-code/m-p/11938636#M1965391</link>
      <description>&lt;P&gt;Once again, try to understand what the code does, then you can also understand what the problem is and how to solve it. You should be able to look at every command and explain to another person (or a rubber duck &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; ) what the code does. If you can't do that then that's a problem.&lt;/P&gt;&lt;P&gt;Step 1: (even copy-pasting this code hurts but I'm willing to sacrifice myself for science. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; )&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;types: begin of str1,
   fld1 type N,
  fld2 type C,
 pfld3 type N,

end of str1.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;This defines a type named str1, this is a structure type (= group of fields, 3 fields in this case). &lt;/P&gt;&lt;P&gt;Step 2:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA: tab1 TYPE TABLE OF str1,
        wa_tab1 TYPE str1.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Here come the actual variables. tab1 is an internal table which can hold the records with structure of type str1, wa_tab1 is a structure of type str1. It has 3 fields, per TYPE definition above.&lt;/P&gt;&lt;P&gt;At this point you could, for example, do like suggested in another answer:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;wa_tab1-fld1 = 1. 

wa_tab1-fld2 = 'A'. 

APPEND wa_tab1 TO tab1.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The first two commands assign a value to the fields in the structure wa_tab1. Then this structure is added to internal table tab1. So, as a result, you have 1 record in table tab1.&lt;/P&gt;&lt;P&gt;Step 3. I'm not clear where you were going with this, to be honest:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SELECT fld1 fld2 FROM tab1 WHERE fld3 = pfld3.

WRITE:/1 tab1-fld1, tab1-fld2.

ENDSELECT.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;SELECT is used with database tables, not with internal tables (in one of the recent releases I believe you can also do SELECT from an internal table, but that seems like an overkill for a simple example). If your goal was to select data from a database table then you need a different structure type definition. It makes no sense to select legitimate data into generic N and C type. Instead, you should use the data dictionary types that correspond to what you are selecting. (Plenty of examples in ABAP Help.) Also using SELECT... ENDSELECT and doing some processing within has not been considered a good practice for a long time already. (Not sure if something changed here with HANA but I doubt.)&lt;/P&gt;&lt;P&gt;If you wanted to get data from the internal table (which, in your code, has no data, so no point doing that either) then use the commands for internal tables: READ and LOOP AT.&lt;/P&gt;&lt;P&gt;Also I'm surprised you didn't get a syntax error on pfld3. Where did that come from? It's not defined anywhere.&lt;/P&gt;&lt;P&gt;And then, of course, we cannot simply refer to the values in an internal table like &amp;lt;table&amp;gt;-&amp;lt;field&amp;gt; Table has rows &lt;STRONG&gt;and&lt;/STRONG&gt; columns. Which &amp;lt;field&amp;gt; would this refer to? In which row/record? Simply makes no sense. If you want to output all the table content then LOOP through it INTO a structure or a field symbol (see Help on LOOP AT) and output the values using that structure or field symbol. &lt;/P&gt;&lt;P&gt;Again, documentation covers all these subjects in depth. There are also plenty of examples available, even in the old releases. In ABAP Editor, go to the menu Environment -&amp;gt; Examples.&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jun 2019 20:20:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/what-is-wrong-in-this-simple-code/m-p/11938636#M1965391</guid>
      <dc:creator>Jelena_Perfiljeva</dc:creator>
      <dc:date>2019-06-21T20:20:27Z</dc:date>
    </item>
  </channel>
</rss>

