Logical operations on binary columns

We need to store approx 200 bitfields so we thought we'd use a binary datatype.
We can set the bit fields easily using
    set bitfield = bitfield  | 1
    set bitfield = bitfield  | 2
    set bitfield = bitfield  | 4
However we don't want to hard-code these values we like to use a table like this
    update tableA
    set bitfield = bitfield | table.value 
    where ..... table.mask = "MASK1"
However, it seems there is a limitation where you can only OR/AND a binary datatype with an integer.
So the column table.value can only go up to 64 bits.
Why can't we use AND/OR betweem two binary columns ?
Is there some sort of work around ?
(Any chance of any changes in ASE ?)
Incidently MS-SQL suffers the same problem.

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

Similar Messages

  • 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

  • Unable to drill down with binary logical operation issues

    QSError: 10058] A general error has occurred. [nQSError: 59001] Binary logical operation is not permitted on Double operand(s) (S1000)
    Basically this comes from my drill down report. I have 2 hierarchies on one report, 3 columns --- months, state, measures..
    If I drill down from STate ----> lowest, then drill month--->lowest, things works fine; but if I start with month---> lowest, then drill state down, I will get this above error..
    I checked the column data types from DB, month is char, week is date, state is char, measure is double
    SO let me know what you think?
    Thanks

    is it helpful?
    On Paass Navigation for another report

  • [nQSError: 59001] Binary Logical operation is not permitted

    Hi All,
    I am querying 3 columns in a report.
    E.g.
    Sales -> Directly pulled from the database column
    Prior Month Sales -> AGO("Sales subject area"."Key Measures"."sales", "Sales subject area".Time_Dimension."Month", 1)
    Current YTD ->
    (CASE WHEN "Sales subject area".Time_Dimension."Year" = VALUEOF("CURRENT_YEAR") AND "Sales subject area".Time_Dimension."Month Number" <= VALUEOF("CURRENT_MONTH") THEN "Sales subject area"."Key Measures"."Sales" ELSE 0 END )
    I get the following error:
    State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 59001] Binary Logical operation is not permitted on VARBINARY, INTEGER operand(s). (HY000)
    Please let me know how to go about this.

    The Data types are as follows:
    1. Sales = Double
    2. Month = Varchar
    3. Month Num is calculated column from -> MOD("Sales Subject Area".Calendar.TimeID, 100) and time id is "Int"
    The Rpd variables are:
    1. Current Year = CAST(SUBSTRING(CAST(MAX(YEARMONTH) AS VARCHAR),1,4) AS INTEGER)
    2. Current Month = CAST(SUBSTRING(CAST(MAX(YEARMONTH) AS VARCHAR),,6) AS INTEGER)
    3. Prior Year = CAST(SUBSTRING(CAST(MAX(YEARMONTH) AS VARCHAR),1,4)-1 AS INTEGER)
    Basically we dont want to use TODATE function as it is not working properly for Prior YTD.

  • 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.

  • 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 .

  • Does bitwise operation on boolean datatypes work like logical operation ?

    Does bitwise operation on boolean datatypes work like logical operation ?
    For example, in the following code, how is each bitwise operation (say) 'b1 & b2' evaluated ?
    1) by converting the values of b1 (true) and b2 (false) to binary and doing '&' on them OR
    2) just treating it as a logical operation (i.e. similar to &&) where both have to be equal to be true
    Also, does the outcome of the if condition need to result in a 'true' or 'false' for the relevant message to print ? ....... Just fyi, I tried out this program and it goes to condition 2 but I do not understand why.
    class SSBool {
    public static void main(String[] args) {
    boolean b1 = true;
    boolean b2 = false;
    boolean b3 = true;
    if (b1 & b2 | b2 & b3 | b2)
    System.out.println ("condition 1");
    if (b1 & b2 | b2 & b3 | b2 | b1)
    System.out.println ("condition 2");
    Thank you,
    AG

    The Java Tutorial (always my first stop if I need an answer) says :
    "When both operands are boolean, the operator & performs the same operation as &&."
    That your program goes to condition 2 is obvious because the last test in the if-clause if (b1 & b2 | b2 & b3 | b2 | b1) looks at b1 which is true...

  • 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;

  • Performance operations based on Column values in SQL server 2008

    Hi ,
    I have a table which consist of following columns
    ID    Formula              
    Values                 
    DisplayValue
    1                    
    a*b/100       100*12/100    
          null
    2                    
    b*c/100       
    12*4/100              
    null
    I want to perform operation based on column "Values" and save data after operations in new column Name "Display Value" .i.e I want to get the below result . Can anyone please help.
    ID    Formula              
    Values                 
    DisplayValue
    1                    
    a*b/100       100*12/100    
          12
    2                    
    b*c/100       
    12*4/100             
    0.48
    Thanks for the help.
    Regards, Priti A

    Try this,
    create table #mytable (ID int,Formula varchar(10), [Values] varchar(10), DisplayValue decimal(10,4))
    insert into #mytable values(1 ,'a*b/100','100*12/100',null)
    insert into #mytable values(2 ,'b*c/100','12*4/100',null)
    declare @rowcount int=1
    while @rowcount <= (select max(id) from #mytable)
    begin
    declare @expression nvarchar(max)
    select @expression=[values] from #mytable where id = + @rowcount
    declare @sql nvarchar(max)
    set @sql = 'select @result = ' + @expression
    declare @result decimal(10,4)
    exec sp_executesql @sql, N'@result decimal(10,4) output', @result = @result out
    update #mytable set DisplayValue= @result where id = @rowcount
    set @rowcount=@rowcount+1
    end
    select * from #mytable
    Regards, RSingh

  • 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

  • Loader in Python crashes on binary columns (MaxDB 7.6)

    <pre>
    Hi, I currently use MaxDB 7.6.06   Build 003-121-202-135 on Linux and experience severe problems with binary columns and the loader. I do the following (with Python):
    session = sdb.loader.Loader ()
    session.cmd('USE USER XYZ SECURE SERVERDB MYDB ON MYSERVER')
    cmd = "EXPORT COLUMNS * FROM some_binary_table DATA OUTSTREAM 'myfile' FWV BINARY"
    session.release()
    For normal tables without binary columns, this works. However, for tables with binary columns that look like this it crashes:
    CREATE TABLE my_binary_table (
            id INTEGER NOT NULL DEFAULT SERIAL,
            data LONG BYTE NOT NULL,
            PRIMARY KEY (id))
    The output of my script is the following:
    snip -
    EXPORT COLUMNS * FROM my_binary_table DATA OUTSTREAM '/tmp/output.dat' FWV BINARY
    > Emergency stack backtrace <----
    Using 'backtrace' for stack tracing
    (0):0x00007febdc407b30
    (1):0x0000000000720920
    (2):0x00000000007268ce
    (3):0x000000000071eecc
    (4):0x00000000006e4d9c
    (5):0x00000000006e6ee0
    (6):0x00000000006df8a8
    (7):0x00000000004142f1
    (8):0x00007febdb73c436
    (9):0x0000000000413c3a
    > Dump of siginfo contents <----
      signal:      11(SIGSEGV)
      code:        1(ILL_ILLOPC:illegal opcode)
      errno:       0
      value(int):  66(0x42)
      value(ptr):  0x42
      pid:         0
      addr:        (nil)
    > Register Dump <----
      rax: 0x0000000000000000  rbx: 0x0000000000c55ea8
      rcx: 0x0000000000c5a530  rdx: 0x0000000000000003
      rsi: 0x0000000000c55b90  rdi: 0x0000000000a36440
      rsp: 0x00007fffe4c70c10  rbp: 0x0000000000000004
      r08: 0x0000000000a36340  r09: 0x0101010101010101
      r10: 0x0000000000000000  r11: 0x00007febdb79d50e
      r12: 0x0000000000c54c30  r13: 0x0000000000000002
      r14: 0x0000000000c533f2  r15: 0x0000000000000003
      rip: 0x0000000000720920 eflg: 0x0000000000010246
       cs: 0x0000               gs: 0x0000
       fs: 0x0000
    omsk: 0x0000000000000000  cr2: 0x0000000000000000
    trap: 0x000000000000000e  err: 0x0000000000000004
    > Floating-point register dump <----
         foper: 0x0000    frip: 0x0000000000000000  fdata: 0x0000000000000001
       control: 0x0001  status: 0x0000  tag: 0x0000
         mxcsr: 0x0000037f  mxcr_mask: 0x00000000
      fp[0]: 0x0.0000 0000 0000 0000 * 2^0x0000
      fp[1]: 0x0.1f80 0000 ffff 0000 * 2^0x0000
      fp[2]: 0x0.0000 0000 0000 0000 * 2^0x0000
      fp[3]: 0x0.0000 0000 0000 0000 * 2^0x0000
      fp[4]: 0x0.0000 0000 0000 0000 * 2^0x0000
      fp[5]: 0x0.0000 0000 0000 0000 * 2^0x0000
      fp[6]: 0x0.0000 0000 0000 0000 * 2^0x0000
      fp[7]: 0x0.0000 0000 0000 0000 * 2^0x0000
      xmm[00]: 0x00000000.00000000.00000000.00000000
      xmm[01]: 0x00000000.00000000.00000000.00000000
      xmm[02]: 0x00000000.00000000.00000000.00000000
      xmm[03]: 0x00000000.00000000.00000000.00000000
      xmm[04]: 0x00000000.00000000.00000000.00000000
      xmm[05]: 0x00000000.00000000.00000000.00000000
      xmm[06]: 0x00000000.00000000.00000000.00000000
      xmm[07]: 0x00000000.00000000.00000000.00000000
      xmm[08]: 0x00000000.00000000.00000000.00000000
      xmm[09]: 0x00000000.00000000.00000000.00000000
      xmm[10]: 0x00000000.00000000.00000000.00000000
      xmm[11]: 0x00000000.00000000.00000000.00000000
      xmm[12]: 0x00000000.00000000.00000000.00000000
      xmm[13]: 0x00000000.00000000.00000000.00000000
      xmm[14]: 0x00000000.00000000.00000000.00000000
      xmm[15]: 0x00000000.00000000.00000000.00000000
    > Module List <----
    |.text Start       |.text End         | Module File Name
    |0x0000000000400000|0x00000000008e3000| /opt/sdb/programs/pgm/lserver
    |0x00007febdb71e000|0x00007febdb86d000| /lib64/libc-2.8.so
    |0x00007febdba77000|0x00007febdba8d000| /lib64/libgcc_s.so.1
    |0x00007febdbc8e000|0x00007febdbce3000| /lib64/libm-2.8.so
    |0x00007febdbee4000|0x00007febdbfd4000| /usr/lib64/libstdc++.so.6.0.10
    |0x00007febdc1f0000|0x00007febdc1f8000| /lib64/librt-2.8.so
    |0x00007febdc3f9000|0x00007febdc40f000| /lib64/libpthread-2.8.so
    |0x00007febdc615000|0x00007febdc622000| /lib64/libcrypt-2.8.so
    |0x00007febdc852000|0x00007febdc854000| /lib64/libdl-2.8.so
    |0x00007febdca56000|0x00007febdca73000| /lib64/ld-2.8.so
    > Symbolic stack backtrace <----
      0: Lunlock_17 + 0x2f
             SFrame: IP: 0x00007febdc407b30 (0x00007febdc407b01+0x2f)
             Module: /lib64/libpthread-2.8.so
      1: ls27_InitDatExtrRec(tls00_DBInfo, MetaDataDef&, tls00_TransformationCmd*,
    tls00_DextractRec&, char) + 0xa90
             Symbol: Z19ls27InitDatExtrRecP12tls00_DBInfoRP11MetaDataDefP23tls00_T
    ransformationCmdRP17tls00_DextractRecPc
             SFrame: IP: 0x0000000000720920 (0x000000000071fe90+0xa90)
             Module: /opt/sdb/programs/pgm/lserver
      2: ls27ExportTableRows(MetaDataDef&, tls00_DextractRec, char*) + 0xae
             Symbol: Z19ls27ExportTableRowsRP11MetaDataDefP17tls00DextractRecPc
             SFrame: IP: 0x00000000007268ce (0x0000000000726820+0xae)
             Module: /opt/sdb/programs/pgm/lserver
      3: ExportPackageDataRecord(MetaDataDef, tls00_DBInfo, char*) + 0x72c
             Symbol: Z23ExportPackageDataRecordP11MetaDataDefP12tls00DBInfoPc
             SFrame: IP: 0x000000000071eecc (0x000000000071e7a0+0x72c)
             Module: /opt/sdb/programs/pgm/lserver
      4: ExecuteTransformationPackage(tls00_Command, tls00_DBInfo) + 0x2ac
             Symbol: Z28ExecuteTransformationPackageP13tls00CommandP12tls00_DBInfo
             SFrame: IP: 0x00000000006e4d9c (0x00000000006e4af0+0x2ac)
             Module: /opt/sdb/programs/pgm/lserver
      5: ParseExecuteStatement(tls00_Command&, tls00_DBInfo) + 0x550
             Symbol: Z21ParseExecuteStatementRP13tls00CommandP12tls00_DBInfo
             SFrame: IP: 0x00000000006e6ee0 (0x00000000006e6990+0x550)
             Module: /opt/sdb/programs/pgm/lserver
      6: ctrlservcommand + 0x398
             SFrame: IP: 0x00000000006df8a8 (0x00000000006df510+0x398)
             Module: /opt/sdb/programs/pgm/lserver
      7: c_main + 0x451
             SFrame: IP: 0x00000000004142f1 (0x0000000000413ea0+0x451)
             Module: /opt/sdb/programs/pgm/lserver
      8: 0x00007febdb73c436 <symbol name not found>
             SFrame: IP: 0x00007febdb73c436
             Module: /lib64/libc-2.8.so
      9: __gxx_personality_v0@@CXXABI_1.3 + 0xea
             SFrame: IP: 0x0000000000413c3a (0x0000000000413b50+0xea)
             Source: start.S:116
             Module: /opt/sdb/programs/pgm/lserver
    Traceback (most recent call last):
      File "/home/dusty/bin/bsppython", line 142, in ?
        execfile(sys.argv[0])
      File "./dump.py", line 8, in ?
        dump_table_data(metadata)
      File "/home/dusty/prog/bsp/buildout/src/sa_tools/sa_tools/dump/__init__.py", l                                                                            ine 17, in dump_table_data
        dbdump(conn, table.name, FILENAME_PATTERN % (table.name, fn))
      File "/home/dusty/prog/bsp/buildout/src/sa_tools/sa_tools/dump/maxdb.py", line                                                                             37, in dbdump
        session.cmd(cmd)
    loader.CommunicationError: loader.CommunicationError: [1] Reading header from pi                                                                            pe:closed by serve
    ERR -11608 COMMUNIC sql03_request: wrong connection state, state is 'requested'
    snip -
    Any clues about how to get around this?
    Best Regards,
    Hermann Himmelbauer</pre>
    Edited by: Hermann Himmelbauer on Jul 7, 2009 4:54 PM

    Thanks for your hint, but I found another satisfying solution: MaxDB has the the possibility to export all non-binary data to a CSV-File format and export the rest to a specific binary file like that:
    EXPORT COLUMNS * FROM mytable DATA OUTSTREAM 'mytable.csv' LOB OUTSTREAM 2 'mytable.dat'
    This fortunately works now!
    Best Regards,
    Hermann Himmelbauer

  • 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

Maybe you are looking for