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 strange error

Former Member
0 Likes
997

Hello,

I'm doing a SELECT on bkpf and vbsegs with a join and got an "error" only when I fill 2 values in my select-options

ex:

1)

p_bukrs = 1000

s_gjahr = 2007

s_kostl= XXX

-> work fine

2)

p_bukrs = 1000

s_gjahr = 2007 to 2008

s_kostl = XXX

-> no reply no error, nothing :s

SELECT * INTO CORRESPONDING FIELDS OF TABLE it_fact
             FROM bkpf INNER JOIN vbsegs ON bkpf~belnr = vbsegs~belnr
             client specified 
             WHERE bkpf~mandt = sy-mandt 
               AND bkpf~bukrs = p_bukrs
               AND bkpf~gjahr IN s_gjahr
               AND bkpf~budat IN s_budat
               AND bkpf~bldat IN s_bldat
               AND vbsegs~kostl IN s_kostl.

I ve tried the same select only on the bkpf table (without JOIN) and all hapen fine.....

I got crazy : )

Thanks for help

1 ACCEPTED SOLUTION
Read only

ThomasZloch
Active Contributor
0 Likes
948

The ON-conditions need to be enhanced:

 FROM bkpf INNER JOIN vbsegs ON bkpf~bukrs = vbsegs~ausbk
                             AND bkpf~belnr = vbsegs~belnr
                             AND bkpf~gjahr = vbsegs~gjahr

It would actually be better to join VBKPF instead of BKPF. Also delete CLIENT SPECIFIED and the WHERE-condition on bkpf~mandt, not needed.

Thomas

6 REPLIES 6
Read only

Former Member
0 Likes
948

hii

may i know where u r using this query an module pool or report

Read only

Former Member
0 Likes
948

Hi,

it would be helpful to know what error you are getting.

Greetings,

Gert.

Read only

Former Member
0 Likes
948

I need this tables to select a belnr based on the gjahr and kost data selection...

-> Unfortunatly, i dont have any error 😕

Just waiting in debug until I cut the transaction...

Thx for reply

Read only

h_senden2
Active Contributor
0 Likes
948

Strange,

i'm tried your code in our test system, and your test scenario, but no error here !

What is exactly the error you're get ?

regards,

Hans

Read only

ThomasZloch
Active Contributor
0 Likes
949

The ON-conditions need to be enhanced:

 FROM bkpf INNER JOIN vbsegs ON bkpf~bukrs = vbsegs~ausbk
                             AND bkpf~belnr = vbsegs~belnr
                             AND bkpf~gjahr = vbsegs~gjahr

It would actually be better to join VBKPF instead of BKPF. Also delete CLIENT SPECIFIED and the WHERE-condition on bkpf~mandt, not needed.

Thomas

Read only

0 Likes
948

thx a lot