Default  value for a column in Table Control

Hi friends, can i set dinamcally a default value for a column in table control?, this column is check type. This default value must appear in empty rows,
thanks

ADD A MODULE AS Module yyyy In ur PAI.
as
In PAI.
LOOP at  itab.
Module YYYY
ENDLOOP.
Module YYYY.
LOOP AT SCREEN.
    IF SCREEN-NAME = 'ITAB-VAL’.
      ITAB-VAL = 'XXXXXXXX'        "(DEFAULT VALUE)
      SCREEN-INPUT = 0.
      MODIFY SCREEN.
    ENDIF.
ENDLOOP.
End module.
*note
make this event work only if the previous column is filled okay.
the display will be in display mode on the screen as screen-input = 0.
see that in the table control u can get the table field for all the rows even though you are processing on some fields .
so what u do is make that particular filed masked(no i/p field and populate the field that will be better instead of populating all the columns okay.
hope this helps you out ,
regards,
vijay.

Similar Messages

  • Calling a user defined function as default value for a column

    Hi All
    Can we call a user defined function as default value for a column ??
    for example:
    create or replace  function test1  return number is
    begin
    return 10;
    end;
    create table testt
    (id  as test1,
      name varchar2(20));
    getting error:
    Error at line 1
    ORA-02000: missing ( keywordThanks
    Ashwani
    Edited by: Ashwani on Jan 16, 2012 1:19 AM

    Hi;
    For your issue i suggest close your thread here as changing thread status to answered and move it to Forum Home » Database » SQL and PL/SQL which you can get more quick response
    Regard
    Helios

  • Setting default values for a column

    Hi,
    I have a table having some default values for the columns. I am using a PreparedStatment to insert into this table. For null values I am using setNull(..) method but the default values given for the columns are not inserted for null values.
    eg: INSERT INTO TEST VALUES(?,?);
    where TEST table contains two columns col1 and col2 with default values 'AA' and 'BB' respectively. My requirement is to make sure that when null values are specified for the columns then the database default should be picked up. using setNull(..) method doesn't help.
    Thanks in advance.
    Gyan

    Default value for a column can be picked up from DatabaseMetaData class.
    The below snippet shows that: -
    DatabaseMetaData metaData = connection.getMetaData();
    ResultSet resultSet = metaData.getColumns(null, null, "TEST", "COL%");
    while ( resultSet.next() )
    String defaultValue = resultSet.getString("COLUMN_DEF");
    String datatype = resultSet.getString("DATA_TYPE");
    System.out.println("defaultValue = " + defaultValue);
    System.out.println("datatype = " + datatype);
    }

  • How to set default values for boolean columns

    I'm trying to deploy some content types and columns into a site with a feature. All it's ok, except that I'm trying to set a default value for boolean columns with no success.
    I've tried to set default value at column level:
    <Field ID="{EFE23A1D-494E-45cf-832E-45E41B17F0CF}" Name="ScopeSpanish" DisplayName="Se publican noticias en español"
    Type="Boolean" Hidden="FALSE" Group="Columnas ShaCon" >
    <Default>TRUE</Default>
    </Field>
    and at content type level:
    <FieldRef ID="{EFE23A1D-494E-45cf-832E-45E41B17F0CF}" Name="ScopeSpanish" DefaultValue="TRUE" Required="TRUE" />
    But in any case, when i create a new item with this content type, default value is applied.
    Can anyone tell how to set default values for boolean columns?
    Thanks in advance,
    Regards,
    Sergio

    In the field definition you can set
    <Default>1</Default>
    or
    <Default>0</Default>
    How to set the default value Null?

  • Default Value for a column in matrix

    Hi,
    How to set default value for a column in matrix which is of type combo(Yes/No).
    The cell has combo in it
    Manoj

    Hi Manoj,
    The column is set as combo. Now you need to tell SBO what constituates a Y or N. In my example my Column "Col6" must display Yes if the RENTED column = 1 and No if the RENTED column = 0. (I'm obviously using a datasource to tie the data to the matrix)
    oMatrix = frm.Items.Item("YourMatrixID").Specific
            oColumns = oMatrix.Columns
    oColumn = oColumns.Item("Col6")
            oColumn.DataBind.SetBound(True, "@VIDEO", "U_RENTED")
            oColumn.ValOn = "1"
            oColumn.ValOff = "0"

  • Table Control with default values for a Column

    Hi,
      I have a table Control with  fields  kschl    kbetr    konwa    mark     
    i have created a range for KSCHL
    now i need to pass this to the table column
    Kindly suggest how can i handle this?
    BEGIN OF y_condition,
      kschl       TYPE kscha,
      kbetr       TYPE kbetr_kond,
      konwa       TYPE konwa,
      mark        TYPE char1,
    END OF y_condition,
    t_cost TYPE STANDARD TABLE OF y_condition,
    MODULE mo_tc_cost_init OUTPUT.
      IF  w_tc_cost_c IS INITIAL.
        REFRESH CONTROL c_tc_cost FROM SCREEN c_scr2000.
        REFRESH t_cost.
        MOVE c_select TO w_tc_cost_c.
        FREE r_kschl.
        MOVE: c_i    TO r_kschl-sign,
              c_eq   TO r_kschl-option,
              c_zhb1 TO r_kschl-low.
        APPEND r_kschl.
        MOVE: c_i    TO r_kschl-sign,
              c_eq   TO r_kschl-option,
              c_zhb2 TO r_kschl-low.
        APPEND r_kschl.
        MOVE: c_i    TO r_kschl-sign,
              c_eq   TO r_kschl-option,
              c_zhb3 TO r_kschl-low.
        APPEND r_kschl.
      ENDIF.

    Can you clarify please?... you say have a table control containing the following columns:
    kschl TYPE kscha,
    kbetr TYPE kbetr_kond,
    konwa TYPE konwa,
    mark TYPE char1
    so where do you expect the range table "r_kschl" to appear? ... did you want a second table control on the screen?
    Jonathan

  • Default value for first row in table after row has rendered

    I have a master-detail type page where the first row in the detail table appears with no values when the page first renders. After the user enters some data in the master area, the default value is available. I then use something like this to set the default in one column of the first row:
    MyVOImpl vo = (MyVOImpl)am.getMyVO1();
    MyRowImpl voRow = (MyRowImpl)vo.first();
    voRow.setMyAttribute("some value");
    When I do this and run the code in the debugger, I can see that the default value is stored somewhere in the row object. However, the value is not displayed in the screen.
    What must I do to get the default value to display after the user has tabbed out of the master data area, and before the user attempts to enter data in the row?

    Hi. Thanks again.
    Here is more detail of the code:
    if (pageContext.isLovEvent())
    * Form was submitted because the user selected
    * a value from the LOV modal window,
    * or because the user tabbed out of the LOV input.
    * This code executes when the event is either
    * LOV_UPDATE or LOV_VALIDATE
    String lovInputSourceId = pageContext.getParameter(SOURCE_PARAM)
    // Find out the result values of the LOV.
    Hashtable lovResults =
    pageContext.getLovResultsFromSession(lovInputSourceId);
    // Find out which LOV input triggered the event.
    if (lovInputSourceId.equals("myLovItemId"))
    String myDefaultVar = null;
    if (lovResults != null)
    myDefaultVar = "some stuff " + (String)lovResults.get("myResultItemId")
    if (myDefaultVar != null && myDefaultVar != "") // yes, this is always true in this case
    // now set the default for the first line.
    // Added lines will be defaulted by the
    // EO.create() method.
    MyVOImpl myVo = (MyVOImpl)am.getMyVO1();
    MyVORowImpl myVoRow = (MyVORowImpl)myVo.first();
    myVoRow.setAttribute("myRowItemId", myDefaultVar); // THIS LINE DOES NOT CAUSE DISPLAY TO CHANGE
    The problem, as noted in the code, is that setAtrribute() does not cause the default value to display in the field.
    What can cause this, and what can fix it?
    Edited by: user522137 on Nov 9, 2010 12:06 PM

  • Using default values for a column

    Hi,
    I am using PL/SQL Developer, where for some columns in a table I've defined 0 as default value.
    After running some queries on the table (insert,update) I realized that all the columns that are supposed to have 0 value (default), actually have NULL value.
    Please advice about possible reason.
    Thanks

    Hi,
    You might have explicitly inserted a NULL value in those columns. Have a look at the below test case:
    SQL> create table test(a number, b number default 0, c number default 1);
    Table created.
    SQL> insert into test (a) values (10);
    1 row created.
    SQL> select * from test;
             A          B          C
            10          0          1
    SQL> insert into test (a, b) values (10, null);
    1 row created.
    SQL> select * from test;
             A          B          C
            10          0          1
            10                     1
    SQL> insert into test (a, b, c) values (10, null, null);
    1 row created.
    SQL> select * from test;
             A          B          C
            10          0          1
            10                     1
            10
    SQL> insert into test (a) values (20);
    1 row created.
    SQL> select * from test;
             A          B          C
            10          0          1
            10                     1
            10
            20          0          1Regards

  • Drop down selection for a column in Table Control

    Hello,
    I have a table control where data is displayed. The user can fill data in one of the column and save. We want to have a drop down in that column where user can select a value. This column is a qunatity field.
    Please guide how it can be done.
    RR

    In SE51 screen editor, double-click on the editable field and set the dropdown listbox at listbox. As I don't think that you have domain value or table value for this field, set the field value list to "A" from program.
    Then in the PBO use the FM VRM_SET_VALUES to fill the list of allowed values. do this in a module called in the LOOP AT WITH CONTROL which fills the table control from the program data. (use a name like TC_XXXX_CHANGE_FIELD_ATTR)
    I'm not sure SE51 will allow you to use a quantity field in a listbox, so use a character field (check also right justified box on dynpro field attrinutes window), in VRM_SET_VALIUES parameters and in initial filling of the screen field use a WRITE xx UNIT yy to fill the screen field. Then a MOVE should perfect correctly when filling actual database/abap field by a move statement.
    Regards,
    Raymond

  • Invoice Forms created with Adobe X - default value for "total" column should be blank

    I am new to the forum and just finding my way around.  Thank you for any help.
    I've created an invoice template in Word, then imported it into Adobe X Pro to turn it into a form.  Pretty simple, but one thing is troubling me.  I have the usual description, quantity, price each, and total columns.  The "total" columns are defaulting with a "0" in them, and I'd prefer they default blank unless an entry is made on that line.  I have right-clicked the "total" fields properties and the default values are blank already, but a zero still shows up.  I  know it can be done because one of my earlier forms defaults to a blank space until I entered something on that line. Then it calculated.  How can I make the "total" column blank unless something is entered there?
    Secondly, when I save a form and want to go back to make changes, I'm not seeing how to do this.  It seems to save as a .pdf, and if I want to modify the form portion I have to start all over from scratch.  What am I missing?
    Thanks so much for any help.

    George, thank you for the response.
    I've entered the script, and no change.  The "total" columns still show a (zero) 0 even when I have not entered anything in that line.
    For example:
    Description             Qty     Unit Price     Total
                                                                             0
                                                                             0
                                                                             0
    etc... all the day down the form.
    I'd like the zeroes not to appear when there is nothing on the Description lines.
    Incidentally, when selecting fields to use for calculations for the "total" column, we're supposed to place a check mark in the box of the fields to be calculated - and I can't CLICK in them.  I have to use the space bar.  Is that how it is supposed to work?
    Thanks for your quick response.
    J
    I

  • Setting default value for lookup column in Sharepoint 2013 via powershell

    Hi,
    when I try to use the 2010 version of setting a default value to a lookup column ( colum.defaultvalue="1;#Open"), this is not longer supported in SharePoint 2013. The defaultvalue is always the alphabetically sorted first entry in the source
    list.
    How can I change this?
    Thanks for any help.
     Lutz

    Hi Lutz,
    You can set the default value of a look-up column. The code is very simple, just need to take care of the code below.
    $w = Get-SPWeb http://web
    $l = $w.Lists["MyDocumentLibrary"]
    $lf = $l.Fields["lookupColumn"]
    $i = $l.Items[0] #List item to update
    $lf.ParseAndSetValue($i,"1;#lookupvalue") #1;#lookupvalue refers to the ID of the lookup item and the value of the lookup item.
    $i.Update()
    As another example, if I wanted to update all the items in my document library that had the lookup value
    Pending, with the lookup value Complete;
    $w = Get-SPWeb http://myweb
    $l = $w.Lists["MyDocumentLibrary"]
    $lf = $l.Fields["lookupColumn"]
    foreach($i in $l.Items)
    if($i["lookupColumn"] -eq "1;#Pending")
    $lf.ParseAndSetValue($i,"2;#Complete")
    $i.Update()
    Indul Hassan
    Microsoft Community Contributor
    http://www.indulhassan.com
    You Snooze.. You Lose !!

  • Defining Default Values for a column in a view

    Hi guys,
    Please can you set a default value while creating a view in the database.
    me

    CREATE VIEW v_1
    AS
    SELECT name, 'A' as col FROM sys.objects
    SELECT * FROM v_1
    DROP VIEW v_1
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • Import and default values for columns

    Hi guys
    I have a table in which there are default values for some columns. I take export of this table.
    I go to another database where this table structure is already there (but default values are not set). I run the import of table with ignore=Y. It does all...import the data...create the indexes and all...but doesn't set the default values for the columns.
    Shouldn't it do that also ? ignore=Y means that ignore the object creation errors and proceed with the rest of the stuff ? Or there is some problem in my understanding ?
    Version 10gR2 on AIX 5.3 and using traditional export/import.
    Thanks
    Amardeep Sidhu

    Hanji Sidhu Sahib.
    Mein Tuhade liye eh example try kita hai.
    SQL> conn simar/simar
    Connected.
    SQL> SQL> create table orders (
    dept varchar2(20) primary key,
    place varchar2(20),
    intcol integer default 12
    2 3 4 5
    Table created.
    SQL>
    Inserted few values ...........+ commit.
    SQL> conn simar/simar
    Connected.
    SQL> select * from orders;
    DEPT PLACE INTCOL
    SALES TORONTO 12
    HR LA 12
    BILLING FLORIDA 12
    IT HALIFAX 5
    exp simar/simar@RACDB file=exptest.dmp log=exptest.log
    rac01:/software/backup>exptest.dmp log=exptest.log <
    Export: Release 10.2.0.3.0 - Production on Tue May 6 23:35:58 2008
    Copyright (c) 1982, 2005, Oracle. All rights reserved.
    Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Production
    With the Partitioning, Real Application Clusters, OLAP and Data Mining options
    Export done in WE8ISO8859P1 character set and AL16UTF16 NCHAR character set
    About to export specified users ...
    . exporting pre-schema procedural objects and actions
    . exporting foreign function library names for user SIMAR
    . exporting PUBLIC type synonyms
    . exporting private type synonyms
    . exporting object type definitions for user SIMAR
    About to export SIMAR's objects ...
    . exporting database links
    . exporting sequence numbers
    . exporting cluster definitions
    . about to export SIMAR's tables via Conventional Path ...
    . . exporting table ABC 12 rows exported
    . . exporting table ORDERS 4 rows exported
    . exporting synonyms
    . exporting views
    . exporting stored procedures
    . exporting operators
    . exporting referential integrity constraints
    . exporting triggers
    . exporting indextypes
    . exporting bitmap, functional and extensible indexes
    . exporting posttables actions
    . exporting materialized views
    . exporting snapshot logs
    . exporting job queues
    . exporting refresh groups and children
    . exporting dimensions
    . exporting post-schema procedural objects and actions
    . exporting statistics
    Export terminated successfully without warnings.
    rac01:/software/backup>strings exptest.dmp |grep -i 'create'
    CREATE TABLE "ABC" ("A" VARCHAR2(10), "B" VARCHAR2(10)) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 STORAGE(INITIAL 65536 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "USERS" LOGGING NOCOMPRESS
    CREATE TABLE "ORDERS" ("DEPT" VARCHAR2(20), "PLACE" VARCHAR2(20), "INTCOL" NUMBER(*,0)) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 STORAGE(INITIAL 65536 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "USERS" LOGGING NOCOMPRESS
    rac01:/software/backup>strings exptest.dmp |grep -i 'alter'
    ALTER TABLE "ORDERS" MODIFY DEFAULT
    ALTER TABLE "ORDERS" MODIFY ("INTCOL" DEFAULT 12
    ALTER TABLE "ORDERS" ADD PRIMARY KEY ("DEPT") USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE(INITIAL 65536 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE "USERS" LOGGING ENABLE
    SQL> conn simar/simar
    Connected.
    SQL> drop table orders;
    Table dropped.
    imp simar/simar@RACDB file=exptest.dmp log=imp_exptest_1.log tables='ORDERS'
    rac01:/software/backup>exptest.dmp log=imp_exptest_1.log tables='ORDERS' <
    Import: Release 10.2.0.3.0 - Production on Tue May 6 23:46:48 2008
    Copyright (c) 1982, 2005, Oracle. All rights reserved.
    Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Production
    With the Partitioning, Real Application Clusters, OLAP and Data Mining options
    Export file created by EXPORT:V10.02.01 via conventional path
    import done in WE8ISO8859P1 character set and AL16UTF16 NCHAR character set
    . importing SIMAR's objects into SIMAR
    . importing SIMAR's objects into SIMAR
    . . importing table "ORDERS" 4 rows imported
    Import terminated successfully without warnings.
    SQL> conn / as sysdba
    Connected.
    SQL> set heading off;
    set echo off;
    Set pages 999;
    set long 90000;
    SQL> SQL> SQL> SQL> SQL>
    SQL> select dbms_metadata.get_ddl('TABLE','ORDERS','SIMAR') from dual;
    CREATE TABLE "SIMAR"."ORDERS"
    ( "DEPT" VARCHAR2(20),
    "PLACE" VARCHAR2(20),
    "INTCOL" NUMBER(*,0) DEFAULT 12,
    PRIMARY KEY ("DEPT")
    USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS
    STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
    PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
    TABLESPACE "USERS" ENABLE
    ) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
    STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
    PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
    TABLESPACE "USERS"
    SQL>
    Here the alter table statement is in the dmp file as well as in the imported table.
    Regards

  • Based on input file i need to update default values to some columns of database table using bulk copy process

    Hi Team,
    Am using BULK INSERT Format file option to load data into table from .txt file here am facing an issue i.e ibased on input file i need to insert default values to some columns of table so we can not declare it on table level, Can we give default values in
    format file ? if we can give how it is ? or Any alternate possibilities to this scenario instead of BULK INSERT ?
    Thanks,
    Sudhakar

    Thanks for your response, here i don't have any rights to change table structure the table is created by different team, my work is to load data from file to table. Is there any chance to supply default values by*XML* format file instead of *.fmt* file
    please let me know the possibility.
    Again, no. If you want to supply default values that are not present in DEFAULT constraints in the table definition, you will need to write your own code. There are plentyfull of options, and I have mentioned some already.
    Here are some more:
    *  Table-valued parameters, see here for examples:
    http://www.sommarskog.se/arrays-in-sql-2008.html
    *  Use BULK INSERT to load data to a staging table, and then apply the default values when you copy from staging to target.
    Erland Sommarskog, SQL Server MVP, [email protected]

  • User defined function to set a default value of a column

    Hi All
    Can we use user defined function to set a default value of a column ??
    for example:
    create or replace  function test1  return number is
    begin
    return 10;
    end;
    create table testt
    (id  as test1,
      name varchar2(20));
    error:
    ORA-02000: missing ( keywordThanks
    Ashwani

    174313 wrote:
    MichaelS for showing example to use function in table ddl , otherwise i was thinking we cannot use function in table ddl as per error I received.That was an example of a virtual column.
    ORA-04044: procedure, function, package, or type is not allowed hereUsing PL/SQL code like that raises 2 basic problems. If that PL/SQL code for the calculating the column default breaks, what happens to the SQL insert statements against that table. These will need to fail as the table definition depends on the PL/SQL code. This is problematic as this dependency simply increases the complexity of the SQL object.
    The 2nd issue is performance. PL/SQL code needs to be executed by the PL/SQL engine. This means a context switch from the SQL engine to the PL/SQL engine in order to determine the default value for that column. Context switching is a performance overhead.
    So even if it was possible to use a PL/SQL function as parameter for the SQL default clause, I would not be that keen to use it.

Maybe you are looking for