02-10-2005 10:35 AM
Hi,
How can I define ranges dynamic for further using in the Select Statement?
Cause my Code is like this; But It comes to Short-Dump
lt_typnr is Range Table.
IF typnr IS SUPPLIED.
CONCATENATE 'TYPNR IN' lt_typnr INTO
source_line separated by space.
APPEND source_line TO where_tab.
ENDIF.
SELECT * FROM ZTYP_TABLE
INTO CORRESPONDING FIELDS OF TABLE lt_header
WHERE (where_tab).
Greetings
Besi
02-10-2005 2:16 PM
In case Anand's solution does not work, if the range table is empty, it will have no impact on the selection. So you could code:
IF typnr IS SUPPLIED.
ELSE.
REFRESH lt_typnr[].
ENDIF.
SELECT * FROM ZTYP_TABLE
INTO CORRESPONDING FIELDS OF TABLE lt_header
WHERE typnr IN lt_typnr.
02-10-2005 10:41 AM
Hi besi,
using sel_opt's is'nt possible in a dynamic wheretab
->
1) so you've to dissolve your sel_opt
2) or you've to use GENERATE SUBROUTINE POOL (F1)
regards Andreas
02-10-2005 10:47 AM
That's not fit to your question, but have a look at the function module :
FREE_SELECTIONS_INIT
FREE_SELECTIONS_DIALOG
FREE_SELECTIONS_RANGE_2_WHERE
Regards
Frédéric.
02-10-2005 10:54 AM
Hi Besi,
Could you please see if this one works?
IF typnr IS SUPPLIED.
CONCATENATE 'TYPNR IN'
'LT_TYPNR'
INTO source_line separated by space.
APPEND source_line TO where_tab.
ENDIF.
The value LT_TYPNR has to be supplied as a <i>literal</i>.
Here in your case, you have given it as a variable. Hence the dump.
Please reward the points and close the thread if this solution is satisfactory.
Regards,
Anand Mandalika.
02-10-2005 2:16 PM
In case Anand's solution does not work, if the range table is empty, it will have no impact on the selection. So you could code:
IF typnr IS SUPPLIED.
ELSE.
REFRESH lt_typnr[].
ENDIF.
SELECT * FROM ZTYP_TABLE
INTO CORRESPONDING FIELDS OF TABLE lt_header
WHERE typnr IN lt_typnr.
02-11-2005 6:13 AM
Also,
in Release 4.6 it is not possible to build a where clause with variables.
So
field = 'A' would work
while
field = g_var would not.
I am not sure in which Release this feature has been introduced.
Christian
02-16-2005 3:01 PM
Hi Developers,
I was on Vacation. Sorry for lately Points.
Thank You for all
Bye
Besi