<?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 Select single in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-single/m-p/2722428#M631601</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Guys,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a strange requirement as stated below :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kindly replace the following select statement by select single.  I doubt if it is possible.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; SELECT matnr&lt;/P&gt;&lt;P&gt;              dgcl&lt;/P&gt;&lt;P&gt;    INTO TABLE pt_dgtmd[]&lt;/P&gt;&lt;P&gt;      FROM dgtmd&lt;/P&gt;&lt;P&gt;      FOR ALL ENTRIES IN pt_matd[]&lt;/P&gt;&lt;P&gt;    WHERE matnr = pt_matd-matnr.&lt;/P&gt;&lt;P&gt;    IF sy-subrc = 0. ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Appreciate with max points if any body could help at the earliest.&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;Shankar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 22 Aug 2007 20:25:43 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-08-22T20:25:43Z</dc:date>
    <item>
      <title>Select single</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-single/m-p/2722428#M631601</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Guys,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a strange requirement as stated below :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kindly replace the following select statement by select single.  I doubt if it is possible.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; SELECT matnr&lt;/P&gt;&lt;P&gt;              dgcl&lt;/P&gt;&lt;P&gt;    INTO TABLE pt_dgtmd[]&lt;/P&gt;&lt;P&gt;      FROM dgtmd&lt;/P&gt;&lt;P&gt;      FOR ALL ENTRIES IN pt_matd[]&lt;/P&gt;&lt;P&gt;    WHERE matnr = pt_matd-matnr.&lt;/P&gt;&lt;P&gt;    IF sy-subrc = 0. ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Appreciate with max points if any body could help at the earliest.&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;Shankar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Aug 2007 20:25:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-single/m-p/2722428#M631601</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-22T20:25:43Z</dc:date>
    </item>
    <item>
      <title>Re: Select single</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-single/m-p/2722429#M631602</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You have internal table &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at pt_matd.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT single  matnr dgcl&lt;/P&gt;&lt;P&gt;INTO  pt_dgtmd -&amp;gt; this is work area&lt;/P&gt;&lt;P&gt;FROM dgtmd&lt;/P&gt;&lt;P&gt;WHERE matnr = pt_matd-matnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if sy-subrc eq 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Seshu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Aug 2007 20:28:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-single/m-p/2722429#M631602</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-22T20:28:33Z</dc:date>
    </item>
    <item>
      <title>Re: Select single</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-single/m-p/2722430#M631603</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You're selecting a group of records (into table pt_dgtmd) which join with another group of records (in pt_matd).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you intend to select a single record, your source should also be a single record. If you must select the first one, you could do this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
CLEAR wa_dgtmd.
LOOP AT pt_matd.
  SELECT SINGLE matnr dgcl
  INTO wa_dgtmd 
  FROM dgtmd
  WHERE matnr = pt_matd-matnr.

  IF sy-subrc = 0.
    EXIT.
  ENDIF.
ENDLOOP.

IF NOT wa_dgtmd IS INITIAL.
  " You've found your single record
ELSE.
  " You didn't
ENDIF.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Regards.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;One more thing, is matnr the primary key of dgtmd table? Because if not, you shouldn't be trying to use SELECT SINGLE, you could try SELECT...UP TO 1 ROWS instead.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        Alejandro Bindi&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Aug 2007 20:57:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-single/m-p/2722430#M631603</guid>
      <dc:creator>alejandro_bindi</dc:creator>
      <dc:date>2007-08-22T20:57:12Z</dc:date>
    </item>
    <item>
      <title>Re: Select single</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-single/m-p/2722431#M631604</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Guys,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your immediate replies.  Since the table PT_MATD does not have an header line it is not possible to loop this table.  Moreover this table is declared as types. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please help.&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;Shankar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Aug 2007 21:12:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-single/m-p/2722431#M631604</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-22T21:12:02Z</dc:date>
    </item>
    <item>
      <title>Re: Select single</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-single/m-p/2722432#M631605</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Add commented code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
DATA: wa_matd LIKE LINE OF pt_matd.  "&amp;lt;&amp;lt;&amp;lt; Added code

CLEAR wa_dgtmd.
LOOP AT pt_matd INTO wa_matd.  "&amp;lt;&amp;lt;&amp;lt; Modified code
  SELECT SINGLE matnr dgcl
  INTO wa_dgtmd 
  FROM dgtmd
  WHERE matnr = wa_matd-matnr.  "&amp;lt;&amp;lt;&amp;lt; Modified code
 
  IF sy-subrc = 0.
    EXIT.
  ENDIF.
ENDLOOP.
 
IF NOT wa_dgtmd IS INITIAL.
  " You've found your single record
ELSE.
  " You didn't
ENDIF.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Aug 2007 21:15:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-single/m-p/2722432#M631605</guid>
      <dc:creator>alejandro_bindi</dc:creator>
      <dc:date>2007-08-22T21:15:13Z</dc:date>
    </item>
    <item>
      <title>Re: Select single</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-single/m-p/2722433#M631606</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;you have internal table without header&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then declare work area&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data wt_matd like line of pt_matd.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data wt_dgtmd like line of pt_dgtmd.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at pt_matd into wa_matd.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT single  matnr dgcl&lt;/P&gt;&lt;P&gt;INTO TABLE wt_dgtmd&lt;/P&gt;&lt;P&gt;FROM dgtmd&lt;/P&gt;&lt;P&gt;WHERE matnr = wt_matd-matnr.&lt;/P&gt;&lt;P&gt;&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;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Seshu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Aug 2007 21:17:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-single/m-p/2722433#M631606</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-22T21:17:51Z</dc:date>
    </item>
    <item>
      <title>Re: Select single</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-single/m-p/2722434#M631607</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks buddy,  I am not getting any syntax error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Once the user comes back, let me give u more points.&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;Shankar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Aug 2007 21:22:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-single/m-p/2722434#M631607</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-22T21:22:37Z</dc:date>
    </item>
    <item>
      <title>Re: Select single</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-single/m-p/2722435#M631608</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I hope that you are aware that the original select would be the better choice than the loop select single.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Aug 2007 07:45:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-single/m-p/2722435#M631608</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-23T07:45:15Z</dc:date>
    </item>
    <item>
      <title>Re: Select single</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-single/m-p/2722436#M631609</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Boes,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The original select statement gives me the ABAP Run time dump.&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;Shankar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Aug 2007 21:01:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-single/m-p/2722436#M631609</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-23T21:01:21Z</dc:date>
    </item>
    <item>
      <title>Re: Select single</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-single/m-p/2722437#M631610</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;Select Single is mainly used for validation perpouse , even it will get all the data from the database table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT &amp;lt;b&amp;gt;single&amp;lt;/b&amp;gt; matnr dgcl&lt;/P&gt;&lt;P&gt;             INTO TABLE pt_dgtmd[]&lt;/P&gt;&lt;P&gt;             FROM dgtmd&lt;/P&gt;&lt;P&gt;             FOR ALL ENTRIES IN pt_matd&lt;/P&gt;&lt;P&gt;             WHERE matnr = pt_matd-matnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF sy-subrc = 0. ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;reward if usefull&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Aug 2007 04:59:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-single/m-p/2722437#M631610</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-24T04:59:54Z</dc:date>
    </item>
  </channel>
</rss>

