on 02-22-2006 5:02 AM
Hi All,
I've a select query in code, which is not able to
select any data from database table. When i goto se16,
and give the same criteria as in the query at runtime,
it displays data.
I've checked various possibilities, but no luck.
This query works fine in our internal system, but is giving problem for a particular system.
The query is:
SELECT * INTO CORRESPONDING FIELDS OF TABLE et_tspl
FROM /sapsll/tspl
WHERE lgreg IN is_sel_options-lgreg
AND spl_list_type IN is_sel_options-spl_list_type
AND spl_data_ref_id IN is_sel_options-spl_data_ref_id
AND datbi >= is_sel_data-sk_datbi
AND spl_valid_from >= lv_ts_valfrom
AND spl_valid_to <= lv_ts_valto
AND crtsp IN lr_crtsp
AND chtsp IN lr_chtsp
AND ernam IN is_sel_options-ernam
AND aenam IN is_sel_options-aenam.
Thanks,
Rohit.
rohit check this ,
just try initially with only one select-option ...
SELECT * INTO CORRESPONDING FIELDS OF TABLE et_tspl
FROM /sapsll/tspl
WHERE lgreg IN is_sel_options-lgreg
here in select-options use only is_sel_options-lgreg
-
now for this check any entry first of all okay.
-
if hit then introduce the second selection range and the and condition in to ur select ...like
AND spl_list_type IN is_sel_options-spl_list_type
if a hit then proceed further till all ur and conditions satisfies ...
if at any stage u get a hit then the problem is with the and logic ...in ur select statement.
remember its an 'and' not 'or'
so go step by step .
vijay.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
rohit check this ,
just try initially with only one select-option ...
SELECT * INTO CORRESPONDING FIELDS OF TABLE et_tspl
FROM /sapsll/tspl
WHERE lgreg IN is_sel_options-lgreg
here in select-options use only is_sel_options-lgreg
-
now for this check any entry first of all okay.
-
if hit then introduce the second selection range and the and condition in to ur select ...like
AND spl_list_type IN is_sel_options-spl_list_type
if a hit then proceed further till all ur and conditions satisfies ...
if at any stage u get a hit then the problem is with the and logic ...in ur select statement.
remember its an 'and' not 'or'
so go step by step .
vijay.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
OK, I thought this is your code not SAP standard code. If this is working in one system and not working in another system, and you confirm that the data is there, then please let us know if there has been any upgrade of the underlying database recently on the system where it is not working.
OS or database upgrades are sometimes(very rarely) known to have caused this kind of anomolies.
Srinivas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi
when you have select options in your query which are not mandatory fields, then the above scenario can occur.
if no data is enteerd in the select options then it selects all the data satisfying the other where conditions in the query.
so here before the select statement 'check not select_option is initial'.
or make the select-options as mandatory.
Regards.
Lavanya.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
In ur query the options other than date are I believe select options and only the
is_sel_data-sk_datbi
lv_ts_valfrom
lv_ts_valto are parameter or derived fields.
Is that correct.
Also in SE16 do u enter values for all the fields specified in the query?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Yes. Thats the unexpected result i get.
I give the same parameters in se16 on /sapsll/tspl and
i get the rows selected correctly.
Thanks,
Rohit.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Rohit, this one is very puzzling. Please let us know if you do solve it.
Have you tried using rfc RFC_GET_TABLE_ENTRIES to read entries remotely to check that this site, can access the data?
Is there anything unusual about this site's underlying database? Maybe it is very different to the other sites you are dealing with.
In the system where it is not selecting the data did u try with normal SE16? Did u get the result?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi,
initially i thought of changing the code and trying...
but this is customer system. so i cant change the code.
The select option could be single value of a range of
values. There is no point in changing the query. Its
standard SAP code.
Regards,
Rohit.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
<i>AND ernam IN is_sel_options-ernam <--
AND aenam IN is_sel_options-aenam.<--</i>
Are these really select options or just a single values? If they are single value fields, then change the IN to EQ
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
try breaking the sql down into chunks to identify which part is failing. This might take a while...
i.e start with
SELECT * INTO CORRESPONDING FIELDS OF TABLE et_tspl
FROM /sapsll/tspl
WHERE lgreg IN is_sel_options-lgreg.
...
and gradually add the other criteria.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
As i already told you this query is already working
correctly, in all the customer system. Its just one
customer system where this is not working.
The table /sapsll/tspl exists in database. This code is
not for R/3 but of GTS, a SAP xApps application.
I know the query is correct. I want to know if there could
be some other reason?
Thanks,
Rohit.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi rohit,
1. /sapsll/tspl
What is this table name ?
2. It must be a SYSTEM table
generated by r/3 in each server.
3. Probably, this table does not exist
in the system (which is giving problem)
4. The query has no problem.
regards,
amit m.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
HI Rohit
SELECT * INTO CORRESPONDING FIELDS OF TABLE et_tspl
FROM /sapsll/tspl
WHERE lgreg IN is_sel_options_lgreg
AND spl_list_type IN is_sel_options_spl_list_type
AND spl_data_ref_id IN is_sel_options-spl_data_ref_id
AND datbi >= is_sel_data-sk_datbi
AND spl_valid_from >= lv_ts_valfrom
AND spl_valid_to <= lv_ts_valto
AND crtsp IN lr_crtsp
AND chtsp IN lr_chtsp
AND ernam IN is_sel_options-ernam
AND aenam IN is_sel_options-aenam.
dont use all the select options in one query using AND use '_' instead of '-' in select options name
regards
kishore
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi Rohit,
In case any of these select options in the Select Command contains no value.. you'll get no data into et_tspl.
declare all the select options as OBLIGATORY and then execute the select..
regards
satesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
61 | |
9 | |
7 | |
6 | |
6 | |
6 | |
5 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.