Default value updation in table

Hi,
    I want to update default value 'X' in ztable field through report.How to set the field value always containing X only.

Hi Anitha,
Can you a bit clarify your question ? - I understand if the ZTable field value is 'X' you need to update it right ?
Then , fetch the entries of the tables for which the field values is 'X' and modify the field value as per the business requirement and update the same table. You can use the work areas while updating the ZTable.
Thanks,
SK

Similar Messages

  • How to change default value in a table using ALTER TABLE

    Hi,
    How to change default value in a table
    I have a table TEST which has 2 fields CODE of Datatype VARCHAR2(10) and Indicator as VARCHAR2(1).
    I want to change the default value using ALTER TABLE TEST of field Indicator to 'I'.
    Any help will be needful for me
    Thanks and Regards

    user598986 wrote:
    Hi,
    How to change default value in a table
    I have a table TEST which has 2 fields CODE of Datatype VARCHAR2(10) and Indicator as VARCHAR2(1).
    I want to change the default value using ALTER TABLE TEST of field Indicator to 'I'.
    ALTER TABLE  test
    MODIFY (indicator DEFAULT 'I'); 
    Incidentally, INDICATOR is a keyword in Oracle, so you may have problems using it as a column name. If so, you'll have to enclose the column name in double-quotes, and be careful to use capital letters inside the quotes.
    Edited by: Frank Kulash on Aug 26, 2009 11:42 AM

  • HOW CAN I PASS A DEFAULT VALUE IN INTERNAL TABLE

    HOW CAN I PASS A DEFAULT VALUE IN INTERNAL TABLE.
    DATA : BEGIN OF ITAB OCCURS 0,
               FIELD1(2) TYPC C DEFAULT   '12',
               FIELD2     TYPE C ,
               END OF ITAB1.
    IT'S GIVING ERROR MESSAGE.
    PLZ LOOK INTO THIS AND GIVE ME CORRECT SOLUTION.
    THANKS
    SURI

    DATA : BEGIN OF ITAB OCCURS 0,
    FIELD1(2) TYPC C,
    FIELD2 TYPE C ,
    END OF ITAB1.
    itab-field1 = '12'.
    itab-field2 = 'A'.
    append itab.
    clear itab-field2.
    itab-field1 = '12'.
    itab-field2 = 'B'.
    append itab.
    clear itab-field2.
    Now everytime u'll have the value for field1 = '12'.
    Regards
    Vasu

  • Default values in SE16 table selection screen

    Hi,
    when we open SE16 along with table name , In the selection screen of that table i want some default values apper for one particular field.
    How can i do that???

    HI.
    STEPS:
    1. Go to SE16.
    2. Enter a table name.
    3. In the selection screen of the table enter values   
    for the fields that you want to set as default values also called variants.
    4. Then click on Goto --> Variant --> Save as Variant
    5. Enter the variant name and short text for the same.
    6. Then click on save on top of the page.
    Steps To retrieve the variant.
    1. go to se16.
    2. Enter table name.
    3. Click on "Get Varian" icon or press "Shift + F5".
    4. Choose the desired variant.
    Thus you will be able to set default values in SE16
    table selection screen.
    Hope this is useful
    Cheers!!!
    Rajesh.

  • How to set default value of a table using sequence number

    Dear all,
    Does any body know that how to set default value of a table
    using sequence number.
    But I don't want to use trigger to do that.
    Please help!!!!
    Eldon

    Andrew is essentially correct. You can get around the trigger,
    but not the sequence, if (and this may be a very big if) you can
    guarantee that every time an insert is done into the table, from
    whatever source, the statement looks something like
    INSERT INTO tbl VALUES (sequence.nextval,other_columns_values)

  • How to dynamically get default value from a table column

    Hi all,
    Here's my problem: Our front end application sends insert and update queries to a pl/sql package. I've got a procedure that gets a PL/SQL table with all the column names an values, a table-name and a primary key name and value. That procedure creates an insert or update statement. So far, so good.
    Now the problem: our front end doesn't know what the default value for a column is. So when a number field doesn't get a value in the front-end, it's inserted with a value '0' though is should ben NULL. My sollution for this is to know the default value of a column: when there's a default of '0', then the value that will be inserted is '0'. When there's no default value and the column can ben NULL, it'll be inserted as NULL. if the column has a not null constraint, a '0' will be inserted.
    Ofcourse I can get the default value from the system-views all_tab_columns or user_tab_columns, but our application is installed at some 100 clients, and has various database installations. Most of the times, the tables are in the same schema as our procedure that performs the insert or update, but sometimes some of the tables are in another schema (in the same database) and also sometimes some tables are stored in another database. In all these situations, a synonym for that table exists in the schema.
    Is there a api function or procedure that I can call to get the default value of a column? I looked at dbms_sql and dbms_metadata, but those packages don't give me that perticular information. if not, I'll stuck with the 'does table exists in schema' yes->use table, no query user_synonyms to look for the owner of the table (and database link) and query all_tab_columns to get the default value. Only this seems a bit overkill to me.
    I hope I'm clear enough? And please don't reply with "don't do inserts this way"! I know, this is not the most optimal sollution, but it does gives us a couple of advantages in our application...

    there is no way that I can think of, apart from what you have already discovered (i.e. views), where you can determine if a column has a defuault value defined against it.
    The other option is triggers, but I guess doing that across 600 tables would not be an option, and besides I stay clear of triggers.
    A different approach therefore, if you cannot pre-determine the data, is to consider a post problem handler, hence I suggested the use of an exception handler.
    The exception handler works regardless of whether the statement is dynamic or not.
    SQL> truncate table abc;
    Table truncated.
    SQL>
    SQL> declare
      2    NULLVAL exception;
      3    pragma exception_init(NULLVAL, -01400);
      4 
      5  begin
      6 
      7    begin
      8 
      9      execute immediate 'insert into abc (y) values (1)';
    10 
    11      exception
    12        when NULLVAL then
    13          -- handle the error
    14          execute immediate 'insert into abc (x,y) values (0,1)';
    15 
    16    end;
    17 
    18    commit;
    19   
    20  end;
    21  /
    PL/SQL procedure successfully completed.
    SQL>
    SQL> select * from abc;
             X          Y
             0          1

  • Hiii help to put default values on custom table

    Hiii
    Please advise how to put assign a default values on a custom table.
    Can you please indicate me the path to navigate to do that

    Please give more details
    where do you want default value while updating table entry or while using table maintenance ?

  • Default value updated

    Hello:
    Can anybody provide help to me in this situation:
    I have a form for user to choose an item from Pop Up LOV, once the user press the button "choose_item" to submit , the default value "Yes"of the availability of that item will be change to "No"
    How can i perform that operation?
    Thanks and best regards

    So, when the user clicks submit have a process:
    UPDATE
    table
    SET
    available='N'
    WHERE
    id=:P1_ID
    Then when you select (for reports etc) then you just do:
    SELECT
    FROM
    table
    WHERE
    available!='N'
    That's if I'm understanding correctly what you are trying to achieve.

  • How to maintain default values for custom table fields --  Urgent

    Hi all,
    I've a requirement wherein i need to create a Z table (with maintainence view) in which i'll have date and time as two of its field which should have current date and current time as default value. Can somebody suggest as how am i to maintain the date and time fields defaulting to current date and current time.
    Incase if someone is unable to intrepret what i'm trying to say, please query me, i'll elaborate it further.
    Please give in your quick inputs which is highly valuable to me and also will be highly appreciated.
    Thanks in advance,
    Vaishnavi Varadarajan

    We have a following custom table which contains the fields “Date on which record was created” and “Name of the person who created the object”. We would like to have these to be filled up with SY-DATUM and SY-UNAME respectively.
    Using the events, we can achieve this.
    Please refer the following link:
    http://abapliveinfo.blogspot.com/2007/12/events-in-table-maintenance-in-sap.html
    Also,
    Write a form routine in table maintanance generator.
    1. SE11 > utilities > table maintenance generator
    2. environment > modification > event
    define the event and form routine to make use of the tigger. in the form routine define an object for the class and call the relevant method.
    Or u can do it as:
    Table maintenance generator is basically used to do table operations like (insert, delete, modify...).
    if you create table maintenance for your table it will build a module pool program, by using you do the above operations.
    below is the procedure to create table maintenance generator.
    1) Create one function group.
    2) after activating your Ztable, choose 'Utilities'----> 'Table maintenance genrator'.
    3) then give the authorization group and function group created abobe in the next screen.
    4) Then choose the "create" button in your application tool bar, which will creates the module pool program.
    5) then create one Tcode by chosing "Transaction with parameters( parameter transaction)".
    6) in transaction field give "SM30", select the check box "Skip initial screen".
    7) in the below of that screen you can find the "Default values" frame.
    8) there under the "name of screen field" select the "View name' and 'update".
    9) in value column against to "view name" give you table name, and against to "Update" put 'X' in capital letters.
    save it then you can straight away use this newly created Tcode to maintain your table.
    Note:- 1) make the modification while saving the data into your table using this newly generated program to carry out your validation (even though it looks like standard program; no need to enter the access key).
    2) if you do any changes to your table and press the activate button automatically the table maintenace generator will be goes off, you need to create this again.
    cheers,

  • Variable values updation in table TVARV- for SCMA - very urgent..

    Hi all,
    Can anyone pass on the code or logic for udating the values of variables like
    SAP_SCMA_FISC_YEAR
    SAP_SCMA_PERIOD
    or the variables I define like
    Current fiscal year
    Current period
    The program should update the values for above variables based on system date, by the period end dates maintained in T009B table
    Your help in this regard is highly appreciated
    Thanks in advance
    Kumar

    Here you go !!
    <b>FM  "UPDATE_TECHN_PERIODEN_ERWEIT"</b>
    <b>FYI</b>
    see the source code of FM "MCP_TECH_PERIODEN_GEN"
    call function 'UPDATE_TECHN_PERIODEN_ERWEIT' "IN UPDATE TASK
             tables
                  uw_t009b = mt_t009b
             exceptions
                  others   = 0.
    <b>Pl... award the points.</b>
    Good luck
    Thanks
    Saquib Khan
    "Some are wise and some are otherwise"

  • IW21 - Default values into Activities table on Creation of Notification

    Hi,
    Can anyone suggest a way to default values in to the first line of the Activities table (VIQMMA) on the Additional Information tab when creating a notification?
    Some fields would be dependant on the entry in the field VIQMFE-OTGRP on the Header tab, others such as Start date and times, would be copied directly from the header tab.
    I have been looking to use an Enhancement Point - but where to put it?
    I'm hoping someone may have tried this already?
    Thanks for your help,
    Jan

    Hi,
    Can anyone suggest a way to default values in to the first line of the Activities table (VIQMMA) on the Additional Information tab when creating a notification?
    Some fields would be dependant on the entry in the field VIQMFE-OTGRP on the Header tab, others such as Start date and times, would be copied directly from the header tab.
    I have been looking to use an Enhancement Point - but where to put it?
    I'm hoping someone may have tried this already?
    Thanks for your help,
    Jan

  • Category attributes default values updating

    Hi,
    I'm developing an application that, upon upload of a file to the specified root folder(through the application), reads some values from a file, creates a folder structure based on those values, and moves the file in the bottom folder. Now, a predefined category should be attached to the file, to enable search by category attributes. My idea is to set the category as required on that bottom folder (or the first), and modify it's attribute default values, so that the file inherits them when moved in it. I have found mshannon's examples in some other thread ( Updating a document with category metadata using updateDocument(): error! ), the first one works only with files, not folders, and the second one doesn't work for me at all, I get an error:
    javax.faces.el.EvaluationException: ORACLE.FDK.AggregateError:ORACLE.FDK.AggregateError
    here is my code:
    public static void updateAttributes() throws FdkException, RemoteException{
    login();
    FileManager fm = s_WsCon.getFileManager();
    Item fajl = fm.resolvePath(prop.getProperty("userhome") + "/root folder/folder1/readme1.txt",
    null);
    long docID = fajl.getId();
    NamedValue[] catInstAtr = new NamedValue[] {
    new NamedValue("CUSTOM_138297", "changed value for att1"),
    new NamedValue("CUSTOM_138299", "changed value for att2")
    NamedValue[] catDef = new NamedValue[] {
    new NamedValue(Options.UPDATE_CATEGORY_ID,new Long(139054)),
    new NamedValue(Options.CATEGORY_DEFINITION_ATTRIBUTES, catInstAtr)
    NamedValue[] docDef = new NamedValue[] {
    new NamedValue(Options.CATEGORY_DEFINITION, catDef)
    AttributeRequest[] reqAtr = new AttributeRequest[]{
    new AttributeRequest(Attributes.DESCRIPTION, null)
    fajl = fm.updateDocument(docID, docDef, reqAtr);
    logut();
    This example is (I think) only for updating on document level, but I could use a solution for folder-level updating, as I explained before. Can anyone help me?
    Thanks,
    Pedja

    Pedja,
    Here is my code to get category from Folder this is updated version from sample code TestCategory2.java
    1. It will get the required category of a folder.
    2. gets the internal category attribute names
    3. get Category id if uploading file along with category attribute values OR
    updating file and also updating previous category instance values..
    package oracle.ifs.examples.content.testcases;
    import java.util.Map;
    import java.util.Properties;
    import java.util.*;
    // Facade Objects
    import oracle.ifs.fdk.AttributeRequest;
    import oracle.ifs.fdk.Attributes;
    import oracle.ifs.fdk.FdkConstants;
    import oracle.ifs.fdk.FdkErrorCodes;
    import oracle.ifs.fdk.FdkException;
    import oracle.ifs.fdk.FdkExceptionEntry;
    import oracle.ifs.fdk.Item;
    import oracle.ifs.fdk.Options;
    import oracle.ifs.fdk.NamedValue;
    import oracle.ifs.fdk.NamedValueSet;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileNotFoundException;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import HTTPClient.HTTPConnection;
    import HTTPClient.HTTPResponse;
    import HTTPClient.HttpOutputStream;
    import java.io.InputStream;
    import java.io.OutputStream;
    import java.net.URL;
    // Web Services Managers
    import oracle.ifs.fdk.CategoryManager;
    import oracle.ifs.fdk.CommonManager;
    import oracle.ifs.fdk.FileManager;
    // Framework
    import oracle.ifs.examples.content.fdk.FdkSession;
    import oracle.ifs.examples.content.fdk.FdkUtils;
    import oracle.ifs.examples.content.fdk.Managers;
    import oracle.ifs.examples.content.fdk.constants.ItemAttributes;
    import oracle.ifs.examples.content.fdk.constants.NamedValueConstants;
    import oracle.ifs.examples.content.testcases.AbstractTest;
    public class TestCategories3
    implements ItemAttributes, NamedValueConstants
    public TestCategories3()
    public static void main(String[] args)
    TestCategories3 tc3= new TestCategories3();
    tc3.getCatinfo();
    * This is where you write your test program.
    public void getCatinfo()
    log(this.getClass().getName()+": starting");
    FdkSession session = null;
    try
    AttributeRequest[] requestedAttributes = null;
    NamedValue[] sortOptions = null;
    Map returnedAttrs = null, map = null;
    log("\nAuthenticating as regular test user ...");
    session = new FdkSession("http://xxx.com:8320/content/","anakkala","sample");
    CommonManager commonM = Managers.getCommonManager(session);
    CategoryManager categoryM = Managers.getCategoryManager(session);
    FileManager fileM = Managers.getFileManager(session);
    // save this attribute request so that it can be used later
    AttributeRequest[] AR_CATEGORY_CONFIGURATION_ATTRIBUTES =
    FdkUtils.newAttributeRequestArray(Attributes.CATEGORY_CONFIGURATION,
    FdkUtils.newAttributeRequestArray(new Object[]
    // Is the category configuration enabled
    FdkUtils.newAttributeRequest(Attributes.CONFIGURATION_ENABLED),
    // Can the category configuration be overridden or is it final
    FdkUtils.newAttributeRequest(Attributes.CONFIGURATION_FINAL),
    // What are the required categories for the category configuration
    FdkUtils.newAttributeRequest(Attributes.REQUIRED_CATEGORIES,
    // for the required categories ...
    FdkUtils.newAttributeRequestArray(new Object[]
    // What is the category classobject display name
    FdkUtils.newAttributeRequest(Attributes.DISPLAY_NAME),
    // get attributes inherited and introduced by category object
    FdkUtils.newAttributeRequest(Attributes.METADATA_ATTRIBUTES,
    // get full settings for each of these attributes
    FdkUtils.newAttributeRequestArray(METADATA_ATTRIBUTE_ATTRIBUTES)
    // Are there any attribute overrides for this category config?
    FdkUtils.newAttributeRequest(Attributes.ATTRIBUTE_OVERRIDES,
    // get full settings for each of these attribute overrides
    FdkUtils.newAttributeRequestArray(ATTRIBUTE_OVERRIDE_ATTRIBUTES))
    log("\nLooking up folder /d-rco/C1/L1/folder1 ...");
    // convert attribute request map to AttributeRequest[]
    requestedAttributes = AR_CATEGORY_CONFIGURATION_ATTRIBUTES;
    Item folder =fileM.resolvePath(
    "/d-rco/C1/L1/folder1",
    requestedAttributes);
    log("folder id is="+folder.getId());
    log("\nProcessing requested attributes - goal: generate override ...");
    //returns a map
    returnedAttrs = FdkUtils.getAttributesMap(folder);
    Item categoryConfig = (Item)
    returnedAttrs.get(Attributes.CATEGORY_CONFIGURATION);
    returnedAttrs = FdkUtils.getAttributesMap(categoryConfig);
    // is CategoryConfiguration enabled?
    Boolean ccEnabled = (Boolean) returnedAttrs.
    get(Attributes.CONFIGURATION_ENABLED);
    // is CategoryConfiguration final? false=subfolders can override
    Boolean ccFinal = (Boolean) returnedAttrs.
    get(Attributes.CONFIGURATION_FINAL);
    // what are the attribute overrides for this category configuration
    log("\nAttribute overrides ...");
    Item[] attributeOverrides = (Item[]) returnedAttrs.
    get(Attributes.ATTRIBUTE_OVERRIDES);
    FdkUtils.log(attributeOverrides);
    // what are the requred categories for this category configuration
    log("\nRequired categories ...");
    Item[] reqCategories = (Item[]) returnedAttrs.get(Attributes.REQUIRED_CATEGORIES);
    FdkUtils.log(reqCategories);
    log("After printing required categories");
    if(ccEnabled.booleanValue() && !ccFinal.booleanValue()
    && reqCategories != null && reqCategories.length >= 1)
    // Folder /<domain>/<basecontainer>/L1/F3.EC has an enabled category
    // configuration that can be overridden and has required categories
    // present ...
    Item category = null;
    for (int i=0; i < reqCategories.length; i++)
    returnedAttrs = FdkUtils.getAttributesMap(reqCategories);
    log( "xxx name="+((String) returnedAttrs.get(Attributes.DISPLAY_NAME) ));
    if ( ((String) returnedAttrs.get(Attributes.DISPLAY_NAME)).
    equals("BG_Serv_Req"))
    category = reqCategories[i];
    break;
    log("category id="+category.getId());
    if (category != null)
    NamedValue[] internalCategoryAttrs = null;
    try {
    internalCategoryAttrs =getInternalCategoryAttrNames("BG_Serv_Req",session);
    }catch(Exception e)
    log("error getting internal names");
    e.printStackTrace();
    log("Category Attribute internal Name ="+ (String)internalCategoryAttrs[0].getValue());
    log("Category Attribute internal Name ="+ (String)internalCategoryAttrs[1].getValue());
    NamedValue[] categoryInstanceAttributes = new NamedValue[] { 
    // use the internal attribute name for all attributes
    new NamedValue((String)internalCategoryAttrs[0].getValue(), "XNXNXNXN 234"),
    new NamedValue((String)internalCategoryAttrs[1].getValue(), "SNKKSKSK 1234")
    NamedValue[] categoryDef = new NamedValue[] { 
    // the id of the category object class for which this new category will be an
    //instance of
    new NamedValue(Options.CATEGORY_CLASS_ID, new Long(category.getId())),
    // the updated values of the category instance
    new NamedValue(Options.CATEGORY_DEFINITION_ATTRIBUTES, categoryInstanceAttributes)
    String sourceFile="test.doc";
    String folderPath = "C:\\upload";
    requestedAttributes = FdkUtils.newAttributeRequestArray(Attributes.URL);
    Item doc = fileM.resolveRelativePath(folder.getId(),sourceFile, requestedAttributes);
    log("START ORACLE TEST CODE FROM TAR");
    // this will get the category instance id
    AttributeRequest categoryAR = new AttributeRequest();
    categoryAR.setAttributeName(Attributes.CATEGORIES);
    AttributeRequest[] attrRequests = new AttributeRequest[]
    { categoryAR};
    Item myDoc = commonM.getItem(doc.getId(), attrRequests);
    NamedValue[] requestedAttributesNV = myDoc.getRequestedAttributes();
    int length = requestedAttributesNV == null ? 0 :
    requestedAttributesNV.length;
    Item[] itemCategories = null;
    log("length="+length);
    for (int i = 0; i < length; i++)
    log("requestedAttributesNV[i].getName()="+requestedAttributesNV[i].getName());
    if(requestedAttributesNV[i].getName().equals(Attributes.CATEGORIES))
    itemCategories = (Item[]) requestedAttributesNV[i].getValue();
    length = itemCategories == null ? 0 : itemCategories.length;
    log("length="+length);
    long categoryInstanceId = 0;
    for (int i = 0; i < length; i++)
    log("Category instance " + itemCategories[i].getName() + " has id " +
    itemCategories[i].getId());
    categoryInstanceId = itemCategories[i].getId();
    log("END ORACLE TEST CODE FROM TAR");
    /* If the document does not exist in OCS */
    if (doc == null) {
    requestedAttributes = FdkUtils.newAttributeRequestArray(Attributes.URL);
    NamedValue[] nvdoc = FdkUtils.newNamedValueArray(
    new Object[][] { { Attributes.NAME,sourceFile} }
    Item def = fileM.createDocumentDefinition(nvdoc,requestedAttributes);
    int uploadStatusCode = uploadContent(
    session,
    getSampleFileStream(sourceFile,folderPath),
    (String) FdkUtils.getAttribute(def,Attributes.URL)
    log("Upload Status to definition file: "+uploadStatusCode);
    nvdoc = FdkUtils.newNamedValueArray(
    new Object[][]
    { Attributes.NAME,sourceFile},
    { Options.USE_SAVED_DEFINITION, new Long(def.getId())},
    { Options.DESTFOLDER, new Long(folder.getId()) },
    // apply category instance informationnew
    { Options.CATEGORY_DEFINITION, categoryDef }
    requestedAttributes = FdkUtils.newAttributeRequestArray(Attributes.URL);
    doc = fileM.createDocument(nvdoc,null,requestedAttributes);
    }else /* if document already exist in OCS */
              log(sourceFile+" file exists so updating ...");
    int uploadStatusCode = uploadContent(
    session,
    getSampleFileStream(sourceFile,folderPath),
    (String) FdkUtils.getAttribute(doc ,Attributes.URL)
    log("uploadStatusCode="+uploadStatusCode);
    FileInputStream fi= getSampleFileStream(sourceFile,folderPath);
    log("category id using in update="+ category.getId());
    NamedValue[] updatecatdef = new NamedValue[] {
    //new NamedValue(Options.UPDATE_CATEGORY_ID, new Long(category.getId())),
    new NamedValue(Options.UPDATE_CATEGORY_ID, new Long(categoryInstanceId)),
    new NamedValue(Options.CATEGORY_DEFINITION_ATTRIBUTES,
    new NamedValue[] {
    new NamedValue((String)internalCategoryAttrs[0].getValue(), "AH234 V2"),
    new NamedValue((String)internalCategoryAttrs[1].getValue(), "SNHGZ12 V2")
    NamedValue[] nv = FdkUtils.newNamedValueArray(
    new Object[][]
    { Attributes.NAME,sourceFile},
    { Attributes.DESCRIPTION,"Sample file"},
    //{Options.CONTENTSTREAM, fi},
    { Options.CATEGORY_DEFINITION, updatecatdef }//Newly added for category upload
    requestedAttributes = FdkUtils.newAttributeRequestArray(Attributes.URL);
    // THIS IS WHERE WE ARE GETTING ERROR
    fileM.updateDocument(doc.getId(),nv,requestedAttributes);
    System.out.println("doc = fm.updateDocument is complete ........." );
    } // end if (Document Confidentiality category present)
    } // end if category configuration enabled / overridable etc
    catch (FdkException fe)
    FdkUtils.log(fe);
    fe.printStackTrace();
    catch (Exception e)
    // java.net.MalformedURLException;
    // java.rmi.RemoteException;
    // javax.xml.rpc.ServiceException;
    // org.apache.axis.AxisFault
    log("Fatal exception occurred in run():");
    e.printStackTrace();
    finally
    if (session != null)
    session.disconnect();
    log("\n"+this.getClass().getName()+": ending");
    private FileInputStream getSampleFileStream(String filename,String path)
    throws FileNotFoundException
    FileInputStream stream = null;
    if (filename != null && filename.length() >= 1)
    if (path.length() >=1 && !path.endsWith("/"))
    path += "/";
    stream = new FileInputStream(new File(path+filename));
    return stream;
    public int uploadContent(
    FdkSession session,
    InputStream inputStream,
    String destinationURL
    throws Exception
    int statusCode = -1;
    if (inputStream == null) return statusCode;
    HTTPConnection conn = null;
    try
    URL url = new URL(destinationURL);
    conn = session.getHttpConnection(url);
    byte[] buffer = new byte[8192];
    int count=0;
    HttpOutputStream outputStream = new HttpOutputStream();
    HTTPResponse response = conn.Put(url.getFile(), outputStream);
    try
    while ((count = inputStream.read(buffer)) != -1)
    outputStream.write(buffer, 0, count);
    finally
    outputStream.flush();
    outputStream.close();
    statusCode = response.getStatusCode();
    finally
    if (inputStream != null)
    inputStream.close();
    if (conn != null)
    conn.stop();
    conn = null;
    return statusCode;
    // Handle the response. Note that a successful response may not be
    // 200, but may also be 201 Created, 204 No Content or any of the other
    // 2xx range responses.
    public void log(String s)
    System.out.println(s);
    public NamedValue[] getInternalCategoryAttrNames(String categoryName,FdkSession session) throws Exception
    NamedValue[] returnNV = null;
    Map attmap = new HashMap();
                   attmap.put(Attributes.METADATA_ATTRIBUTES,
                   FdkUtils.newAttributeRequestArray(
                   new String[] { Attributes.ATTRIBUTE_NAME,
                   Attributes.DISPLAY_NAME }));
                   AttributeRequest[] request = FdkUtils.getAttributeRequestArray(attmap);
                   Item cat = FdkUtils.getCategoryObject(session, null, categoryName, request);
    log("inside method cat id="+cat.getId());
    /** ANAKKALA START **/
    NamedValue[] catNV = cat.getRequestedAttributes();
    if( catNV != null && catNV.length >0)
    for (int i=0; i<catNV.length; i++)
    if(catNV[i].getName().equals("METADATA_ATTRIBUTES"))
    //log("** CatNV.getName="+catNV[i].getName()+" value="+catNV[i].getValue());
    Item[] meta = (Item[]) catNV[i].getValue();
    log("meta length="+meta.length);
    returnNV = new NamedValue[meta.length];
    for (int j=0; j<meta.length; j++)
    log("--Item getname="+meta[j].getName()+" value="+meta[j].getId()+" gettype="+meta[j].getType()+" gettypedesc="+meta[j].getTypeDesc());
    returnNV[j] = new NamedValue(meta[j].getName(),meta[j].getName());
    NamedValue[] metaNV = meta[j].getRequestedAttributes();
    log("---metaNV length="+metaNV.length);
    for(int k=0; k<metaNV.length; k++)
    log("------metaNV.getName="+metaNV[k].getName()+" value="+metaNV[k].getValue());
    /** ANAKKALA END **/
    //NamedValue[] ret = null;
    return returnNV;

  • Default value for a table field?

    Hi,
    I have a table which contains the fields USER_NAME and DATE_CHANGED_AT.
    here's what i want to do:
    When we use se16 to enter data into the table, i want these fields to have default values .
    user_name should contain the currently logged in user.
    date_changed_at should contain todays date.
    The aim is to eventually have these fields contain the person who last changed the row and the date when it was changed.
    It doesnt matter if se16 doesnt contain it and we have a way of defaulting these values thru the table creation process.
    something similar to the mandt field. When we create the table data, MANDT field is pre-populated.
    Any thoughts?
    Regards
    Vandana

    Entering data using SE16 is not a good practice .
    YOu have to use table maintenance generator to maintable the table entries.
    This also provides with options to write your own code to meet requirements like this.
    EVENTS in table maintenance generator
    Regards,
    Ravi

  • How to Add column with default value in compress table.

    Hi ,
    while trying to add column to compressed table with default value i am getting error.
    Even i tried no compress command on table still its giivg error that add/drop not allowed on compressed table.
    Can anyone help me in this .
    Thanks.

    Aman wrote:
    while trying to add column to compressed table with default value i am getting error.This is clearly explain in the Oracle doc :
    "+You cannot add a column with a default value to a compressed table or to a partitioned table containing any compressed partition, unless you first disable compression for the table or partition+"
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_3001.htm#sthref5163
    Nicolas.

  • How to get column default value define on table?

    Hi,
    I am trying to get a table column default value with no success. I am using the Oracle Data Provider for .NET 10g Release 2 (10.2.0.2)
    1). OracleConnection.GetSchema( "Columns", New System.String() {"<Owner>", "<Table_Name>"} returns everything BUT default value.
    2). I tried querying oracle directly (sample below) but the default value comes back blank even though the column has one defined.
    Dim oracleConnection As Oracle.DataAccess.Client.OracleConnection = factory.CreateConnection
    Dim oracleCommand As New Oracle.DataAccess.Client.OracleCommand( _
    "SELECT data_default FROM DBA_TAB_COLUMNS WHERE OWNER = 'TEST_SCHEMA' AND UPPER( TABLE_NAME ) = 'TEST' AND UPPER(COLUMN_NAM) = 'TESTCOL'")
    oracleConnection.Open()
    oracleCommand.Connection = oracleConnection
    Dim oracleReader As Oracle.DataAccess.Client.OracleDataReader = oracleCommand.ExecuteReader
    oracleReader.GetValue(0) 'This will return blank rather than default value for the column.
    oracleReader.Read()
    oracleReader.Close()
    oracleConnection.Close()
    Any help would be appreciated.
    Thanks,
    Rob Panosh
    Advanced Software Designs

    Hi Rob,
    I just ran up a quick test and I can't duplicate the behavior you describe.
    I created a simple table as "scott":
    SQL> create table def_test(c varchar2(32) default 'hello, world');
    Table created.In my simple test I used the following C# code:
    NOTE: There is an error in this code if using ODP.NET (see my post below for details on this)
    using System;
    using System.Data;
    using System.Data.OracleClient;
    class Program
      static void Main(string[] args)
        string constr = "user id=scott;" +
                        "password=tiger;" +
                        "data source=orademo;" +
                        "pooling=false;" +
                        "enlist=false";
        OracleConnection con = new OracleConnection(constr);
        con.Open();
        OracleCommand cmd = con.CreateCommand();
        cmd.CommandText = "select   data_default " +
                          "from     all_tab_columns " +
                          "where    owner='SCOTT' " +
                          "and      table_name='DEF_TEST' " +
                          "and      column_name='C'";
        OracleDataReader dr = cmd.ExecuteReader();
        dr.Read();
        string defaultValue = (string) dr.GetValue(0);
        Console.WriteLine("Default value is: {0}", defaultValue);
        dr.Dispose();
        cmd.Dispose();
        con.Dispose();
    }Since the GetValue method returns an "object" I cast the value to a string and got the correct result.
    However, I don't have a 10.2 ODP.NET environment right now so I was using 11.1 for this.
    In your real code I suspect that you assign "oracleReader.GetValue(0)" to something - when you say "blank" do you mean zero length or a space or something else?
    Regards,
    Mark
    Edited by: Mark Williams on Jul 31, 2009 10:02 AM

Maybe you are looking for