<?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 problem in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-problem/m-p/1627124#M280147</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;    Use FM NAMETAB_GET to get key and non key fields an &lt;/P&gt;&lt;P&gt;    build dynamic table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      CALL FUNCTION 'NAMETAB_GET'&lt;/P&gt;&lt;P&gt;       EXPORTING&lt;/P&gt;&lt;P&gt;            LANGU                = SY-LANGU&lt;/P&gt;&lt;P&gt;            TABNAME              = DBTABPRT-TABNAME&lt;/P&gt;&lt;P&gt;       TABLES&lt;/P&gt;&lt;P&gt;            NAMETAB              = NT&lt;/P&gt;&lt;P&gt;       EXCEPTIONS&lt;/P&gt;&lt;P&gt;            NO_TEXTS_FOUND       = 01&lt;/P&gt;&lt;P&gt;            TABLES_HAS_NO_FIELDS = 02&lt;/P&gt;&lt;P&gt;            TABLE_NOT_ACTIV      = 03.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      DATA: LV_LEN TYPE I,&lt;/P&gt;&lt;P&gt;        LV_OFF TYPE I,&lt;/P&gt;&lt;P&gt;        TNAME LIKE DBTABPRT-TABNAME.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Field symbols&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  FIELD-SYMBOLS &amp;lt;FS&amp;gt;.&lt;/P&gt;&lt;P&gt;  REFRESH:WTAB,&lt;/P&gt;&lt;P&gt;          NT1.&lt;/P&gt;&lt;P&gt;  CLEAR: GV_COUNT,&lt;/P&gt;&lt;P&gt;         WTAB,&lt;/P&gt;&lt;P&gt;         NT1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  IF DBTABPRT-OPTYPE = 'U'.&lt;/P&gt;&lt;P&gt;    TNAME = DBTABPRT-TABNAME.&lt;/P&gt;&lt;P&gt;    LOOP AT NT WHERE KEYFLAG = 'X'.&lt;/P&gt;&lt;P&gt;      LV_LEN = NT-DDLEN.&lt;/P&gt;&lt;P&gt;      LV_OFF = NT-OFFSET.&lt;/P&gt;&lt;P&gt;      GV_COUNT = GV_COUNT + 1.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Assign value to field symbol&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      ASSIGN DBTABPRT-VKEY+LV_OFF(LV_LEN) TO &amp;lt;FS&amp;gt;.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;One primary index&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      IF GV_COUNT = 1.&lt;/P&gt;&lt;P&gt;        CONCATENATE NT-FIELDNAME ' = '''&amp;lt;FS&amp;gt;'''' '.'&lt;/P&gt;&lt;P&gt;        INTO WTAB .&lt;/P&gt;&lt;P&gt;        APPEND WTAB.&lt;/P&gt;&lt;P&gt;        CLEAR WTAB.&lt;/P&gt;&lt;P&gt;      ENDIF.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;More than One primary index&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      IF GV_COUNT &amp;gt; 1.&lt;/P&gt;&lt;P&gt;        CONCATENATE 'AN' 'D' INTO WTAB.&lt;/P&gt;&lt;P&gt;        APPEND WTAB.&lt;/P&gt;&lt;P&gt;        CLEAR WTAB.&lt;/P&gt;&lt;P&gt;        CONCATENATE NT-FIELDNAME ' = '''&amp;lt;FS&amp;gt;'''' '.'&lt;/P&gt;&lt;P&gt;             INTO WTAB.&lt;/P&gt;&lt;P&gt;        APPEND WTAB.&lt;/P&gt;&lt;P&gt;        CLEAR WTAB.&lt;/P&gt;&lt;P&gt;      ENDIF.&lt;/P&gt;&lt;P&gt;    ENDLOOP.&lt;/P&gt;&lt;P&gt;    SELECT * FROM (TNAME)&lt;/P&gt;&lt;P&gt;             INTO TABLE&lt;/P&gt;&lt;P&gt;             NT1 WHERE (WTAB).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  endselect.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Amole&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 12 Sep 2006 10:49:46 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-09-12T10:49:46Z</dc:date>
    <item>
      <title>select problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-problem/m-p/1627118#M280141</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;I have a screen with two text fields. And i am using the value of this two fields in my query. Now if no value is provided by the user, the value is set to '*' in PAI i.e i want to display all its fields. How should i write the query.. Btw following query doesnt work. i dont want to use case or if.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select * from &amp;lt;table&amp;gt; where field1 = *&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Sep 2006 10:14:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-problem/m-p/1627118#M280141</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-12T10:14:03Z</dc:date>
    </item>
    <item>
      <title>Re: select problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-problem/m-p/1627119#M280142</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;is it a report program ? &lt;/P&gt;&lt;P&gt;if so u have to use select options.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;in select options u can restrict to one field in screen  by giving NO intervels.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the query will be like this,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select * from &amp;lt;table&amp;gt; where field1 in p_para1 and field2 in p_para2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if no valules there , all the data is selected&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Sep 2006 10:18:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-problem/m-p/1627119#M280142</guid>
      <dc:creator>anversha_s</dc:creator>
      <dc:date>2006-09-12T10:18:22Z</dc:date>
    </item>
    <item>
      <title>Re: select problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-problem/m-p/1627120#M280143</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Puru,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Built a range table and in the select query use IN RANGE TABLE. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this will solve ur problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;reward if helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Vasanth&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Sep 2006 10:18:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-problem/m-p/1627120#M280143</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-12T10:18:53Z</dc:date>
    </item>
    <item>
      <title>Re: select problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-problem/m-p/1627121#M280144</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There are two ways to resolve it...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Define range for the particular field...and in your PAI keep the low value blank and use the below sql.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT * from table where field1 in r_field1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. U keep it as '*' or '%' and use the like statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT * from table where field1 like '*'&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Sep 2006 10:21:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-problem/m-p/1627121#M280144</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-12T10:21:27Z</dc:date>
    </item>
    <item>
      <title>Re: select problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-problem/m-p/1627122#M280145</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Define a range:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ranges: r_field for &amp;lt;table&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if not field1 is initial.&lt;/P&gt;&lt;P&gt;r_field-sign = 'I'.&lt;/P&gt;&lt;P&gt;r_field-option = 'EQ'.&lt;/P&gt;&lt;P&gt;r_field-option-low = field1.&lt;/P&gt;&lt;P&gt;append r_field.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if not field2 is initial.&lt;/P&gt;&lt;P&gt;r_field-sign = 'I'.&lt;/P&gt;&lt;P&gt;r_field-option = 'EQ'.&lt;/P&gt;&lt;P&gt;r_field-option-low = field2.&lt;/P&gt;&lt;P&gt;append r_field.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if field1 is initial and field2 is initial.&lt;/P&gt;&lt;P&gt;r_field-sign = 'I'.&lt;/P&gt;&lt;P&gt;r_field-option = 'EQ'.&lt;/P&gt;&lt;P&gt;append r_field.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select * from &amp;lt;table&amp;gt; where field1 in r_field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Prakash.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Sep 2006 10:22:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-problem/m-p/1627122#M280145</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-12T10:22:00Z</dc:date>
    </item>
    <item>
      <title>Re: select problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-problem/m-p/1627123#M280146</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 make use of a dynamic where condition in select.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;types : begin of t_mara,
         matnr like mara-matnr,
        end of t_mara.

data: it_mara type table of t_mara with header line.

data: v_where type string.

parameters : p_matnr like mara-matnr.

if not p_matnr is initial.
  v_where = 'matnr = p_matnr '.
else.
  v_where = ' '.
endif.
select matnr from mara into table it_mara where (v_where).
if sy-subrc = 0.
  write :/ ' got it '.
endif.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Sailaja.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Sep 2006 10:22:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-problem/m-p/1627123#M280146</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-12T10:22:35Z</dc:date>
    </item>
    <item>
      <title>Re: select problem</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-problem/m-p/1627124#M280147</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;    Use FM NAMETAB_GET to get key and non key fields an &lt;/P&gt;&lt;P&gt;    build dynamic table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      CALL FUNCTION 'NAMETAB_GET'&lt;/P&gt;&lt;P&gt;       EXPORTING&lt;/P&gt;&lt;P&gt;            LANGU                = SY-LANGU&lt;/P&gt;&lt;P&gt;            TABNAME              = DBTABPRT-TABNAME&lt;/P&gt;&lt;P&gt;       TABLES&lt;/P&gt;&lt;P&gt;            NAMETAB              = NT&lt;/P&gt;&lt;P&gt;       EXCEPTIONS&lt;/P&gt;&lt;P&gt;            NO_TEXTS_FOUND       = 01&lt;/P&gt;&lt;P&gt;            TABLES_HAS_NO_FIELDS = 02&lt;/P&gt;&lt;P&gt;            TABLE_NOT_ACTIV      = 03.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      DATA: LV_LEN TYPE I,&lt;/P&gt;&lt;P&gt;        LV_OFF TYPE I,&lt;/P&gt;&lt;P&gt;        TNAME LIKE DBTABPRT-TABNAME.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Field symbols&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  FIELD-SYMBOLS &amp;lt;FS&amp;gt;.&lt;/P&gt;&lt;P&gt;  REFRESH:WTAB,&lt;/P&gt;&lt;P&gt;          NT1.&lt;/P&gt;&lt;P&gt;  CLEAR: GV_COUNT,&lt;/P&gt;&lt;P&gt;         WTAB,&lt;/P&gt;&lt;P&gt;         NT1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  IF DBTABPRT-OPTYPE = 'U'.&lt;/P&gt;&lt;P&gt;    TNAME = DBTABPRT-TABNAME.&lt;/P&gt;&lt;P&gt;    LOOP AT NT WHERE KEYFLAG = 'X'.&lt;/P&gt;&lt;P&gt;      LV_LEN = NT-DDLEN.&lt;/P&gt;&lt;P&gt;      LV_OFF = NT-OFFSET.&lt;/P&gt;&lt;P&gt;      GV_COUNT = GV_COUNT + 1.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Assign value to field symbol&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      ASSIGN DBTABPRT-VKEY+LV_OFF(LV_LEN) TO &amp;lt;FS&amp;gt;.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;One primary index&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      IF GV_COUNT = 1.&lt;/P&gt;&lt;P&gt;        CONCATENATE NT-FIELDNAME ' = '''&amp;lt;FS&amp;gt;'''' '.'&lt;/P&gt;&lt;P&gt;        INTO WTAB .&lt;/P&gt;&lt;P&gt;        APPEND WTAB.&lt;/P&gt;&lt;P&gt;        CLEAR WTAB.&lt;/P&gt;&lt;P&gt;      ENDIF.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;More than One primary index&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      IF GV_COUNT &amp;gt; 1.&lt;/P&gt;&lt;P&gt;        CONCATENATE 'AN' 'D' INTO WTAB.&lt;/P&gt;&lt;P&gt;        APPEND WTAB.&lt;/P&gt;&lt;P&gt;        CLEAR WTAB.&lt;/P&gt;&lt;P&gt;        CONCATENATE NT-FIELDNAME ' = '''&amp;lt;FS&amp;gt;'''' '.'&lt;/P&gt;&lt;P&gt;             INTO WTAB.&lt;/P&gt;&lt;P&gt;        APPEND WTAB.&lt;/P&gt;&lt;P&gt;        CLEAR WTAB.&lt;/P&gt;&lt;P&gt;      ENDIF.&lt;/P&gt;&lt;P&gt;    ENDLOOP.&lt;/P&gt;&lt;P&gt;    SELECT * FROM (TNAME)&lt;/P&gt;&lt;P&gt;             INTO TABLE&lt;/P&gt;&lt;P&gt;             NT1 WHERE (WTAB).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  endselect.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Amole&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Sep 2006 10:49:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-problem/m-p/1627124#M280147</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-12T10:49:46Z</dc:date>
    </item>
  </channel>
</rss>

