Need help in updating database table from screen fields

Hi,
Can anyone tell me how to update the database table with the entries given in the fields of a screen ?...a procedure-wise explanation would be very helpful.
Thank you.
Moderator message: sorry, no beginner forums here, please search for available information or attend training.
locked by: Thomas Zloch on Aug 12, 2010 3:16 PM

Hi,
Can anyone tell me how to update the database table with the entries given in the fields of a screen ?...a procedure-wise explanation would be very helpful.
Thank you.
Moderator message: sorry, no beginner forums here, please search for available information or attend training.
locked by: Thomas Zloch on Aug 12, 2010 3:16 PM

Similar Messages

  • Updating database table from internal table

    I am updating the database table from internal table for this is have used the following syntax
    Update kna1 from table itab.
    And it is giving error message as the work are itab is not long enough.
    Please help me.

    Hi,
       Refer this code
    *&      Form  SUB_READ_UPDATE_BSEG
          text
    FORM sub_read_update_bseg.
      IF NOT it_final[] IS INITIAL.
        LOOP AT it_final INTO wa_final.
          UPDATE bseg SET zuonr = wa_final-ccnum
                      WHERE bukrs EQ wa_final-bukrs
                      AND   belnr EQ wa_final-vbeln
                      AND   rfzei EQ wa_final-rfzei
                      AND   saknr NE ' '.
        ENDLOOP.
    *--Message data updated successfully
        MESSAGE i888 WITH text-002.
        LEAVE LIST-PROCESSING.
      ELSE.
    *--Message No data found
        MESSAGE i888 WITH text-003.
        LEAVE LIST-PROCESSING.
      ENDIF.
    ENDFORM.                    " SUB_READ_UPDATE_BSEG
    Regards,
    PRashant

  • 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

  • Updating database table from an internal table

    Hi All,
    I am updating a database table from an internal table.
    I am changing the non-key fields in that table.
    when I check sy-subrc = 4.
    Record already exists, because I am changing non-key fields of the
    database table.
    Is there any addition like to accept the duplicate keys with update.
    Alternatively, I have used Modify, It is adding new record,
    Again, I have search the old record and use Delete on the database table.
    Thanks & Regards,
    Kalyan Chandramouli
    SAP ABAP Consultant

    Hi,
    You are right, the field which I am trying to change is a part of primary key.
    Because, sy-subrc = 4. says,
    No line with specified primary key exits in the database table.
    I have a Z-tabel, with Kunnr Vkorg Matnr Bzirk Bztxt Split_percentage
    In this table primary key consists of KunnrVkorgMatnr+Bzirk.
    I am able to change the Split_percentage using UPDATE.
    Now, my client want to change Bzirk, Bztxt also in the table.
    How can I Go.
    Thanks & Regards,
    Kalyan Chandramouli
    SAP ABAP Consultant

  • 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.

  • Updating database table from Freely Defined Screens in co11n transaction ?

    Hi All,
    I got a requirement to add a new addional field and want to save it in the standard table for reporting purpose. I followed the steps like :
    1 ) In SMOD, i entered the enhancement (CONFPP07). where I get to find the freely defined screens i.e. 900, 910 and 920.
    2 ) I chose 900, and designed it in screen painter with a text field & input-outout field.
    3 ) In the include program, I defined the input-output field as :
         data: g_fco_kostl like afrud-kostl.
    Now, though I defined it in the include program ( ZXCOFTOP ). I need the data from that input-output field to get saved in AFRU table. Can anyone help me out in this ???
    Pls advice....

    So, according to your code, it means that :
    1) your screen field is WA_AFRUD-ZZSHIF
    2) WA_AFRUD is declared as global (in ZXCOFTOP)
    Is that true?
    In PAI: EXIT_SAPLCORU_S_101, you should only do:
    move wa_afrud-zzshif to es_afrud-zzshif.
    In Exit : EXIT_SAPLCORF_105, you have to replace 'A'
    LOOP AT AFRUD_TAB.
    AFRUD_TAB-ZZSHIF = *wa_afrud-zzshif.* "'A'
    MODIFY AFRUD_TAB.
    ENDLOOP.
    Note that LOOP AT  is problable not the good coding (I think that this exit has to remain empty), it was just a test to check it works
    Did you think to activate your project in CMOD? (you have to activate both project, and the exits)
    Are you sure your exit is called. Did you debug it?
    See also Note 12831 (program SAPRSMODCHECK) to check there is no problem between project/exits
    Edited by: Sandra Rossi on Oct 17, 2008 6:59 PM

  • Update database table from a work area

    hi!
    I have a workarea that is like the corresponding database table. There are a lot of fields so I dont want to update each field with an UPDATE but instead I want to do som sort of:
    UPDATE dbase_table
    FROM work_area
    WHERE dbase_table-primary_key = work_area-primary_key
    I could only find a statement called UPDATE dbase_table FROM  work_area but I dont understand how without specifying a WHERE clause it knows which rows to update.
    regards
    Baran

    UPDATE  dbtab      FROM wa. or
    UPDATE (dbtabname) FROM wa.
    Extras:
    1. ... CLIENT SPECIFIED
    2. ... CONNECTION con
    Effect
    Changes one single line in a database table, using a primary key to identify the line and taking the values to be changed from the specified work area, wa. The data is read out of wa from left to right, matching the line structure of the database table dbtab. The structure of wa remains unchanged. This means that wa must be at least as wide (see DATA) as the line structure of dbtab, and have the same alignment. Otherwise, a runtime error occurs.
    If either the database table, dbtab, or the work area, wa, contain Strings, wa must be compatible with the line structure of dbtab.
    Example
    Changing the telephone number of the customer with customer number '12400177' in the current client:
    DATA   wa TYPE scustom.
    SELECT SINGLE * FROM scustom INTO wa
      WHERE id = '12400177'.
    wa-telephone = '06201/44889'.
    UPDATE scustom FROM wa.
    When the command has been executed, the system field SY-DBCNT contains the number of updated lines (0 or 1).
    Examples
    Update discount for the customer with the customer number '00017777' to 3 percent (in the current client):
    DATA: wa TYPE scustom.
    SELECT SINGLE * FROM scustom INTO wa
      WHERE id = '00017777'.
    wa-discount = '003'.
    UPDATE scustom FROM wa.
    The Return Code is set as follows:
    SY-SUBRC = 0:
    The specified line has been updated.
    SY-SUBRC = 4:
    The system could not update any line in the table, since there is no line with the specified primary key.
    BR< JAcek

  • Updating database table from co11n transaction ?

    I got a requirement to add two new addional fields  and want to save it in the standard table for reporting purpose. I follwed the steps like :
    1. I created new fields in the table AFRU using appending struture. and activated it using se14.
    2. I created a project and entered the enhancment (CONFPP07)  and i created the screen-exit. then i declared thse two fields in the include : ZXCOFTOP. once i activated the screen exit it appeared in the CO11N TCODE but when i enter some values in this fields , its getting stored  in the variable but i dont know how to store this value in the table AFRU .
    3. for updating i used the exit CONFPP05 and my would be like AFRUD_TAB-ZZSHIF = CAPTAIN.
    but the problem is its not getting updated in the database table AFRU.
    should i have to use module ...endmodule in ( SAPLCORU_S - 900 screen , exit : CONFPP07 ) and write code... , like the we follow
    for ztransaction or how should i solve this issue ?

    So, according to your code, it means that :
    1) your screen field is WA_AFRUD-ZZSHIF
    2) WA_AFRUD is declared as global (in ZXCOFTOP)
    Is that true?
    In PAI: EXIT_SAPLCORU_S_101, you should only do:
    move wa_afrud-zzshif to es_afrud-zzshif.
    In Exit : EXIT_SAPLCORF_105, you have to replace 'A'
    LOOP AT AFRUD_TAB.
    AFRUD_TAB-ZZSHIF = *wa_afrud-zzshif.* "'A'
    MODIFY AFRUD_TAB.
    ENDLOOP.
    Note that LOOP AT  is problable not the good coding (I think that this exit has to remain empty), it was just a test to check it works
    Did you think to activate your project in CMOD? (you have to activate both project, and the exits)
    Are you sure your exit is called. Did you debug it?
    See also Note 12831 (program SAPRSMODCHECK) to check there is no problem between project/exits
    Edited by: Sandra Rossi on Oct 17, 2008 6:59 PM

  • Updating database table from co11n ?

    I have added two fields in transaction co11n.....now i want to store these data in the database table .i have used the exit CONFPP07.....where and how should i write the code...can everyone give me some tips to do this ?

    Hi,
    You have to write the code in the below func module exits:
    EXIT_SAPLCORU_S_100 : Transfer Data from SAPLCORU_S to Customer-Defined Screen
    Use just move-corresponding <Func Module Paramters> To <Include strucutre of your table wherre customer fields are appended>
    EXIT_SAPLCORU_S_101 : Return Data from Customer-Defined Screen to SAPLCORU_S
    Use just move-corresponding ES_AFRUD To screen fields
    Regards
    Shiva

  • Is it possible to update internal table from database table

    Hello All:
              I know how to update database table from internal table in one shot (batch) but is the reverse possible? Can I update some fields in an internal table from a database table in one shot (without looping) because my internal table is huge? Could you please provide me any ideas how to acheive something like this? Thanks in advance and answers will be rewarded.
    thanks.
    Mithun

    Hello my friend,
    You can do it MAYBE , i think you can reverse the update doing a ROLLBACK, but only after you update....not after the program finishes..
    To update some fields at once use:
    UPDATE DBTABLE FROM TABLE IT_TABLE
    Hope this helps!!
    Gabriel

  • Modify database table from internal table

    Hi All,
    I need to update database table from internal table which is having around 30000 records.
    I am using MODIFY tabname FROM TABLE int_tabname...
    Using this statement, I can modify the databse records very well. But user has some additional requirement.
    He wants that the table should be modified from the internal table and after modification we should have the erroneous records to be displayed if any.
    e.g. if 1500 records out of 30000 are erroneous then only 28500 records should be updated and 1500 records should be displayed as erroneous records so that the user can correct them and use them again for executing the program.
    Is there any FM which imports the database table name and internal table, modifies the database and exports an internal tanle with erroneous records?
    Any help will be appriciated,
    Regards,
    Neha

    Hi
    modifying datbase table useing internal table
    <b>advises</b> before updating this datbase table plz lock that table to avoid incosistency
    write the logic for modifying
    Modify the database table as per new dunning procedure
      MODIFY fkkvkp FROM TABLE lt_fkkvkp   .
    and finally unlock the table
    <b>example</b>
    *To lock table for further operations
      constants: lc_tabname TYPE  rstable-tabname  VALUE 'FKKVKP'  . "FKKVKP
      CALL FUNCTION 'ENQUEUE_E_TABLE'
        EXPORTING
          tabname        = lc_tabname
        EXCEPTIONS
          foreign_lock   = 1
          system_failure = 2
          OTHERS         = 3.
      IF sy-subrc EQ 0.
      To fetch all the contract accounts for customers of the segment
      Households/SME.
        PERFORM fetch_contract_accounts using lc_tabname .
      ENDIF.                    " IF sy-subrc EQ 0.
    *wrote the logic
    Modify the database table as per new dunning procedure from internal table
      MODIFY fkkvkp FROM TABLE lt_fkkvkp   .
    *unlock the tbale
      CALL FUNCTION 'DEQUEUE_E_TABLE'
       EXPORTING
         TABNAME   =  uc_tabname .
    <b>Reward if usefull</b>

  • 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.

  • Need the file extensions database table name

    Hi,
    I need to know the Database table name for file extensions in WCC.
    Please check the image for reference .

    Hi 2790552
    Please look at file doc_config.htm in the location <middleware_home>/Oracle_ECM1/ucm/idc/resources/core/tables/doc_config.htm
    This is the file which helps in building the applet view.
    I do belive that revisions and documents table might be used for validation and other specific things, but thats more in the context of document processing and from component IBR at runtime. But administration sake, i thing it works from the these config files since database doesn't have any table to hold this info.

  • How to Import/Export database tables from one server to other in oracle8i

    Hello friend,
    Please can any one tell me how to import/export groups of database tables from one server with oracle to another using VB.net. It would be nice if some one can provide some code of it.
    I am a software developer and I am in middle of a large project development, in which I need to export a large oracle database from one server to another efficiently.
    Its very urgent so please someone help me.

    At command prompt (source db)
    set ORACLE_SID=db_name
    exp system/password@db_name full=y buffer=104857600 file=(c:\file1.dmp, c:\file2.dmp....) log=c:\exp.log filesize=2000M
    Then ftp the export dump files (in binary) to the other server or copy to target server over the network.
    At command prompt (target db)
    set ORACLE_SID=db_name
    imp system/password@db_name full=y ignore=y buffer=104857600 file=(c:\file1.dmp, c:\file2.dmp....) log=c:\imp.log filesize=2000M
    If the path names of the datafiles are going to be different in the target server (as compared to the source), then precreate the tablespaces before import. Set buffer value accordingly.
    Message was edited by:
    FeNiCrC_Neil

Maybe you are looking for

  • WRT54G V7 firmware?

    Hello all, I have been having a few problems with my new WRT54G. Mainly an intermittent connection to the router over a wired connection. Sometimes every few minutes, my pc loses connection to the router then it gains it again. I have tried looking a

  • Why transfer order is unable to print in LT31

    Hi, This is a question about LT31 printing problem. my print code used and spool control data used are "02". Problem: I tested our system both in production and quality system on LT31 and both system behave differently though LT31 is standard SAP. Th

  • Changing script to smartforms fro chk priniting

    Hi , I have to do a check priniting using the F110 transaction. We were previously using a Script but then as per one requireemnt where in the number was to displayed in a white colour in a black box ;as this functionality cannot be acheived using th

  • Spacing Between Elements

    How can I reduce the space between the two elements below (h2 & p)? There is a significant gap between the two lines which cannot be reduced with padding / margin. The gap does reduce with font size  but not as much as I would like. <header>     <h2

  • BUG 2.1 - ARW (Sony Raw) no photos found error during Auto Import

    BUG 2.1 - ARW (Sony Raw) no photos found error during Auto Import I've seen this issue since beta1. The issue seems to be related to a camera setting that stores the files in folders by date. The Folder structure becomes drive>DCMI>10202008>image.ARW