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

Error in Select Statement

Former Member
0 Likes
840

Hi,

I am getting error for this select statement

SELECT eine~evers INTO wa_eine-evers

FROM eina

JOIN eine ON einainfnr = eineinfnr

WHERE eina~matnr = wa_idata-matnr

AND eina~lifnr = wa_idata-lifnr

AND eine~esokz = wa_idata-esokz

AND eine~werks = wa_idata-werks

AND eine~evers = wa_idata-ship_inst.

Here the SY-SUBRC = 4.

But not for this select statement

SELECT eine~evers INTO eine-evers

FROM eina

JOIN eine ON einainfnr = eineinfnr

WHERE eina~matnr = wa_idata-matnr

AND eina~lifnr = wa_idata-lifnr

AND eine~esokz = wa_idata-esokz

AND eine~werks = wa_idata-werks

AND eine~evers = wa_idata-ship_inst.

Here SY-SUBRC = 0.

Can anyone tell the difference between these two select statement.and the cause for the error.

Thanks

Kumar

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
816

Hi,

Pls try to state the error clearly and what error it is throwing.

Pls check with the declarations of Wa_eine and eine. DO they refer to same struture or not.

Reward if helpful.

Regards

Chandralekha

7 REPLIES 7
Read only

Former Member
0 Likes
817

Hi,

Pls try to state the error clearly and what error it is throwing.

Pls check with the declarations of Wa_eine and eine. DO they refer to same struture or not.

Reward if helpful.

Regards

Chandralekha

Read only

0 Likes
816

Hi,

TYPES: BEGIN OF x_eine.

INCLUDE STRUCTURE eine.

TYPES: END OF x_eine.

t_eine TYPE TABLE OF x_eine. "Internal Table

wa_eine TYPE x_eine. "Work area

LOOP AT t_idata INTO wa_idata.

CLEAR: wa_eine-netpr,

wa_eine-peinh,

wa_eine-bprme,

wa_eine-waers,

wa_idata-new,

wa_idata-old,

wa_eine-evers.

Select statement 1

SELECT eine~evers INTO wa_eine-evers

FROM eina

JOIN eine ON einainfnr = eineinfnr

WHERE eina~matnr = wa_idata-matnr

AND eina~lifnr = wa_idata-lifnr

AND eine~esokz = wa_idata-esokz

AND eine~werks = wa_idata-werks

AND eine~evers = wa_idata-ship_inst.

Certain Logic and then.

Select statement 2

SELECT einenetpr einepeinh

einebprme einewaers eine~prdat

INTO (wa_eine-netpr,

wa_eine-peinh,

wa_eine-bprme,

wa_eine-waers,

wa_eine-prdat)

FROM eina

JOIN eine ON einainfnr = eineinfnr

WHERE eina~matnr = wa_idata-matnr

AND eina~lifnr = wa_idata-lifnr

AND eine~ekorg = '1000'

AND eine~esokz = wa_idata-esokz

AND eine~werks = wa_idata-werks.

EXIT.

ENDSELECT.

I am getting the data from select statement 2 but not from Select statement 1.

The sy-subrc for 1st statement is 4, but wen i checked in the DB table the record is there.

Thanks

Kumar

Read only

0 Likes
816

Hi,

Are you using all the reference keys in join?

regards,

Subramanian

Edited by: Subramanian PL on Jul 16, 2008 11:04 AM

Read only

0 Likes
816

Hi,

No i'm not using all the reference in the join.

Here is my select statement.

SELECT eine~evers INTO wa_eine-evers

FROM eina

JOIN eine ON einainfnr = eineinfnr

WHERE eina~matnr = wa_idata-matnr

AND eina~lifnr = wa_idata-lifnr

AND eine~esokz = wa_idata-esokz

AND eine~werks = wa_idata-werks

AND eine~evers = wa_idata-ship_inst.

EXIT.

ENDSELECT.

IF sy-subrc <> 0.

l_flag = 'X'.

ENDIF.

Read only

Former Member
0 Likes
816

Ram,

I feel the wa_ eine-evers and eine-evers are of not same type and length.

Read only

Former Member
0 Likes
816

Hi,

I see a difference

AND eine~ekorg = '1000'

AND eine~evers = wa_idata-ship_inst.

is missing

THanks

Naren

Read only

0 Likes
816

Hi,

Problem solved

thanks for all those who have replied my questions.

Thanks

Kumar