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

problem with select

Former Member
0 Likes
779

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
Read only

rahulkavuri
Active Contributor
0 Likes
737

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

Read only

Former Member
0 Likes
737

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

Read only

Former Member
0 Likes
737

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

Read only

0 Likes
737

yes i use not equal

Read only

former_member181966
Active Contributor
0 Likes
737

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"

Read only

LeonardoAraujo
SAP Mentor
SAP Mentor
0 Likes
737

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