How to update database table !!!

hi all,
Please advice how to update database table with certain cndition needs to be checked.
Please consider below scenario.
have used enqueu and dequeue function to lock entries  and also i have used BAPI so considering that return parameter . i want to update table
/tdk/st0027.
1. I want to update database table
2. there are certain condition needs to be checked like ,
   loop at it_final into wa_final.
th_return-type = 'S'.
           if th_final-vbeln = /tdk/st0027-vbeln and
              th_final-posnr = /tdk/st0027-posnr and
              th_final-etenr = /tdk/st0027-sdslno.
above condition which i need to check .and need to append below system fields need to be appended in table.
          th_final-prstsind = '20'.
          th_final-chgdate  = g_date.
          th_final-chgtime  = g_uzeit.
          th_final-chgprog  = g_cprog.
          th_final-chguser  = g_uname.
          append th_final to td_final.
          update /tdk/st0027 FROM th_final.
          endif.
endloop.
but i am getting error saying that  "The type od database table and work area (TH_FINAL)  are not unicode convertible"?
I am not able to understandwhat would be the solution for this ?
Thanks and regards,
Prasad K. NAralkar

The error occurs in the UPDATE statement included in the code. In this statement it is seen that there is a mismatch of structure defined for the DDIC table /tdk/st0027 and that of your work area th_final.
try to create a structure w.r.t the DDIC table.
Eg: DATA: wa_temp TYPE /tdk/st0027.
MOVE-CORRESPONDING th_final TO wa_temp.
Then try to UPDATE using the temporary work area i.e wa_temp which has structure similar to that of the database table.

Similar Messages

  • How to update database table with this new internal table

    hi
    i have a internal table having 8 records and it contains one record which was modified by user
    not i want this new record to be updated to the database table which was modified by the user
    how to do it pls suggest?
    i want to use index for comarision as using index will not have any problems like promary key etc
    like i want to capture the index for this table which was modified thr recoed index and use thi record indext to modify the database table
    or any other suggestion
    regards
    nishant

    Hi Nishant,
    Have an additional field in a table to indicate a change with which you avoid in updating the record modified by user.
    Regards,
    Madhu.

  • How to update database table from Internal Table

    hi experts,
        Can anyone please assist me in inserting records to a database table from an Internal Table
    whose structures are identical.
    Thanks in Advance,
    Sudhaa............

    Hi Sudha,
    Here are some example of update and insert:
    UPDATE SFLIGHT SET PLANETYPE = 'A310'
    PRICE = PRICE - '100.00'
    WHERE CARRID = 'LH' AND CONNID = '0402'.
    This example overwrites the contents of the PLANETYPE column with A310 and decreases the value of the PRICE column by 100 for each entry in SFLIGHT where CARRID contains u2018LHu2019 and CONNID contains u2018402u2019.
    TABLES SPFLI.
    DATA WA TYPE SPFLI.
    MOVE 'AA' TO WA-CARRID.
    MOVE '0064' TO WA-CONNID.
    MOVE 'WASHINGTON' TO WA-CITYFROM.
    UPDATE SPFLI FROM WA.
    MOVE 'LH' TO SPFLI-CARRID.
    MOVE '0017' TO SPFLI-CONNID.
    MOVE 'BERLIN' TO SPFLI-CITYFROM.
    UPDATE SPFLI.
    CARRID and CONNID are the primary key fields of table SPFLI. All fields of those lines where the primary key fields are "AA" and "0064", or "LH" and "0017", are replaced by the values in the corresponding fields of the work area WA or the table work area SPFLI.
    DATA: ITAB TYPE HASHED TABLE OF SPFLI
    WITH UNIQUE KEY CARRID CONNID,
    WA LIKE LINE OF ITAB.
    WA-CARRID = 'UA'. WA-CONNID = '0011'. WA-CITYFROM = ...
    INSERT WA INTO TABLE ITAB.
    WA-CARRID = 'LH'. WA-CONNID = '1245'. WA-CITYFROM = ...
    INSERT WA INTO TABLE ITAB.
    WA-CARRID = 'AA'. WA-CONNID = '4574'. WA-CITYFROM = ...
    INSERT WA INTO TABLE ITAB.
    UPDATE SPFLI FROM TABLE ITAB.
    This example fills a hashed table ITAB and then overwrites the lines in SPFLI that have the same primary key (CARRID and CONNID) as a line in the internal table.
    Insert statement :
    TABLES SPFLI.
    DATA WA TYPE SPFLI.
    WA-CARRID = 'LH'.
    WA-CITYFROM = 'WASHINGTON'.
    INSERT INTO SPFLI VALUES WA.
    WA-CARRID = 'UA'.
    WA-CITYFROM = 'LONDON'.
    INSERT SPFLI FROM WA.
    SPFLI-CARRID = 'LH'.
    SPFLI-CITYFROM = 'BERLIN'.
    INSERT SPFLI.
    If the database table does not already contain a line with the same primary key as specified in the work area, the operation is completed successfully and SY-SUBRC is set to 0. Otherwise, the line is not inserted, and SY-SUBRC is set to 4.
    Regards,
    Premraj kaushik

  • How to update database table with key field?

    Hello Experts,
    I have a database table with following fields
    MATNR   - Key
    SSOUR  -  Key
    KUNNR   - Key
    MENG1 
    MENG2
    MENG3
    And this table contains records like...
    MSD50001     R      1000001     5.30    2.30    5.25
    MSD50002     R      1000002     5.30    2.30    5.25
    MSD50003     R      1000003     5.30    2.30    5.25
    MSD50005     R      1000004     5.30    2.30    5.25
    MSD50004     R      1000005     5.30    2.30    5.25
    I have an internal table with same fields of above database table.
    MSD50001     A      1000001     5.30    2.30    5.25
    MSD50002     A      1000002     5.30    2.30    5.25
    MSD50003     A      1000003     5.30    2.30    5.25
    MSD50005     A      1000004     5.30    2.30    5.25
    MSD50004     A      1000005     5.30    2.30    5.25
    MSD50006     A      1000006     5.30    2.30    5.25
    I want to update the DB table with following internal table records.
    If internal table records = db table records are same then Update....else insert from internal table to db table.
    But here, SSOUR is key field so i am not able to use
    MODIFY dbtab from itab.
    It results me , entries in internal table are inserted into db table.
    So i have double records.
    Is there any statement which updates the key field? and if no fields in db table then insert it?
    Regards
    RH

    hi,
    u cannot update akey field.u can update only non key fields by using key field as a selection criteria.For example if u go to sm30 if u enter any table for inserting values, the key field will always be greyed out it is not succumbed to chnges.but u can insert value into ,if ur inserting and in the insert staemnet if  u have key field which is already present in the table it will return sy-subrc = 4 otherwise it will insert the record and return 0.
    eg for update :
    UPDATE zdm_wtyprof  SET upload_status = 'S'
                             WHERE spart = wa_upd-spart.
    here spart is the key field and it will update the status field in the table as S.
    if updated succesfully it will return 0.
    SIMILARLY U CAN USE select.

  • How to update database table in jdeveloper 10g

    I currently have a roles table, usersinroles table, and a users table. The users table has a user ID, the roles table has a Role ID, and the usersinroles table has Role ID and user ID as foreign keys. I can add new users, but how can I implement the ability to add a role to the user and it store the USER ID of that particular user and the ROLE ID of the role I choose in the usersinroles table??
    Thanks,
    Adam

    I'm not sure I understand your question here.
    If you have EOs for each one of the three tables with master-detail associations from the user and role tables to the cross table, then you can create a master/details form showing a user and all his roles and then adding a record to the crosstable will automatically add the userid correctly.

  • Update database table

    I have 1 million records in application server and I want to update database table from that.
    Is UPDATE statement the best technique to do it.
    Just wanted to know if there is any other better tehcniques.
    Also i want to write the errors to job log. How can we do that?
    Regards,
    DNP

    If they are all new records or all changes, it would be best to use INSERT or UPDATE. You will also want to do mass inserts/changes using an internal table. Since you have so many records, you will probably have to do this in chunks in order to avoid dumping on the rollback area.
    Rob

  • Enqueue and Dequeue before updating Database table

    Hi all,
    We are updating database tables using INSERT, MODIFY and UPDATE statements. Since many people will be running the application at the same time we need to lock the table before updating database table. So we need to use ENQUEUE and DEQUEUE functionality for this purpose.
    Can any plz explain what are the steps we should follow now?
    Thanks in advance.

    Hi,
    Any Database access should carefully handled as multiple applications may be accessing the database at the same time. To read a record from the database you don't need to implement a lock, but to write you need not only locks but also ideally should use the Update Function Modules to comply SAP "All or Nothing" Principle. This will prevent data inconsistency of the database and the data will be proper state. You need to use the COMMIT WORK and ROLLBACK WORK in you code to handle the consistency part of the database.
    The best design approach would be seperate the Database Layer completely from the business layers. This will make your code robust and easy to maintain.
    As, for the Locking Concepts, you will get multiple resources from SDN as how to create Locks and implement the Locking modules in your code. But more than that what matters is why and how to implement the SAP Locking concepts to make your application run better.
    Have a look at the following link
    http://help.sap.com/saphelp_nw70/helpdata/en/cf/21eea5446011d189700000e8322d00/content.htm
    Hope this helps.
    Thanks,
    Samantak.

  • Doubt in updating database table

    hi all
    i want to modify values ztable from a internal table ....
    for eg : the ztable contains matnr and accept_qty
    matnr   qty
    mat01   
    mat02
    i need to modify qty of the table .. i am using where condition (ie modify where matnr = ) but where condition is not working for database tables .... how to proceed with this ..
    thanks
    lokesh

    hi,
    before that :- modify statemnt will modify a record if there is record having the same key like that of record in work area.
    if there is no record in itab with key of work area record, it will insert a new record in itab.
    look this sample code.
    *modify internal table
    loop at itab into wa.
    wa-field1 = data1.
    wa-field2 = data2.
    wa-field 3= data3.
    modify itab from wa transporting field1 field2 field3 where key_field = wa-keyfield. "there shuld not be any chang in key field.
    endloop.
    *now update database table
    *work area and data base structure shuld be same type
    if itab[] is not initial.
    modify ztable from table itab.
    endif.
    rgds
    anver
    if hlped pls mark points

  • How to update the table available in BADI method

    Hi Friends,
    I have to implement one badi ME_REQ_POSTED for purchase requistion, in this badi  I have to read first line item and do
    some check...if that check is true i need to update subsequent line item (line 20, 30, 40 or so) with purchase group and MRP controller.
    In this BADI i have method POSTED, in this method parameter IM_EBAN is a table which i need to modify with my different
    values for purchase group and MRP controller.
    Kindly let me know how to update this table, so the changes can be reflected in purchase requistion.
    Since when I tried to directly modify the table in a loop, system throw one error stating IM_EBAN can not be modified.
    kindly help.
    pradeep

    hi
    I have implemented this exit but it does not stop at it while saving Purchase requistion. But my previous BADI stops at it when saving.
    Kindly guide.

  • How to update the table value in the valuechange event?

    I have an input field in the datatable with the valueChangeListener
    <rich:dataTable id="cart" value="#{cart.cartList}" var="item">
    <h:inputText value="#{item.cost}" id="qty" valueChangeListener="#{items.updateCost}" onchange="submit()">
    <h:outputText value="#{item.errorMsg}"> </h:outputText>
    in the backing bean
         Item item = (Item) model.getRowData();
    // do some update, if the cost too larger, change to max_cost
         item.setCost(max_cost);
         item.setErrorMsg("Error Msg");
    After calling the valuechange method, the screen output doesn't update the cost.
    How to update the table value in the valuechange event?

    As you're misusing the valueChangeListener to set another input field, you need to skip the update model values phase. Otherwise the value set in the valueChangeListener will be overridden by the submitted value. You can do this by calling the FacesContext#renderResponse() inside the valueChangeListener method. This will shift the current phase immediately to the render response phase, hereby skipping the update model values and invoke application phases.

  • How to update a table (CUSTOMER) on a Report Server with the data from the same table (CUSTOMER) from another server Transaction server?

    I had an interview question that is:
    How to update a table (Customer) on a server ex: Report Server with the data from the same table (Customer) From another server ex: Transaction server?
    Set up steps so inset, update or delete operation takes place across the servers.
    It would be great if someone please enlighten me in details about this process in MS SQL Server 2008 R2.
    Also please describe would it be different for SQL Server 2012?
    If so, then what are the steps?

    I had an interview question that is:
    How to update a table (Customer) on a server ex: Report Server with the data from the same table (Customer) from another server ex: Transaction server?
    Set up steps so that inset, update or delete operation gets done correctly across servers.
    I was not sure about the answer, it would be great if someone please put some light on this and explain in details about this process in MS SQL Server 2008 R2.
    Also it would be very helpful if you please describe would it be different for SQL Server 2012? If so, then what are the steps?

  • How to update Spry-table and present the updated table in a div element?

    Hello!
    I am using a very interesting AJAX-framework called Spry when designing a web page. Here the web page is: Link.
    I need some help.
    Every time a new project or shift is added, the changes are written to an xml-file. When the page is reloaded, Spry reads data from xml-files.
    This is caused by this code:
    dsProjects = new Spry.Data.XMLDataSet("timetable/projects.xml", "projects/project");
    dsShifts = new Spry.Data.XMLDataSet("timetable/{dsProjects::url}", "project/shift"); //look inside projects.xml and //extrac xml-file. url
    dsName = new Spry.Data.XMLDataSet("timetable/{dsProjects::url}", "project");
    I call this function that I have written: loadProjectsIntoDivElement ().
    This function does the following: [See attached code.]
    It iterates through the Spry-datastructure and puts the data in a table inside of the div-element called 'projectsList'.
    Now, when I add a new project, I want it to be inserted into the Spry-datastructure and then cause the new data to be written into the div element called 'Specials_DIV'.
    I have found out how to update a Spry-datastructure (e.g. dsProjects above), but I don't know how to update the table containing the data without refreshing the page. This should be done using Spry.
    Some code:
    1:
    2:
    3:
    function loadProjectsIntoDivElement () {
    $('#projectsList').html('');
    $('#projectsList').append('<table id="Specials_Table"><tr><th spry:sort="id">ID</th><th spry:sort="NAME">Name </th><th spry:sort="hoursestimated">Nr. of hours estimated</th><th spry:sort="hoursworked">Nr. of hours worked</th><th spry:sort="costperhour">Cost per hour.</th></tr>{function::init_hours}<tr spry:repeat="dsProjects" onclick="chooseProject({ds_RowID})"><td>{id}</td><td>{NAME}</td><td>{hoursestimated}</td><td>{hoursworked}</td><td>{costperhour}</td></tr></table><br/>{function::get_hours}<br/>');
    I have tried to accomplish this in various ways but I don't succeed.
    I want to do it without refreshing the page.
    Update: I found some code here that I will try: Link
    Thanks in advance!
    Anders Branderud
    My blog

    Hello!
    Thanks!
    I don't succeed with the implementation in any browser.
    I have found a way to it, but I would like a way that updates the data quicker and without reloading all of the page. After all, I am only adding one row on the end of the data structure, so there should be no need to read in all data again.
    Now I do it like this:
    When a project is added, do this:
    1. Store a new row in the project file through a php script.
    2. When the post-call to the php-file returns, do refresh of the whole page.
    Then the newest version of the xml file will be read in.
    However, I don't want to read the data from a xml file each time that a new project is created.
    I know how to add the new data to a Spry-datastructure [in my code 'dsProjects'], but I don't know how to display the updated data without reloading the whole page.
    I have tried some various ways to do it, but haven't succeded.
    Thanks!
    Anders Branderud

  • How to view database table in OAF run page.

    Hi,
    how to view database table in OAF run page,any manual setting .please help me.
    thanks
    saran.

    Hi;
    1. This site side related EBS for your issue there is sqldeveloer dedicated forum side
    Forum Home » Application Development in PL/SQL » SQL Developer (Not for general SQL/PLSQL questions)
    2. Please see:
    http://docs.oracle.com/cd/B10501_01/java.920/a96655.pdf
    Regard
    Helios

  • How to view database table in oracle9i Jdeveloper

    Hi,
    how to view database table in oracle9i jdeveloper,any manual setting .please help me.
    thanks
    saran.

    In Jdeveloper go to View-->Connection Nevigator. there you will see all kind of connctions. Expand Database and check if your DB connection is present there. If not, you need to create using right clicking on Database and choose New Database Connecton. Here few screens will be there where you need to put the TNS entries of your database.
    Once DB connection is created, you can expand the connection by clicking on + icon and you can see different available schema objects. Again you need to expand Tables and you can look for specific table in there.
    Hope this clears your doubts.
    Thanks,
    Mukesh Uchaniya

  • How to view database table in oracle9i developer

    Hi,
    how to view database table in oracle9i developer,any manual setting .please help me.
    thanks
    saran.

    Hi;
    1. This site side related EBS for your issue there is sqldeveloer dedicated forum side
    Forum Home » Application Development in PL/SQL » SQL Developer (Not for general SQL/PLSQL questions)
    2. Please see:
    http://docs.oracle.com/cd/B10501_01/java.920/a96655.pdf
    Regard
    Helios

Maybe you are looking for

  • My MacBook crashed whilst installing, now it won't open. Can you help me?

    i had to restart my MacBook after it crashed s it was the only option to take when my computer screen just went black after freezing. Once i restarted, Flash Professional Cs5.5 wasn't installed because I couldn't' find it however there was an option

  • NEED HELP ( sound doesn't work )

    Hello, i such a problem: i've bought a new computer P4 MSI motherboard whith OB sound card. After installing windows,my speakers doesn't work.In hardware devices there are 3 quastion signs : ? other divices ? Ethernet controller ? multimedia controll

  • Sequence Quiz Using User Defined Variables - Can See Underlying Variable Name On Move

    I have just tested using 1 slide to capture several user defined variables and the next slide to insert those variables as options in a sequence quiz slide. This works but as soon as I grab an object to begin sequencing them the underlying variable n

  • Dock  Trash too close to folder

    Can a space be put between the trash can and a folder on the dock. Sometimes I miss the folder and it accidentally goes in the tras. Can you put a spacer like you can in the tool bar? thanks bob

  • Scan options on printer screen

    I have Windows 7 with a HP Photosmart c6180 AiO. I use Microsoft Office 2003 and used to get a scan menu on my printer screen. For some reason, it disappeared and I want to scan documents to a RTF. How do I get my my menu back? I did updates, and rei