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: 

Problem in select statement

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

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

former_member184119
Active Contributor
0 Kudos

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

Former Member
0 Kudos

Solved

Former Member
0 Kudos

solved