<?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: Select single problem in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-single-problem/m-p/4909568#M1146212</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Martin,&lt;/P&gt;&lt;P&gt;Use the below query.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
Tables: PA0001.
data: wa_pa0001 type pa0001.

select single * into wa_pa0001 from PA0001 where pernr = wa-pernr.
if sy-subrc  0.
  do something
endif.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Chidanand&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 10 Dec 2008 04:13:09 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-12-10T04:13:09Z</dc:date>
    <item>
      <title>Select single problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-single-problem/m-p/4909563#M1146207</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 a problem with a select single statement:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;select single * from PA0001 where pernr = wa-pernr.
if sy-subrc &amp;lt;&amp;gt; 0.
  do something
endif.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I always get the syntax error  "A target error must be declared either explicity with an INTO clause or implicity with a TABLES statement."&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does anybody have an idea what the problem is?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks and regards,&lt;/P&gt;&lt;P&gt;Martin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Dec 2008 19:05:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-single-problem/m-p/4909563#M1146207</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-12-09T19:05:02Z</dc:date>
    </item>
    <item>
      <title>Re: Select single problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-single-problem/m-p/4909564#M1146208</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try this way&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
Tables : PA0001.
select single * from PA0001 where pernr = wa-pernr.
if sy-subrc  0.
  do something
endif.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Dec 2008 19:13:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-single-problem/m-p/4909564#M1146208</guid>
      <dc:creator>former_member194669</dc:creator>
      <dc:date>2008-12-09T19:13:53Z</dc:date>
    </item>
    <item>
      <title>Re: Select single problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-single-problem/m-p/4909565#M1146209</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Martin,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When you try to use any select statement there should be a into clause in case if your using tables declaration it would consider  the table as a workarea by default and will not throw a synatx error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try the below logic.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Report zxyz_123.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;tables: pa0001.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select single * from pa0001 where pernr = '000156784'.&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cheers,&lt;/P&gt;&lt;P&gt;Devendran&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Dec 2008 19:18:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-single-problem/m-p/4909565#M1146209</guid>
      <dc:creator>devendran_krishnan</dc:creator>
      <dc:date>2008-12-09T19:18:23Z</dc:date>
    </item>
    <item>
      <title>Re: Select single problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-single-problem/m-p/4909566#M1146210</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;define work area for PA0001 with keyword Tables.&lt;/P&gt;&lt;P&gt;In select statement use 'INTO PA0001'.&lt;/P&gt;&lt;P&gt;then you can use work area PA0001  "to perform someting".&lt;/P&gt;&lt;P&gt;Try below code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tables: PA0001.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: wa_pernr TYPE PA0001-PERNR.&lt;/P&gt;&lt;P&gt;parameters: p_pernr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;wa_pernr = p_pernr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select single * from PA0001 INTO PA0001 where pernr = wa_pernr.&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;do something ( here you can use work are fields as per your requirement e.g. PA0001-PERNR, PA0001-SUBTY).&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Dec 2008 19:21:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-single-problem/m-p/4909566#M1146210</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-12-09T19:21:45Z</dc:date>
    </item>
    <item>
      <title>Re: Select single problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-single-problem/m-p/4909567#M1146211</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Martin Fischer,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To fetch records from DB and perform some action on it, first you need to move the records either in an internal table(for more than one records) or in a work area(for a single record.)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Use this code:-&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
REPORT  zxy_abc.

*--------------------Type Declaration----------------------*
TYPES : BEGIN OF it, 
        pernr TYPE pa0001-pernr,
        subty TYPE pa0001-subty,
        objps TYPE pa0001-objps,
        END OF it.
*--------------------Data Declaration----------------------*
DATA : wa_pa0001 TYPE it. "Work Area for type it
*--------------------Query---------------------------------*
START-OF-SELECTION.

SELECT SINGLE * FROM pa0001
INTO wa_pa0001
WHERE pernr = wa_pa0001-pernr.

IF sy-subrc EQ 0.
*code
*use these fields by wa_pa0001-pernr and so on..
ENDIF.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this solves your problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; Regards.&lt;/P&gt;&lt;P&gt;Tarun Gambhir.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Dec 2008 03:59:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-single-problem/m-p/4909567#M1146211</guid>
      <dc:creator>I355602</dc:creator>
      <dc:date>2008-12-10T03:59:38Z</dc:date>
    </item>
    <item>
      <title>Re: Select single problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-single-problem/m-p/4909568#M1146212</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Martin,&lt;/P&gt;&lt;P&gt;Use the below query.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
Tables: PA0001.
data: wa_pa0001 type pa0001.

select single * into wa_pa0001 from PA0001 where pernr = wa-pernr.
if sy-subrc  0.
  do something
endif.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Chidanand&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Dec 2008 04:13:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-single-problem/m-p/4909568#M1146212</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-12-10T04:13:09Z</dc:date>
    </item>
    <item>
      <title>Re: Select single problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-single-problem/m-p/4909569#M1146213</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Select Query is correct ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;check out with wa-pernr. Is it wa_pernr or wa-pernr. ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Else try to use the into clause as : &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT SINGLE * FROM pa0001    &lt;/P&gt;&lt;P&gt;                             into wrk_area&lt;/P&gt;&lt;P&gt;                             WHERE pernr = wa_pernr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Dec 2008 04:19:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-single-problem/m-p/4909569#M1146213</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-12-10T04:19:15Z</dc:date>
    </item>
    <item>
      <title>Re: Select single problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-single-problem/m-p/4909570#M1146214</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Either use explicit work area using into clause or use the TABLES command to decalre implicit work area..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Dec 2008 04:39:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-single-problem/m-p/4909570#M1146214</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-12-10T04:39:26Z</dc:date>
    </item>
  </channel>
</rss>

