Application Development and Automation 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: 
Read only

difference between the selects

Former Member
0 Likes
629

hi all,

select *

appending table cvbfa

from vbfa

where vbelv = :vs_vbelv.

and

select *

appending table cvbfa

from vbfa

where vbelv = vs_vbelv.

5 REPLIES 5
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
608

It looks like the first one may be "Native SQL" rather than "Open SQL".

http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3b8b358411d1829f0000e829fbfe/frameset.htm

Regards,

RIch Heilman

Read only

Former Member
0 Likes
608

Hello KP,

Your second statement doesn't seem to me a Native SQL statement!! It's just another (lesser used) way of writing the first statement.

For example -

data itab type table of spfli.

and

data : itab type table of spfli.

are both equivalent statements. However, I'm sure that you agree that the colon operator is generally used whn multiple statements need to be <i>chained</i> together.

For example -

data : itab1 type table of spfli,

itab2 type table of sflight.

This is certainly the more preferred way of declaring data.

Similarly, in your case, you could actually have written something like -

data vs_vbelv type vbelv.
data vb_vbelv type vbelv.
data cvbfa type table of vbfa.

select *
appending table cvbfa
from vbfa
where vbelv = : vs_vbelv ,
                vb_vbelv .

The SELECT statement above would otherwise have to be written as -

select *
appending table cvbfa
from vbfa
where vbelv = vs_vbelv.

select *
appending table cvbfa
from vbfa
where vbelv = vb_vbelv .

So instead of writing two different select statements, you write only one of them.

Hope that clears the doubt you had.

Regards,

Anand Mandalika.

Read only

0 Likes
608

Wow, I never knew that you could do that with a select statement, I guess "ranges" or "select-options", made this type of coding obselete? I've never seen this before. Good one, Anand.

Regards,

RIch Heilman

Read only

0 Likes
608

rich,

i believe we could get away from using ranges like this too.

select * from xxxx into yyyy where

xxxx-zzzz in ( const1 , const2, ....constn ).

thanks guys for all the answers.

Read only

0 Likes
608

Hello KP,

Honestly, I thought I had <i>answered</i> this question. This post is still marked as 'unanswered'. Could you please close this thread by either

1) rewarding 10 points to an answer

or

2) choosing the option "Solved it on my own" ?

Regards,

Anand Mandalika.