<?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 Inline Declaration Assignment in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/issue-with-inline-declaration-assignment/m-p/363057#M7783</link>
    <description>&lt;P&gt;Besides all the other correct answers here, think about using the CONV operator in order to enforce the correct type at operand positions. Then, you cannot use  CONCATENATE but &amp;amp;&amp;amp;:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;... = ... &amp;amp;&amp;amp; CONV string( ... ) &amp;amp;&amp;amp; ...&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Horst&lt;/P&gt;</description>
    <pubDate>Sat, 15 Oct 2016 12:40:06 GMT</pubDate>
    <dc:creator>retired_member</dc:creator>
    <dc:date>2016-10-15T12:40:06Z</dc:date>
    <item>
      <title>Issue with Inline Declaration Assignment</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/issue-with-inline-declaration-assignment/m-p/363053#M7779</link>
      <description>&lt;P&gt;Hi Experts,&lt;/P&gt;&lt;P&gt;Please find my below code. &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
DATA : PA_FY TYPE GJAHR.    " SUCCEEDING FINANCIAL YEAR.
DATA(PA_FY1) = PA_FY + 1.

**/-- FINANCIAL YEAR STARTING DATE

CONCATENATE PA_FY '04' '01' INTO DATA(FIN_STRT_DATE).

**/-- FINACIAL YEAR ENDING DATE

CONCATENATE PA_FY1 '03' '31' INTO DATA(FIN_END_DATE).

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;This code is returning error message .&lt;/P&gt;&lt;P&gt;"PA_FY1" must be character-type data object (data type C,N,D,T or string)&lt;/P&gt;&lt;P&gt;But if i declare 'PA_FY1' as &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA(PA_FY1) TYPE GJAHR.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Then it wont throw any error message.&lt;/P&gt;&lt;P&gt;B.R.&lt;/P&gt;</description>
      <pubDate>Fri, 14 Oct 2016 09:12:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/issue-with-inline-declaration-assignment/m-p/363053#M7779</guid>
      <dc:creator>former_member207873</dc:creator>
      <dc:date>2016-10-14T09:12:05Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with Inline Declaration Assignment</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/issue-with-inline-declaration-assignment/m-p/363054#M7780</link>
      <description>&lt;P&gt;Your statement&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA(PA_FY1)= PA_FY +1.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;is not valid because the type of the defined variable PA_FY1 cannot be determined from the left hand side of the term: PA_FY is character-like, 1 is a number. So which type should the compiler use? That is how the error message should be understood, I guess.&lt;/P&gt;&lt;P&gt;And you probably mean &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA PA_FY1 TYPE GJAHR&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;as&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA(PA_FY1)TYPE GJAHR.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;is not valid ABAP.&lt;/P&gt;&lt;P&gt;JNN&lt;/P&gt;</description>
      <pubDate>Fri, 14 Oct 2016 10:24:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/issue-with-inline-declaration-assignment/m-p/363054#M7780</guid>
      <dc:creator>nomssi</dc:creator>
      <dc:date>2016-10-14T10:24:10Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with Inline Declaration Assignment</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/issue-with-inline-declaration-assignment/m-p/363055#M7781</link>
      <description>&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA(PA_FY1)= PA_FY +1.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The compiler determines the types as explained here: &lt;A href="http://help.sap.com/abapdocu_702/en/?url=ABENARITH_TYPE.htm"&gt;Calculation type&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Based on the documentation: PA_FY being of type N, and 1 being an Integer, then the calculation type will be Packed (type P).&lt;/P&gt;&lt;P&gt;Consequently, PA_FY1 is also defined as type P.&lt;/P&gt;&lt;P&gt;If you comment the erroneous code, and if you debug, you'll be able to see the real type of PA_FY1.&lt;/P&gt;</description>
      <pubDate>Fri, 14 Oct 2016 12:02:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/issue-with-inline-declaration-assignment/m-p/363055#M7781</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2016-10-14T12:02:17Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with Inline Declaration Assignment</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/issue-with-inline-declaration-assignment/m-p/363056#M7782</link>
      <description>&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA(PA_FY1) = PA_FY + 1.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;is a valid statement as of ABAP 7.40&lt;/P&gt;&lt;P&gt;The syntax error is probably for this line, because PA_FY1 is of type P :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;CONCATENATE PA_FY1 '03' '31' INTO DATA(FIN_END_DATE).&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 14 Oct 2016 14:51:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/issue-with-inline-declaration-assignment/m-p/363056#M7782</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2016-10-14T14:51:33Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with Inline Declaration Assignment</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/issue-with-inline-declaration-assignment/m-p/363057#M7783</link>
      <description>&lt;P&gt;Besides all the other correct answers here, think about using the CONV operator in order to enforce the correct type at operand positions. Then, you cannot use  CONCATENATE but &amp;amp;&amp;amp;:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;... = ... &amp;amp;&amp;amp; CONV string( ... ) &amp;amp;&amp;amp; ...&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Horst&lt;/P&gt;</description>
      <pubDate>Sat, 15 Oct 2016 12:40:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/issue-with-inline-declaration-assignment/m-p/363057#M7783</guid>
      <dc:creator>retired_member</dc:creator>
      <dc:date>2016-10-15T12:40:06Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with Inline Declaration Assignment</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/issue-with-inline-declaration-assignment/m-p/363058#M7784</link>
      <description>&lt;P&gt;Taking both &lt;A rel="user" href="https://answers.sap.com/users/3970/horstkeller.html" nodeid="3970"&gt;Horst Keller&lt;/A&gt;'s response and &lt;A rel="user" href="https://answers.sap.com/users/1091/sandrarossi.html" nodeid="1091"&gt;Sandra Rossi&lt;/A&gt;'s into account, you could combine them and use the statement&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA(PA_FY1) = CONV gjahr( PA_FY + 1 ).&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;This will force the data type &lt;EM&gt;gjahr&lt;/EM&gt; onto PA_FY1.&lt;/P&gt;</description>
      <pubDate>Mon, 17 Oct 2016 16:05:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/issue-with-inline-declaration-assignment/m-p/363058#M7784</guid>
      <dc:creator>raghug</dc:creator>
      <dc:date>2016-10-17T16:05:46Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with Inline Declaration Assignment</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/issue-with-inline-declaration-assignment/m-p/363059#M7785</link>
      <description>&lt;P&gt;or&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA(FIN_STRT_DATE) = CONV string( PA_FY1 ) &amp;amp;&amp;amp; '04' &amp;amp;&amp;amp; '01'.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; FIN_STRT_DATE will have type string.&lt;/P&gt;</description>
      <pubDate>Mon, 17 Oct 2016 16:41:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/issue-with-inline-declaration-assignment/m-p/363059#M7785</guid>
      <dc:creator>retired_member</dc:creator>
      <dc:date>2016-10-17T16:41:57Z</dc:date>
    </item>
  </channel>
</rss>

