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

Select statement.-urgent.

Former Member
0 Likes
1,109

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.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,059

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.

10 REPLIES 10
Read only

Former Member
0 Likes
1,059

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.

Read only

Former Member
0 Likes
1,060

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.

Read only

Former Member
0 Likes
1,059

Change the r_kunnr-option to EQ

r_kunnr-sign = 'I'.

r_kunnr-option = 'EQ'.

Read only

Former Member
0 Likes
1,059

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

Read only

Former Member
0 Likes
1,059

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

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
1,059

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

Read only

Former Member
0 Likes
1,059

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.

Read only

Former Member
0 Likes
1,059

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.

Read only

0 Likes
1,059

ans also u change i_kunnr-option = 'EQ'. instead of using Between.

Read only

Former Member
0 Likes
1,059

\[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