<?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 Dynamic selection. in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-selection/m-p/2269239#M492776</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 need some help related to dynamic selection using &amp;lt;b&amp;gt;field symbols&amp;lt;/b&amp;gt; in a single select statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I elaborate the requirement:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to retrieve data from GLPCT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If user gives the value 01,02,.......14,15,16. in selection screen level.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then i have to retrieve HSL01,HSL02.....HSL14,HSL15,HSL16.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This should be done in a single select statement and i am not supposed get the entire" HSL01,HSL02.....HSL14,HSL15,HSL16." if user gives any of the corresponding.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can any one send sample code how to write  &amp;lt;b&amp;gt;dynamic select statements&amp;lt;/b&amp;gt; in ABAP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 30 May 2007 12:39:11 GMT</pubDate>
    <dc:creator>former_member637135</dc:creator>
    <dc:date>2007-05-30T12:39:11Z</dc:date>
    <item>
      <title>Dynamic selection.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-selection/m-p/2269239#M492776</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 need some help related to dynamic selection using &amp;lt;b&amp;gt;field symbols&amp;lt;/b&amp;gt; in a single select statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I elaborate the requirement:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to retrieve data from GLPCT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If user gives the value 01,02,.......14,15,16. in selection screen level.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then i have to retrieve HSL01,HSL02.....HSL14,HSL15,HSL16.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This should be done in a single select statement and i am not supposed get the entire" HSL01,HSL02.....HSL14,HSL15,HSL16." if user gives any of the corresponding.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can any one send sample code how to write  &amp;lt;b&amp;gt;dynamic select statements&amp;lt;/b&amp;gt; in ABAP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 May 2007 12:39:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-selection/m-p/2269239#M492776</guid>
      <dc:creator>former_member637135</dc:creator>
      <dc:date>2007-05-30T12:39:11Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic selection.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-selection/m-p/2269240#M492777</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;You can write dynamic select as following&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
data: dyn_select_txt(100).

dyn_select_txt = '&amp;lt;table_field&amp;gt; in ('HSL01', 'HSL02'........)'.

select * from GLPCT into table lt_glpct
where (dyn_select_txt).
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you can concatenate values you want in the txt variable that you have declared and use that txt variable in your select statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cheers,&lt;/P&gt;&lt;P&gt;Asim&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 May 2007 20:26:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-selection/m-p/2269240#M492777</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-30T20:26:28Z</dc:date>
    </item>
    <item>
      <title>Re: Dynamic selection.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-selection/m-p/2269241#M492778</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 m giving syntax for dynamic select stmt:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;parameters: p_matnr type mara-matnr.
data: fld_list(70),
        db_table(70),
        itab type table of string.

fld_list =  ' matnr mara ' .
db_table = ' mara '.

concatenate ' matnr = ' ''' p_matnr ''' into conditions.

select ( fld_list ) from ( db_table ) into corrosponding fields of table itab where ( conditions ).&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Its really good to use Field symbol for performace improvement as it just points to data and does not copy values ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;e.g.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA path LIKE ibipparms-path.

DATA: i_excel LIKE alsmex_tabline OCCURS 0 WITH HEADER LINE.

data: i_fcat type LVC_T_FCAT,
wa_fcat type lvc_s_fcat.

data: fname(10),
I_PTABLE TYPE REF TO DATA.


SELECTION-SCREEN BEGIN OF BLOCK b WITH FRAME TITLE text-001.
PARAMETERS p_path LIKE rlgrap-filename OBLIGATORY.
SELECTION-SCREEN END OF BLOCK b.


FIELD-SYMBOLS: &amp;lt;fs_final&amp;gt; TYPE ANY,
&amp;lt;I_TABLE&amp;gt; type table.


AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_path.
CALL FUNCTION 'F4_FILENAME'
IMPORTING
file_name = path.

p_path = path.


START-OF-SELECTION.


CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = p_path
i_begin_col = 1
i_begin_row = 1
i_end_col = 256
i_end_row = 65536
TABLES
intern = i_excel.


loop at i_excel where row = '1'.
wa_fcat-ROW_POS = i_excel-row.
wa_fcat-col_pos = i_excel-col.
* concatenate 'COL_' i_excel-col into fname.
wa_fcat-FIELDNAME = I_EXCEL-VALUE.
append wa_fcat to i_fcat.
endloop.

CALL METHOD CL_ALV_TABLE_CREATE=&amp;gt;CREATE_DYNAMIC_TABLE
EXPORTING
IT_FIELDCATALOG = I_FCAT
IMPORTING
EP_TABLE = I_PTABLE.


Assign i_ptable-&amp;gt;* to &amp;lt;i_table&amp;gt;.

perform zf_assign.


End-of-selection.

LOOP AT I_FCAT INTO WA_FCAT .
WRITE: WA_FCAT-FIELDNAME(10).
ENDLOOP.

LOOP AT &amp;lt;I_TABLE&amp;gt; assigning &amp;lt;fs_final&amp;gt;.
WRITE:/ &amp;lt;fs_final&amp;gt;.
ENDLOOP.



*&amp;amp;---------------------------------------------------------------------*
*&amp;amp; Form zf_assign
*&amp;amp;---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --&amp;gt; p1 text
* &amp;lt;-- p2 text
*----------------------------------------------------------------------*
form zf_assign .

field-symbols: &amp;lt;ls_table&amp;gt;.

ASSIGN LOCAL COPY OF INITIAL LINE OF &amp;lt;I_TABLE&amp;gt; TO &amp;lt;LS_TABLE&amp;gt;.

LOOP AT i_excel WHERE ROW &amp;lt;&amp;gt; 1.

ASSIGN COMPONENT i_excel-col OF STRUCTURE &amp;lt;LS_TABLE&amp;gt; TO &amp;lt;fs_final&amp;gt;.
&amp;lt;fs_final&amp;gt; = i_excel-value.

AT END OF row.
APPEND &amp;lt;LS_TABLE&amp;gt; TO &amp;lt;i_table&amp;gt;.
ENDAT.

ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Jogdand M B&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 May 2007 04:45:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/dynamic-selection/m-p/2269241#M492778</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-31T04:45:15Z</dc:date>
    </item>
  </channel>
</rss>

