Editing Data Grid Records

I'm experiencing an odd problem with a "quick and dirty" test
application I built today using the ColdFusion wizzard in the
production release of Flex 2 Builder. The application connects to a
single datasource, displays a data grid with two fields
(approximately 120 records in the source table), and contains the
wizzard provided buttons for adding, editing, and deleting the data
grid records. When I select a record in the data grid and click the
edit button, a second form (a detail page as defined in the
wizzard) pops open with access to all fields in my table. The
problem is, the data flashes (no pun intended) briefly in the form
fields, and then dissappears so what I'm left with is an "add new
record" form. Now here's the weird part: If I'm using a browser on
the machine where I built the Flex app, the details page displays
fine with all data fields filled out properly with the contents of
the table. If I'm using a browser on the virtual server I'm using
to host the CF server, again, everything displays fine. It's only
when I access the application from another system on the network
that I see the dissappearing data effect. I've verified that each
browser instance is running the most current version of Flash
player 9. I've also ensured that (for testing purposes) the
crossdomain.xml file is set to "*" (thinking that it might be some
strange cross domain issue manifesting itself).
On a seperate note, the "master/detail" version of this
application (where the data grid and detail editor are on the same
form) works perfectly no matter where I'm accessing the
application. Any ideas would be appreciated.
Thanks - Michael McConnell

Could be a timing issue with when the data comes back from
CF. I would get into the debugger or add trace statements to find
out when/why the fields are getting set/reset

Similar Messages

  • PARTIALLY Editable data grid?

    As the title says.
    I've got a data grid. Most of the entries are editable, using
    an item Editor (numeric stepper). However, several rows are not
    editable.
    Is there a way to make certain rows in a data set
    non-editable, and how?

    You can also intercept the itemEditBeginning event and if you
    don't want the cell to be edited, do event.preventDefault().

  • How can we find out data in an editable ALV grid has been changed or not?

    Hi Experts,
    How can we find out whether a data in an editable ALV grid has been changed or not.
    I am using the
    FM -> REUSE_ALV_GRID_DISPLAY_LVC
    for ALV display.
    I have to chekc whther data has been changed or not befor saving. if changed then only i want to
    SAVE
    . I cannot use the internal table comparison method for this purpose also i am not using OOP ALV.
    So kindly sugest me an alternative.
    Thanks and Regards,
    Shahana

    Hi,
    Thanks for your answer. I already saw this post.
    See this method.
    CALL METHOD reuse_alv_grid->check_changed_data
    IMPORTING
    e_valid = lv_check.
    This will update the internal table with the edited values. Then we can go for internal table comparison.
    But my scenario will not allow me for itab comparisons.I just want to know the ALV data has been changed or not.
    Regards,
    Shahana

  • Editable data in excel view of alv grid

    hi friends..
    now i am displaying the data in alv grid..
    my requirement is i want to display the data in excel format.. (not in seperate excel..)
    i want to display the excel sheet with data within the screen itself.
    for this
    i tried this scenario by fallowing steps
    in layout->view tab->microsoft excel..
    (layout button in the application toolbar i.e pf-status)
    it show excel sheet within report and data with excel sheet.
    now i got data in excel sheet.
    but my requirement is if i made any changes in data in excel means
    i want those updated or edited data in the another internal table..
    this scenario is work in the case of abap list viewer (instead of microsoft excel)
    for this i use one button in the pf-status (UPDATE).
    after made changes in grid data i export those modified data to abap memory and download to another internal table..
    how can i get the same scenario in micosoft excel

    Hi,
    Please make sure that you have made a <b>global</b>
    <b>declaration</b> for the ALV Grid control.If not try
    with this
    Please reward points if this explanation is useful.
    Regards,
    Siva

  • How to Transfer Data from editable ALV grid control to internal table?

    Hi,
    Can anyone give me a simple example by which I can transfer data from editable alv grid control back to the internal table. The ALV has been created by OO approach.
    I would appreciate if the solution is provided without handling any events.
    Regards,
    Auro

    Hello Auro
    You simply need to call method <b>go_grid->check_changed_data</b> at PAI of the dynpro displaying the ALV grid. If data have been changed on the editable ALV grid then this method will raise event DATA_CHANGED. If you do not want or need to handle this event (e.g. for validating the edited values) then you do not define any event handler method.
    Regards
      Uwe

  • Get edited data ou of grid back into internal tabel

    Hi dear all,
    after the help of so brilliant tutors i now can edit my ALV Grid, but I dont't know how i can get the content of the edited rows back into the internal table (it_outtab). I studied several methods, but for example the method SAVE_DATA is private, so I can't use it out of my program.
    Many  many thanks in advance for th friendly colleague who knows the answer.
    Dorothea.

    Hello Dorothea
    If you just want that your itab contents reflects the data on the editable ALV grid then the simplest solution is to call the appropriate method at PAI:
    " Your dynpro flow logic may look like this:
    PROCESS BEFORE OUTPUT.
      MODULE STATUS_0100.
    PROCESS AFTER INPUT.
      MODULE USER_COMMAND_0100.
    *& Module USER_COMMAND_0100 INPUT
    * text
    MODULE user_command_0100 INPUT.
      CALL METHOD go_grid->check_changed_data( ).  " retrieves changes from editable ALV grid
                                                                                " and updates itab, e.g. gt_outtab
    " NOTE: If you do not need to validate the changed data there is no need
    "            to define an event handler method.
    CASE gd_okcode.
    WHEN 'BACK' OR
    'END' OR
    'CANC'.
    SET SCREEN 0. LEAVE SCREEN.
    WHEN OTHERS.
    ENDCASE.
    CLEAR: gd_okcode.
    ENDMODULE. " USER_COMMAND_0100 INPUT
    You may want to have a look at ALV GRID Problem with reading contents and my dicussion with David Halitsky in Where/how would you add the actual DB update to BCALV_EDIT_03?.
    Regards
      Uwe

  • Hot to use the data grid to edit column objects

    I have a simple object type:
    CREATE OR REPLACE TYPE TIMESLICE AS OBJECT
    SINCE TIMESTAMP (6),
    UNTIL TIMESTAMP (6)
    And a simple table with one column containing objects of this type:
    CREATE TABLE TABLE1
    COLUMN1 TIMESLICE
    I can insert into the table:
    INSERT INTO SLICES VALUES (timeslice (NULL, NULL));
    But when I try to use the data grid and write there the same string "timeslice (NULL, NULL)" as value I get the following error during commit:
    One error saving changes to table "TABLE1":
    Row 1: ORA-06550: line 1, column 55:
    PL/SQL: ORA-00932: inconsistent datatypes: expected UDT got CHAR
    ORA-06550: line 1, column 7:
    PL/SQL: SQL Statement ignored
    The data grid interprets the value as characters instead of an expression.
    How do I have to enter the object in the data grid?

    Is it possible to access the cache datasource inside the script component which is available in the same data flow task??
    Thanks in advance,
    Saravanan

  • Can not open data grids or run reports in HFM

    Hi
    We created an application and have been working in it for weeks without any issues. Just recently once we open the app, we can longer open data grids or run financial grids. The system just hangs and we do not get an error message. Has anyone experienced this? We are wondering if it is a space issue on one of the data base tables.

    Hello,
    I would start by checking with your DBA to see if you have any issues with table space. Next, i would log onto the HFM servers and see if you have any errors being recorded in the Application Event View. If you do have errors in your Event Viewer, can you please post them?
    Thanks
    Edited by: tonyfeole on Oct 13, 2009 1:33 PM

  • SQL Developer 1.1.0.21: Issues with Data Grid and SQL syntax checking

    In this new release of SQL Dev, when I execute a SQL in the SQL Worksheet and click in the Data Grid in the Results tab and try to navigate within a record using arrow keys, the grid cell enters into edit mode by default and so I cannot use the Left or Right arrow keys to navigate the grid. I am forced to use tab key to navigate. This is counter intuitive in my opinion.
    Is there any option to change this behavior?
    Another issue that I have come across is with SQL syntax checking. In some cases, when I press F9 to execute a SQL, it shows the SQL as executed i.e. shows something like 0.0134 seconds in the toolbar and no results displayed. In reality, the SQL had some syntax error which were NOT reported. This can be frustrating since now I have to fall back to SQL*Plus or TOAD just for syntax check.
    I like the fact that SQLDev highlights the current SQL but it would be more useful if it just indicated the first line of the current sql instead of highlighting the whole sql.
    Manish

    "In this new release of SQL Dev, when I execute a SQL in the SQL Worksheet and click in the Data Grid in the Results tab and try to navigate within a record using arrow keys, the grid cell enters into edit mode by default and so I cannot use the Left or Right arrow keys to navigate the grid. I am forced to use tab key to navigate. This is counter intuitive in my opinion."
    In the "Results" tab, Click Ctrl & Tab keys (at the same time) or with mouse click on any cell other than the first column (a sequence or rownum), you will be able to navigate using the arrow keys.
    "Another issue that I have come across is with SQL syntax checking. In some cases, when I press F9 to execute a SQL, it shows the SQL as executed i.e. shows something like 0.0134 seconds in the toolbar and no results displayed. In reality, the SQL had some syntax error which were NOT reported. This can be frustrating since now I have to fall back to SQL*Plus or TOAD just for syntax check."
    The 0.0134 seconds could be the result of the most recently executed successful statement. Check the Script Output tab for errors. Use F5 (Run Script option) instead of F9.
    "I like the fact that SQLDev highlights the current SQL but it would be more useful if it just indicated the first line of the current sql instead of highlighting the whole sql."
    On the SQL statement (or code), Right Click -> Format SQL (or press Ctrl & B), proper formatting would help.
    I use version 1.0.0.15.57 and seems to be working allright.
    - Babu Rangasamy

  • Issues with Data Grid Combo Boxes

    Hi,
    I am trying to implement, 3 combo boxes for each row in extended data grid but unable to find the solution. Can someone please help?
    Problem in detail:
    The issue is after populating the data grid i want to give users 3 options  using 3 combo boxes(i.e each row in data grid will now have 3 options , which is basically converting 1 row into 3 rows with 3 options),so that they are able to do their computations.
    This is reallly urgent, any help would be highly appreciated.
    Thanks & Regards
    Pankaj

    "In this new release of SQL Dev, when I execute a SQL in the SQL Worksheet and click in the Data Grid in the Results tab and try to navigate within a record using arrow keys, the grid cell enters into edit mode by default and so I cannot use the Left or Right arrow keys to navigate the grid. I am forced to use tab key to navigate. This is counter intuitive in my opinion."
    In the "Results" tab, Click Ctrl & Tab keys (at the same time) or with mouse click on any cell other than the first column (a sequence or rownum), you will be able to navigate using the arrow keys.
    "Another issue that I have come across is with SQL syntax checking. In some cases, when I press F9 to execute a SQL, it shows the SQL as executed i.e. shows something like 0.0134 seconds in the toolbar and no results displayed. In reality, the SQL had some syntax error which were NOT reported. This can be frustrating since now I have to fall back to SQL*Plus or TOAD just for syntax check."
    The 0.0134 seconds could be the result of the most recently executed successful statement. Check the Script Output tab for errors. Use F5 (Run Script option) instead of F9.
    "I like the fact that SQLDev highlights the current SQL but it would be more useful if it just indicated the first line of the current sql instead of highlighting the whole sql."
    On the SQL statement (or code), Right Click -> Format SQL (or press Ctrl & B), proper formatting would help.
    I use version 1.0.0.15.57 and seems to be working allright.
    - Babu Rangasamy

  • Data grid Pull

    I want my data to fill a data grid
    but I am getting a comma delimmited grid with only one record and all of the data going into the first record as comma delimited data.
    what am I doing wrong here?
    Thanks in advance.
    <?xml version="1.0" encoding="utf-8"?>
    <s:Group 
    xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="
    library://ns.adobe.com/flex/spark" xmlns:mx="
    library://ns.adobe.com/flex/halo" width="760" height="398" xmlns:mx1="library://ns.adobe.com/flex/mx" xmlns:functiondata="services.functiondata.*">
    <fx:Script>
    <![CDATA[
    import mx.controls.Alert; 
    import mx.events.FlexEvent; 
    protected function dataGrid_creationCompleteHandler(event:FlexEvent):void
    getDataResult.token = functionData.getData();
    getDataResult2.token = functionData.getData();
    ]]>
    </fx:Script>
    <fx:Declarations>
     <s:CallResponder id="getDataResult"/>
     <functiondata:FunctionData id="functionData" fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)" showBusyCursor="true"/>
     <s:CallResponder id="getDataResult2"/>
     </fx:Declarations>
     <s:Label x="0" y="0" text="Operating Procedures" fontWeight="bold" fontSize="15" textDecoration="underline"/>
     <s:Label x="0" y="23" text="DAGR KEY PAD" fontStyle="italic" fontWeight="bold"/>
     <mx1:VRule x="392" y="0" height="100%"/>
     <s:RichText x="401" y="44" text="* The DAGR obtains current position by simply turning the DAGR on with an open view of the sky." width="45%" fontStyle="italic"/>
     <s:Label x="408" y="0" text="POWER ON" fontSize="15" fontWeight="bold" textDecoration="underline"/>
     <s:Label x="405" y="77" text="a) Push and release the PWR/QUIT key to turn the DAGR on."/>
     <s:RichText x="406" y="91" text="b) The POWER ON STATUS message is displayed for two seconds (If a CV Key, GUV key, SV code, internal compass condition exist, acknowledge message accordingly), then the SV Sky View Page is automatically displayed if the following are true. (1) Self-test has passed; (2) DAGR does not need initialization." width="45%"/>
     <s:RichText x="427" y="179" text="c) From the SV Sky View page, the DAGR automatically displays the present position page after acquiring the current position. " width="45%"/>
     <s:Label x="409" y="211" text="POWER OFF" fontSize="15" fontWeight="bold" textDecoration="underline"/>
     <s:Label x="403" y="233" text="a) Push and hold PWR/QUIT key for 2 seconds."/>
     <s:Label x="403" y="246" text="b) DAGR displays WARNING acknowledge as necessary"/>
     <s:Label x="400" y="264" text="DISPLAY LIGHTING" fontSize="15" fontWeight="bold" textDecoration="underline"/>
     <s:Label x="397" y="287" text="a) If keypad/Display lighting is required, turn display light on/off by pushing and holding the BRIGHTNESS/MENY key." width="45%"/>
     <s:Label x="398" y="341" text="b) Display lighting on/off status can be verified by observing the display lighting status indicator." width="45%"/>
     <s:TextArea x="10" y="40" width="374" editable="true" fontSize="13">
     <s:text><![CDATA[* All of the keys on the DAGR keypad are duel function (primary/secondary) except for the cursor (arrow) keys. Each duel function key is labeled with two sets of letters. All primary function keys are labeled with large letters and all secondary functions are labeled with smaller letters. Push and release to activate the primary function of the key. Push and hold (for 2 seconds) to activate the secondary function of the key. Use cursor keys to scroll up and down as well as left and right within pages. Press and release the QUIT/PWR key and POS/PAGE key to advance from one page to another.]]></s:text>
     </s:TextArea>
     <mx1:DataGrid x="47" y="211" id="dataGrid" creationComplete="dataGrid_creationCompleteHandler(event)" dataProvider="{getDataResult2.lastResult.category}">
     <mx1:columns>
     <mx1:DataGridColumn headerText="category" dataField="category"/>
     <mx1:DataGridColumn headerText="category_id" dataField="category_id"/>
     <mx1:DataGridColumn headerText="categoryName" dataField="categoryName"/>
     </mx1:columns>
     </mx1:DataGrid>
     </s:Group>-------------------------------------

    Now the data grid is pulling all of the records from the XML file as the top record in the data grid with off of the data from the xml file as comma delimited.
    App Code:
         <?xml version="1.0" encoding="utf-8"?>
    <s:Group 
    xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="
    library://ns.adobe.com/flex/spark" xmlns:mx="
    library://ns.adobe.com/flex/halo" width="760" height="398" xmlns:mx1="library://ns.adobe.com/flex/mx" xmlns:functiondata="services.functiondata.*">
    <fx:Script>
    <![CDATA[
    import mx.controls.Alert; 
    import mx.events.FlexEvent; 
    protected function dataGrid_creationCompleteHandler(event:FlexEvent):void
    getDataResult.token = functionData.getData();
    ]]>
    </fx:Script>
    <fx:Declarations>
    <s:CallResponder id="getDataResult"/>
    <functiondata:FunctionData id="functionData" fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)" showBusyCursor="true"/>
     </fx:Declarations>
     <s:Label x="0" y="0" text="Operating Procedures" fontWeight="bold" fontSize="15" textDecoration="underline"/>
     <s:Label x="0" y="23" text="DAGR KEY PAD" fontStyle="italic" fontWeight="bold"/>
     <mx1:VRule x="392" y="0" height="100%"/>
     <s:RichText x="401" y="44" text="* The DAGR obtains current position by simply turning the DAGR on with an open view of the sky." width="45%" fontStyle="italic"/>
     <s:Label x="408" y="0" text="POWER ON" fontSize="15" fontWeight="bold" textDecoration="underline"/>
     <s:Label x="405" y="77" text="a) Push and release the PWR/QUIT key to turn the DAGR on."/>
     <s:RichText x="406" y="91" text="b) The POWER ON STATUS message is displayed for two seconds (If a CV Key, GUV key, SV code, internal compass condition exist, acknowledge message accordingly), then the SV Sky View Page is automatically displayed if the following are true. (1) Self-test has passed; (2) DAGR does not need initialization." width="45%"/>
     <s:RichText x="427" y="179" text="c) From the SV Sky View page, the DAGR automatically displays the present position page after acquiring the current position. " width="45%"/>
     <s:Label x="409" y="211" text="POWER OFF" fontSize="15" fontWeight="bold" textDecoration="underline"/>
     <s:Label x="403" y="233" text="a) Push and hold PWR/QUIT key for 2 seconds."/>
     <s:Label x="403" y="246" text="b) DAGR displays WARNING acknowledge as necessary"/>
     <s:Label x="400" y="264" text="DISPLAY LIGHTING" fontSize="15" fontWeight="bold" textDecoration="underline"/>
     <s:Label x="397" y="287" text="a) If keypad/Display lighting is required, turn display light on/off by pushing and holding the BRIGHTNESS/MENY key." width="45%"/>
     <s:Label x="398" y="341" text="b) Display lighting on/off status can be verified by observing the display lighting status indicator." width="45%"/>
     <s:TextArea x="10" y="40" width="374" editable="true" fontSize="13">
     <s:text><![CDATA[* All of the keys on the DAGR keypad are duel function (primary/secondary) except for the cursor (arrow) keys. Each duel function key is labeled with two sets of letters. All primary function keys are labeled with large letters and all secondary functions are labeled with smaller letters. Push and release to activate the primary function of the key. Push and hold (for 2 seconds) to activate the secondary function of the key. Use cursor keys to scroll up and down as well as left and right within pages. Press and release the QUIT/PWR key and POS/PAGE key to advance from one page to another.]]></s:text>
     </s:TextArea>
     <mx1:DataGrid x="10" y="211" id="dataGrid" creationComplete="dataGrid_creationCompleteHandler(event)" dataProvider="{getDataResult.lastResult}">
     <mx1:columns>
     <mx1:DataGridColumn headerText="catID" dataField="catID"/>
     <mx1:DataGridColumn headerText="categoryName" dataField="categoryName"/>
     </mx1:columns>
     </mx1:DataGrid>
     </s:Group>--------------------------
    XML File:
    <? xml version="1.0" encoding="utf-8" ?> 
    < main>
     <catID>1</catID>
     <categoryName>F1/FUNCTION KEY</categoryName>
     <catID>2</catID>
     <categoryName>F2/OUT FUNCTION KEY</categoryName>
     <catID>3</catID>
     <categoryName>F3/STATUS FUNCTION KEY</categoryName>
     <catID>4</catID>
     <categoryName>POS/PAGE KEY</categoryName>
     <catID>5</catID>
     <categoryName>BRIGHTNESS/MENU KEY</categoryName>
     <catID>6</catID>
     <categoryName>WP/ENTER KEY</categoryName>
     <catID>7</catID>
     <categoryName>RIGHT CURSOR CONTROL KEY</categoryName>
     <catID>8</catID>
     <categoryName>DOWN CURSOR CONTROL KEY</categoryName>
     <catID>9</catID>
     <categoryName>LEFT CURSOR CONTROL KEY</categoryName>
     <catID>10</catID>
     <categoryName>UP CURSOR CONTROL KEY</categoryName>
     <catID>11</catID>
     <categoryName>PWR/QUIT KEY</categoryName></ 
    main>

  • Display value in data grid

    08/29/2008 08:58:48 AM
    Reply | Quote | Top | Bottom | Edit
    hi all,
    i have two classes.
    class User
    public String name;
    public int age;
    public Address address;
    class Address
    public String city;
    I'm passing a List<Users> to the data provider of a
    data grid . I can display the values of properties of Users i.e,
    name and age.. My issue is how do i display the value of city which
    is a propertyt of Address class in the datagrid column..
    thanx in advance
    Mark this message as the answer.
    Print this message
    Report this to a Moderator

    Hi,
    Try labelFunction property of the DataGridColumn.
    labelFunction allow you to specify a function name, which will be
    invoked when that data is rendered. You will get the Object (User
    id your case) corresponding the row being rendered will be passed
    as argument to the function. You can use the object and return the
    value you want to be displayed.
    Please find more details on labelFunction at the URL below
    http://livedocs.adobe.com/flex/3/langref/mx/controls/dataGridClasses/DataGridColumn.html#l abelFunction
    You can also try custom item renderer.
    Hope this helps.

  • FillBy always fills in the same row in data grid view. How to make it fill in a new row for each click of the Fillby Button? VB 2010 EXPRESS?

    Hi there, 
    I am a beginner in Visual Basic Express 2010. I have a Point of Sale program that uses DataGridView to display records from an external microsoft access
    database using the fillby query. 
    It works, but it repopulates the same row each time, but i want to be able to display multiple records at the same time, a new row should be filled for
    each click of the fillby button. 
    also I want to be able to delete any records if the customer suddenly decides to not buy an item after it has already been entered. 
    so actually 2 questions here: 
    1. how to populate a new row for each click of the fillby button 
    2. how to delete records from data grid view after an item has been entered 
    Thanks 
    Vishwas

    Hello,
    The FillBy method loads data according to what the results are from the SELECT statement, so if there is one row then you get one row in the DataGridView, have two rows then two rows show up.
    Some examples
    Form load populates our dataset with all data as it was defined with a plain SELECT statement. Button1 loads via a query I created after the fact to filter on a column, the next button adds a new row to the existing data. When adding a new row it is appended
    to the current data displayed and the primary key is a negative value but the new key is shown after pressing the save button on the BindingNavigator or there are other ways to get the new key by manually adding the row to the backend table bypassing the Adapter.
    The following article with code shows this but does not address adapters.
    Conceptually speaking the code in the second code block shows how to get the new key
    Public Class Form1
    Private Sub StudentsBindingNavigatorSaveItem_Click(
    sender As Object, e As EventArgs) Handles StudentsBindingNavigatorSaveItem.Click
    Me.Validate()
    Me.StudentsBindingSource.EndEdit()
    Me.TableAdapterManager.UpdateAll(Me.MyDataSet)
    End Sub
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    'TODO: This line of code loads data into the 'MyDataSet.Students' table. You can move, or remove it, as needed.
    Me.StudentsTableAdapter.Fill(Me.MyDataSet.Students)
    End Sub
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
    Me.StudentsTableAdapter.FillBy(Me.MyDataSet.Students, ComboBox1.Text)
    End Sub
    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
    Me.MyDataSet.Students.AddStudentsRow("Jane", "Adams", "Female")
    End Sub
    End Class
    Get new key taken from
    this article.
    Public Function AddNewRow(ByVal sender As Customer, ByRef Identfier As Integer) As Boolean
    Dim Success As Boolean = True
    Try
    Using cn As New OleDb.OleDbConnection With {.ConnectionString = Builder.ConnectionString}
    Using cmd As New OleDb.OleDbCommand With {.Connection = cn}
    cmd.CommandText = InsertStatement
    cmd.Parameters.AddWithValue("@CompanyName", sender.CompanyName)
    cmd.Parameters.AddWithValue("@ContactName", sender.ContactName)
    cmd.Parameters.AddWithValue("@ContactTitle", sender.ContactTitle)
    cn.Open()
    cmd.ExecuteNonQuery()
    cmd.CommandText = "Select @@Identity"
    Identfier = CInt(cmd.ExecuteScalar)
    End Using
    End Using
    Catch ex As Exception
    Success = False
    End Try
    Return Success
    End Function
    In closing I have not given you a solution but hopefully given you some stuff/logic to assist with this issue, if not perhaps I missed what you want conceptually speaking.
    Additional resources
    http://msdn.microsoft.com/en-us/library/fxsa23t6.aspx
    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem.

  • Here's how to do ALV (OO) with dynamic fcat, int table and editable data

    Hi everybody
    Here's a more useful approach to ALV grid with OO using dynamic table, data NOT from DDIC, dynamic FCAT and how to get changed lines from the grid when ENTER key is pressed.
    It's really not too dificult but I think this is more useful than the ever present SFLIGHT methods from the demos.
    This also defines a subclass of cl_gui_alv_grid so you can access the protected attributes / methods of that class.
    You don't need to add the class via SE24 -- done fron this ABAP.
    When you run it click Edit for the first time.
    After editing data press ENTER and the break point should bring you into the relevant method.
    Code developed on NW2004S trial version but also works on rel 6.40 on a "Real" system.
    The code should work without any changes on any system >=6.40.
    All you need to do is to create a blank screen 100 via SE51  with a custom container on it called CCONTAINER1.
    The rest of the code can just be uploaded into your system using the SE38 upload facility.
    When running the program click on the EDIT button to enable the edit functionality of the grid.
    Change your data and when you press ENTER you should get the break-point where you can see the original table and changed rows.
    This program is actually quite general as it covers Dynamic tables, building a dynamic fcat where your table fields are NOT in the DDIC, intercepting the ENTER key via using an event, and accessing the protected attributes of the cl_gui_alv_grid by defining a subclass of this class in the abap.
    I've seen various questions relating to all these functions but none in my view ever answers the questions in a simple manner. I hope this simple program will answer all these and show how using OO ALV is actually quite easy and people shouldn't be scared of using OO.
    Have fun and award points if useful.
    Cheers
    Jimbo.
    <b>PROGRAM zdynfieldcat.
    Simple test of dynamic ITAB with user defined (not ddic) fields
    Build dynamic fcat
    use ALV grid to display and edit.
    *When edit mode set to 1 toolbar gives possibility of adding and
    *deleting rows.
    *Define subclass of cl_gui_alv_grid so we can use protected attributes
    *and methods.
    Add event handler to intercept user entering data and pressing the
    *ENTER key.
    When enter key is pressed get actual value of NEW table (all rows)
    rather than just the changed data.
    *use new RTTI functionality to retrieve internal table structure
    *details.
    Create a blank screen 100  with a custom container called CCONTAINER1.
    James Hawthorne
    include <icon>.
    define  any old internal structure  NOT in DDIC
    types: begin of s_elements,
           anyfield1(20) type c,
           anyfield2(20) type c,
           anyfield3(20) type c,
           anyfield4(20) type c,
           anyfield5(11) type n,
           end of s_elements.
    types:  lt_rows  type lvc_t_roid.
    Note new RTTI functionality allows field detail retrieval
    at runtime for dynamic tables.
    data:   wa_element type s_elements ,
            wa_data type s_elements,
            c_index type sy-index,
            c_dec2 type s_elements-anyfield5,
            wa_it_fldcat type lvc_s_fcat,
            it_fldcat type lvc_t_fcat,
            lr_rtti_struc TYPE REF TO cl_abap_structdescr,    "RTTI
            lt_comp TYPE cl_abap_structdescr=>component_table,"RTTI
            ls_comp LIKE LINE OF lt_comp,                     "RTTI
            zog  like line of lr_rtti_struc->components,      "RTTI
            struct_grid_lset type lvc_s_layo,
            l_valid  type c,
            new_table type ref to data.
    field-symbols: <dyn_table> type standard table,
                   <actual_tab> type standard table,
                   <fs1> type ANY,
                   <FS2> TYPE TABLE.
    data: grid_container1 type ref to cl_gui_custom_container.
    class lcl_grid_event_receiver definition deferred.
    data: g_event_receiver type ref to lcl_grid_event_receiver.
    data: ls_modcell type LVC_S_MODI,
          stab type ref to data,
          sdog type  s_elements.      .
    class lcl_grid_event_receiver definition.
      public section.
        methods:
        handle_data_changed
             for event data_changed of cl_gui_alv_grid
                 importing er_data_changed,
           toolbar for event toolbar of cl_gui_alv_grid
                     importing e_object
                               e_interactive,
          user_command for event user_command of cl_gui_alv_grid
                     importing e_ucomm.
    endclass.
    *implementation of Grid event-handler class
    class lcl_grid_event_receiver implementation.
    method handle_data_changed.
    code whatever required after data entry.
    various possibilites here as you can get back Cell(s) changed
    columns or the entire updated table.
    Data validation is also possible here.
    perform check_data using er_data_changed.
    endmethod.
    Method for handling all creation/modification calls to the toolbar
      method toolbar.
        data : ls_toolbar type stb_button.
    Define Custom Button in the toolbar
        clear ls_toolbar.
        move 0 to ls_toolbar-butn_type.
        move 'EDIT' to ls_toolbar-function.
        move space to ls_toolbar-disabled.
        move 'Edit' to ls_toolbar-text.
        move icon_change_text to ls_toolbar-icon.
        move 'Click2Edit' to ls_toolbar-quickinfo.
        append ls_toolbar to e_object->mt_toolbar.
        clear ls_toolbar.
        move 0 to ls_toolbar-butn_type.
        move 'UPDA' to ls_toolbar-function.
        move space to ls_toolbar-disabled.
        move 'Update' to ls_toolbar-text.
        move icon_system_save to ls_toolbar-icon.
        move 'Click2Update' to ls_toolbar-quickinfo.
        append ls_toolbar to e_object->mt_toolbar.
        clear ls_toolbar.
        move 0 to ls_toolbar-butn_type.
        move 'EXIT' to ls_toolbar-function.
        move space to ls_toolbar-disabled.
        move 'Exit' to ls_toolbar-text.
        move icon_system_end to ls_toolbar-icon.
        move 'Click2Exit' to ls_toolbar-quickinfo.
        append ls_toolbar to e_object->mt_toolbar.
      endmethod.
      method user_command.
        case e_ucomm .
          when 'EDIT'.          "From Tool bar
            perform set_input.
             perform init_grid.
          when 'UPDA'.          "From Tool bar
            perform refresh_disp.
            perform update_table.
          when 'EXIT'.          "From Tool bar
            leave program.
        endcase.
      endmethod.
    endclass.
    class zcltest definition inheriting from  cl_gui_alv_grid.
    define this as a subclass so we can access the protected attributes
    of the superclass cl_gui_alv_grid
    public section.
    methods: constructor, disp_tab.
    endclass.
    need this now to instantiate object
    as we are using subclass rather than the main cl_gui_alv_grid.
    class zcltest implementation.
    METHOD constructor.
    CALL METHOD super->constructor
            exporting i_appl_events = 'X'
               i_parent = grid_container1.
    endmethod.
    method disp_tab.
    FIELD-SYMBOLS: <outtab> TYPE STANDARD TABLE.
    break-point 1.
    mt_outtab is the data table held as a protected attribute
    in class cl_gui_alv_grid.
    ASSIGN me->mt_outtab->* TO <outtab>.  "Original data
    do whatever you want with <outtab>
    contains data BEFORE changes each time.
    Note that NEW (Changed) table has been obtained already by
    call to form check_data USING P_ER_DATA_CHANGED
             TYPE REF TO CL_ALV_CHANGED_DATA_PROTOCOL.
    Entered data is in table defined by <fs2>
    In this method you can compare original and changed data.
    Easier than messing around with individual cells.
    do what you want with data in <fs2>  validate / update / merge etc
    endmethod.
    endclass.
    data :
        ok_code like sy-ucomm,
        save_ok like sy-ucomm,
        i4 type int4,
    Container Object [grid_container]
    now created via method constructor
    in the subclass zcltest.
    Control Object [grid]
    grid1 type ref to zcltest,
    Event-Handler Object [grid_handler]
    grid_handler type ref to lcl_grid_event_receiver.
    start-of-selection.
    call screen 100.
    module status_0100 output.
    now display it as grid
    if grid_container1 is initial.
        create object grid_container1
            exporting
              container_name = 'CCONTAINER1'.
        create object grid1.
         break-point 1.
        create object grid_handler.
        set handler:
           grid_handler->user_command for grid1,
           grid_handler->toolbar for grid1,
           grid_handler->handle_data_changed for grid1.
    perform create_dynamic_fcat.
    perform create_dynamic_itab.
    perform populate_dynamic_itab.
    perform init_grid.
    perform register_enter_event.
    set off ready for input initially
    i4 = 0.
      call method grid1->set_ready_for_input
             exporting
               i_ready_for_input = i4.
    endif.
    endmodule.
    module user_command_0100 input.
    *PAI not needed in OO ALV anymore as User Commands are handled as events
    *in method user_command.
    *we can also get control if the Data entered and the ENTER is pressed by
    *raising an event.
    Control then returns to method handle_data_changed.
    endmodule.
    form create_dynamic_fcat.
    get structure of our user table for building field catalog
    Use the RTTI functionality
    lr_rtti_struc ?= cl_abap_structdescr=>describe_by_data( wa_data ).
    Build field catalog just use basic data here
    colour specific columns as well
    loop at lr_rtti_struc->components into zog.
    c_index = c_index + 1.
    clear wa_it_fldcat.
      wa_it_fldcat-fieldname = zog-name .
      wa_it_fldcat-datatype =  zog-type_kind.
      wa_it_fldcat-inttype =   zog-type_kind.
      wa_it_fldcat-intlen =    zog-length.
      wa_it_fldcat-decimals =  zog-decimals.
      wa_it_fldcat-lowercase = 'X'.
      if c_index eq 2.
      wa_it_fldcat-emphasize = 'C411'.
         endif.
        if c_index eq 3.
      wa_it_fldcat-emphasize = 'C511'.
       endif.
      append wa_it_fldcat to it_fldcat .
    endloop.
    endform.
    form create_dynamic_itab.
    Create dynamic internal table and assign to field sysmbol.
    Use dynamic field catalog just built.
    call method cl_alv_table_create=>create_dynamic_table
                 exporting
                    it_fieldcatalog = it_fldcat
                 importing
                    ep_table        = new_table.
    assign new_table->* to <dyn_table>.
    endform.
    form populate_dynamic_itab.
    load up a line of the dynamic table
    c_dec2 = c_dec2 + 11.
    wa_element-anyfield1 = 'Tabbies'.
    wa_element-anyfield2 = 'ger.shepards'.
    wa_element-anyfield3  = 'White mice'.
    wa_element-anyfield4 =  'Any old text'.
    wa_element-anyfield5 =  c_dec2.
    append  wa_element to <dyn_table>.
    endform.
    form check_data USING P_ER_DATA_CHANGED
               TYPE REF TO CL_ALV_CHANGED_DATA_PROTOCOL.
    Get altered data back
      ASSIGN   p_er_data_changed->mp_mod_rows TO <FS1>.
    stab =       p_er_data_changed->mp_mod_rows.
    ASSIGN STAB->* TO <FS2>.
    LOOP AT <FS2> INTO sdog.
    ALV grid display with altered data is now in <fs2>.
    do any extra processing you want here
    endloop.
    now display new table
    call method grid1->disp_tab.
    endform.
    form exit_program.
      call method grid_container1->free.
      call method cl_gui_cfw=>flush.
      leave program.
    endform.
    form refresh_disp.
      call method grid1->refresh_table_display.
    endform.
    form update_table.
    The dynamic table here is the changed table read from the grid
    after user has changed it
    Data can be saved to DB or whatever.
    loop at <dyn_table> into wa_element.
    do what you want with the data here
    endloop.
    switch off edit mode again for next function
    i4 = 0.
      call method grid1->set_ready_for_input
          exporting
              i_ready_for_input = i4.
    endform.
    form set_input.
    i4 = 1.
      call method grid1->set_ready_for_input
         exporting
           i_ready_for_input = i4.
    endform.
    form switch_input.
    if i4 = 1.
    i4 = 0.
    else.
    i4 = 1.
    endif.
      call method grid1->set_ready_for_input
         exporting
           i_ready_for_input = i4.
    endform.
    form init_grid.
    Enabling the grid to edit mode,
         struct_grid_lset-edit = 'X'. "To enable editing in ALV
         struct_grid_lset-grid_title  = 'Jimbos Test'.
         call method grid1->set_table_for_first_display
           exporting
             is_layout           = struct_grid_lset
           changing
             it_outtab             =  <dyn_table>
             it_fieldcatalog       =  it_fldcat.
    endform.
    form register_enter_event.
    call method grid1->register_edit_event
                   exporting
                      i_event_id = cl_gui_alv_grid=>mc_evt_enter.
    Instantiate the event or it won't work.
    create object g_event_receiver.
    set handler g_event_receiver->handle_data_changed for grid1.
    endform.</b>

    Hi there
    IE7 doesn't give me the add new page option and I get 404 error when trying to access the "How to contribute" section.
    I'll load up Firefox later (this browser usually works when IE7 doesn't always work properly).
    I'll copy the stuff to the wiki when I've got the browser sorted out.
    Cheers
    jimbp

  • Bug in 1.5.1 Deleting number value in data grid

    Hello,
    it is not possible to set a number in a column to NULL by simply deleting the value
    DROP TABLE tab_test;
    CREATE TABLE tab_test(
    dat DATE
    ,num NUMBER
    ,var VARCHAR2(2)
    INSERT INTO tab_test (dat,num,var)
    VALUES (TO_DATE('01.01.2009','dd.mm.yyyy'),4,'ff');
    COMMIT;Open the table in SQL Developer and select data tab.
    Deleting the date value and commiting is ok
    UPDATE "RVS_FE"."TAB_TEST" SET DAT = TO_DATE('', 'DD.MM.YYYY') WHERE ROWID = 'AAA6Q0AAGAABHUlAAA' AND ORA_ROWSCN = '10443975276'
    Commit Successful
    Deleting the number value and commiting raises an error
    UPDATE "RVS_FE"."TAB_TEST" SET NUM =  WHERE ROWID = 'AAA6Q0AAGAABHUlAAA' AND ORA_ROWSCN = '10443975285'
    One error saving changes to table "RVS_FE"."TAB_TEST":
    Row 1: ORA-00932: inconsistent datatypes: expected NUMBER got DATE
    Rollback Successful
    Deleting the char value and commiting is ok
    UPDATE "RVS_FE"."TAB_TEST" SET VAR =  WHERE ROWID = 'AAA6Q0AAGAABHUlAAA' AND ORA_ROWSCN = '10443975285'
    Commit Successful
    Regards
    Marcus
    Edited by: Marwim on 26.11.2008 08:59

    Jim, I could reproduce and see the error, no change columns order.
    You can use the Marwim script's and, on the data grid, select the column DATE, delete value and commit.
    On the data grid, select the column var, delete value and commit.
    On the data grid, select the column num, delete value and commit -> get error.

Maybe you are looking for