Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

select query

Former Member
0 Kudos

hi all,

when i put AUFNR = AUFNR in where condition

syntax error is aufnr has two meaning in open sql

what it means?

plz tell me.

regards

sonu

11 REPLIES 11

Former Member
0 Kudos

Just change the variable name AUFNR to something else like V_AUFNR.

so new query would be AUFNR = V_AUFNR

Former Member
0 Kudos

Hi Sonu

On one side declare your internal table aufnr and on other side declare your table aufnr

Can i have your part of coding please

Reward all helpfull answers

Regards

Pavan

Former Member
0 Kudos

Hi,

you need to specify the table name before aufnr.

table1-AUFNR = table2-AUFNR.

regards,

Ruchika

Former Member
0 Kudos

Hello,

If you are using a Join Statement then specify the alias name for the aufnr

i.e

SELECT F~CARRID F~CONNID F~FLDATE 
    INTO (CARRID, CONNID, DATE) 
    FROM SFLIGHT AS F INNER JOIN SPFLI AS P 
           ON F~CARRID = P~CARRID AND 
              F~CONNID = P~CONNID 
    WHERE P~CITYFROM = 'FRANKFURT' 
      AND P~CITYTO   = 'NEW YORK' 
      AND F~FLDATE BETWEEN '20010910' AND '20010920' 
      AND F~SEATSOCC < F~SEATSMAX. 
  WRITE: / DATE, CARRID, CONNID. 
ENDSELECT.

As said above use a~ or any alphabet ~ in the where condition which you as used to select from.

If u r not using joins then change ur paramter aufnr to p_aufnr and then check.

Regards,

Deepu.K

.

Former Member
0 Kudos

Hi,

Tables:your table name

data: WA type your table name.(WA means work area)

select * form your table name where WA-AUFNR = AUFNR.

write: / 'success'.

(here WA-AUFNR is field of WA which is same as Actual AUFNR Which is present in data base table, whose value is specied by you at run time)

***********PLEASE REWARD POINTS IF THE INFORMATION IS HELPFUL TO YOU*************

Former Member
0 Kudos

HI,

UR CODE WORKS FINE FOR SELECT STATEMENT BUT IT DOESN'T WORK FOR INTERNAL TABLES.

FOR TO COMPARE FIELDS OF TWO INTERNAL AS

LOOP AT ITAB WHERE AUFNR = ITAB2-AUFNR.

.............................

.............................

ENDLOOP.

OR WHEN COMPARING WITH ANY PARAMETER IT AGAIN WORKS FINE

LOOP AT ITAB WHERE AUFNR = AUFNR. // AUFNR IS A PARAMETER.

...............

..............

ENDLOOP.

IF HELPFUL REWARD SOME POINTS.

WITH REGARDS,

SURESH.A

Former Member
0 Kudos

hi

u change aufnr as V_aufnr or s_aufnr.

then in select query write like this..

aufnr in v_aufnr.

reward if useful

Former Member
0 Kudos

Hello Sonu...

I think you are using this statement in a select query... If you are using innerjoin operation... You should use alias name also in where condition...

Like a~aufnr = aufnr.

Reward if helpful.

Regards

--

Sasidhar Reddy Matli.

Former Member
0 Kudos

SELECT A~VKORG " Sales Organization

A~BUKRS " Company Code

B~VTWEG " Distribution Channel

B~SPART " Division

FROM TVKO AS A JOIN TVTA AS B

ON AVKORG EQ BVKORG

INTO TABLE T_TVTA

FOR ALL ENTRIES IN T_KNB1_TEMP

WHERE A~VKORG IN S_SALORG

AND A~BUKRS EQ T_KNB1_TEMP-BUKRS

AND B~VTWEG IN S_DISCHA

AND B~SPART IN S_DIVI.

Change your select query similar to the above query.

Regards,

Pavan

Former Member
0 Kudos

hi sonu

if u have given AUFNR in select option then change it as s_AUFNR and write

where AUFNR in s_AUFNR.

if u have given AUFNR in parameters then change it as p_AUFNR and write

where AUFNR = p_AUFNR.

if u didnt declare it either in select options or parameters then write

where AUFNR = tablename-AUFNR.

REWARD IF USEFUL....

Former Member
0 Kudos

HI

(is table field on which u want to put condition )AUFNR = AUFNR ( this should refer to the variable or the field from int table , change name here u may get through) Praveen