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: 

problem with select

Former Member
0 Kudos

i make a query in se16 for table ESSR

and make the select in the same conditions as in se16

and get another results why???

select lblni ebeln ebelp banfn bnfpo packno

from essr

into corresponding fields of table itab

where erdat in zerdat

and loekz = ' '

and kzabn = 'X'

and frgrl = ' '

and knttp = 'F'.

and f_lock = ' '

and banfn <> ' '

and bnfpo <> ' '.

and frggr = 'CS'.

6 REPLIES 6

rahulkavuri
Active Contributor
0 Kudos

I think the Client number may be the problem...

Former Member
0 Kudos

Hi Rani,

Are you sure that the underlying SQL passed to the database by the SAP database managment layer is identical in both cases ?

I would trace both the SE16 transaction and your own coded program using ST05 and compare the results. This may point to the difference.

Gary

Former Member
0 Kudos

Did you also use 'Not Equal To' for BANFN and BANPO in SE16?

0 Kudos

yes i use not equal

former_member181966
Active Contributor
0 Kudos

I think if you check the same selection in SE16 and then code it . You might be missing something . As Select statement is too long I prefer you to break it and then analyze it .

E,g

<u><b>Part 1 select and also check in SE16</b></u>

<b>select lblni ebeln ebelp banfn bnfpo packno

from essr

into corresponding fields of table itab

where erdat in zerdat

and loekz = ' '

and kzabn = 'X'.</b>

<u><b>Part 2 select and also check in SE16</b></u>

select lblni ebeln ebelp banfn bnfpo packno

from essr

into corresponding fields of table itab

where erdat in zerdat

and loekz = ' '

and kzabn = 'X'

and frgrl = ' '

and knttp = 'F'

and f_lock = ' '.

part 3

select lblni ebeln ebelp banfn bnfpo packno

from essr

into corresponding fields of table itab

where erdat in zerdat

and loekz = ' '

and kzabn = 'X'

and frgrl = ' '

and knttp = 'F'<b>.</b> ( i think you put this full stop by mistake )

and f_lock = ' '

and banfn <> ' '

and bnfpo <> ' '<b>.</b> ( i think you put this full stop by mistake )

and frggr = 'CS'.

Hope this’ll give you idea!!

<b>P.S award the points.</b>

Good luck

Thanks

Saquib Khan

"Some are wise and some are otherwise"

LeonardoAraujo
Active Contributor
0 Kudos

I've experienced different results when comparing null blank and non blank field contents.

Try this:

Use SE30 and run your SE16. This way you will get the runtime analysis. Go in the details and check the select single of fetch command for table ESSR. Put a breakpoint or just copy the call. The call might be structured a little different then yours, maybe using only ranges(select options).

Good luck

Message was edited by: Leonardo De Araujo