<?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: abap inline declaration doubts in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-inline-declaration-doubts/m-p/682876#M30445</link>
    <description>&lt;P&gt;So even though I am using inline declaration in my program, in some cases I HAVE to use the DATA statement (like in the case of the internal table and the reference variable) ? I thought that the purpose of inline declaration was to eliminate the use the DATA statement completely for declaration purposes.&lt;/P&gt;</description>
    <pubDate>Tue, 17 Jul 2018 11:04:25 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2018-07-17T11:04:25Z</dc:date>
    <item>
      <title>abap inline declaration doubts</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-inline-declaration-doubts/m-p/682873#M30442</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt;I was just trying out a simple code using abap inline declaration. However, I am stuck at some particular lines of code . Below is the code snippet:&lt;/P&gt;
  &lt;P&gt;&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;TYPES: BEGIN OF TY_FINAL,
 VBELN TYPE VBELN_VA, 
 VKORG TYPE VKORG, 
 KUNNR TYPE KUNNR, 
 POSNR TYPE POSNR_VA, 
 MATNR TYPE MATNR,
 END OF TY_FINAL.
DATA: L_REF TYPE REF TO DATA,
 VBELN1 TYPE VBELN_VA.
SELECT-OPTIONS: S1 FOR VBELN1.
 START-OF-SELECTION.
 CREATE DATA L_REF TYPE TY_FINAL. 
 SELECT VBELN, 
 VKORG, 
 KUNNR 
 FROM VBAK 
 INTO TABLE @data(IT_VBAK) 
 WHERE VBELN IN @S1.
 IF IT_VBAK IS NOT INITIAL. 
 SELECT VBELN,
 POSNR, 
 MATNR
 FROM VBAP 
 INTO TABLE @data(IT_VBAP) 
 FOR ALL ENTRIES IN @IT_VBAK 
 WHERE VBELN = @IT_VBAK-VBELN.
 ENDIF.
 ASSIGN IT_FINAL TO field-SYMBOL(&amp;lt;FS_FINAL&amp;gt;). 
 ASSIGN L_REF-&amp;gt;* TO FIELD-SYMBOL(&amp;lt;FS_WA&amp;gt;) .
LOOP AT IT_VBAK ASSIGNING FIELD-SYMBOL(&amp;lt;FS_VBAK&amp;gt;). 
 &amp;lt;FS_WA&amp;gt;-VBELN = &amp;lt;FS_VBAK&amp;gt;-VBELN.
 &amp;lt;FS_WA&amp;gt;-Vkorg = &amp;lt;FS_VBAK&amp;gt;-Vkorg.
 &amp;lt;FS_WA&amp;gt;-kunnr = &amp;lt;FS_VBAK&amp;gt;-kunnr. 
 read table it_vbap assigning &amp;lt;fs_vbap&amp;gt; with key vbeln = &amp;lt;fs_vbak&amp;gt;-vbeln. 
 &amp;lt;FS_WA&amp;gt;-posnr = &amp;lt;FS_VBAp&amp;gt;-posnr. 
 &amp;lt;FS_WA&amp;gt;-matnr = &amp;lt;FS_VBap&amp;gt;-matnr.
 APPEND &amp;lt;FS_WA&amp;gt; TO &amp;lt;FS_FINAL&amp;gt;. 
 ENDLOOP.
 UNASSIGN &amp;lt;FS_WA&amp;gt; .
&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;&lt;/P&gt;
  &lt;P&gt;&lt;/P&gt;
  &lt;P&gt;Here are my queries:&lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt;1) Is there a different way to declare the select options when working with inline declaration or do I have to use a variable using DATA statement like the conventional way (I had to declare a vbeln1 type vbeln_va) ?&lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt;2) How do I assign the internal table to a field symbol?&lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt;ASSIGN IT_FINAL TO field-SYMBOL(&amp;lt;FS_FINAL&amp;gt;).&lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt;3) How to create the reference variable (L_REF in this case) using inline declaration ?&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;Matt &lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;</description>
      <pubDate>Tue, 17 Jul 2018 07:04:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-inline-declaration-doubts/m-p/682873#M30442</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2018-07-17T07:04:26Z</dc:date>
    </item>
    <item>
      <title>Re: abap inline declaration doubts</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-inline-declaration-doubts/m-p/682874#M30443</link>
      <description>&lt;P&gt;Read the documentation?&lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt;&lt;A href="https://help.sap.com/http.svc/rc/abapdocu_752_index_htm/7.52/en-US/index.htm?file=abeninline_declarations.htm" target="test_blank"&gt;https://help.sap.com/http.svc/rc/abapdocu_752_index_htm/7.52/en-US/index.htm?file=abeninline_declarations.htm&lt;/A&gt;&lt;/P&gt;
  &lt;P&gt;"Is there a different way to declare the select options when working with inline declaration or do I have to use a variable using DATA statement like the conventional way" &lt;/P&gt;
  &lt;P&gt; No, the only thing you can do (but that doesn't change the SELECT-OPTIONS statement):&lt;/P&gt; 
  &lt;PRE&gt;&lt;CODE&gt;DATA(var) = VALUE scarr-carrid( ).
SELECT-OPTIONS selopt FOR var.
&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt;"How do I assign the internal table to a field symbol?"&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;/P&gt;
  &lt;P&gt;Exactly as shown, but of course, the internal table must exist, the position behind ASSIGN is not a declaration position:&lt;/P&gt; 
  &lt;PRE&gt;&lt;CODE&gt;DATA itab TYPE TABLE OF string.
ASSIGN itab TO FIELD-SYMBOL(&amp;lt;fs&amp;gt;).
&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt;"How to create the reference variable (L_REF in this case) using inline declaration":&lt;/P&gt;
  &lt;P&gt; &lt;/P&gt;
  &lt;P&gt; Trivial ...&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;DATA var TYPE i.
GET REFERENCE OF var INTO DATA(dref1).
DATA(dref2) = REF #( var ).
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 17 Jul 2018 09:53:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-inline-declaration-doubts/m-p/682874#M30443</guid>
      <dc:creator>retired_member</dc:creator>
      <dc:date>2018-07-17T09:53:54Z</dc:date>
    </item>
    <item>
      <title>Re: abap inline declaration doubts</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-inline-declaration-doubts/m-p/682875#M30444</link>
      <description>&lt;P&gt;&lt;/P&gt;
  &lt;P&gt;Your explanation is wrong regarding TABLES. With TABLES you declare a structure and not a table.&lt;/P&gt;
  &lt;P&gt;&lt;/P&gt;
  &lt;P&gt;Simply, don't use TABLES ...&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jul 2018 09:57:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-inline-declaration-doubts/m-p/682875#M30444</guid>
      <dc:creator>retired_member</dc:creator>
      <dc:date>2018-07-17T09:57:12Z</dc:date>
    </item>
    <item>
      <title>Re: abap inline declaration doubts</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-inline-declaration-doubts/m-p/682876#M30445</link>
      <description>&lt;P&gt;So even though I am using inline declaration in my program, in some cases I HAVE to use the DATA statement (like in the case of the internal table and the reference variable) ? I thought that the purpose of inline declaration was to eliminate the use the DATA statement completely for declaration purposes.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jul 2018 11:04:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-inline-declaration-doubts/m-p/682876#M30445</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2018-07-17T11:04:25Z</dc:date>
    </item>
    <item>
      <title>Re: abap inline declaration doubts</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-inline-declaration-doubts/m-p/682877#M30446</link>
      <description>&lt;P&gt;&lt;EM&gt; I thought that the purpose of inline declaration was to eliminate the use the DATA statement completely for declaration purposes.&lt;/EM&gt;&lt;/P&gt;
  &lt;P&gt;Not really.I find inline declaration to improve readability, especially with helper variables.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jul 2018 11:08:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-inline-declaration-doubts/m-p/682877#M30446</guid>
      <dc:creator>matt</dc:creator>
      <dc:date>2018-07-17T11:08:23Z</dc:date>
    </item>
    <item>
      <title>Re: abap inline declaration doubts</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-inline-declaration-doubts/m-p/682878#M30447</link>
      <description>&lt;P&gt;Thanks for using a code block - do you think next time you might nicely format the code as well, with indents, to make it easier to read?&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jul 2018 11:09:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-inline-declaration-doubts/m-p/682878#M30447</guid>
      <dc:creator>matt</dc:creator>
      <dc:date>2018-07-17T11:09:08Z</dc:date>
    </item>
    <item>
      <title>Re: abap inline declaration doubts</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-inline-declaration-doubts/m-p/682879#M30448</link>
      <description>&lt;P&gt;"I thought that the purpose of inline declaration was to eliminate the use the DATA statement completely for declaration purposes."&lt;/P&gt;
  &lt;P&gt;Who said so? No you use it where appropriate. Of course, you can in fact get rid of DATA, but why?&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;TYPES itab TYPE STANDARD TABLE OF string WITH EMPTY KEY.
DATA(itab) = VALUE itab( ).

ASSIGN itab TO FIELD-SYMBOL(&amp;lt;fs&amp;gt;).
&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Jul 2018 11:11:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-inline-declaration-doubts/m-p/682879#M30448</guid>
      <dc:creator>retired_member</dc:creator>
      <dc:date>2018-07-17T11:11:03Z</dc:date>
    </item>
  </channel>
</rss>

