NULL and Space value in ABAP

Hi All,
       I like to know, is it NULL and Space value is same in ABAP, if it is not how to check null value.
Thank you.
Senthil

everything is correct though some answers are not correct.
A Database NULL value represents a field that has never been stored to database - this saving space, potentially.
Usually all SAP tables are stored with all fields, empty fields are stored with their initial value.
But: If a new table append is created and the newly-added fields do not have the 'initial value' marked in table definition, Oracle will just set NULL values for them.
as mentioned: There is no NULL value to be stored in an ABAP field. The IS NULL comparison is valid only for WHERE clause in SELECT statement. WHERE field = space is different from WHERE field IS NULL. That's why you should check for both specially for appended table fields.
If a record is selected (fulfilling another WHERE condition) into an internal table or work area, NULL values are convertted to their initial values anyway.
Hope that sheds some light on the subject!
regards,
Clemens

Similar Messages

  • No distinction between NULL and space

    No distinction between NULL and space. When you see the resultset, in PL/SQL developer, you will see that the NULL value is in yellow colour while column data having spaces is in white colour. In the new tool, there is not distinction between the two, so each time we will have to use the NVL function to determine the value in the column, which I would not like to do.

    An option in Preferences could be created, so that it was possible to choose as values NULL would be shown, as already it occurs in other tools.

  • Avoiding null and duplicate values using model clause

    Hi,
    I am trying to use model clause to get comma seperated list of data : following is the scenario:
    testuser>select * from test1;
    ID VALUE
    1 Value1
    2 Value2
    3 Value3
    4 Value4
    5 Value4
    6
    7 value5
    8
    8 rows selected.
    the query I have is:
    testuser>with src as (
    2 select distinct id,value
    3 from test1
    4 ),
    5 t as (
    6 select distinct substr(value,2) value
    7 from src
    8 model
    9 ignore nav
    10 dimension by (id)
    11 measures (cast(value as varchar2(100)) value)
    12 rules
    13 (
    14 value[any] order by id =
    15 value[cv()-1] || ',' || value[cv()]
    16 )
    17 )
    18 select max(value) oneline
    19 from t;
    ONELINE
    Value1,Value2,Value3,Value4,Value4,,value5,
    what I find is that this query has duplicate value and null (',,') coming in as data has null and duplicate value. Is there a way i can avoid the null and the duplicate values in the query output?
    thanks,
    Edited by: orausern on Feb 19, 2010 5:05 AM

    Hi,
    Try this code.
    with
    t as ( select substr(value,2)value,ind
            from test1
            model
            ignore nav
            dimension by (id)
            measures (cast(value as varchar2(100)) value, 0 ind)
            rules
            ( ind[any]=  instr(value[cv()-1],value[cv()]),
            value[any] order by id = value[cv()-1] || CASE WHEN value[cv()] IS NOT NULL
                                               and ind[cv()]=0     THEN ',' || value[cv()] END      
    select max(value) oneline
    from t;
    SQL> select * from test1;
            ID VALUE
             1 Value1
             2 Value2
             3 Value3
             4 Value4
             5 Value4
             6
             7 value5
             8
    8 ligne(s) sélectionnée(s).
    SQL> with
      2   t as ( select substr(value,2)value,ind
      3          from test1
      4          model
      5          ignore nav
      6          dimension by (id)
      7          measures (cast(value as varchar2(100)) value, 0 ind)
      8          rules
      9          ( ind[any]=  instr(value[cv()-1],value[cv()]),
    10          value[any] order by id = value[cv()-1] || CASE WHEN value[cv()] IS NOT NULL
    11                                             and ind[cv()]=0     THEN ',' || value[cv()] END 
    12          )
    13        )
    14   select max(value) oneline
    15   from t;
    ONELINE
    Value1,Value2,Value3,Value4,value5
    SQL>

  • NULL and SPACE

    Hello Gurus:
    I have had to use BOTH 'null' and 'space' (ofcourse I tried 'initial' too...) when selecting data from PRPS table, otherwise all the required records were not fetched. I had to do this on two different occassions. The first is a SAP provided field and the other is customer's enhancement. I have cut-paste the two code blocks. Any ideas why?
    Thanks in advance,
    Sard.
    ***********(1)**************
    select posid objnr func_area zzfunct from prps into
                    corresponding fields of table it_wbs
                              where func_area is null or
                                    func_area eq space.
    ************(2)**************
    select prps-pspnr prps-posid prps-post1
       into (wa_test1-pspnr, wa_test1-posid, wa_test1-post1,
       from prps
      where prps-posid in s_wbs and
            ...                 and
           ( prps-zzmlind is null or prps-zzmlind eq space ).
    append wa_test1 to it_test1.
    clear wa_test1.
    endselect.

    Hello Richard,
    the Requirement to check for NULL corresponds to the definition of the database (field) within the DDIC. Check the flag initialize (it has also some documentation).
    This flag is intended to be used if the definition of the db table is changed at SAP while the table already is used at customer side.
    After deploying the corresponding patch or upgrade such a changed definition may result into the need to convert all entries. For tables with many entries this would result into inacceptable downtime. So such changes are done without the initialiazation/conversion of existing entries.
    The tradeoff is the syntax you noticed.
    Kind regards
    Klaus

  • From two given tables, how do you fetch the values from two columns using values from one column(get values from col.A if col.A is not null and get values from col.B if col.A is null)?

    From two given tables, how do you fetch the values from two columns using values from one column(get values from col.A if col.A is not null and get values from col.B if col.A is null)?

    Hi,
    Use NVL or COALESCE:
    NVL (col_a, col_b)
    Returns col_a if col_a is not NULL; otherwise, it returns col_b.
    Col_a and col_b must have similar (if not identical) datatypes; for example, if col_a is a DATE, then col_b can be another DATE or it can be a TIMESTAMP, but it can't be a VARCHAR2.
    For more about NVL and COALESCE, see the SQL Language manual: http://docs.oracle.com/cd/E11882_01/server.112/e26088/functions119.htm#sthref1310
    I hope this answers your question.
    If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables involved, and also post the results you want from that data.
    Explain, using specific examples, how you get those results from that data.
    Always say which version of Oracle you're using (e.g., 11.2.0.2.0).
    See the forum FAQ: https://forums.oracle.com/message/9362002

  • Union two tables with diffrent count of fields with null and float value

    Hello,
    i want to union two tables, first one with 3 fields and second one with 4 fields (diffrent count of fields).
    I can add null value at end of first select but it does not work with float values in second table. Value form second table is convert to integer.
    For example:
    select null v1 from sessions
    union
    select 0.05 v1 from sessions
    result is set of null and 0 value.
    As workaround i can type:
    select null+0.0 v1 from sessions
    union
    select 0.05 v1 from sessions
    or simple change select's order.
    Is any better/proper way to do this? Can I somehow set float field type in first select?
    Best regards,
    Lukasz.
    WIN XP, MAXDB 7.6.03

    Hi Lukasz,
    in a UNION statement the first statement defines the structure (number, names and types of fields) of the resultset.
    Therefore you have to define a FLOAT field in the first SELECT statement in order to avoid conversion to VARCHAR.
    Be aware that NULL and 0.0 are not the same thus NULL+0.0 does not equal NULL.
    In fact NULL cannot equal to any number or character value at all.
    BTW: you may want to use UNION ALL to avoid the search and removal of duplicates - looks like your datasets won't contain duplicates anyhow...
    Regards,
    Lars

  • Is null and regular value in where ($variable)

    is there any polibility to create select depend on value in where ?
    select count(x) where y = $variablebut if variable is NULLit doesn't work cause must be IS NULL or IS NOT
    select count(x) where y is $variableIs there any posibility to make it working with null and regular variable?

    try:
    select count(x) from <yourtable> where nvl(y,<not_possible_value>) = nvl($variable,<not_possible_value>);where <not_possible_value> is a value that is not possible for column y.
    E.g. if y always is a positive number you could use the value -1.

  • Null and Empty Values

    Hi All,
    Is there a parameter which allows me to translate automatically the instruction
    select * from table_a where col_a = ''
    in
    select * from table_a where col_a is null
    Thanks

    Not in Oracle, no. col_a = NULL and col_a IS NULL are logically distinct clauses. If you are dealing with NULL's, you absolutely must use three-valued logic in your statements.
    Depending on what you are doing, you may be able to throw an NVL on col_a to ensure a non-NULL value is returned.
    Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

  • Hiding Entire Row having Null and default valu in SSRS Using Expression

    Hi,
    In my reports having number of rows and three columns.The first columns  value will be different for each and every row and it will be  hard corded to the text box.  My question is how to hide the particular row second and third column suppose
    to be null or empty data and each and every row had Hide is true.Please provide me the solution if anybody known.
    Regards,
    HariKan
    HariKan

    Hi Qiuyun Yn,
    Thanks for your reply.
     If i use Not Null in my query in where
    condition  then i have to add 30 fields in my where condition,  and i guess it will not give proper output why because i have 30 columns.
    So could you please give me in report level solution. I am struggling past 10 days for this issue.
    Regards,
    Hari 
    HariKan

  • Webi displays null and wrong values after BW upgraded to SP6

    Hi,
    Webi report retrieves blank values after BW Backend upgraded to SP6.
    We were on SAP EHP 1 for SAP Net Weaver 7.0 and SP4. On the BO side we are on BO XI R/3 FP 2.1.
              Once we add new filters to a simple webi query the webi displays the null values for the characteristics which already exist in the report and more ever wrong values displayed for few columns. We have checked the MDX query in BW by using 'MDXTEST' and the results are good.
            It looks like that it is a rendering issue in Webi side and exactly no idea...
    Can anybody know how to fix the issue or any SAP notes exists for resolving this?
    Thank you,
    Regards,
    Satya

    Hi Ingo,
    We are also facing the same issue that satya is facing.
    We have developed the reports in BO XI 3.1 SP2 FP2.1 and SAP BW 7.01 EHP1 which was running correctly and showing the right result.
    But we upgraded the BW system to SAP BW 7.01 SP6 and check the WebI reports which was showing the unexpected results. ( instead of n rows it shows only 1 row for any query without dimension values)
    So we upgraded the BO sys to BO XI 3.1 SP2 FP 2.6 and checked the result but no luck with that also.
    The workaround i found is i must need to add the Node objects from the universe in the Query which are also used in the query filter of Web Intelligence. But this is not reliable as we need to change all the developed queries.
    We have also tried to perform the things shown in the notes but no MDX trace is enabling.
    Please let me know if there is any other solution.

  • 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

  • Replacing NULL and EmptyString('') with "Unknown" in SSRS parameter dropdown

    All,
    What I want to do is, in the SSRS parameter drop down, instead of showing NULL and Blank values(), i want to categorize them as "Unknown", so, if the user selects "Unknown" from the SSRS drop down parameter, he should be able to see all
    the records that have NULL values or empty strings in that particular column in the result set.
    Can you tell me, how should I handle it in my main stored proc as well as in the dataset?
    Right now, i have something like this:
    Where
    (t1.name in (select value from dbo.Split(@TName,',')) OR @TName IN ('All'))
    -- Where t1.Name has empty strings and NULL values. Both of these values should be categorized under "Unknown"
    -- How would the dataset query look like? Right now I have this query for populating the drop down for that parameter:
    Select All
    UNION
    Select Distinct Name
    Order BY 1

    Hello,
    Please refer to the following stored procedure:
    SELECT
    CASE WHEN TName IS NULL OR TName = ''
    THEN 'Unknown' ELSE TName END AS TName
    From DemoTable
    Then, use following query code to get the parameter values:
    SELECT Distinct
    CASE WHEN TName IS NULL OR TName = '' THEN 'Unknown'
    ELSE TName END AS TName
    FROM DemoTable
    Regards,
    Alisa Tang
    Alisa Tang
    TechNet Community Support

  • How to include NULL in multi value parameters

    Good Morning,
    I'm posting this question after i tried other links and was not successful. I'm using a report builder to create a report. SSRS2008R2.
    I have a sql to get the data into the data set. Source is ORACLE DB. The query is pulling lastname,firstname,dob,joindt,divname. I created a parameter in the SQL :
    WHERE DIVNAME IN (:divname).
    I created another dataset (select distinct divname from table2) and selected the paramter properties to get the values from the second dataset and selected it to be multivalued. However the user wants to see the NULL's or BLANKS that are in the DIVNAME.
    Can some one please tell me as how i can acheive this?
    When i run the query in the sql plus i get (null) values as well, but when in the second dataset i run the query i just get the DISTINCT divnames and a  "BLANK" field (in SSRS)
    Thanks

    Hi thinkingeye,
    According to your description, you want to include the null values in your multiple values parameter. Right?
    In Reporting Services, we can't allow both null values and multiple values in a parameter. In this scenario, since you have created a dataset for getting distinct divname, we suggest you try "select distinct isnull(divname,-1) from [table]" in this
    dataset so that all the null values will return -1. Also using isnull() function to replace divname in other query. This might be the most effective work around.
    Reference:
    Null and Multi-value parameter possible
    Include Null Value Multi-Value Parameter list
    If you have any question, please feel free to ask.
    Best Regards,
    Simon Hou

  • ABAP program to neutralize  0Unit value and 0quantity value

    Hi all,
    I'm not expert in ABAP, and i would like implement a small abap program (routine)in my cube.
    I would like neutralize the 0UNIT value and 0QUANTITY value only when 0VTYPE = 1 or 2 :
    <b>in other words, if 0vtype = 1 or 4 then 0unit = space and 0quantity = 0
    b]
    Can you tell me please <b>how and where</b> write the ABAP program please ?
    Message was edited by:
            Pontoise Pontoise
    Message was edited by:
            Pontoise Pontoise

    Hi,
    I amnt able to understand your requirement. But the code for which you asked is simple.
    If 0vtype = 1 or 0vtype = ' '.
    0unit = space.
    0quantity = 0.
    endif.
    Regards
    Aneesh.

  • Order Of Null and Not Null Values while table creation

    We have to create a table with 10 fields .5 of them are Null and Not Null. Now my question what should be the order of fileds??.Means Null Fields will come first or Not Null.

    The only reason I can think of having the NULL columns at the end is storage space.
    To conserve space, a null in a column only stores the column length (zero). Oracle
    does not store data for the null column. Also, for trailing null columns, Oracle does
    not even store the column length.

Maybe you are looking for

  • Fix for wireless connection issues on MacBook Pro - reinstall OS!

    I hope this helps some of you out there. I was having all the usual problems with connectivity with the MacBook Pro I bought in January 09. It dropped the signal constantly and if I closed the top, it would make me search for my network again then it

  • Add new WorkMode in IC Webclient for telephony

    Hi, We are implementing IC Webclient on the project and have linked it to a telephony system. The telephony system has got a Supervisor desktop screen where you can view all the advisors logged on adn their status/ workmode. The standard Workmode set

  • Fixing CAD Program Paths

    I'm often asked to edit drawings that were created in engineering CAD programs. I keep running into the same problem where Illustrator can't fill a closed path completely, and I can't find a workaround yet for this. Let's say I have a closed path of

  • Document set items Version history

    Hi, I'm trying to to retrieve document set version history. here i need to retrieve all modified versions of a document in document set ? Can any body help? I have tried but didnt find anyway .. how to get version history of a document in document se

  • Using Resource type in Netweaver 7.1 for file upload

    Dear All, I want to check the file extension and file size before uploading it through a file upload UI element in Web Dynpro 7.1. How to go about it? And I am using following code for image upload. Is it correct one? IWDResource photoData = wdContex