<?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: Storing field value into variable using select query in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/storing-field-value-into-variable-using-select-query/m-p/12097772#M1972473</link>
    <description>&lt;P&gt;Are you getting any error?&lt;/P&gt;</description>
    <pubDate>Mon, 16 Dec 2019 16:30:40 GMT</pubDate>
    <dc:creator>GK817</dc:creator>
    <dc:date>2019-12-16T16:30:40Z</dc:date>
    <item>
      <title>Storing field value into variable using select query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/storing-field-value-into-variable-using-select-query/m-p/12097770#M1972471</link>
      <description>&lt;PRE&gt;&lt;CODE&gt; DATA var TYPE c LENGTH 20.
 SELECT SINGLE lokkt FROM bseg INTO var WHERE hkont = value.
 
&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;Hey gurus, I'm trying to store a field value from table directly into a variable using this query.. I'm guessing there is a logical error or the query itself could be wrong.. if so then please help me understand how could i achieve this or fix it?&lt;/P&gt;</description>
      <pubDate>Mon, 16 Dec 2019 16:21:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/storing-field-value-into-variable-using-select-query/m-p/12097770#M1972471</guid>
      <dc:creator>former_member600516</dc:creator>
      <dc:date>2019-12-16T16:21:29Z</dc:date>
    </item>
    <item>
      <title>Re: Storing field value into variable using select query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/storing-field-value-into-variable-using-select-query/m-p/12097771#M1972472</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;SELECT SINGLE lokkt FROM bseg INTO  @DATA(lv_lokkt) where hkont =  @value.&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 16 Dec 2019 16:30:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/storing-field-value-into-variable-using-select-query/m-p/12097771#M1972472</guid>
      <dc:creator>GK817</dc:creator>
      <dc:date>2019-12-16T16:30:04Z</dc:date>
    </item>
    <item>
      <title>Re: Storing field value into variable using select query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/storing-field-value-into-variable-using-select-query/m-p/12097772#M1972473</link>
      <description>&lt;P&gt;Are you getting any error?&lt;/P&gt;</description>
      <pubDate>Mon, 16 Dec 2019 16:30:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/storing-field-value-into-variable-using-select-query/m-p/12097772#M1972473</guid>
      <dc:creator>GK817</dc:creator>
      <dc:date>2019-12-16T16:30:40Z</dc:date>
    </item>
    <item>
      <title>Re: Storing field value into variable using select query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/storing-field-value-into-variable-using-select-query/m-p/12097773#M1972474</link>
      <description>&lt;P&gt;The program is going into infinite loop.. since this is the only change i made i'm guessing this query broke something else in the code&lt;/P&gt;</description>
      <pubDate>Mon, 16 Dec 2019 16:35:56 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/storing-field-value-into-variable-using-select-query/m-p/12097773#M1972474</guid>
      <dc:creator>former_member600516</dc:creator>
      <dc:date>2019-12-16T16:35:56Z</dc:date>
    </item>
    <item>
      <title>Re: Storing field value into variable using select query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/storing-field-value-into-variable-using-select-query/m-p/12097774#M1972475</link>
      <description>&lt;P&gt;learn new way to code &lt;/P&gt;&lt;P&gt;&lt;A href="https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-us/abenselect_inline_decl_abexa.htm"&gt;SELECT, Inline Declarations&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://blogs.sap.com/2014/10/08/abap-news-for-740-sp08-open-sql/"&gt;ABAP News for 7.40, SP08 – Open SQL&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Dec 2019 16:44:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/storing-field-value-into-variable-using-select-query/m-p/12097774#M1972475</guid>
      <dc:creator>Nawanandana</dc:creator>
      <dc:date>2019-12-16T16:44:12Z</dc:date>
    </item>
    <item>
      <title>Re: Storing field value into variable using select query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/storing-field-value-into-variable-using-select-query/m-p/12097775#M1972476</link>
      <description>&lt;P&gt;Infinite loop or just &lt;STRONG&gt;very very very long&lt;/STRONG&gt;? BSEG used to be a cluster table, so maybe it's your case, and HKONT is not part of the primary key, consequently, a huge number of lines will have to be read from BSEG table until one line satisfies the condition.&lt;/P&gt;&lt;P&gt;What did you change?&lt;/P&gt;</description>
      <pubDate>Mon, 16 Dec 2019 16:44:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/storing-field-value-into-variable-using-select-query/m-p/12097775#M1972476</guid>
      <dc:creator>Sandra_Rossi</dc:creator>
      <dc:date>2019-12-16T16:44:55Z</dc:date>
    </item>
    <item>
      <title>Re: Storing field value into variable using select query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/storing-field-value-into-variable-using-select-query/m-p/12097776#M1972477</link>
      <description>&lt;P&gt;No loop there. &lt;/P&gt;&lt;P&gt;Please try UPTO 1 ROWS or may be 100 ROWS and see if you get the results. If yes, then may be it's the huge data as suggested by Sandra.&lt;/P&gt;</description>
      <pubDate>Mon, 16 Dec 2019 17:03:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/storing-field-value-into-variable-using-select-query/m-p/12097776#M1972477</guid>
      <dc:creator>GK817</dc:creator>
      <dc:date>2019-12-16T17:03:55Z</dc:date>
    </item>
    <item>
      <title>Re: Storing field value into variable using select query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/storing-field-value-into-variable-using-select-query/m-p/12097777#M1972478</link>
      <description>&lt;P&gt;&lt;A href="https://answers.sap.com/users/480548/pro888.html"&gt;Prasad Supare&lt;/A&gt;,&lt;/P&gt;&lt;P&gt;The data type of the field used in the select Query is different from the variable, you need to correct that. You data declaration and code must be as below:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA var TYPE ALTKT_SKB1.
SELECT SINGLE lokkt 
FROM bseg 
INTO @var 
WHERE hkont = @value.

Or

You can use the code suggested by Gaurav Above.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Regards!&lt;/P&gt;</description>
      <pubDate>Mon, 16 Dec 2019 18:18:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/storing-field-value-into-variable-using-select-query/m-p/12097777#M1972478</guid>
      <dc:creator>former_member1716</dc:creator>
      <dc:date>2019-12-16T18:18:30Z</dc:date>
    </item>
    <item>
      <title>Re: Storing field value into variable using select query</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/storing-field-value-into-variable-using-select-query/m-p/12097778#M1972479</link>
      <description>&lt;P&gt;Hi Prasad,&lt;/P&gt;&lt;P&gt;In the old days FiDoc item table BSEG used to be a cluster table w/ only BELNR / POSNR as the primary key. The way to go was to look for a secondary index either on BKPF (FiDoc Header) or one of the secondary index tabs (BSID... etc). Check if HKONT is an index on BKPF or another table that contains the BELNR, then join w/BSEG on BELNR. That should give you acceptable performance... at least used to in ECC. S/4 HANA; no clue, but worth a try!&lt;/P&gt;&lt;P&gt;A remark on the other answers: IMHO they 'only' address the 'formally unclean' code, but not the performance... (except, of course, Sandra's comment...)&lt;/P&gt;&lt;P&gt;All the best,&lt;BR /&gt;Mike&lt;/P&gt;</description>
      <pubDate>Mon, 16 Dec 2019 18:47:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/storing-field-value-into-variable-using-select-query/m-p/12097778#M1972479</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2019-12-16T18:47:32Z</dc:date>
    </item>
  </channel>
</rss>

