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 query not working

Former Member
0 Likes
4,138

hi,

can anyone tell me whats wrong in this code:

SELECT bukrs

lifnr

augdt

augbl

gjahr

belnr

budat

bldat

blart

wrbtr

zterm

zbd1t

zbd2t

zbd1p

zbd2p

INTO TABLE i_bsak

FROM bsak

WHERE lifnr EQ p_lifnr

AND augdt IN s_date

AND augbl EQ 'RE'

AND gjahr EQ p_gjahr.

it is not fetching any data. sy-subrc is 4. Though

there is one record meeting the selection criteria enterd in the selection screen.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,355

shouldn't AUGBL be a document number???

whts an 'RE' doing in a augbl field? Just Curious.

pk

11 REPLIES 11
Read only

Former Member
0 Likes
2,355

Hi,

Check the sequenec of fields selected and fields in i_bsak

internal table.

when both the sequence are same, then only it will fetch.

revert back if any issues.

regards,

Naveen

Read only

Former Member
0 Likes
2,355

hi,

just check order of the internal table fields with database table fields.

Read only

Former Member
0 Likes
2,356

shouldn't AUGBL be a document number???

whts an 'RE' doing in a augbl field? Just Curious.

pk

Read only

Former Member
0 Likes
2,355

Hi,

1>Check the where condition.

2> check the data wheather it realy can be fetched

Otherwise there is no reason .

Regards,

anirban

Read only

Former Member
0 Likes
2,355

Hi Poonam Naik ,

Try to use 'corresponding fields of table',,,,,,

that may be solve ur probelm,,,,

Hope it is helps.

Regards,

T.Durai murugan.

Read only

Former Member
0 Likes
2,355

Hi,

In BSAK, AUGBL is an Clearing Document Number, it is of 10 characters lenght.

Please check that the clearing document number is properly given or not, you can see that i made bold in your select query.

SELECT bukrs

lifnr

augdt

augbl

gjahr

belnr

budat

bldat

blart

wrbtr

zterm

zbd1t

zbd2t

zbd1p

zbd2p

INTO TABLE i_bsak

FROM bsak

WHERE lifnr EQ p_lifnr

AND augdt IN s_date

AND augbl EQ 'RE'

AND gjahr EQ p_gjahr.

Read only

Former Member
0 Likes
2,355

Hi,

is this line correct: AND augbl EQ 'RE' ???

Its a BELNR!!

Look via se16 / se16n into BSAK to find as you need.

Regards, Dieter

Read only

JozsefSzikszai
Active Contributor
0 Likes
2,355

hi Poonam,

check the value of p_lifnr at runtime. If you have a vendor, whose number is 123, than it is stored in the database: 0000000123 (because of the conversion exit on the domain behind). So p_lifnr has to have the value with the leading zeros.

hope this helps

ec

Read only

Former Member
0 Likes
2,355

hi Poonam,

i am not very sure but you can try something like:

WHERE lifnr EQ p_lifnr

AND augbl EQ 'RE'

AND gjahr EQ p_gjahr

OR augdt IN s_date.

With luck,

Pritam.

Read only

Former Member
0 Likes
2,355

As Deiter said...

check clearing doc no ..

normally its char of 10.

check that..

Regards..

Raj Mummidi

Edited by: Raju Mummidi on Jul 17, 2008 1:56 PM

Read only

Former Member
0 Likes
2,355

hi Poonam,

The problem is in the where condition only.without

declaring AUGBL field as either Parameter or select-options

where will you validate the value 'RE'.So please check it out

to solve the problem.