Select statement - Where Condition not possible
Hi,
I am trying to extract data from sap standard table CFX_COL.I want extract based on a field which is of type string.I can see that in the table but when I code below I am getting error.Any other alterantives?
REPORT x.
TABLES:proj.
DATA: it_proj TYPE STANDARD TABLE OF proj.
DATA:wa_proj TYPE proj.
DATA: it_cfol TYPE STANDARD TABLE OF CFX_COL.
DATA:wa_cfol TYPE CFX_COL.
data:v_name type STRING.
PARAMETERS: p_pspid LIKE proj-pspid.
SELECT * FROM proj INTO CORRESPONDING FIELDS OF TABLE it_proj
WHERE pspid = p_pspid.
READ TABLE it_proj INTO wa_proj INDEX 1.
concatenate wa_proj-pspid '-' wa_proj-post1 into v_name.
select * from CFX_COL into CORRESPONDING FIELDS OF TABLE it_cfol
where name in v_name.
Error:The Field "NAME" is a long string , so it cannot be used in WHERE, ON or HAVING conditions.
Rgds
Vara
Hi Vara.
Select will not work if you are trying to search based on the name field as in the table CFX_COL it has data type String which basically is not content but a reference to a storage area and internally it is stored in a different format not searchable. Even , if you try to find the number of entries in the table you can not put any value in this field as it will not be available for input as it doesn't contain any value.
STRING: Character string with variable length This data type can only be used in types (data elements, structures, table types) and domains. In the Dictionary a length can be specified for this type (at least 256 characters). It may be used in database tables, however, only with restrictions. For a description of them refer to the documentation of the ABAP statement 'STRING' . In ABAP, this type is implemented as a reference to a storage area of variable size. As default for the output length 132 characters are proposed. You cannot attach search helps to components of this type.
http://help.sap.com/saphelp_40b/helpdata/en/cf/21f2e5446011d189700000e8322d00/content.htm
Regards
Apoorva
Similar Messages
-
Select statement where column not equal to number
Hi experts,
I have a column amount
id amount
1 123.0000000000
2 33344.0000
3 66666.36220000000000000000
4 2122222.7878789799999
5 444444444
6 .000000000000000000000
7 wweeeeeeeeeerr
8 eeeeeeeeeeeeeet
I want to get :
id amount
7 wweeeeeeeeeerr
8 eeeeeeeeeeeeeet Thanks in advancei am getting my amount from txt file
Iam loading that into external files and then to the database tables
intially i will get amount(it should have only numbers) as varchar2
(But , when iam loading into tabes i will convert that into number using CAST function.)
When loading , Iam getting invalid number error -
How to speed a select statement with the NOT EXISTS where condition ?
Hi all,
I created a view : create or replace view view_name as select * from table_1,table_2 where join_condition and some conditions.
Now I have added in the view "where" clause two NOT EXISTS conditions based on one another different table respectively.
Before I added these two conditions the response time was fast ; but after I added these two conditions then the response time deteriorated.
So how to optimize the select statement ? Hints and so on ...
Thank you very much indeed
Message was edited by:
andrianiainaJust run the script :
SQL> explain plan for select * from dual;
Explained.
SQL> @$ORACLE_HOME/rdbms/admin/utlxpls.sql
PLAN_TABLE_OUTPUT
| Id | Operation | Name | Rows | Bytes | Cost |
| 0 | SELECT STATEMENT | | | | |
| 1 | TABLE ACCESS FULL | DUAL | | | |
Note: rule based optimization
9 rows selected.
SQL>Nicolas. -
Hi Everyone,
I am getting rows into internal table lt_mseg even if this where condition like this werks NE gs_t001w-werks in below code
is true. It looks like it's not excluding if not equal to gs_t001w-werks. Is anything wrong in below code? please help me...
SELECT * INTO TABLE gt_t005 FROM t005 WHERE xegld = 'X'.
SELECT * FROM t001w INTO TABLE gt_t001w FOR ALL ENTRIES IN gt_t005
WHERE ( land1 = gt_t005-land1 OR land1 = 'NO' ) AND vkorg NE 'LDE'.
SELECT * FROM mkpf INTO TABLE gt_mkpf
WHERE budat IN p_oextdt AND vgart = 'WL'.
LOOP AT gt_mkpf INTO gs_mkpf.
CHECK gt_t001w[] IS NOT INITIAL.
SELECT * FROM mseg APPENDING TABLE lt_mseg
FOR ALL ENTRIES IN gt_t001w
WHERE mblnr = gs_mkpf-mblnr
AND mjahr = gs_mkpf-mjahr
AND bwart NE '641'
AND xauto = ' '
AND werks NE gs_t001w-werks
AND kunnr = gt_t001w-kunnr.
ENDLOOP.Hi Sany,
Thanks for your reply. I f I remove this LOOP AT gt_mkpf INTO gs_mkpf and use for all entries how can I exlude plants that I got from t001w?
I used range here in below code now I am getting run time error in this loop, it says value table for IN itab operator has unexpected format....
DATA:
gt_t005 TYPE TABLE OF t005,
gs_t005 LIKE LINE OF gt_t005,
gt_t001w TYPE TABLE OF t001w,
gt_rng_plant type range of t001w,
gs_rng like line of gt_rng_plant,
gs_t001w LIKE LINE OF gt_t001w,
gt_mkpf TYPE TABLE OF mkpf,
gs_mkpf LIKE LINE OF gt_mkpf .
SELECT * INTO TABLE gt_t005 FROM t005 WHERE xegld = 'X'.
SELECT * FROM t001w INTO TABLE gt_t001w FOR ALL ENTRIES IN gt_t005
WHERE ( land1 = gt_t005-land1 OR land1 = 'NO' ) AND vkorg NE 'LDE'.
SELECT * FROM mkpf INTO TABLE gt_mkpf
WHERE budat IN p_oextdt AND vgart = 'WL'.
gs_rng-sign = 'I'.
gs_rng-option = 'EQ'.
LOOP AT gt_t001w INTO gs_t001w.
gs_rng-low = gs_t001w-werks.
gs_rng-high = gs_t001w-werks.
APPEND gs_rng TO gt_rng_plant.
ENDLOOP.
LOOP AT gt_mkpf INTO gs_mkpf.
SELECT * FROM mseg APPENDING TABLE lt_mseg
FOR ALL ENTRIES IN gt_t001w
WHERE mblnr = gt_mkpf-mblnr
AND mjahr = gt_mkpf-mjahr
AND bwart NE '641'
AND xauto = ' '
AND werks not in gt_rng_plant
AND kunnr = gt_t001w-kunnr.
ENDLOOP. -
Query transform with where condition not equal to
All,
I have a two tables in a Data services job where I am using a Query transform to load the data from these two tables into another table. In the where tab in query transform i had a conditon saying table1.column1 <> table2.column1 and table1.column2 <> table2.column2.
I need to see the record count of table1-table2 in my final thrid table, but I see more record count and also the not equal condition is failing. Its working for an equal condition but the not equal condition is failing.
The equivalent SQL query for the above transform has to be:
select * from table1 inner join table2 on table1.column1 = table2.column1 where table1.column1 <> table2.column1 and
table1.column2 <> table2.column2.
Any thoughs on how to fix my query transform.
ThanksHi
As per your below statement
"I need to see the record count of table1-table2 in my final thrid table, but I see more record count and also the not equal condition is failing. Its working for an equal condition but the not equal condition is failing."
If you trying to get the records from table-1 which are not in table-2 (as you trying table1-table2)
you can try logic in query transformation where clause
not table1.field1 in (table2.field1)
and
not table1.field2 in (table2.field2)
it gives you count from table1 only
Regards
Ahalya Gopinath -
Select Statement -- Where Clause Execution Order
What is the order of execution of the "AND" and "OR" in the WHERE clause of a Select statement?
Are the "AND"'s executed from the top down, left to right? Is it the same for the "OR"'s execution?
Thanks for any help...Not clear why you care. There is an order in which the optimizer parses the SQL (which may change from ver to ver), but this is a fairly quick operation. The order in which tables are visited and predicates evaluated is dependent on what the op[timizer does with the SQL.
Ken -
RFQ - Header Condition (Not possible to determine a condition type)
Hi,
I have defined my own Condition Schema for RFQ Item Condition are working fine. But when i am trying to add header condition it is giving msg "Not possible to determine a condition type"
RegardsHi,
I have defined my own Condition Schema for RFQ Item Condition are working fine. But when i am trying to add header condition it is giving msg "Not possible to determine a condition type" and now allowing me to enter the condition on header level.
Regards
Edited by: Kashif Ihsan on Jun 14, 2010 3:52 PM -
Mysql select statement where = works and LIKE fails
I am using Flash Builder 4. On the server side I use php and mysql. I created a php dataservice using FB4. My plan had been to allow users to enter a search term and query the database using a "LIKE" statement. FB4 created the php code that I simply modified changing the parameter name. The input parameter is a string.
public function getT_caseByID($searchTerm) {
$stmt = mysqli_prepare($this->connection, "SELECT * FROM $this->tablename WHERE (title = ?)");
$this->throwExceptionOnError();
mysqli_stmt_bind_param($stmt, 'i', $searchTerm);
$this->throwExceptionOnError();
mysqli_stmt_execute($stmt);
$this->throwExceptionOnError();
mysqli_stmt_bind_result($stmt, $row->idt_case, $row->title, $row->id_author, $row->comments);
if(mysqli_stmt_fetch($stmt)) {
return $row;
} else {
return null;
A look at FB4 shows this code returns data.
This code works fine but if I make the below change it fails, even when I use the wildcard %. the only change is "=" to "LIKE".
public function getT_caseByID($searchTerm) {
$stmt = mysqli_prepare($this->connection, "SELECT * FROM $this->tablename WHERE (title LIKE ?)");
$this->throwExceptionOnError();
mysqli_stmt_bind_param($stmt, 'i', $searchTerm);
$this->throwExceptionOnError();
mysqli_stmt_execute($stmt);
$this->throwExceptionOnError();
mysqli_stmt_bind_result($stmt, $row->idt_case, $row->title, $row->id_author, $row->comments);
if(mysqli_stmt_fetch($stmt)) {
return $row;
} else {
return null;
A look into FB4 shows "void".
Any help would be appreciated. I am using localhost on Apache Server on a development computer with Windows XP.correctio0n on the select statement
select statement code*********
select
apspnr astspr aobjnr apspid
bpsphi bposid
caufnr cpspel
dinact dstat
eudate eusnam eutime "estat
F~TXT04
g~estat
G~TXT04
into corresponding fields of table itobj
from proj as a
inner join prps as b on apspnr = bpsphi
inner join aufk as c on bpspnr = cpspel
inner join jest as d on cobjnr = dobjnr
inner join jcds as e on dobjnr = eobjnr
and dstat = estat
inner join tj02t as f on estat = fistat
inner join tj30t as g on astspr = gstsma
for all entries in itparm
where apspid = itparm-pspid "or estat = itparm-psy )
or bposid = itparm-posid "or estat = itparm-wsy )
or caufnr = itparm-aufnr "or estat = itparm-nsy )
and ( dinact 'X' or einact 'X')
and fspras = 'E' and gspras = 'E'. -
Queryeditor using fields more than once in where clause not possible?
I have to create a select query with a WHERE clause using a field multiple times.
I can't get this to work. For example:
SELECT ALL
EMSDTALIB.EMSPPA.PAIDNR,
EMSDTALIB.EMSPPA.PANAAM,
EMSDTALIB.EMSPPA.PAVLTR,
EMSDTALIB.EMSPPA.PATITL,
EMSDTALIB.EMSPPA.PAADRS,
EMSDTALIB.EMSPPA.PAHSNR,
EMSDTALIB.EMSPPA.PAHSNT,
EMSDTALIB.EMSPPA.PAPCA1
FROM EMSDTALIB.EMSPPA
WHERE EMSDTALIB.EMSPPA.PABEDR=1 AND EMSDTALIB.EMSPPA.PADTUD=0 AND
(EMSDTALIB.EMSPPA.PADVBD='001' OR EMSDTALIB.EMSPPA.PADVBD='003' OR EMSDTALIB.EMSPPA.PADVBD='006')How do I get this to work?
Regards,
RolandHi Roland, Luca, ICON_SS,
I just tried similar queries using the latest release bits and it works fine.
My Queries that worked fine are :
SELECT ALL DASUSR1.PERSON.PERSONID, DASUSR1.PERSON.NAME, DASUSR1.PERSON.JOBTITLE, DASUSR1.PERSON.FREQUENTFLYER
FROM DASUSR1.PERSON
WHERE ( DASUSR1.PERSON.NAME='Able, Tony' OR NAME='Black, John' )
SELECT ALL DASUSR1.PERSON.PERSONID, DASUSR1.PERSON.NAME, DASUSR1.PERSON.JOBTITLE, DASUSR1.PERSON.FREQUENTFLYER
FROM DASUSR1.PERSON
WHERE ( DASUSR1.PERSON.PERSONID=1 OR PERSONID=2 OR PERSONID=3)
I would suggest you to Download & Install latest Creator bits released 9/27/2004, if not already done.
Appreciate your valuable feedback,
Sakthi -
Select statements where we have to write in crm 7.0
hi
i am new to sap crm 7.0
1)where we are useing select statments in sap crm 7.0
where we have to write the code as a crm technical consultant
at which level genil or bol .if we write can u plz let me knw with clear answer.Subhani,
Writing queries in CRM is always tricky. The question you have asked is very general, still i will try my hands on it for the larger benefit of the community.
One should avoid writing queries on UI layer - As a general practice writing queries on UI is not appreciated because it hampers performance to a large extent.
Use of standard FM instead of queries - There are several standard FM provided by SAP which serves most of the purpose for which queries may have to be written, they are written in a way so as to optimize the DB connect.
BOL/GenIL - Incase the interaction with the DB table is very frequent, Query must be written in BOL/GenIL layer, this is done in order to have a steady framework and avoid frequent DB connect.
If you have any specific query, feel free to post it but be more elaborative so that community members can help.
Regards,
Harshit Kumar -
Offset operation in select statements where clause
dear experts,
if i use offset operation in select query , syntactically giving
me a warning message.
how to avoid warning message
without using another internal table populated with only jtab+0(10).
ex:
select field1 field2
into table itab
from ztable1
for all entries in jtab
where field = jtab+0(10).
thanks in advance.No need to populate another internal table...
when populating jtab from database select ur field twice
structure for jtab..
types: begin of ty_jtab,
field type ...
field1 type char10,
end of ty_jtab.
populate the field twice..
select ...
field
field
into table jtab
Now u can use the field field1 in the next select
select field1 field2
into table itab
from ztable1
for all entries in jtab
where field = jtab-field1. -
Interface-Determination: selecting an interface mapping not possible
Hi all,
I configured a scenario CRM (IDoc) -> XI -> Oracle database using BPM. Now I want to configure the same scenario without a business process. But in the interface determination it's neither possible to drag&drop the interface mapping, nor select it from the list. What's the problem?
Thanks in advance
DominicDominic,
Like pointed by Michal , you have missed something somewhere.
1.Look into message mapping and check what the source and target message types are.
2. Look into Interface mapping and check if the message interfaces use the same message types as in the message mapping
3. Look into Interface determination and see if the source and inbound message interface is the same as in Interface mapping.
4. Make sure interface and message mapping is activated.!
Regards
Bhavesh -
Where its not possible to use a variable (&&var) in SQL*PLUS ?
SQL*Plus Command Reference - DEFINE
Whenever you run a stored query or script, SQL*Plus substitutes the value of variable for each substitution variable referencing variable (in the form &variable or &&variable)
The question is which are the limits of this. Can eg even be between a 'STR&&varING' passed as parameter to some function? Or as parameter I can pass only a single variable and there isnt such auto-casting level ?
I have created DBCA Scripts to batch create a DB. So I want inside these scripts to replace the DBNAME with a variable. So I can create different DBS with these prescriptions from an API tool.
E.g here there are 6 different scenarios where I might need to pass the variable. I dont know
1. On which of the bellow scenarios I can inject the &&var
2. On which I cant and thus have to create a 2nd VAR to inject the 1st one
3. Which dont accept variables at all - but only static text
@D:\app\admin\DBNAMEY\scripts\CreateDB.sql
spool D:\app\admin\DBNAMEY\scripts\CreateDB.log append
startup nomount pfile="D:\app\admin\DBNAMEY\scripts\init.ora";
CREATE DATABASE "DBNAMEY"
DATAFILE 'D:\app\oradata\DBNAMEY\system01.dbf' SIZE ...
GROUP 2 ('D:\app\oradata\DBNAMEY\redo02.log') SIZE 51200K,
I may not start testing the scripts 6 times fearing corrupting my Workstation on half executed scripts.GoodfireGeorge wrote:
SQL*Plus Command Reference - DEFINE
Whenever you run a stored query or script, SQL*Plus substitutes the value of variable for each substitution variable referencing variable (in the form &variable or &&variable)
The question is which are the limits of this. Can eg even be between a 'STR&&varING' passed as parameter to some function? Or as parameter I can pass only a single variable and there isnt such auto-casting level ?
I have created DBCA Scripts to batch create a DB. So I want inside these scripts to replace the DBNAME with a variable. So I can create different DBS with these prescriptions from an API tool.
E.g here there are 6 different scenarios where I might need to pass the variable. I dont know
1. On which of the bellow scenarios I can inject the &&var
2. On which I cant and thus have to create a 2nd VAR to inject the 1st one
3. Which dont accept variables at all - but only static text
@D:\app\admin\DBNAMEY\scripts\CreateDB.sql
spool D:\app\admin\DBNAMEY\scripts\CreateDB.log append
startup nomount pfile="D:\app\admin\DBNAMEY\scripts\init.ora";
CREATE DATABASE "DBNAMEY"
DATAFILE 'D:\app\oradata\DBNAMEY\system01.dbf' SIZE ...
GROUP 2 ('D:\app\oradata\DBNAMEY\redo02.log') SIZE 51200K,
I may not start testing the scripts 6 times fearing corrupting my Workstation on half executed scripts.
If you can't test because you are afraid the test might fail, you need to address that issue first. No one on the web is going to give you iron-clad assurance that some code you write is going to work exactly as you expect.
Your script is trying to create a database? What's the worst thing that can happen if it doesn't work? Do you know how to manually dis-mantle whatever your script does? If not, you need to learn. The knowledge you will gain from that exercise will go a long way to improving your understanding of how these things interrelate. -
Select with where condition comparing different domains
SELECT *
FROM table
FOR ALL ENTRIES IN it_temp
WHERE col1 = it_temp-col_id.
col1 is of type char20
it_temp-col_id is of type char10.
"col1" and "it_temp-col_id" must have the same type and the same length.
do someone know a workaround?
thanks!!types : begin of ity_temp_1,
col_temp type table-col1, " this is type 20.
endof ity_temp_1.
data: lt_temp_1 type standard table of ity_temp_1,
ls_temp_1 type ity_temp_1.
loop at it_temp into is_temp.
clear ls_temp_1.
ls_temp_1-col_temp = is_temp-col1. " passing col1(type 10 to col_temp of type 20.)
append ls_temp_1 into lt_temp_1.
clear : is_temp.
endloop.
"now lt_temp_1 holds matching domain.
SELECT *
FROM table
FOR ALL ENTRIES IN lt_temp_1 " comparing with passed values with same domain
WHERE col1 = lt_temp_1-col_temp. -
How can do bach input in test client ? where ABAP not possible.
"Changes to Repository or cross-client Customizing are
not permitted"
Can any buddy tel me how can I register bulk of data from excel file ,to AS01 transaction code ?
Client is test client where i want to register dada while going by recording method of BDC got error
"Changes to Repository or cross-client Customizing are
not permitted"
Can any budy tel me alternative option how can i register it ?
is LSMW OK in this case?Hi,
If this is one time load, then LSMW is suggestible.
LSMW in turn can use BAPI/IDOC/BDC methods. Since you told the using BDC you dont have authorization.
Check LSMW with BAPI method and use the BAPI for AS01: BAPI_FIXEDASSET_CREATE1
Hope this helps
Regards
Shiva
Maybe you are looking for
-
When are movies and TV shows going to be available on iTunes Switzerland ?
Hello, I am from Switzerland and I was wondering when we will be able to purchase movies and TV shows on our iTunes store (both in French and German). Thanks for your answer. Best regards. Zeekin
-
Published video to mobile me web gallery how do I view on iphone?
I made a video in imovie and published the video onto my mobile me web gallery. How do I view this video on my iPhone?
-
Getting socket error while trying to get oracle connection using JDBC
hi, I am getting following socket read error while trying to get database connection using JDBC. This happening with jdk1.5.0_12 version with Oracle 9i following is the stacktrace... Thread t@92: (state = IN_NATIVE) - java.net.SocketInputStream.socke
-
Load a class inside class?
Hi all! I am creating a console based program and I wonder how i can load an outside class inside my main class? I have a case switch funktion and when you chosse case '3' i want the class to run another class file and the continute with the rest of
-
Isight doesn't work with mountain lion
Hi, I recently upgrade my Macbook Pro to mountain lion, but, my Isight camera doesn't work. Neither, Photo booth or face time recognize it. Did I miss something during installation? Does it have solution? thanks for the help.