04-06-2009 1:34 PM
Hi all,
In selection screen we are having period as select option.The values for period are 01 to 16. Based on
the values entered in selection screen for period we need to select HSLXX from FAGLFLEXT.
For example if we enter 01 to 03 in selection screen then we need to select HSL01 HSL02 HSL03
from FAGLFLEXT.
Like this we need to select fields dynamically in select statement. Can any one tell me how to restrict fields dynamically.
Regards,
Swetha
04-06-2009 1:41 PM
Hi Swetha,
Look at this thread and the Same Topic is discussed.
https://forums.sdn.sap.com/click.jspa?searchID=24510876&messageID=6133607
04-06-2009 1:41 PM
Hi Swetha,
Look at this thread and the Same Topic is discussed.
https://forums.sdn.sap.com/click.jspa?searchID=24510876&messageID=6133607
04-06-2009 1:48 PM
hi Swetha,
the third select statemnet will work for you..
try this..
_Dynamic where clause in select query.._
* With a variable, result: AND rbusa = '5145'
concatenate 'AND rbusa = ' '''' i_tab-zgsber ''''
append where_clause to where_tab.
* Select
select * from zcostfreq
where (where_tab).
endselect.
_Using a dynamic table name_
parameters:
p_tab type tabname.
start-of-selection.
select count(*) from (p_tab) into l_count.
_Dynamic retrieval and writing of data_
FIELD-SYMBOLS:
<row> TYPE ANY,
<component> TYPE ANY.
PARAMETERS:
p_tab TYPE tabname.
CREATE DATA dataref TYPE (p_tab).
* The variable dataref cannot be accessed directly, so a field symbol is
* used
ASSIGN dataref->* TO <row>.
SELECT *
FROM (p_tab) UP TO 10 ROWS
INTO <row>.
NEW-LINE.
DO.
* Write all the fields in the record
ASSIGN COMPONENT sy-index
OF STRUCTURE <row>
TO <component>.
IF sy-subrc <> 0.
EXIT.
ENDIF.
WRITE <component>.
ENDDO.
ENDSELECT.
Regards,
Prabhduas