<?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: Selecting literals instead of fields in Open SQL in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/selecting-literals-instead-of-fields-in-open-sql/m-p/13670757#M2027645</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am not sure about your specific requirement but if we have lots of entries in a table lets say, we have lots of entries in MARA table, I want specific entries where matnr starts with "SFDC". So inshort I am trying to create a range which stores this "SFDC" and selects only those fields.&lt;/P&gt;&lt;P&gt;This is the new syntax used for HANA.&lt;/P&gt;&lt;LI-CODE lang="abap"&gt;DATA: lr_matnr type range of matnr,
      ls_matnr like line of lr_matrn.

ls_matnr-sign = 'I'.
ls_matnr-option = 'CP'.
ls_matnr-low = 'SFDC*'.
Append ls_matnr to lr_matnr.

SELECT 'I' AS sign,
       'EQ; AS option,
       matnr AS low,
       ' ' AS high
from mara
into table &lt;a href="https://community.sap.com/t5/user/viewprofilepage/user-id/1407137"&gt;@DATA&lt;/a&gt;(lt_matnr)
where ( matnr in @s_matnr AND matnr in &lt;a href="https://community.sap.com/t5/user/viewprofilepage/user-id/12268"&gt;@LR&lt;/a&gt;_matnr ).

// the s_matnr is a select option just to choose the matnr value from selection screen. &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;I hope I answered your query, The output table will have the 4 field i.e, sign, option, low, high&lt;/P&gt;&lt;P&gt;In the low field all the required matnr value will be stored.&lt;/P&gt;</description>
    <pubDate>Mon, 15 Apr 2024 09:32:50 GMT</pubDate>
    <dc:creator>MadhavSharma</dc:creator>
    <dc:date>2024-04-15T09:32:50Z</dc:date>
    <item>
      <title>Selecting literals instead of fields in Open SQL</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/selecting-literals-instead-of-fields-in-open-sql/m-p/2834954#M663752</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is it possible to use a literal as opposed to a fieldname in the SELECT clause of a SELECT statement in order to populate all the columns in a table with the same value?  For example (and I realise this doesn't syntax check), is there a way of doing the following without any looping statements?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;* Build a range of Company Codes in a Controlling Area
data: r_bukrs type range of tka02-bukrs.

select 'I'   as sign
       'EQ'  as option
       bukrs as low
from table r_bukrs
from tka02
where kokrs eq '0001'.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Many thanks,&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, 04 Oct 2007 11:19:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/selecting-literals-instead-of-fields-in-open-sql/m-p/2834954#M663752</guid>
      <dc:creator>afordham</dc:creator>
      <dc:date>2007-10-04T11:19:29Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting literals instead of fields in Open SQL</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/selecting-literals-instead-of-fields-in-open-sql/m-p/2834955#M663753</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Andrew.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We cannot use Literals in place of field names in SELECT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So this can be the Work around solution.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: r_bukrs type range of tka02-bukrs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data : t_bukrs type TABLE OF T001-BUKRS .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select &lt;/P&gt;&lt;P&gt;          bukrs &lt;/P&gt;&lt;P&gt;INTO table T_bukrs&lt;/P&gt;&lt;P&gt;from tka02&lt;/P&gt;&lt;P&gt;where kokrs eq '0001'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT T_BUKRS into T_BUKRS-TABLE_LINE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MOVE 'I' TO R_BUKRS-SIGN.&lt;/P&gt;&lt;P&gt;MOVE 'EQ' TO R_BUKRS-OPTION.&lt;/P&gt;&lt;P&gt;MOVE T_BUKRS-TABLE_LINE TO R_BUKRS-LOW.&lt;/P&gt;&lt;P&gt;APPEND R_BUKRS.&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;&amp;lt;b&amp;gt;reward if helpful.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Oct 2007 11:29:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/selecting-literals-instead-of-fields-in-open-sql/m-p/2834955#M663753</guid>
      <dc:creator>varma_narayana</dc:creator>
      <dc:date>2007-10-04T11:29:33Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting literals instead of fields in Open SQL</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/selecting-literals-instead-of-fields-in-open-sql/m-p/2834956#M663754</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Andrew,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can write the code in follwing way.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      ranges:r_bukrs for tka02-bukrs.&lt;/P&gt;&lt;P&gt;      &lt;/P&gt;&lt;P&gt;      select bukrs as low&lt;/P&gt;&lt;P&gt;      into corresponding fields of table r_bukrs&lt;/P&gt;&lt;P&gt;      from tka02&lt;/P&gt;&lt;P&gt;      where kokrs eq '0001'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      r_bukrs-sign = 'I'.&lt;/P&gt;&lt;P&gt;      r_bukrs-option = 'EQ'.&lt;/P&gt;&lt;P&gt;      modify r_bukrs transporting sign option where sign is initial.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;**Reward if useful&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Archana&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Oct 2007 11:32:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/selecting-literals-instead-of-fields-in-open-sql/m-p/2834956#M663754</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-04T11:32:59Z</dc:date>
    </item>
    <item>
      <title>Re: Selecting literals instead of fields in Open SQL</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/selecting-literals-instead-of-fields-in-open-sql/m-p/13670757#M2027645</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am not sure about your specific requirement but if we have lots of entries in a table lets say, we have lots of entries in MARA table, I want specific entries where matnr starts with "SFDC". So inshort I am trying to create a range which stores this "SFDC" and selects only those fields.&lt;/P&gt;&lt;P&gt;This is the new syntax used for HANA.&lt;/P&gt;&lt;LI-CODE lang="abap"&gt;DATA: lr_matnr type range of matnr,
      ls_matnr like line of lr_matrn.

ls_matnr-sign = 'I'.
ls_matnr-option = 'CP'.
ls_matnr-low = 'SFDC*'.
Append ls_matnr to lr_matnr.

SELECT 'I' AS sign,
       'EQ; AS option,
       matnr AS low,
       ' ' AS high
from mara
into table &lt;a href="https://community.sap.com/t5/user/viewprofilepage/user-id/1407137"&gt;@DATA&lt;/a&gt;(lt_matnr)
where ( matnr in @s_matnr AND matnr in &lt;a href="https://community.sap.com/t5/user/viewprofilepage/user-id/12268"&gt;@LR&lt;/a&gt;_matnr ).

// the s_matnr is a select option just to choose the matnr value from selection screen. &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;I hope I answered your query, The output table will have the 4 field i.e, sign, option, low, high&lt;/P&gt;&lt;P&gt;In the low field all the required matnr value will be stored.&lt;/P&gt;</description>
      <pubDate>Mon, 15 Apr 2024 09:32:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/selecting-literals-instead-of-fields-in-open-sql/m-p/13670757#M2027645</guid>
      <dc:creator>MadhavSharma</dc:creator>
      <dc:date>2024-04-15T09:32:50Z</dc:date>
    </item>
  </channel>
</rss>

