Logical operator Question

Select * from bsik into table it_bsik
         WHERE LIFNR in p_client and
               bukrs eq  so_cia  and
               budat LE so_fec   and
               AUGDT LE so_fec   and
*               blart <> 'KZ'.
             ( BSCHL <> 50       or
               BSCHL <> 11       or
               BSCHL <> 01       or
               BSCHL <> 25 )     and
               umskz NE 'T'      and
               umskz NE 'F'      and
               umskz NE 'R'      and
               umskz NE 'P'      and
               umskz NE 'J'      and
               umskz NE 'L'.
is this Select Right ? , it get me the right info but i feel that is not right
because the and and and part , i want get all Open Item from bsik except the Special GL , so i am looking for the umskz field , so i feel that the multiple and things dont check all situation but i have a doc with value F in umskz so look like the select is doing it right can somebody show me and guide me i have only few months trying learning myself abap.
Thanks
pd: i dont know much sql either.

Hi Edgar
Firstly i would like to tell you few things and also my understanding of what you want to achieve:
1.Its always better to mention the exact  fields you want to get in your select
   query rather than giving ' * '.By mentioning the exact fields , you improve the
   performance of your SQL.
2. From your query below i am assuming that p_client is a select option and
   so_cia is a parameter. In actual practice , we always use so_ for  a select
   option and p_ for a parameter. I am not sure if you have your reasons to name it
   that way but i will be going as per the standards . So i will rename p_client to
   so_lifnr ,  so_cia to p_werks , so_fec to p_date.
3. You want to fetch all the records where document type (BLART) is not equal  
    to 'KZ'.
4. You want to fetch all the records for which the posting key(BSCHL) is not equal
    to  50 or 11 or  01 or 25.I am not sure if this is what you want or do you want all of them not to appear in the result table. If that is the case you will have to use 'AND' to connect all.
5. You want to fetch all the records for which Special G/L Indicator(UMSKZ) is not
    equal to T  , F , R , P , J , L. ( please note that I could not find the value 'L' for 
    the domain UMSKZ )
So based on the above understanding your SQL would be:
CLEAR :it_bsik[].
Select *  FROM BSIK INTO TABLE it_bsik
              WHERE lifnr in so_lifnr
              AND      bukrs = p_bukrs
              AND      budat LE p_date
              AND      augdt  LE p_date
              AND     ( bschl <> 50
              OR         bschl <> 11
              OR         bschl <> 01
              OR         bschl <> 25 )
              AND       umskz NE 'T'
              AND       umskz NE 'F'
              AND       umskz NE 'R'
              AND       umskz NE 'P'
              AND       umskz NE 'J'
              AND       umskz NE 'L'.
IF sy-subrc EQ 0.
*Check for sy-subrc
ENDIF.
Note: Always check for sy-subrc after a select. I have changed p_client to so_lifnr , so_cia to p_bukrs and so_fec to p_date above. Correct me if my understanding is wrong.
Hope this would be of some help to you.
Cheers
shivika
Message was edited by:
        Shivika Bhorchi

Similar Messages

  • A quick question  of Logical Operator - NOT?

    I know that the logical operator for NOT is " ! " sign.
    But someone could please tell me how do I use the NOT operator in the below code.
    if (c instanceof JLabel) Thanks

    Before you use this, think long and hard if there's a better way to
    achieve your goal than wandering through all of a panel's
    components checking for those that aren't JLabels.
    import javax.swing.*;
    public class Not {
         public static void main(final String[] argv) {
              final JComponent panel = new JPanel();
              if (!(panel instanceof JLabel)) {
                   System.out.println("It works.");
    }

  • Logic operations on a string of bits

    Hi, I have a very simple question that I cannot seem to figure out.  I would just like to perform logic operations (AND, OR, etc.) on 2 strings of bits that are 24 bits long each, however I cannot find in the functions palette a function that acts as a binary constant.  I only see numeric constant and hex functions.  Can somone please let me know where I can find this.  For example, I would like to AND '111111111111111111111111' & '000000000000000000000000'.    
    Solved!
    Go to Solution.

    I think that these bitwise operations should work directly on strings too. Thus I wrote up this idea.  
    LabVIEW Champion . Do more with less code and in less time .

  • How to achieve logical operator on [Authorize(Roles = ] in MVC

    For example, I need to make a controller accessible a user with two roles; role "Admin" and "Editor". How to achieve it.
       [Authorize(Roles = "Admins")]
        public class SampleController : BaseController
    How to do logical operator, such as AND and OR (maybe || and &&)
    Thanks!
      

    Hello klouapple,
    Please post your question to ASP.NET forum instead of here.
    Best regards,
    Barry
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Basic view/stream join problem (Logical Operator LO_CROSS error)

    Hi -
    I am writing a CQL processor which processes a stream of events. It translates them 1:1 to another type of event, and also assigns a calculated Version field to the output events.
    The inbound events have an ID field which may contain duplicates. The version is an internal sequence starting at 1 for each ID, and incrementing by ID each time another instance of that ID is seen.
    Sample input (schema: ID, Payload):
    1, abc
    2, abc
    3, abc
    1, def
    4, abc
    2, defDesired output (schema: ID, Version, Payload):
    1, 1, abc
    2, 1, abc
    3, 1, abc
    1, 2, def
    4, 1, def
    2, 2, defI have defined a processor with a view that aggregates the inbound events in a fixed depth relation (I receive fewer than 1000 events/versions per ID), and try to join that to a transform query:
    <view id="Versioner">
      select id, count(*)+1 as version
      from inboundEvents [partition by id rows 1000]
      group by id
    </view>
    <query id="Translator">
      select payload, ..., f.id, v.version
      from inboundEvents as f, Versioner as v
      where f.id=v.id
    </query>Question 1 - when deploying, CEP gives this error, which I don't understand. What basic error am I making?
    Description: unbound stream not allowed
    Cause: A stream input was applied to Logical Operator LO_CROSS
    Action: Do not use stream input for Logical Operator LO_CROSS> Question 2 - is there a better CQL pattern for this - it is ugly to need to fix the partition depth to 1000.
    -thanks, Barney
    Edited by: Barney on 10-Aug-2011 10:59

    Q1 -"inboundEvents" is a Stream and a Stream without a window cannot be used in a Join
    You could instead use the query
    <query id="Translator">
    RSTREAM (
      select payload, ..., f.id, v.version
      from inboundEvents[NOW] as f, Versioner as v
      where f.id=v.id
    </query>Q2 - You do not need the PARTITION window. Instead, just use
    <view id="Versioner">
      select id, count(*)+1 as version
      from inboundEvents
      group by id
    </view>

  • Logical Operations in SQL decode function ?

    Hi,
    Is it possible to do Logical Operations in SQL decode function
    like
    '>'
    '<'
    '>='
    '<='
    '<>'
    not in
    in
    not null
    is null
    eg...
    select col1 ,order_by,decode ( col1 , > 10 , 0 , 1)
    from tab;
    select col1 ,order_by,decode ( col1 , <> 10 , 0 , 1)
    from tab;
    select col1 ,order_by,decode ( col1 , not in (10,11,12) , 0 , 1)
    from tab;
    select col1 ,order_by,decode ( col1 ,is null , 0 , 1)
    from tab;
    Regards,
    infan
    Edited by: user780731 on Apr 30, 2009 12:07 AM
    Edited by: user780731 on Apr 30, 2009 12:07 AM
    Edited by: user780731 on Apr 30, 2009 12:08 AM
    Edited by: user780731 on Apr 30, 2009 12:08 AM
    Edited by: user780731 on Apr 30, 2009 12:09 AM

    example:
    select col1 ,order_by,case when col1 > 10 then 0 else 1 end
    from tab;
    select col1 ,order_by,case when col1 &lt;&gt; 10 then 0 else 1 end
    from tab;
    select col1 ,order_by,case when col1 not in (10,11,12) then 0 else 1 end
    from tab;As for testing for null, decode handles that by default anyway so you can have decode or case easily..
    select col1 ,order_by,decode (col1, null , 0 , 1)
    from tab;
    select col1 ,order_by,case when col1 is null then 0 else 1 end
    from tab;

  • Nqs error 59001: Binary logical operation error in OBIEE 11g

    Hi,
    Requirement: Need to calculate YTD for invoiced amount and Prior YTD for invoiced amount and last year total invoiced amount.
    Logic we used: For YTD Invoiced amount we used “Year To Date” time series function in rpd.
    For Prior YTD we used “Ago function on Calculated YTD column”.
    For Last Year Invoiced amount we used “ CASE function and dynamic variables” as:
    CASE WHEN year=valueOf(previous_year) THEN invoiced_amount END;
    Now, when I’m creating a report, I’m getting the following error as:
    *[nQSError: 43119] Query Failed: [nQSError: 59001] Binary Logical operation is not permitted on VARBINARY, INTEGER operand(s). (HY000)*
    Please help me to solve this, i need to release the instance by EOD

    Hi,
    As per my understanding the ValueOf(previous_year) is double precesion so it wont allow to use binary logical operator.Change to integer becos we can manage year with interger data type.
    [nQSError: 59001] Binary Logical operation is not permitted on DOUBLE PRECISION, VARBINARY operand(s).
    mark if helpful/correct
    thanks,
    prassu

  • How to apply different Logical operations to N.of Signals

    Hello all,
    Please help me if anyone have idea about this.
    I have “N” number of signals. I want to apply different Logical operations for this.
    For Example:
          (((SigA >= 30 && SigB <=55) || (SigC = 42)) && (SigD > 45))
    ((((SigD >= 89.25 && SigF <=55.568) ||(SigG = 156.89)) && (SigA >= 45)) || ((SigF – Sig A) >25))
    Here Conditions will change every time. User can input different conditions (like Excel calculations). I need to check signals as per these type of conditions. Is there is any tool kits available in LabVIEW / we need to develop?
    Currently I’m thinking about string manipulations to extract the each condition . Once first condition is finished then check this results with next conditions (so on..)
    Munna

    Hi GerdW,
    After long time again I stated doing this task. Could you please help me in this.
    As per my snippet, at 1st making array based on given String. From that string I need to check where open & closed brackets are coming to do logical operations.
    For Example: (2 OR ((1 AND 2) OR 3))
    Index
    0
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    String
    2
    O
    R
    1
    A
    N
    D
    2
    O
    R
    3
    Please give me any idea/sample VI for the same.
    Here, 1,2 & 3 are Indices of Boolean 2D Array.
    Munna

  • Logical operations on different systemgroups

    Hi,
    I want to define several systemgroups in the transaction RZ21 on a central monitoring system. Afterwards I want to make logical operations on these groups (like: group1 and group2) in the monitor definition. Is this possible and in what way? I hadn't found hints on sap-notes.
    Greetings
    Christian Wosgien

    > I think you mixed up bit and binary datatype.
    > Binary datatype is normally used for images, text, storing a pdf in your db, etc
    I'm aware that's what they're usually used for (although I have thought varbinary would have been better)
    but I need to store lots of bit fields and  was hoping I could use a binary datatype, rather than have status1, status2, status3, etc
    > If you want 1 column to store multiple values using bitmasks, than you can use an integer to do that.
    > e.g. see examples in system tables like sysdatabases..status (small int) and sysdatabases..status4 (int)
    That's what we're using at the moment - if fact we're now using unisgned bigint - that gives 64 bits.
    The fact that sys* tables have multiple status fields shows it would be useful here.
    > Sybooks: The bitwise operators are a Transact-SQL extension for use with integer type data.
    > So it looks like you've got to use multiple columns to achieve wat you want.
    Yep - that's exactly what we've found.
    It seems unfortunate to not allow bitwise operations on binary datatypes. Its not a common use of them I know
    but I've worked at couple of places which would have benefited from this.
    We've spent some time writing our own functions that implement bitwise operations on binary fields, but would have been better if these were build in.
    > Why would you want to store 200 bitfields in 1 column?
    For a similar reason as the sys* tables have multiple status columns - If binary columns allowed bitwise operations - they'd only need 1 status field.

  • Logical Operator list to end users

    Hi,
    Is there any way that we can provide Logical operator also in the filter/prompt, for the end user in WebI on top of a SAP BW universe?
    Ex: User has to select a logical operator(like <,<=,>,>=,= etc) and value for a 'Net Due Date' filter
    Tried searching the forum, but did not get the proper work around.
    Thank you in advance.
    ---Veera

    are you talking about adding filters in webi reports?
    i think its easy,
    just in the query itself you can add filter and make it as prompt.
    but you have to select the operator, case this is something you have to do into the query itself.
    users can not do this when they are running the report.
    but there is another option which is "Quick Filter" in there users can add quick filters and select operators as they like.
    good luck

  • Logical Operator list t oend users

    Hi,
    Is there any way that we can provide Logical operator also in the filter/prompt, for the end user in WebI on top of a SAP BW universe?
    Ex: User has to select a logical operator(like <,<=,>,>=,= etc) and value for a 'Net Due Date' filter
    Tried searching the forum, but did not get the proper work around.
    Thank you in advance.
    ---Veera

    Hi,
    Yes it is possible.
    Here is a sample based on @CALYEAR characteristic
    <FILTER KEY="@Select(Calendar Year\L01 Calendar Year).[TECH_NAME]">
    <CONDITION OPERATORCONDITION="@Prompt('Select operator','A:A',{'Equal':'Equal','Not Equal':'NotEqual','Greater':'Greater','Less':'Less','Greater or Equal':'GreaterOrEqual','Less or Equal':'LessOrEqual'},mono,primary_key,persistent,{'Equal':'Equal'})">
    <CONSTANT TECH_NAME="@Prompt('Select year','A','Calendar Year\L01 Calendar Year',Mono,Primary_Key,Persistent)"></CONSTANT>
    </CONDITION></FILTER>
    Here is the prompt definition you have to create instead of a static value for the OPERATORCONDITION:
    @Prompt('Select operator','A:A',{'Equal':'Equal','Not Equal':'NotEqual','Greater':'Greater','Less':'Less','Greater or Equal':'GreaterOrEqual','Less or Equal':'LessOrEqual'},mono,primary_key,persistent,{'Equal':'Equal'})
    Regards
    Didier

  • Logical operator 'like'

    I have a small query where I have to retrieve vendor details not including the vendors starting with '9'.
    I have written the below query for that.
    select b~lifnr  " Vendor number
         into corresponding fields of table gi_output_vendors
    from  lfa1
    where  lifnr   not like  '9%'.
    But the output I am getting contains vendor numbers '0000950000' where I wanted to eliminate these type of numbers also. i.e, I don't want to consider leading zeroes.
    So, the below code I have written for that.
    The problem is with if condition or delete statement  'like' logical operator is not being allowed.
    loop at gi_output_vendors into wa_output_vendors.
    shift wa_output_vendors-lifnr left deleting leading '0'.
    if wa_output_vendors-lifnr like '9%'   " didn't work delete gi_output_vendors from wa_output_vendors   where
                  lifnr like '9%'. "didn't work
    endif.
    endloop.
    When I use 'like' with 'if' condition or 'delete' statement, I am getting error saying that 'Like operator is not allowed'.
    How could I deal with this situation.
    Thanks in advance.
    Vishnu Priya

    If you can guarantee the 9 will always be in the same place then it would be better to use offset logic or something like 'lifnr NOT LIKE '00009'' - incidentally, I believe the % wildcard only replaces one character so '9%' will be looking for a 2 char string containing a 9 followed by ONE other character.  Using '9' will look for a 9 followed by any number of other characters. Since lifnr is a 10 char field (according to your example) '9%' will always fail. I would suggest using the Data Browser (SE11) selection screens to try out some of the possibilities and see what works.
    Hope that's of some help!
    Andy
    By the way, I wouldn't recommend using '9' becasue this will look for a 9 <b>anywhere</b> in the lifnr field i.e. it could exclude a perfectly valid number just because it ends in a 9!
    Message was edited by: Andrew Wright
    Sorry, ignore me, in SQL you should use % and not * for multiple characters.  However, the same applies if you can guarantee the position of the 9.
    Message was edited by: Andrew Wright

  • Logical operator

    Hi Experts,
    Can we use logical operator in where clause of select statement?????
    My requirement is i want to CA logical operator in select statement.Is there any possibility????????
    If there please tell me???????????\
    Nice answers reward with maxi points.................

    Hi Subash,
    Prakash is right with his idea to go by range,
    but it won't work like this.
    Instead build your range like this:
    ranges r_matnr for Tnnnn-MATNR.
    r_matnr-sign = 'I'.
    r_matnr-option = 'BT'.
    r_matnr-low = '0'.
    r_matnr-high = '9999999999'.
    "max length of matnr filled with 9
    APPEND r_matnr.
    then
    SELECT * FROM Tnnnn WHERE MATNR IN r_matnr
    AND ......
    this will get you only those entries with plain numerical MATNR.
    For the opposit selection, just replace 'I' wit 'E' in r_matnr-option.
    hope that helps.
    Regards
    JW
    Edited by: Joerg Wulf on Jan 8, 2008 10:43 PM

  • How to store logical operator in an array in java

    how to store logical operator in an array in java.
    Array should not be String type if i pass an element of that array it should be considered as logical operator

    my exact requirment is like this, i need some logic
    to convert string like this "2 Equals 3 AND 4 greater
    than 7" to condition like this
    2 == 3 && 4 >7 which i can pass to if
    condition.So you want to create an expression parser?
    No need for something as ugly as what you think you need, a simple nested conditional will do it for just the few logical operations.

  • Ignore logical operator in string

    I assign a string string to a variable var, then show the variable using $$var$$
    This works if the string is something like "Black White", and $$var$$ returns "Black White"
    However, if the string contains a logical operator like "and" or "or", then captivate sees it as a logical operator, and returns "false".  Therefore the string "Black or White" makes the variable return "false"
    I believe I need to put something in front of or around the logical operator so that it's ignored, like "Black */or/* White", or something like that, but I can't remember what.

    Still no concatenation in CP8 One of my old, old feature requests.
    Captivate doesn't know the difference between a string and a number.

Maybe you are looking for

  • What to do when trying to log into my iCloud and it says "this apple iD is valid, but it's not an iCloud account"?

    What to do when trying to log into my iCloud and it says "this apple iD is valid, but it's not an iCloud account"?

  • Need Help with this SQL Report

    Declare @Total int Select @Total=count(*) From v_Add_Remove_Programs Where v_Add_Remove_Programs.DisplayName0 Like '@DisplayName' Select Distinct v_Add_Remove_Programs.DisplayName0 as [Software Product], Version0 as [Version], COUNT(v_GS_System.Name0

  • In the background process field tcode is clean

    Executing a transaction in the background field tcode is clean. For example the transaction mir11 run in the background does not fill the field BKPG-TCODE as it happens running online. there 'a solution? thanks

  • Opening the file in read only mode

    hi all, i am using i want to open any type of files in read only mode using host command.so first i am setting the attribute to read only and then opening the file. But still the opened file is editable. i have written like below Host( 'cmd /c  attri

  • Perl, MysQL, DBD, running 10.5.7

    Hi, As several forums suggested Apple screwed up Perl with the 2009-001 Security update. As I found out the problems with Perl have not been repaired in 10.5.7, although I expected it to be. Alas. I used to run Perl scripts using the DBI::DBD interfa