<?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 statement in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/2675620#M618165</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use this code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
data lv_zzptg type marc-zzptg.

concatenate s_vs_name '%' into lv_zzptg.

select matnr werks ekgrp zzptg from marc into table it_marc
where matnr in s_matnr
and werks in s_werks
and ekgrp in s_ekgrp
and zzptg like lv_zzptg.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please mark points if the solution was useful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Manoj&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        Manoj V Kumar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 16 Aug 2007 05:31:44 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-08-16T05:31:44Z</dc:date>
    <item>
      <title>select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/2675618#M618163</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Fnds,&lt;/P&gt;&lt;P&gt;I am having a problem in selection statement, &lt;/P&gt;&lt;P&gt;In selection screen s_zvs_name field is 3 characters length, &lt;/P&gt;&lt;P&gt;and the field zzptg in marc table is 9 characters length,&lt;/P&gt;&lt;P&gt;Now i want to select the records from marc where the 1st 3 characters will be the s_zvs_name.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I m trying like this, but it is not accepting.&lt;/P&gt;&lt;P&gt;select matnr werks ekgrp zzptg from marc into table it_marc&lt;/P&gt;&lt;P&gt;      where matnr in s_matnr&lt;/P&gt;&lt;P&gt;        and werks in s_werks&lt;/P&gt;&lt;P&gt;        and ekgrp in s_ekgrp&lt;/P&gt;&lt;P&gt;        and zzptg+0(3) in s_vs_name.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Plz give me the correct solution for this.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Aug 2007 05:25:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/2675618#M618163</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-16T05:25:22Z</dc:date>
    </item>
    <item>
      <title>Re: select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/2675619#M618164</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;Do one thing&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select zzptg from marc into table itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;now loop at itab.&lt;/P&gt;&lt;P&gt;itab1-fld1 = itab-zzptg+0(3).&lt;/P&gt;&lt;P&gt;append itab1.&lt;/P&gt;&lt;P&gt;claer itab ,itab1.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and proceed with these data&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;reward points to all helpful answers &lt;/P&gt;&lt;P&gt;kiran.M&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Aug 2007 05:31:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/2675619#M618164</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-16T05:31:01Z</dc:date>
    </item>
    <item>
      <title>Re: select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/2675620#M618165</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use this code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
data lv_zzptg type marc-zzptg.

concatenate s_vs_name '%' into lv_zzptg.

select matnr werks ekgrp zzptg from marc into table it_marc
where matnr in s_matnr
and werks in s_werks
and ekgrp in s_ekgrp
and zzptg like lv_zzptg.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please mark points if the solution was useful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Manoj&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        Manoj V Kumar&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Aug 2007 05:31:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/2675620#M618165</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-16T05:31:44Z</dc:date>
    </item>
    <item>
      <title>Re: select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/2675621#M618166</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Manoj,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;No, it's not working.....&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Aug 2007 06:10:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/2675621#M618166</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-16T06:10:16Z</dc:date>
    </item>
    <item>
      <title>Re: select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/2675622#M618167</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi kiran,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How it will work, &lt;/P&gt;&lt;P&gt;In selection statement itself i want to restrict the no.of entries by using the field z_vs_name.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Aug 2007 06:15:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/2675622#M618167</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-16T06:15:49Z</dc:date>
    </item>
    <item>
      <title>Re: select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/2675623#M618168</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;You can't have offset operations on SELECTS in the WHERE clause for the fields in the table. So it is causing you problem here. You need to have this condition separately rather than in the SELECT. First get the data into internal table without this condition and later have this condition on internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check this code.&lt;/P&gt;&lt;P&gt;select matnr werks ekgrp zzptg from marc into table it_marc&lt;/P&gt;&lt;P&gt;where matnr in s_matnr&lt;/P&gt;&lt;P&gt;and werks in s_werks&lt;/P&gt;&lt;P&gt;and ekgrp in s_ekgrp.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF IT_MARC[] IS NOT INITIAL.&lt;/P&gt;&lt;P&gt;LOOP AT IT_MARC.&lt;/P&gt;&lt;P&gt;IF IT_MARC-ZZPTG+0(3) IN S_VS_NAME.&lt;/P&gt;&lt;P&gt;APPEND IT_MARC TO IT_FINAL.&lt;/P&gt;&lt;P&gt;CLEAR IT_FINAL.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;Friendly Note:&amp;lt;/b&amp;gt; You have many open threads and Plz close the threads if they are answered/solved and reward points to the people who are helping you by taking their time.&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;Vinay&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Aug 2007 06:23:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/2675623#M618168</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-16T06:23:37Z</dc:date>
    </item>
    <item>
      <title>Re: select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/2675624#M618169</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;it will work, but only for special input values. As far as I understood you wright, I assume that you have defined s_zvs_name as a range. Therefore you have to create a where clause out of your range. You have to loop over your range and append to the where clause. For a equality row you could use the concatenate with '%', for between you have to extend with extremes (e.g. for ABC - MNO you have to write BETWEEN 'ABCAAAAAA ' and 'MNOZZZZZZ' - if the field contains only upper case characters). For a pattern you could use it directly in the LIKE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope that helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Ralph&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Aug 2007 06:59:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/2675624#M618169</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-16T06:59:07Z</dc:date>
    </item>
    <item>
      <title>Re: select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/2675625#M618170</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you redefine the selection screen SELECT-OPTIONS field S_ZVS_NAME to be the same type as the database field MARC-ZZPTG, and then have the user input the value as 3 characters followed by * you will get the records you want.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you must have only 3 characters on the selection screen, you will need to convert the input 3 character SELECT-OPTIONS table into a program RANGES table of 9 characters, putting an * in position 4.  This is not simple, as if the user inputs a range say AAA to ABC you cannot covert this to AAA* to ABC* as wildcards are not allowed in ranges.  Simplest to have the user input values matching the table field definition.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Andrew&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Aug 2007 10:56:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/2675625#M618170</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-16T10:56:36Z</dc:date>
    </item>
    <item>
      <title>Re: select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/2675626#M618171</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;you can either write &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select matnr werks ekgrp zzptg &lt;/P&gt;&lt;P&gt;         from marc &lt;/P&gt;&lt;P&gt;         into table it_marc&lt;/P&gt;&lt;P&gt;where matnr in s_matnr&lt;/P&gt;&lt;P&gt;and werks in s_werks&lt;/P&gt;&lt;P&gt;and ekgrp in s_ekgrp&lt;/P&gt;&lt;P&gt;and zzptg like s_vs_name1&lt;/P&gt;&lt;P&gt;   or zzptg like s_vs_name2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then you must change the s_vs_name into  3 character + anything, i.e. 'ABC%'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or you do  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select matnr werks ekgrp zzptg &lt;/P&gt;&lt;P&gt;          from marc&lt;/P&gt;&lt;P&gt;          into wa &lt;/P&gt;&lt;P&gt;where matnr in s_matnr&lt;/P&gt;&lt;P&gt;and werks in s_werks&lt;/P&gt;&lt;P&gt;and ekgrp in s_ekgrp.&lt;/P&gt;&lt;P&gt;  check ( wa-zzptg+0(3) in s_vs_name ).&lt;/P&gt;&lt;P&gt;    append wa to it_marc.&lt;/P&gt;&lt;P&gt;endselect&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The check is usually not recommended, however, if  check also conditions, whcih are not possible in the where condition, then it is o.k. And I don't think that zzptg is in an index, if it is then you should try option 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Siegfried&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Aug 2007 07:15:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/2675626#M618171</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-17T07:15:03Z</dc:date>
    </item>
    <item>
      <title>Re: select statement</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/2675627#M618172</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi&lt;/P&gt;&lt;P&gt;write the code in initialization event then it works because it got executed before selection screen&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Aug 2007 16:26:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-statement/m-p/2675627#M618172</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-17T16:26:09Z</dc:date>
    </item>
  </channel>
</rss>

