07-30-2007 7:49 PM
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
07-30-2007 7:58 PM
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
07-30-2007 7:58 PM
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
07-30-2007 8:00 PM
one of the condition in where clause might not be matching..
check the corresponding data in the corresponding table.
Reward if useful
Regards
Pradeep
07-30-2007 8:05 PM
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
07-30-2007 8:06 PM
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.
07-30-2007 8:14 PM
Thanks guys !
Turns out I was missing one character in the objnr comparision string..... thanks for all your inputs... appreciate it.
Amy
07-30-2007 8:19 PM
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