How to use  'is null' in select statement of ABAP program

hi,
I want to use 'is nul' or 'not null' in select statement of my ABAP program for any field. I have written below query but I am getting sy-subrc = 4 and getting no data.
SELECT * FROM mara INTO TABLE it_mara
      WHERE volum IS NULL .
Can anyone resolve this.

Hi PKB,
Check the below thread for NULL and Space value in ABAP . It will help you
NULL and Space value in ABAP
Regards,
Pawan

Similar Messages

  • Can we use is null in our select statement in ABAP program

    hi,
    I want to use 'is nul' or 'not null' in select statement of my ABAP program for any field. I have written below query but I am getting sy-subrc = 4 and getting no data. Can anyone resolve this.

    Hi,
    I think you've posted your question on the wrong forum. This is the SAP Business One development forum which is not part of ERP and doesn't include any ABAP or Netweaver programming.
    For a list of forums please see here:
    http://forums.sdn.sap.com/index.jspa
    Kind Regards,
    Owen

  • How to use SET ID in select statement of SQ02

    Hi,
    I have a infoset, where for one of my Zfield, i have writen a select statement in order to get my ouput.
    if aufk-aufnr = 'XYZ'.
      select sum( FKBTR ) from fmifiit into zfmifiit
      where fikrs = aufk-kokrs
      and fipex IN capex
      and wrttp NE '51'.
    endif.
    For the above statement, i have created (with 10 single values, table name FMCI, field name FIPEX)  a SET id named CAPEX and used with IN operator.
    But when i generating the infoset i am getting error like below
    The IN operator with "CAPEX" is followed neither by an internal table nor by a value list
    I was using IN opeartor for set ids during validation / substitutions, where if i have to validate multiple single values.
    What to do here?
    Regards,
    Srinu

    [OPEN-SQL|http://help.sap.com/abapdocu_70/en/ABENOPEN_SQL_GENERAL.htm] set of statement, [SELECT|http://help.sap.com/abapdocu_70/en/ABAPWHERE.htm] statement, [WHERE|http://help.sap.com/abapdocu_70/en/ABENWHERE_LOGEXP.htm] addition requires a selection table (type range, [WHERE - IN seltab |http://help.sap.com/abapdocu_70/en/ABENWHERE_LOGEXP_SELTAB.htm]) of parameter and not a set. We are in Abap here, not in a Customizing screen
    You have to convert the set to a selection table in an ABAP coding before using it in a SELECT statement.
    (Check FM like G_SET_TREE_IMPORT to import definition of set (values and intervals) and map them to a select-table, or ask a developper to perform it, look at G_SET_TREE_IMPORT -> select statement)
    Regards,
    Raymond

  • Delete adjacent duplicates how to use in the below select statement

    hi i have a problem
    i am suing the below select statement
    SELECT    a~extno
              a~guid_lclic       " for next select
              e~ctsim
              e~ctsex
    *revised spec 3rd
              f~guid_pobj
              f~amnt_flt
              f~amcur
              f~guid_mobj
              e~srvll     "pk
              e~ctsty     "PK
              e~lgreg  "PK
      INTO TABLE gt_sagmeld
      FROM /SAPSLL/LCLIC  as a
      INNER JOIN /sapsll/tlegsv as e on elgreg = algreg
      inner join /sapsll/legcon as f on fguid_lclic = aguid_lclic   " for ccngn1 selection
      inner join /sapsll/corcts as g on gguid_pobj = fguid_pobj
                               where   a~extno in s_extno.
      sort gt_sagmeld by guid_lclic lgreg ctsty srvll GUID_POBJ GUID_MOBJ.
      delete adjacent duplicates from gt_sagmeld comparing guid_lclic lgreg ctsty srvll GUID_POBJ GUID_MOBJ .
    now i am confused how to use delete adjacent dupliacate and on which fields
    as first table /sal../lclic primary key is guid_lclic
    and it is joined to table
    legcon by guid_lclci ( not a primary key here)
    legcon primary key is guid_legcon
    and table 3 legsv by lgreg (pk here)
    table 3 has tow more primary key srvll and ctsty also
    NOW MY QUESTIO IS TAHT IS I USE ABOVE DELETE ADJACENT STATMENT IT FETCHES 20 LAKH RECORDS
    I WANT TO REDUCE IS LET ME KNOW ON WHAT fields i need to use delete adjacen duplicates
    or use comparing all fields?
    regards
    Arora

    hi sudha
    if u see my select statement is contains four Primary keys
    srvll
    lgreg
    ctsty
    guid_lclic
    but the next table connected to this table legcon is by guid_pobj and anothe table by guid_mobj
    and if i take this gt_sagmeld to another temp table and i find abt 10 lakh uniques guid_pobj
    similary 6 lakh guid_mobj so the next slect is hanpering because of this
    not COMING TO OUR POINT IF I SORT ONLY BY OUR PRIMARY KEYS NOT TAKING INTO ACCOUNT TEH GUID_POBJ AND GUID_MOBJ
    THE ENTRIES ARE VERY LESS BUT IF I TAKE INOT ACCCOUNT IN GT_SAGMELD THE ENTRIES ARE ABT 20 LAKH
    SO I AM NOT SURE WHETHER TO TAKNE GUID_POBJ AND GUID_MOBJ INOT ACCOUNT FOR DELECTING ADJACENT DUPLICATES?
    HENCE THE QUESTION OF ON WHICH FIRLD DELETE OR COMPARING ALL FIELDS I USE?

  • [php+mysql] how to use variables in a select statement?

    Hi all,
    I'm searching for a way to use a variable in the select
    statement of mysql
    query.
    I have this variable that can contain:
    $var=field_1 field_2 field5
    or
    $var=field3 field4 field8
    so, the variable content is not always the same.
    I would like to filter a table selecting only the columns
    specified by the
    current $var content.
    Is this possible to do something like this?
    $var=field1 field5 field10
    SELECT string_to_array($var)
    FROM mytable
    ORDER BY mysortfield ASC
    Or, is there another way to select columns dynamically?
    Thanks for any suggestion.
    tony

    Hi all,
    I'm searching for a way to use a variable in the select
    statement of mysql
    query.
    I have this variable that can contain:
    $var=field_1 field_2 field5
    or
    $var=field3 field4 field8
    so, the variable content is not always the same.
    I would like to filter a table selecting only the columns
    specified by the
    current $var content.
    Is this possible to do something like this?
    $var=field1 field5 field10
    SELECT string_to_array($var)
    FROM mytable
    ORDER BY mysortfield ASC
    Or, is there another way to select columns dynamically?
    Thanks for any suggestion.
    tony

  • How to use where clause with get statement in LDB programs

    Hi All,
    I am using logical databse in my report program.I am not getting how to use the where clause in the get statement is it possible to use?or if not possible only option is we should filter it after get statment is right?Can you please some body throw some idea on this?
    Regards
    Mahesh

    Hi,
    Reffer these links
    http://help.sap.com/saphelp_nw04/helpdata/en/9f/db9bfa35c111d1829f0000e829fbfe/content.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/9f/db9b5e35c111d1829f0000e829fbfe/frameset.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/c6/8a15381b80436ce10000009b38f8cf/frameset.htm
    /people/srivijaya.gutala/blog/2007/03/05/why-not-logical-databases
    reward if helpful
    Thanks,
    Suma.

  • How to use anonymous block in select statement

    Hello Experts.
    I have one requirement which i can resolve using anonymous block in plsql. But i want implement it in select query only.
    Database: Oracle 11.2.0
    select count(*) from emp where name='xyz' and sal=50
    if count(*)>0
    then
    select dept,sector from emp where name='xyz' and sal=50
    here i dont have any primary key.
    How can i achieve above using sql query not plsql. Here is one sloution which i have got but its not satisfying above requiremnt as i dont have any primary key columns
    select toll_number from toll_details
    where toll_id =(select toll_id from toll_details where toll_new_id='5263655214' group by toll_id having count(*)>0)
    here toll_id is primary key, so used group by. But how to do this in my above requirement as i dont have primary key.
    Appreciate any help on this.
    Thank you

    897112 wrote:
    Hello Experts.
    I have one requirement which i can resolve using anonymous block in plsql. But i want implement it in select query only.
    Database: Oracle 11.2.0
    select count(*) from emp where name='xyz' and sal=50
    if count(*)>0
    then
    select dept,sector from emp where name='xyz' and sal=50
    here i dont have any primary key.
    How can i achieve above using sql query not plsql. Here is one sloution which i have got but its not satisfying above requiremnt as i dont have any primary key columns
    select toll_number from toll_details
    where toll_id =(select toll_id from toll_details where toll_new_id='5263655214' group by toll_id having count(*)>0)
    here toll_id is primary key, so used group by. But how to do this in my above requirement as i dont have primary key.
    Appreciate any help on this.
    Thank youTry this
    SQL> create table plch_test(id number,name varchar2(20),sal number);
    Table created.
    SQL> insert into plch_test values(1,'XYZ',50);
    1 row created.
    SQL> insert into plch_test values(2,'AAA',100);
    1 row created.
    SQL> insert into plch_test values(3,'BBB',200);
    1 row created.
    SQL> insert into plch_test values(4,'CCC',400);
    1 row created.
    SQL> commit;
    Commit complete.
    SQL> select * from plch_test;
            ID NAME                        SAL
             1 XYZ                          50
             2 AAA                         100
             3 BBB                         200
             4 CCC                         400
    SQL> ed
    Wrote file afiedt.buf
      1  select id,name
      2  from plch_test a
      3  where 1=(select count(*) from plch_test b where a.id=b.id)
      4* and id=&id
    SQL> /
    Enter value for id: 2
    old   4: and id=&id
    new   4: and id=2
            ID NAME
             2 AAA
    SQL> /
    Enter value for id: 0
    old   4: and id=&id
    new   4: and id=0
    no rows selectedHope this helps!!!
    Regards,
    Achyut

  • How to use SET BIT and GET BIT in ABAP Programming

    Hi,
    Our team is currently working for an Upgrade  project which is using a tool automatically upgrades when we supplly the code. fine, But now the requirement is , we need to write different test cases for the available key words in ABAP. Now we r looking for the usage of  " BIT ", keyword. so , kindly provide any program or code using this key word.
    Please find the description Provided and give some relative ABAP code to satisfy the given description.
    The data object byte_string must be byte-type. The statement reads the bit at the bit position BITPOS of the variable byte_string and assigns its value to the variable val. A default mode can be specified if required *
    Thanks & Regards,
    P.N.Kumar.

    What on earth are you testing? That ABAP still works? I think SAP might have run that through rigourous testing themselves.
    If you want sample code, why not read the ABAP help, and work some out for yourself?
    matt

  • How to use a function in select clause

    hi gems...good evening...
    I want to write a select clause from a function. The scenario is like below:
    function parameters
    CREATE OR REPLACE FUNCTION FUNCTION_DEMO(p_pid IN NUMBER,
    p_bankerNum IN NUMBER,
    p_banker_name IN VARCHAR2,
    p_business_num IN NUMBER,
    p_businesses IN table_typ_businesses)
    return table_typ_bankers
    as .......
    global object and table types
    CREATE OR REPLACE TYPE obj_typ_businesses AS OBJECT (businesses NUMBER);
    CREATE OR REPLACE TYPE table_typ_businesses AS TABLE OF obj_typ_businesses;
    CREATE OR REPLACE TYPE obj_typ_bankers AS OBJECT (banker_num NUMBER(10,0));
    CREATE OR REPLACE TYPE table_typ_bankers IS TABLE OF obj_typ_bankers;
    The select query
    select * from
    table(cast(FUNCTION_DEMO(1,
    2,
    'ALEX',
    2,
    table(cast(select businesses_id from reference_businesses) as table_typ_businesses) as table_typ_bankers)But it is giving error with Missing expression.
    My function is compiled successfully. I just want to make the select query to view the output given by the function i.e the table type "table_typ_bankers".
    Please help...thanks in advance..

    Hi ,
    You can check this and change your code by taking this as an example. I just noted down with simple one input and return as collection type
    and how to use/call it in select statement.
    SQL> CREATE OR REPLACE TYPE obj_typ_businesses AS OBJECT (businesses NUMBER)
      2  /
    Type created.
    SQL> CREATE OR REPLACE TYPE table_typ_businesses AS TABLE OF obj_typ_businesses
      2  /
    Type created.
    SQL> CREATE OR REPLACE TYPE obj_typ_bankers AS OBJECT (banker_num NUMBER(10,2))
      2  /
    Type created.
    SQL> CREATE OR REPLACE TYPE table_typ_bankers IS TABLE OF obj_typ_bankers
      2  /
    Type created.
    /* Now creating a demo function and just focusing on your one input as collection type  */
    SQL> create or replace function f11 ( tab_rec  IN table_typ_businesses)
      2  return table_typ_bankers
      3  is
      4  t_val table_typ_bankers:= table_typ_bankers();
      5  begin
      6        dbms_output.put_line('tab_rec count -'||tab_rec.count);
      7
      8  for i in 1..tab_rec.count
      9              loop
    10               dbms_output.put_line ('tab_rec value ('||i||')'||tab_rec(i).businesses);
    11                       t_val.EXTEND;
    12                    t_val(i) := obj_typ_bankers(tab_rec(i).businesses * 12.50);
    13              end loop;
    14              return t_val;
    15  end;
    16  /
    Function created.
    /* To run your function by a select statement */
    SQL> SELECT * FROM TABLE(f11(table_typ_businesses(obj_typ_businesses(5),
      2                          obj_typ_businesses(12),
      3                                         obj_typ_businesses(18))
      4                                             ) )
      5  /
    BANKER_NUM
          62.5
           150
           225
    tab_rec count -3
    tab_rec value (1)5
    tab_rec value (2)12
    tab_rec value (3)18Hope this will help you... :)
    Thanks!
    Ashutosh

  • Using plsql tables in select statement of report query

    Hi
    Anyone have experience to use plsql table to select statement to create a report. In otherwords, How to run report using flat file (xx.txt) information like 10 records in flat files and use this 10 records to the report and run pdf files.
    thanks in advance
    suresh

    hi,
    u can use the utl_file package to do that using a ref cursor query in the data model and u can have this code to read data from a flat file
    declare
    ur_file utl_file.file_type;
    my_result varchar2(250);
    begin
    ur_file := UTL_FILE.FOPEN ('&directory', '&filename', 'r') ;
    utl_file.get_line(ur_file, my_result);
    dbms_output.put_line(my_result);
    utl_file.fclose(ur_file);
    end;
    make sure u have an entry in ur init.ora saying that your
    utl_file_dir = '\your directory where ur files reside'
    cheers!
    [email protected]

  • Error by using database procedure in select statement

    hi ,
    I have built a database procedure having one parameter with in out varchar type. that return value with some addition.
    i am using it with some column in select statement only for display purpuses but i am facing error by doing that in select statement. that procedure is working well with bind variable but not with select statement.
    plz help me how i can use a procedure in select statement. or can i do it or not.

    plz help me how i can use a procedure in select statement. or can i do it or not.A workaround could be to create a wrapper function for your procedure. One that only passes the input parameters and returns the output parameter.
    The simply call this function in your select which internally calls the procedure.

  • Using java function in select statement

    Hi,
    I am trying to use java function in select statement.
    public class ClassA{
         private static String MyConst = "foo";
         public static String functionA(){
              return MyConst;
    in my query I have:
    select
         ClassA.functionA() AS id,
         groupId AS newID,
    from
         myChannel[now]
    ClassA is part of the application (no need to import).
    I get and error of Invalid Expression on ClassA.functionA().
    I also tried to declare the function in the processor element:
    <wlevs:processor id="proc">
         <wlevs:function function-name="A" exec-methode="functionA">
              <bean class="mtPackage.ClassA"/>
         </wlevs:function>
    <wlevs:processor>
    but then I get a different error in the processor XML file:  "An InvocationTargetException was encoutered while attemting to register the user defind function A. The message was null"
    What am I missing here?

    Hi,
    From the above description, you have tried two manners to call method functionA() in the user defined  class ClassA. One uses java cartridge manner directly and the other try to use user defined function manner.
    For the java cartridge manner, the following CQL query should work if the ClassA is really included in the OEP app. I have done similar test before, it works.
    select
         ClassA.functionA() AS id,
         groupId AS newID,
    from
         myChannel[now]
    For user defined function manner, I think two things you need to change:
    1. Need to declare the function in the EPN assembly file(under META-INF/spring/), not component configuration file(under META-INF/wlevs/). The following is an example:
    <wlevs:processor id="proc">
         <wlevs:function function-name="A" exec-methode="functionA">
              <bean class="mtPackage.ClassA"/>
         </wlevs:function>
    </wlevs:processor>
    2. Call the user defined function in the CQL query in the component configuration file under processor. For example:
    select A() from myChannel
    Regards,
    XiYing

  • How to use Not Null in

    Hi All,
    I did one personalization which is related to DFF of an Item.
    It is working partially but i need the perfect solution will u please resolve my doubts.
    My requirement is as follows:
    I have one DFF in Items page say attribute1 which has a maximum of 3 values i.e., 'A' or 'B' or 'C'
    In my Purchase order Auto create form, when an select an requisition, the related lines are displayed for me.
    When i select an line and if the line has an item which has an attribute values of either 'A' or 'B' or 'C'.
    Then i need to display an error message.
    For this I do the following steps.
    In conditions tab i wrote the following condiitons:
    Not Null IN ( SELECT attribute1 FROM mtl_system_items_b where segment1= :REQ_LINES.ITEM_NUMBER AND organization_id=FND_PROFILE.VALUE('ORG_ID'))
    But my condition evaluates to false, even though i have values in attribute1---------------------- My question is will the above query is right or not. if not will u please provide me the correct syntax of how to use not null.
    'A' IN ( SELECT attribute1 FROM mtl_system_items_b where segment1= :REQ_LINES.ITEM_NUMBER AND organization_id=FND_PROFILE.VALUE('ORG_ID'))
    The above query is working fine. Please help me on this issue.
    Thanks and Regards
    Zaheer

    Dear Zaheer,
    you compare the organization with Operating unit, Please use
    fnd_profile.value('MFG_ORGANIZATION_ID') inspite of org_id.
    Tariq.

  • How to call user fuction in select statement.

    hi,
    i am facing some problem.How to call user functions in select statement.please send me answer with example.
    Thanks
    Gopal

    Locations to Call User-Defined Functions
    • Select list of a SELECT command
    • Condition of the WHERE and HAVING clauses
    • CONNECT BY, START WITH, ORDER BY, and GROUP
    BY clauses
    • VALUES clause of the INSERT command
    • SET clause of the UPDATE command
    Restrictions on Calling Functions from SQL Expressions
    To be callable from SQL expressions, a user-defined
    function must:
    • Be a stored function
    • Accept only IN parameters
    • Accept only valid SQL data types, not PL/SQL
    specific types, as parameters
    • Return data types that are valid SQL data types,
    not PL/SQL specific types
    • Functions called from SQL expressions cannot
    contain DML statements.
    • Functions called from UPDATE/DELETE statements
    on a table T cannot contain DML on the same table
    T.
    • Functions called from an UPDATE or a DELETE
    statement on a table T cannot query the same table.
    • Functions called from SQL statements cannot
    contain statements that end the transactions.
    • Calls to subprograms that break the previous
    restriction are not allowed in the function.
    jeneesh                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • How to put OR clause in SELECT statement

    Hi
    How to put OR clause in SELECT statement to return number_first/number_last to match records from another table's column.
    <pre>
    SELECT
    a.id ,
    flat_number ||' '|| a.number_first||' '||a.street_name||' '||a.suburb address1,
    apt_no ||' '|| street_no||' '||b.street_name||' '||b.suburb address2
    from
    a ,
    b
    where b.street_name = a.street_name
    AND b.SUBURB = a.SUBURB
    AND b.STATE = a.STATE
    </pre>
    Thsi will return this as exact match.
    ADDRESS 1
    12 TAMAN TENANG A ORCHARD 3142     
    10 RAMA YISHUN 2095
    ADDRESS2
    12 TAMAN TENANG A ORCHARD 3142     
    10 RAMA YISHUN 2095
    However this only matches number_first.
    How can I get the query work that it will match both number_first and number_last (table b)in address 1 to match street_no in address2 ( table b).My oracle version is 10GR/2.

    Hi, I have a hard time understanding your request, and below is what I thought you want:
    SELECT
        a.id ,
           flat_number ||' '|| (decode(b.street_no, a.number_first, a.number_first, a.number_last, a.number_last)||' '||a.street_name||' '||a.suburb  address1,
             apt_no ||' '|| street_no||' '||b.street_name||' '||b.suburb address2
          from
                 a ,
                 b
                where          b.street_name = a.street_name
                 AND            b.SUBURB      = a.SUBURB
                AND            b.STATE       = a.STATE
                AND  (B.street_no=a.number_first OR b.street_no=a.number_last);Not tested.
    Also, since your B.street_no will be either a.number_first OR a.number_last, you could replace
    (decode(b.street_no, a.number_first, a.number_first, a.number_last, a.number_last) with just b.street_no.
    Edited by: PhoenixBai on Aug 26, 2010 11:33 AM

Maybe you are looking for

  • Mavericks 10.9.3 Blue Screen on start up and system unstable

    I wonder if anyone is experiencing the same issue. After the last Safari update that I think was May 22nd 2014, My MBPro has been unstable. When booting up there is a brief dark blue screen with white Apple logo or occasionally a light blue screen wi

  • How to count a occurence of a string in file

    import java.util.*; import java.io.*; class Count public static void main(String args[ ] )throws Exception      FileReader fr=new FileReader("d:\\compfetch\\clean\\first.txt");      BufferedReader br=new BufferedReader(fr);      StringBuffer sb=new S

  • Using JavaScript need to clear speach bubble error messages

    Hi, I used AdfPage.PAGE.clearMessages(null); in javascript to clear the error message, But it will not clearing the error message(speach bubble error message), it will clearing only when ADF popup Error Messages. Example: I entered wrong date in the

  • Set value of multiselect property

    Hi, I have created a multiselect metadata property. How can I set its value programmatically?

  • ECC reported results

    How does the yearly Netprofit account gets mapped from ECC to BCS. is it normally transferred? As I understand the Netprofit is calculated in ECC on yearly basis and BCS will calculate on monthly basis. If it will be transferred how to ensure the del