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

Problem in select statement

Former Member
0 Likes
932

Hi Friends ,

I am having a problem in the following select query , its not giving any syntax error but it is not picking the values as per the condition :

SELECT GPART VKONT KTOKL ZPRINTALLOW FROM FKKVKP

INTO TABLE GT_FKKVKP

WHERE KOFIZ_SD = '03' OR

KOFIZ_SD = '04' AND

KTOKL = '0005' AND

GPART IN SEL_BP.

Can someone pls help me out in this.

Thanks

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
890

Total Posts: 46

Total Questions: 25 (10 unresolved)

Please clean up your old posts.

See if this helps:

SELECT gpart vkont ktokl zprintallow FROM fkkvkp
  INTO TABLE gt_fkkvkp
  WHERE ( kofiz_sd = '03'   OR
          kofiz_sd = '04' ) AND
          ktokl = '0005'    AND
          gpart IN sel_bp.

Rob

Edited by: Rob Burbank on Apr 27, 2009 10:49 AM

7 REPLIES 7
Read only

Former Member
0 Likes
890

Hi Krishna moorthy,

write the code in the below format..


 SELECT GPART VKONT KTOKL ZPRINTALLOW FROM FKKVKP
        INTO TABLE GT_FKKVKP
        WHERE KOFIZ_SD in ( '03' , '04' )          "write this way
        AND      ktokl = '0005'        
        AND   GPART IN SEL_BP.

regards,

Prabhudas

Read only

Former Member
0 Likes
890

Check out whether the condition is wrong in condition.

You code:

KOFIZ_SD = 03 OR 04 AND 005.

Check out it should be ( 03 OR 04 ) AND 0005

Read only

Former Member
0 Likes
890

Hello,

Or try to use brackets in your where-statement to make sure it selects what you exspect it to select.

The hierarchy for logical expressions is:

1. AND

2. OR

That may be the cause why the result isn't what you exspected.

regards

Read only

Former Member
0 Likes
891

Total Posts: 46

Total Questions: 25 (10 unresolved)

Please clean up your old posts.

See if this helps:

SELECT gpart vkont ktokl zprintallow FROM fkkvkp
  INTO TABLE gt_fkkvkp
  WHERE ( kofiz_sd = '03'   OR
          kofiz_sd = '04' ) AND
          ktokl = '0005'    AND
          gpart IN sel_bp.

Rob

Edited by: Rob Burbank on Apr 27, 2009 10:49 AM

Read only

Former Member
0 Likes
890

Hi Prabhudas,

KTOKL = '0005' check this you have written as KOFIZ_SD .

and Select do one thing

First put kozid_sd = '03' and check then again another...its genrally beacause of the length problem...at one point you may catch easily check it out !!if not so revert back ...Best of luck

Regards

sas

Read only

Former Member
0 Likes
890

Solved

Read only

Former Member
0 Likes
890

solved