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 -Problem

Former Member
0 Likes
536

Hi all,

Want a select statement as follows:

[1]

SELECT mastmatnr knvvkunnr kna1~loevm FROM mast

INNER JOIN knvv ON knvvkunnr = mastmatnr

INNER JOIN kna1 ON kna1kunnr = mastmatnr

INTO CORRESPONDING FIELDS OF TABLE itab

WHERE mastwerks = 0001 AND maststlan = 8

AND knvv~vkorg = 0200

AND knvv~vtweg = 00

AND knvv~spart = 01

AND knvv~kdgrp = 'T1'

AND kna1~loevm <> 'X' .

But it gives me a sy-subrc = 4.

Tried something to find out the problem

The following worked.

SELECT mast~matnr FROM mast

INTO CORRESPONDING FIELDS OF TABLE

itab.

The following didnt work.

SELECT mast~matnr FROM mast

INTO CORRESPONDING FIELDS OF TABLE

itab where mast~werks = 0001.

AND mast~stlan = 8.

Is it something to do with primary Key?

How should I modify [1-see above],A modified statement would be helpful.

Eagerly waiting for a reply.....

P

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
496

WERKS is a char4 field...

so 0001 and '0001' are different.... right!!! .... 0001 means 1 only...

can try by putting quote

3 REPLIES 3
Read only

Former Member
0 Likes
497

WERKS is a char4 field...

so 0001 and '0001' are different.... right!!! .... 0001 means 1 only...

can try by putting quote

Read only

Former Member
0 Likes
496

hi,

the join condition you are using is invalid.

You are checking the Material number in MAST table to be equal to KUNNR in KNVV table.

Please check the condition again.

Regards,

Komal.

Read only

0 Likes
496

Thanks a lot guys for the prompt reply..

I put quotes and it worked.

The kunnr and materialnummer is the same in this case.Its a customisation we have done....

Thanks a lot.