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 not retreiving data

Former Member
0 Kudos

Hello All,

I have a question regarding select statement.

Here is the select code

SELECT belnr

perio

wkgbtr

wogbtr

objnr

gjahr

wrttp

vrgng

parob

parob1

uspob

bukrs

owaer

FROM coep

INTO CORRESPONDING FIELDS OF TABLE gt_coep_recv

WHERE perio IN s_perio

AND gjahr IN s_gjahr

AND bukrs IN s_bukrs

AND kstar LIKE '001124%'

AND objnr LIKE 'LKIRST%'

AND parob LIKE 'LKIRSTP%STCC%'

AND wrttp = '11'

AND vrgng = 'RKL'.

This select return a sy-subrc value of 4 when executed. But when I go the COEP table and try to select data basing on the same conditions, I am able to retrieve data.

Any idea why?

Thanks,

Amy

1 ACCEPTED SOLUTION

former_member194669
Active Contributor
0 Kudos

Hi,

For testing this

Test 1: keep only

WHERE perio IN s_perio.

Test 2: keep only

WHERE perio IN s_perio

AND gjahr IN s_gjahr.

Test 3: keep only

WHERE perio IN s_perio.

AND gjahr IN s_gjahr

AND bukrs IN s_bukrs.

and so on.

one point of time you will get an sy-subrc eq 4 . and you can easily identify the field in which you are doing wrong.

aRs

6 REPLIES 6

former_member194669
Active Contributor
0 Kudos

Hi,

For testing this

Test 1: keep only

WHERE perio IN s_perio.

Test 2: keep only

WHERE perio IN s_perio

AND gjahr IN s_gjahr.

Test 3: keep only

WHERE perio IN s_perio.

AND gjahr IN s_gjahr

AND bukrs IN s_bukrs.

and so on.

one point of time you will get an sy-subrc eq 4 . and you can easily identify the field in which you are doing wrong.

aRs

Former Member
0 Kudos

one of the condition in where clause might not be matching..

check the corresponding data in the corresponding table.

Reward if useful

Regards

Pradeep

Former Member
0 Kudos

I guess below conditions are problem :

AND kstar LIKE '001124%'

AND objnr LIKE 'LKIRST%'

AND parob LIKE 'LKIRSTP%STCC%'

Try to keep one by one and see the results.

Thanks

Seshu

Former Member
0 Kudos

WHERE perio IN s_perio

AND gjahr IN s_gjahr

AND bukrs IN s_bukrs

AND kstar LIKE '001124%'

AND objnr LIKE 'LKIRST%'

AND parob LIKE 'LKIRSTP%STCC%'

AND wrttp = '11'

AND vrgng = 'RKL'.

KSTAR, OBJNR, PAROB may be having conversion exits so your LIKE may not be correct. Try to isolate the problem to one or more of the where clause conditions and then see why it is wrong. My guess is it is to do with the conversion exits.

Former Member
0 Kudos

Thanks guys !

Turns out I was missing one character in the objnr comparision string..... thanks for all your inputs... appreciate it.

Amy

Former Member
0 Kudos

HI,

its difficult to suggest some thing in this scenerio but.. one advice try commenting the like part and see if it is working if it works try adding like for one field at a time and check ..

SELECT belnr

perio

wkgbtr

wogbtr

objnr

gjahr

wrttp

vrgng

parob

parob1

uspob

bukrs

owaer

FROM coep

INTO CORRESPONDING FIELDS OF TABLE gt_coep_recv

WHERE perio IN s_perio

AND gjahr IN s_gjahr

AND bukrs IN s_bukrs

AND kstar LIKE '001124%'

AND objnr LIKE 'LKIRST%'

<b>AND parob LIKE 'LKIRSTP%STCC%' " I doubt this is the problem</b>

AND wrttp = '11'

AND vrgng = 'RKL'.

Thanks

mahesh