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: 

Data retrival problem from BSEG table

Former Member
0 Kudos

Hi,

I am retriving data from BSEG table using BELNR, BUKRS, GJAHR in the where condition. I have to get 4 records which are present in the BSEG table. I am getting only 3 records from the select. What May be the problem in the retrival.

Kishore

1 ACCEPTED SOLUTION

ravisankara_varaprasad
Active Participant
0 Kudos

Hi,

I have written a sample query on BSEG table . It is fetching the correct number of records.

Just compare the actual values in BSEG .

data: i_bseg type standard table of bseg.

data: wa_bseg type bseg.

data:v_belnr type BELNR_D.

v_belnr = '100000000'.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

input = v_belnr

IMPORTING

OUTPUT = v_belnr.

.

select * into table i_bseg

from BSEG

where BUKRS = '2580'

and BELNR = v_belnr

and GJAHR = '2006'.

if sy-subrc eq 0.

loop at i_bseg into wa_bseg.

write : / wa_bseg-bukrs,

wa_bseg-belnr,

wa_bseg-gjahr.

endloop.

endif.

Hope it helps you.

Kind Regards,

Ravi Sankar.Z

5 REPLIES 5

ravisankara_varaprasad
Active Participant
0 Kudos

Hi,

I have written a sample query on BSEG table . It is fetching the correct number of records.

Just compare the actual values in BSEG .

data: i_bseg type standard table of bseg.

data: wa_bseg type bseg.

data:v_belnr type BELNR_D.

v_belnr = '100000000'.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

input = v_belnr

IMPORTING

OUTPUT = v_belnr.

.

select * into table i_bseg

from BSEG

where BUKRS = '2580'

and BELNR = v_belnr

and GJAHR = '2006'.

if sy-subrc eq 0.

loop at i_bseg into wa_bseg.

write : / wa_bseg-bukrs,

wa_bseg-belnr,

wa_bseg-gjahr.

endloop.

endif.

Hope it helps you.

Kind Regards,

Ravi Sankar.Z

Former Member
0 Kudos

Hi,

are you working in the same client as your information ?? have you proved in SE16 that the 4 records that you mention fulfill the conditions in WHERE ??

Additionally, you write that your select condition is loke this:

select * from BSEG

where BELNR = something

BUKRS = something

GJAHR = something.

If this is true, you might have some day a performance problem, ´cause you are not following the correct sequence of the key fields:

select * from BSEG

where BUKRS = something

BELNR = something

GJAHR = something.

Something else. In the data base you might find the records like '0000012345' and you´re probably searching with '12345'. Pay attention to this point.

Former Member
0 Kudos

I have taken 3 key fields in the where condition , we have 4 keyfields in the BSEG. i am selecting the 4th key field in the internal table..Is it may be reason....Do i need to take all the key fields in the internal table ....?

Kishore

0 Kudos

Hi,

Go to Se11, and input the data similar to the data pass in the where condition of the select statement, and execute.

Check how any records are retrieved.

Thanks,

Sriram Ponna.

Former Member
0 Kudos

Hi,

I am not suggesting you to use BSEG table,Because performancewise it is poor.

Just know what you need to display exact detaisl and search

for relevant tables.

Regards,

Chandu