‎2008 Jun 11 11:59 AM
Hi,
Can anyone please let me know , why the below select statement is not fetching data.
types : BEGIN OF ty_ibsid ,
kunnr LIKE bsid-kunnr,
umskz LIKE bsid-umskz,
belnr LIKE bsid-belnr,
bldat LIKE bsid-bldat,
blart LIKE bsid-blart,
shkzg LIKE bsid-shkzg,
dmbtr LIKE bsid-dmbtr,
zfbdt LIKE bsid-zfbdt,
zterm LIKE bsid-zterm,
zbd1t LIKE bsid-zbd1t,
zbd2t LIKE bsid-zbd2t,
zbd3t LIKE bsid-zbd3t,
zbd1p LIKE bsid-zbd1p,
zbd2p LIKE bsid-zbd2p,
rebzg LIKE bsid-rebzg,
END OF ty_ibsid.
data : ibsid type table of ty_ibsid.
RANGES: r_kunnr FOR bsid-kunnr.
r_kunnr-sign = 'I'.
r_kunnr-option = 'BT'.
do 5 times.
r_kunnr-low = '1864017'.
APPEND r_kunnr.
CLEAR r_kunnr-low.
ENddo.
SORT r_kunnr.
DELETE ADJACENT DUPLICATES FROM r_kunnr.
SELECT kunnr
umskz belnr bldat blart shkzg dmbtr zfbdt zterm zbd1t zbd2t
zbd3t zbd1p zbd2p rebzg
INTO TABLE ibsid
FROM bsid
WHERE bukrs = '0695'
AND kunnr IN r_kunnr.
‎2008 Jun 11 12:04 PM
Hello,
Please check for the fields BUKRS and KUNNR if in the domain exists conversion exits. If yes, try putting zeros in the begin of the field before do the select command.
Regards.
‎2008 Jun 11 12:03 PM
Check table bsid if there exists an entry for the combination of BUKRS - 0695 and KUNNR -1864017.
While populating the range, change the OPTION to EQ from BT. You are passing values only to LOW parameter. so EQ will do.
Regards,
Lakshmi.
‎2008 Jun 11 12:04 PM
Hello,
Please check for the fields BUKRS and KUNNR if in the domain exists conversion exits. If yes, try putting zeros in the begin of the field before do the select command.
Regards.
‎2008 Jun 11 12:05 PM
Change the r_kunnr-option to EQ
r_kunnr-sign = 'I'.
r_kunnr-option = 'EQ'.
‎2008 Jun 11 12:09 PM
hi,
try this
types : BEGIN OF ty_ibsid ,
kunnr LIKE bsid-kunnr,
umskz LIKE bsid-umskz,
belnr LIKE bsid-belnr,
bldat LIKE bsid-bldat,
blart LIKE bsid-blart,
shkzg LIKE bsid-shkzg,
dmbtr LIKE bsid-dmbtr,
zfbdt LIKE bsid-zfbdt,
zterm LIKE bsid-zterm,
zbd1t LIKE bsid-zbd1t,
zbd2t LIKE bsid-zbd2t,
zbd3t LIKE bsid-zbd3t,
zbd1p LIKE bsid-zbd1p,
zbd2p LIKE bsid-zbd2p,
rebzg LIKE bsid-rebzg,
END OF ty_ibsid.
data : ibsid type table of ty_ibsid.
select-options : r_kunnr for kna1-kunnr.
select-options : bukrs for t001-bukrs.
SELECT kunnr
umskz belnr bldat blart shkzg dmbtr zfbdt zterm zbd1t zbd2t
zbd3t zbd1p zbd2p rebzg
INTO TABLE ibsid
FROM bsid
WHERE bukrs in bukrs
AND kunnr IN r_kunnr.
it will work.
Regards,
Aniruddh
‎2008 Jun 11 12:09 PM
Hi,
I am not sure why u are trying to append same kunnr value five times to your ranges table, and delete adjacent duplicates from range table comparing kunnr field.
Check the below code...
r_kunnr-sign = 'I'.
r_kunnr-option = 'EQ'.
do 5 times.
r_kunnr-low = '0001864017'.
APPEND r_kunnr.
CLEAR r_kunnr.
ENddo.
SORT r_kunnr.
DELETE ADJACENT DUPLICATES FROM r_kunnr.
SELECT kunnr
umskz belnr bldat blart shkzg dmbtr zfbdt zterm zbd1t zbd2t
zbd3t zbd1p zbd2p rebzg
INTO TABLE ibsid
FROM bsid
WHERE bukrs = '0695'
AND kunnr IN r_kunnr.
And also check your data base there are any table entries exist with the same kunnr and for the company code combination.
Rgds,
Bujji
‎2008 Jun 11 12:09 PM
ur simply appending '1864017' with Between clause to ranges..
instead try it like this.
r_kunnr-sign = 'I'.
r_kunnr-option = 'EQ'.
r_kunnr-low = '1864017'.
APPEND r_kunnr.
r_kunnr-low = '12345'.
APPEND r_kunnr.
r_kunnr-high = '99999'.
APPEND r_kunnr.
SELECT kunnr
umskz belnr bldat blart shkzg dmbtr zfbdt zterm zbd1t zbd2t
zbd3t zbd1p zbd2p rebzg
INTO TABLE ibsid
FROM bsid
WHERE bukrs = '0695'
AND kunnr IN r_kunnr.
also check whethre any records exists in BSID in se16 with these where clause values
‎2008 Jun 11 12:14 PM
hi,
u r using ranges .instead u can use
select-options: r_kunnr FOR bsid-kunnr no-display.
and u r filling that table with 5 times with same valuse then result of deleting will give at last only one record..
so directly u can assign only one record right? instead of do 5 times.
try and tell me
diana.
‎2008 Jun 11 12:22 PM
tables bsid.
types : begin of ty_ibsid ,
kunnr like bsid-kunnr,
umskz like bsid-umskz,
belnr like bsid-belnr,
bldat like bsid-bldat,
blart like bsid-blart,
shkzg like bsid-shkzg,
dmbtr like bsid-dmbtr,
zfbdt like bsid-zfbdt,
zterm like bsid-zterm,
zbd1t like bsid-zbd1t,
zbd2t like bsid-zbd2t,
zbd3t like bsid-zbd3t,
zbd1p like bsid-zbd1p,
zbd2p like bsid-zbd2p,
rebzg like bsid-rebzg,
end of ty_ibsid.
data : ibsid type table of ty_ibsid with header line.
select-options: r_kunnr for bsid-kunnr no-display.----
modified
r_kunnr-sign = 'I'.
r_kunnr-option = 'BT'.
r_kunnr-low = '1864017'.----
removed do enddo
append r_kunnr.
clear r_kunnr-low.
select kunnr
umskz belnr bldat blart shkzg dmbtr zfbdt zterm zbd1t zbd2t
zbd3t zbd1p zbd2p rebzg
into table ibsid
from bsid
where bukrs = '0695'
and kunnr in r_kunnr.
i tried with following statement . i got sy-subrc = 4 .that means there is no record available for the following conditions. u can verify this ,using table go to se11 , give bsid,then give same bukrs and kunnr if u r getting record then problem in select otherwise there is no record so unsuccessful is the result..
if sy-subrc = 0.
write: 'successful'.
loop at ibsid.
write: ibsid-belnr.
endloop.
else.
write:'not successful'.
endif.
reward if useful.
diana.
‎2008 Jun 11 12:27 PM
ans also u change i_kunnr-option = 'EQ'. instead of using Between.
‎2008 Jun 11 12:26 PM
\[removed by moderator as it was just a copy and paste answer of someone else's work without giving a source\]
Edited by: Jan Stallkamp on Jun 11, 2008 2:59 PM