<?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 Doing Calculation in Select and Write Stament in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/doing-calculation-in-select-and-write-stament/m-p/857990#M47488</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;I have worked quite a lot on Oracle Database Programming. I am tring to do some programming in ABAP , but its failing to do so. What is the normal way of calculating the fields in the ABAP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Take for Eg below table structure.&lt;/P&gt;&lt;P&gt;Table Name: YSALESTAB. (Sales Table)&lt;/P&gt;&lt;P&gt;Field: ORDERNO (Order Number)&lt;/P&gt;&lt;P&gt;       PRODNO  (Product Number)&lt;/P&gt;&lt;P&gt;       UNITPR  (Unit Price)&lt;/P&gt;&lt;P&gt;       QTYORD  (Qty Ordered)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Question A): I am executing the following select.&lt;/P&gt;&lt;P&gt;SELECT ORDERNO UNITPR QTYORD, &amp;lt;b&amp;gt;UNITPR*QTYORD&amp;lt;/b&amp;gt; from YSALESTAB.&lt;/P&gt;&lt;P&gt;   WRITE .......&lt;/P&gt;&lt;P&gt;ENDSELECT.&lt;/P&gt;&lt;P&gt;But it is not allowing me to select calculated field. Is there any way in the select statement to use calculated field or I will have to go with other workaround like defining local variable and doing calculation on that variable?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Question B): Is there any way to write out calculated fields in write statement.&lt;/P&gt;&lt;P&gt;eg data : int1 type i value 3, int2 type i value 4.&lt;/P&gt;&lt;P&gt;write &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt; 'Values are ', int1 * int2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Mitesh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 01 Apr 2005 07:20:54 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2005-04-01T07:20:54Z</dc:date>
    <item>
      <title>Doing Calculation in Select and Write Stament</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/doing-calculation-in-select-and-write-stament/m-p/857990#M47488</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;I have worked quite a lot on Oracle Database Programming. I am tring to do some programming in ABAP , but its failing to do so. What is the normal way of calculating the fields in the ABAP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Take for Eg below table structure.&lt;/P&gt;&lt;P&gt;Table Name: YSALESTAB. (Sales Table)&lt;/P&gt;&lt;P&gt;Field: ORDERNO (Order Number)&lt;/P&gt;&lt;P&gt;       PRODNO  (Product Number)&lt;/P&gt;&lt;P&gt;       UNITPR  (Unit Price)&lt;/P&gt;&lt;P&gt;       QTYORD  (Qty Ordered)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Question A): I am executing the following select.&lt;/P&gt;&lt;P&gt;SELECT ORDERNO UNITPR QTYORD, &amp;lt;b&amp;gt;UNITPR*QTYORD&amp;lt;/b&amp;gt; from YSALESTAB.&lt;/P&gt;&lt;P&gt;   WRITE .......&lt;/P&gt;&lt;P&gt;ENDSELECT.&lt;/P&gt;&lt;P&gt;But it is not allowing me to select calculated field. Is there any way in the select statement to use calculated field or I will have to go with other workaround like defining local variable and doing calculation on that variable?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Question B): Is there any way to write out calculated fields in write statement.&lt;/P&gt;&lt;P&gt;eg data : int1 type i value 3, int2 type i value 4.&lt;/P&gt;&lt;P&gt;write &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt; 'Values are ', int1 * int2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Mitesh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Apr 2005 07:20:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/doing-calculation-in-select-and-write-stament/m-p/857990#M47488</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-04-01T07:20:54Z</dc:date>
    </item>
    <item>
      <title>Re: Doing Calculation in Select and Write Stament</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/doing-calculation-in-select-and-write-stament/m-p/857991#M47489</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Mitesh,&lt;/P&gt;&lt;P&gt;Unfotunately there is no possibility to use calcualted fields in an ABAP Open SQL query. Also ABAP has a rudimentary syntax concerning expressions: you cannot use calculated expressions almost anywhere except the right side of an assignment statement. In your question 2 you have to use some intermediate variable.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Apr 2005 07:35:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/doing-calculation-in-select-and-write-stament/m-p/857991#M47489</guid>
      <dc:creator>sergey_korolev</dc:creator>
      <dc:date>2005-04-01T07:35:14Z</dc:date>
    </item>
    <item>
      <title>Re: Doing Calculation in Select and Write Stament</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/doing-calculation-in-select-and-write-stament/m-p/857992#M47490</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sergei,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the reply..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Mitesh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Apr 2005 08:00:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/doing-calculation-in-select-and-write-stament/m-p/857992#M47490</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-04-04T08:00:20Z</dc:date>
    </item>
    <item>
      <title>Re: Doing Calculation in Select and Write Stament</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/doing-calculation-in-select-and-write-stament/m-p/857993#M47491</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;try this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;types : begin of ty_mara,&lt;/P&gt;&lt;P&gt;        matnr type mara-matnr,&lt;/P&gt;&lt;P&gt;        quan  type n,&lt;/P&gt;&lt;P&gt;        end of ty_mara.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: BEGIN OF WA,&lt;/P&gt;&lt;P&gt;        matnr type mara-matnr,&lt;/P&gt;&lt;P&gt;        quan  type n,&lt;/P&gt;&lt;P&gt;      END OF WA.&lt;/P&gt;&lt;P&gt;data v_matnr type mara-matnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;v_matnr = '000000000000000033'.&lt;/P&gt;&lt;P&gt;EXEC SQL.&lt;/P&gt;&lt;P&gt;select matnr, ntgew*3 into :wa   from&lt;/P&gt;&lt;P&gt;mara where matnr = :v_matnr&lt;/P&gt;&lt;P&gt;ENDEXEC.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;write &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt; wa-matnr, wa-quan.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Apr 2005 10:09:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/doing-calculation-in-select-and-write-stament/m-p/857993#M47491</guid>
      <dc:creator>jayanthi_jayaraman</dc:creator>
      <dc:date>2005-04-04T10:09:28Z</dc:date>
    </item>
  </channel>
</rss>

