Difference between CHAR and VARCHAR2 datatype

Difference between CHAR and VARCHAR2 datatype
CHAR datatype
If you have an employee name column with size 10; ename CHAR(10) and If a column value 'JOHN' is inserted, 6 empty spaces will be inserted to the right of the value. If this was a VARCHAR column; ename VARCHAR2(10). How would it handle the column value 'JOHN' ?

The CHAR datatype stores fixed-length character strings, and Oracle compares CHAR values using blank-padded comparison semantics.
Where as the VARCHAR2 datatype stores variable-length character strings, and Oracle compares VARCHAR2 values using nonpadded comparison semantics.
This is important when comparing or joining on the columns having these datatypes;
SQL*Plus: Release 10.2.0.1.0 - Production on Pzt Au 6 09:16:45 2007
Copyright (c) 1982, 2005, Oracle. All rights reserved.
SQL> conn hr/hr
Connected.
SQL> set serveroutput on
SQL> DECLARE
2 last_name1 VARCHAR2(10) := 'TONGUC';
3 last_name2 CHAR(10) := 'TONGUC';
4 BEGIN
5 IF last_name1 = last_name2 THEN
6 DBMS_OUTPUT.PUT_LINE ( '-' || last_name1 || '- is equal to -' || last_name2
|| '-');
7 ELSE
8 DBMS_OUTPUT.PUT_LINE ( '-' || last_name1 || '- is NOT equal to -' || last_n
ame2 || '-');
9 END IF;
10 END;
11 /
-TONGUC- is NOT equal to -TONGUC -
PL/SQL procedure successfully completed.
SQL> DECLARE
2 last_name1 CHAR(6) := 'TONGUC';
3 last_name2 CHAR(10) := 'TONGUC';
4 BEGIN
5 IF last_name1 = last_name2 THEN
6 DBMS_OUTPUT.PUT_LINE ( '-' || last_name1 || '- is equal to -' || last_name2
|| '-');
7 ELSE
8 DBMS_OUTPUT.PUT_LINE ( '-' || last_name1 || '- is NOT equal to -' || last_n
ame2 || '-');
9 END IF;
10 END;
11 /
-TONGUC- is equal to -TONGUC -
PL/SQL procedure successfully completed.
Also you may want to read related asktom thread - "Char Vs Varchar" http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:1542606219593
and http://tahitiviews.blogspot.com/2007/05/less-is-more-more-or-less.html
Best regards.

Similar Messages

  • Difference between char and varchar, also the difference between varchar2

    Hi,
    Can anyone explain me the difference between char and varchar, and also the difference between varchar and varchar2...

    Varchar2 is variable width character data type, so if you define column with width 20 and insert only one character to tis column only, one character will be stored in database. Char is not variable width so when you define column with width 20 and insert one character to this column it will be right padded with 19 spaces to desired length, so you will store 20 characters in the dattabase (follow the example 1). Varchar data type from Oracle 9i is automaticlly promoted to varchar2 (follow example 2)
    Example 1:
    SQL> create table tchar(text1 char(10), text2 varchar2(10))
    2 /
    Table created.
    SQL> insert into tchar values('krystian','krystian')
    2 /
    1 row created.
    SQL> select text1, length(text1), text2, length(text2)
    2 from tchar
    3 /
    TEXT1 LENGTH(TEXT1) TEXT2 LENGTH(TEXT2)
    krystian 10 krystian 8
    Example 2:
    create table tvarchar(text varchar(10))
    SQL> select table_name,column_name,data_type
    2 from user_tab_columns
    3 where table_name = 'TVARCHAR'
    4 /
    TABLE_NAME COLUMN_NAME DATA_TYPE
    TVARCHAR TEXT VARCHAR2
    Best Regards
    Krystian Zieja / mob

  • What 's the difference between quote ' and double quote "?

    what's the difference between quote' and double quote "?
    when we use each one?
    Exemple of use of each case?

    'c' is a char, ie. a primitive type representing a single character
    "c" is an instance of the String class length 1.

  • Exact difference between function and procedure

    exact difference between function and procedure(real time diff.....not like return value, dml....) and function do some work at the same time that work also do procedure..why function

    ranitB wrote:
    1. Function is called Inline a query. A return value is must.
    But, procedure may/may not contain a return value.Not true.
    A function may be called in a query providing it meets certain limitations (no DDL, or transactional statements such as commit/rollback etc.).
    A function does not have to be called from a query, it can be called from other PL/SQL code or from other external applications.
    Regular functions must return a value, though pipelined functions do not...
    SQL> CREATE OR REPLACE TYPE split_tbl IS TABLE OF VARCHAR2(32767);
      2  /
    Type created.
    SQL> CREATE OR REPLACE FUNCTION split (p_list VARCHAR2, p_delim VARCHAR2:=' ') RETURN SPLIT_TBL PIPELINED IS
      2      l_idx    PLS_INTEGER;
      3      l_list   VARCHAR2(32767) := p_list;
      4      l_value  VARCHAR2(32767);
      5    BEGIN
      6      LOOP
      7        l_idx := INSTR(l_list, p_delim);
      8        IF l_idx > 0 THEN
      9          PIPE ROW(SUBSTR(l_list, 1, l_idx-1));
    10          l_list := SUBSTR(l_list, l_idx+LENGTH(p_delim));
    11        ELSE
    12          PIPE ROW(l_list);
    13          EXIT;
    14        END IF;
    15      END LOOP;
    16      RETURN;
    17    END SPLIT;
    18  /
    Function created.
    SQL> SELECT column_value
      2  FROM TABLE(split('FRED,JIM,BOB,TED,MARK',','));
    COLUMN_VALUE
    FRED
    JIM
    BOB
    TED
    MARK... whilst the definition of the function shows a return type, the return statement inside the function simply returns, without a value. That's because the data is passed back through a special "pipeline", and you can write code to show that the data is available to a query as soon as it's piped, and before the function has completed (reached the return statement) if you like.
    A procedure does not return a value (And no an OUT parameter is not a "returned" value, it's a writeable parameter, there's a difference)
    2. There are some limitations in functions which is possbl through procedures.
    Like - Oracle doesn't support DML in functions called in Select queries (using PRAGMA AUTONOMOUS_TRANSACTION will help).Not strictly true. and SQL query is considered to be DML, so a function could perform a query and then be used inside another query...
    SQL> ed
    Wrote file afiedt.buf
      1  create or replace function f_dname(p_deptno in number) return varchar2 is
      2    v_dname varchar2(10);
      3  begin
      4    select dname into v_dname
      5    from   dept
      6    where  deptno = p_deptno;
      7    return v_dname;
      8* end;
    SQL> /
    Function created.
    SQL> ed
    Wrote file afiedt.buf
      1* select empno, ename, f_dname(deptno) as dname from emp
    SQL> /
         EMPNO ENAME      DNAME
          7369 SMITH      RESEARCH
          7499 ALLEN      SALES
          7521 WARD       SALES
          7566 JONES      RESEARCH
          7654 MARTIN     SALES
          7698 BLAKE      SALES
          7782 CLARK      ACCOUNTING
          7788 SCOTT      RESEARCH
          7839 KING       ACCOUNTING
          7844 TURNER     SALES
          7876 ADAMS      RESEARCH
          7900 JAMES      SALES
          7902 FORD       RESEARCH
          7934 MILLER     ACCOUNTING
    14 rows selected.It's been discussed many times on the forum... my favourite here...
    {message:id=1668675}
    Edited by: BluShadow on 17-Sep-2012 09:22

  • What is the difference between tkprof and explainplan

    Hi,
    what is the difference between tkprof and explainplan.

    Execution Plans and the EXPLAIN PLAN Statement
    Before the database server can execute a SQL statement, Oracle must first parse the statement and develop an execution plan. The execution plan is a task list of sorts that decomposes a potentially complex SQL operation into a series of basic data access operations. For example, a query against the dept table might have an execution plan that consists of an index lookup on the deptno index, followed by a table access by ROWID.
    The EXPLAIN PLAN statement allows you to submit a SQL statement to Oracle and have the database prepare the execution plan for the statement without actually executing it. The execution plan is made available to you in the form of rows inserted into a special table called a plan table. You may query the rows in the plan table using ordinary SELECT statements in order to see the steps of the execution plan for the statement you explained. You may keep multiple execution plans in the plan table by assigning each a unique statement_id. Or you may choose to delete the rows from the plan table after you are finished looking at the execution plan. You can also roll back an EXPLAIN PLAN statement in order to remove the execution plan from the plan table.
    The EXPLAIN PLAN statement runs very quickly, even if the statement being explained is a query that might run for hours. This is because the statement is simply parsed and its execution plan saved into the plan table. The actual statement is never executed by EXPLAIN PLAN. Along these same lines, if the statement being explained includes bind variables, the variables never need to actually be bound. The values that would be bound are not relevant since the statement is not actually executed.
    You don’t need any special system privileges in order to use the EXPLAIN PLAN statement. However, you do need to have INSERT privileges on the plan table, and you must have sufficient privileges to execute the statement you are trying to explain. The one difference is that in order to explain a statement that involves views, you must have privileges on all of the tables that make up the view. If you don’t, you’ll get an “ORA-01039: insufficient privileges on underlying objects of the view” error.
    The columns that make up the plan table are as follows:
    Name Null? Type
    STATEMENT_ID VARCHAR2(30)
    TIMESTAMP DATE
    REMARKS VARCHAR2(80)
    OPERATION VARCHAR2(30)
    OPTIONS VARCHAR2(30)
    OBJECT_NODE VARCHAR2(128)
    OBJECT_OWNER VARCHAR2(30)
    OBJECT_NAME VARCHAR2(30)
    OBJECT_INSTANCE NUMBER(38)
    OBJECT_TYPE VARCHAR2(30)
    OPTIMIZER VARCHAR2(255)
    SEARCH_COLUMNS NUMBER
    ID NUMBER(38)
    PARENT_ID NUMBER(38)
    POSITION NUMBER(38)
    COST NUMBER(38)
    CARDINALITY NUMBER(38)
    BYTES NUMBER(38)
    OTHER_TAG VARCHAR2(255)
    PARTITION_START VARCHAR2(255)
    PARTITION_STOP VARCHAR2(255)
    PARTITION_ID NUMBER(38)
    OTHER LONG
    DISTRIBUTION VARCHAR2(30)
    There are other ways to view execution plans besides issuing the EXPLAIN PLAN statement and querying the plan table. SQL*Plus can automatically display an execution plan after each statement is executed. Also, there are many GUI tools available that allow you to click on a SQL statement in the shared pool and view its execution plan. In addition, TKPROF can optionally include execution plans in its reports as well.
    Trace Files and the TKPROF Utility
    TKPROF is a utility that you invoke at the operating system level in order to analyze SQL trace files and generate reports that present the trace information in a readable form. Although the details of how you invoke TKPROF vary from one platform to the next, Oracle Corporation provides TKPROF with all releases of the database and the basic functionality is the same on all platforms.
    The term trace file may be a bit confusing. More recent releases of the database offer a product called Oracle Trace Collection Services. Also, Net8 is capable of generating trace files. SQL trace files are entirely different. SQL trace is a facility that you enable or disable for individual database sessions or for the entire instance as a whole. When SQL trace is enabled for a database session, the Oracle server process handling that session writes detailed information about all database calls and operations to a trace file. Special database events may be set in order to cause Oracle to write even more specific information—such as the values of bind variables—into the trace file.
    SQL trace files are text files that, strictly speaking, are human readable. However, they are extremely verbose, repetitive, and cryptic. For example, if an application opens a cursor and fetches 1000 rows from the cursor one row at a time, there will be over 1000 separate entries in the trace file.
    TKPROF is a program that you invoke at the operating system command prompt in order to reformat the trace file into a format that is much easier to comprehend. Each SQL statement is displayed in the report, along with counts of how many times it was parsed, executed, and fetched. CPU time, elapsed time, logical reads, physical reads, and rows processed are also reported, along with information about recursion level and misses in the library cache. TKPROF can also optionally include the execution plan for each SQL statement in the report, along with counts of how many rows were processed at each step of the execution plan.
    The SQL statements can be listed in a TKPROF report in the order of how much resource they used, if desired. Also, recursive SQL statements issued by the SYS user to manage the data dictionary can be included or excluded, and TKPROF can write SQL statements from the traced session into a spool file.
    How EXPLAIN PLAN and TKPROF Aid in the Application Tuning Process
    EXPLAIN PLAN and TKPROF are valuable tools in the tuning process. Tuning at the application level typically yields the most dramatic results, and these two tools can help with the tuning in many different ways.
    EXPLAIN PLAN and TKPROF allow you to proactively tune an application while it is in development. It is relatively easy to enable SQL trace, run an application in a test environment, run TKPROF on the trace file, and review the output to determine if application or schema changes are called for. EXPLAIN PLAN is handy for evaluating individual SQL statements.
    By reviewing execution plans, you can also validate the scalability of an application. If the database operations are dependent upon full table scans of tables that could grow quite large, then there may be scalability problems ahead. On the other hand, if large tables are accessed via selective indexes, then scalability may not be a problem.
    EXPLAIN PLAN and TKPROF may also be used in an existing production environment in order to zero in on resource intensive operations and get insights into how the code may be optimized. TKPROF can further be used to quantify the resources required by specific database operations or application functions.
    EXPLAIN PLAN is also handy for estimating resource requirements in advance. Suppose you have an ad hoc reporting request against a very large database. Running queries through EXPLAIN PLAN will let you determine in advance if the queries are feasible or if they will be resource intensive and will take unacceptably long to run.

  • What is the difference between cumulative and non cumulative keyfigures?

    Hi Friends
    What is the difference between cumulative and non cumulative keyfigures, when we r using  the cumulative and non cumulative
    Regards
    Ravindra

    Hi Ravindra,
    Have a look at the help:
    http://help.sap.com/saphelp_nw2004s/helpdata/en/8f/da1640dc88e769e10000000a155106/frameset.htm
    http://help.sap.com/saphelp_nw2004s/helpdata/en/80/1a62f8e07211d2acb80000e829fbfe/frameset.htm
    Go through these.
    Re: Types of non-cumulative keyfigures
    http://help.sap.com/saphelp_nw2004s/helpdata/en/8f/da1640dc88e769e10000000a155106/content.htm
    See the following threads
    non-cumulatives KF in reporting
    Re: use of non cumulative keyfigure
    Re: When do we use Non-Cumulative values?
    Key figures:
    1. Cumulative Vaules
    2. Non – Cumulative Values
    Cumulative Values:
    Cumulative Values are Keyfigures for which Keyfigure Values are must posted in every time unit that reported on (= time period – specific Values).
    Example:
    Revenue
    Non – Cumulative Values:
    Non – Cumulative Values are Keyfigures for which KeyFigures are only evaluated for selected time Periods.
    Cumulative Keyfigures With Exception Aggregation:
    It's a 'normal' KF (with summation, min or max as aggregation behaviour), but you set some exception in this behaviour...for example, you can say that a KF, normally aggregated by 'summation', have to show the max value (or the average, or '0' or something else), that is the 'exception aggregation' when you use it in combination with 0DOC_DATE (or other char), that is the 'exception aggregation char reference'...in this case OLAP processor give to you the possibility to see your KF with different behaviour depending from you use 0DOC_DATE (in our example, MAX) or something else (SUMMATION).
    Non – Cumulative keyfigure with Associated Single Delta:
    If you have a stock KF that is fed from only one (other) movement KF that can assume positive and negative sign.
    KF1 (initial) STOCK (non-***.) = 100
    KF2 flow = -30
    KF2 flow = 70
    KF1 (final) STOCK (non-***.) = 140
    Non-cumulative key figure with associated in and outflow:
    This is the case of 2LIS_03_BF KF stocks fields.
    Here, we have the same situation in point 2, but you will have not only ONE flow KF, but TWO, one dedicated to in and another one dedicated to out !
    You have to use this scenario if you have no KF that have positive and negative sign, but two KFs each one representing positive (in) and negative (out) logical sign!
    KF1 (initial) STOCK (non-***.) = 100
    KF2 (out))flow = 30
    KF3 (in)flow = 70
    KF1 (final) STOCK (non-***.) = 140
    Website Addresses For Non – Cumulative KeyFigures:
    http://help.sap.com/saphelp_nw04/helpdata/en/80/1a62dee07211d2acb80000e829fbfe/frameset.html
    http://help.sap.com/saphelp_nw04/helpdata/en/82/f2dc37f0f12313e10000009b38f8cf/content.html
    http://help.sap.com/saphelp_bw31/helpdata/en/82/f2dc37f0f12313e10000009b38f8cf/content.html
    http://help.sap.com/saphelp_erp2004/helpdata/en/d2/e0173f5ff48443e10000000a114084/content.html
    Re: Non-Cumulative keyfigure example
    Re: Types of non-cumulative keyfigures
    /community [original link is broken]
    http://help.sap.com/saphelp_bw32/helpdata/en/80/1a62dee07211d2acb80000e829fbfe/frameset.html
    /community [original link is broken]?forumID=131&threadID=29557&messageID=273049
    /community [original link is broken]?forumID=131&threadID=111914&messageID=1248243
    Check this very useful docu.
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/93ed1695-0501-0010-b7a9-d4cc4ef26d31
    ****Assign Points If Helpful****
    Regards,
    Ravikanth

  • Difference between FileInputStream and DataInputStream

    Hai everyone,
    I want to know the difference between FileInputStream and DataInutStream.As i am new to this environment i am little bit confused between the two. So i request you to explain the difference with an example so that everything will be clear for me.

    FileInputStream is for reading bytes from a file, as is indicated in the API docs: http://java.sun.com/j2se/1.5.0/docs/api/java/io/FileInputStream.html
    DataInputStream is for reading java primitives (byte, char, short, int, long, float, double, boolean) through some other stream, as is indicated in the API docs: http://java.sun.com/j2se/1.5.0/docs/api/java/io/DataInputStream.html
    If you want to read Java primtives from a file, you'd use them together: FileInputStream fis = new FileInputStream("somefile"); // for reading bytes from the file
    DataInputSeam dis = new DataInputStream(fis); // for interpreting bytes read by fis as Java primitives
    int ii = dis.readInt(); // dis uses fis to read 4 bytes from the file, and interprets them as a Java int You should probably go through this: http://java.sun.com/docs/books/tutorial/essential/io/index.html

  • Difference between GENERIC_M and GENERIC_M_CI

    hi all,
    I have just begun looking into the volumes of documentation on multi-lingual sorting support in Oracle. I am basically trying to understand the difference between GENERIC_M and GENERIC_M_CI types of NLS_SORT. My code ran into an oracle bug when using GENERIC_M as NLS_SORT (See Re: Issue sorting with column > 500 chars in length when NLS_SORT is GENERIC_M As a temporary workaround I am trying to use GENERIC_M_CI and see what impact it will have on my application code which needs to support both English and French sorting. Could someone please summarize the difference for me please? In the meantime, Binary NLS_SORT will not work for French, correct?
    Thanks in advance.
    A fellow Oracle user

    Check out Chapter 5, Linguistic Sorting and String Searching of the Globalization Support Guide.
    Specifying a Case-Insensitive or Accent-Insensitive SortUse the NLS_SORT session parameter to specify a case-insensitive or accent-insensitive sort:
    * Append _CI to an Oracle sort name for a case-insensitive sort.

  • Performance between CLOB and VARCHAR2

    I would like to know if there is any really performance issues between CLOB and VARCHAR2 data types?
    In particular, why would it not be better to declare all large text items as CLOB rather than VARCHAR2(4000) in a table? For example, if I am going to store about a page of text, in a table, why not standardize of CLOB? Only use VARCHAR2 for small text items.

    I doubt that there would be much, if any, performance difference between a CLOB and a VARCHAR2. By default, Oracle will store CLOBS directly in the table if they are less than about 4000 bytes, so the effect would be the same as a VARCHAR2(4000).
    The advantage of VARCHAR2(4000) over a CLOB is that you document and enforce the maximum size of the field. If you know that no test item will exceed 4000 bytes, then I would store it as a VARCHAR2, because if they can store more, someone will.
    A possible disadvantage of using CLOBS instead of VARCHAR2(4000) is that when you declare a column as a CLOB, Oracle creates the two lob segments whether or not they are needed to actually store data. So, depending on how many VARCHAR2(4000) columns you change to CLOBS without needing to store more than 4000 bytes, you can potentially waste a significant amount of space.
    SQL> CREATE TABLE t_clob (id NUMBER, descr CLOB);
    Table created.
    SQL> SELECT segment_name, index_name
      2  FROM dba_lobs
      3  WHERE table_name = 'T_CLOB';
    SEGMENT_NAME                   INDEX_NAME
    SYS_LOB0000136329C00002$$      SYS_IL0000136329C00002$$
    SQL> SELECT segment_name, segment_type, blocks
      2  FROM dba_segments
      3  WHERE segment_name in ('SYS_LOB0000136329C00002$$','SYS_IL0000136329C00002$$')
    SEGMENT_NAME                   SEGMENT_TYPE           BLOCKS
    SYS_IL0000136329C00002$$       LOBINDEX                   64
    SYS_LOB0000136329C00002$$      LOBSEGMENT                 64HTH
    John

  • Difference between Null and null?

    What is the difference between null and NULL?
    When is each used?
    Thanks,

    veryConfused wrote:
    There is a null in java, but no NULL. null means no value. However, when assigning value, the following is different:Although the empty String has no special role. Null means, the referential type is not assigned (doesn't refer) to a specific object. The empty String is just another object though, so seeing it or pointing it out as something special when it actually isn't at all (no more special than new Integer(0) or new Object[0]) just adds to the confusion.

  • Difference between GUI_UPLOAD and WS_UPLOAD

    Hi,
    Please make me clear about the difference between GUI_UPLOAD and WS_UPLOAD. In which cases we need to use these modules...??
    Thanks,
    Satish

    I would suggest to always use the GUI_UPLOAD.  I say this because this is the function module which is used in the GUI_UPLOAD method of the class CL_GUI_FRONTEND_SERVICES.   Really, you should probably use the class/method instead of the function module.
      data: filename type string.
      filename = p_file.
      call method cl_gui_frontend_services=>gui_upload
             exporting
                  filename                = filename
                  filetype                = 'ASC'
             changing
                  data_tab                = iflatf
             exceptions
                  file_open_error         = 1
                  file_read_error         = 2
                  no_batch                = 3
                  gui_refuse_filetransfer = 4
                  no_authority            = 6
                  unknown_error           = 7
                  bad_data_format         = 8
                  unknown_dp_error        = 12
                  access_denied           = 13
                  others                  = 17.
    Regards,
    Rich Heilman

  • The difference between Lion and Mountain Lion

    Can some one explain to me the difference between Lion and Mtn Lion? I'm currently 10.6.8 Is it beneficiall for me to upgrade?

    Mountain Lion is an enhanced version of previous OS X and so that is Mavericks.
    About upgrading it all depends on what your needs are and if your hardware supports it.
    System requirements for OS X Lion
    System requirements for OS X Mountain Lion
    OS X Mavericks: System Requirements
    Please check also applications compatibility. From Lion onward, you cannot run PPC application.

  • The difference between N80 and N80IE ?

    What is the difference between M80 and N80ie?

    02-Jan-2007
    07:45 PM
    korngear wrote:
    The Nokia N80 Internet Edition is a new version of this handset with the same hardware as the normal N80. It is due for release in Q4 of 2006 and will be available in Patina Bronze or Pearl Black, and has the following additional software included.
    Yahoo Go! for Mobile
    Flickr
    Some Amazon Branded Software
    'Download!' App management
    Internet Telephone - SIP VOIP Frontend
    WLAN Wizard
    Gizmo VOIP - Gizmo Project VOIP Frontend.
    \\en.wikipedia.org//
    @Korngear
    Thanks.
    Could N80 be upgraded to N80IE?

  • The difference between SFP+ and X2

    Dear Expert,
    I need to know what is the difference between SFP+ and X2! and can I use SFP+ card and module instead of X2?
    Thanks,
    Mohammad Saeed

    Hi,
    They are both used for 10Gig interfaces.  The difference is the connector type.
    SFP+ is LC and X2 is SC.
    You can not put an SFP+ into an X2 slot or X2 optic into a SFP+.
    HTH

  • Difference between ok_code and sy-ucomm

    Hi,
    Can any one tell me the difference between ok_code and sy-ucomm

    Hi,
    Actually OK_CODE and SY-Ucomm are the same. But experts suggest use of OK code for following reason:
    In each PAI event that a user triggers by choosing either a pushbutton on the screen or an element in a GUI status, the corresponding function code is placed into the system field SYST-UCOMM or SY-UCOMM and placed in the OK_CODE field (as long as the function code is not empty). Empty function codes are placed in neither the SY-UCOMM field nor the OK_CODE field.
    In your ABAP programs, you should work with the OK_CODE field instead of SY-UCOMM. There are two reasons for this: Firstly, the ABAP program has full control over fields declared within it, and secondly, you should never change the value of an ABAP system field. However, you should also always initialize the OK_CODE field in an ABAP program for the following reason:
    In the same way that the OK_CODE field in the ABAP program and the system field SY-UCOMM receive the contents of the corresponding screen fields in the PAI event, their contents are also assigned to the OK_CODE screen field and system field SYST-UCOMM in the PBO event. Therefore, you must clear the OK_CODE field in the ABAP program to ensure that the function code of a screen is not already filled in the PBO event with an unwanted value. This is particularly important when the next PAI event can be triggered with an empty function code (for example, using ENTER). Empty function codes do not affect SY-UCOMM or the OK_CODE field, and consequently, the old field contents are transported.

Maybe you are looking for

  • Convert VI llb from LabVIEW 5 for use in LabVIEW 8.6

    Hi Everybody!  Firstly, I'd like to say how much I have enjoyed working for NI and especially supporting the online community in my spare work time. I have to say it is a great place for NI, long term users, new users and everything else LabVIEW - an

  • Query Performance - Query very slow to run

    I have built a query to show payroll costings per month per employee by cost centres for the current fiscal year. The cost centres are selected with a hierarchy variable - it's quite a latrge hierarchy. The problem is the query takes ages to run - ne

  • Help with Decode/CASE function

    Can anyone provide some help or insight how can this be done. Senario: I have two parameters in my report. Paramerer_A and Parameter_B If I enter a value (XYZ) in Parameter_A and value (XYZ) in Parameter_B, I want the report to display ERROR and do n

  • Deletion strategy

    I'm considering using BDB JE for building an application that needs to store a large amount of events per day (in the order of 100,000,000). The record structure is pretty small (I assume it will be less of 100B) but I was wondering what would be the

  • Dynamically change the source flv video in flv play back...

    Dear Friends, Iam trying to load flv files in flash using flvplayerback components. iam using the following code. Initially iam loadign video1.flv. Then i want to load video2.flv when i press next button. It is loading video2 only when i press next b