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

Similar Messages

  • 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

  • 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

  • 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

  • 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

  • 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

  • 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

  • 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

  • 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

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

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

  • Updating database tables.

    hii,
    i worked on it and got the selected data into internal table now could you tell me the exact code to update the datbase table with this data in this  scenario : i have two fields in databse tabel one being primary key and against which every time i have to update second field from the value selected by user.
    please tell me the exact code to update the database table from this internal table.

    hi,
    its  abap coding only.
    use insert, update or modify statement.
    i.e
    insert table ztable from itab.
    but it is advisable do not use these statement directly,
    You can create Perform on commit. and use FM in update task
    Yogesh N
    Edited by: Yogesh N on Aug 25, 2008 6:15 AM

  • Updating database table using ALV Grid class CL_ALV_CHANGED_DATA_PROTOCOL

    Hi,
    I am trying to use class CL_ALV_CHANGED_DATA_PROTOCOL to update a database table from an ALV grid.
    I have used program BCALV_EDIT_04 as an example.
    I am able to successfully processed inserted or deleted lines using the attributes
    MT_DELETED_ROWS
    MT_INSERTED_ROWS
    but I also want to process modified lines.
    I was just wondering whether anyone out there has some example code for this.
    I can see that there are the following attributes available
    MT_MOD_CELLS
    MP_MOD_ROWS.
    I would ideally like to use MP_MOD_ROWS rather than  MT_MOD_CELLS but it is not clear to me what type MP_MOD_ROWS is.
    If anyone has any example code for this sort of thing, please let me know.
    Thanks,
    Ruby

    hi Ruby,
    Yes we can use that *data reference variable *.
    It is a variable( something comparable to a pointer ) that points to a int table( table with changed contents )
    which ll be created at run-time based on the data type ot the internal table that we pass to the parameter it_outtab of method set_table_for_first_display ...
    assign er_data_changed->mp_mod_rows->* to a field-symbol and use it...
    Check the below code for example -> method refresh_changed_data
    screen flow logic.
    PROCESS BEFORE OUTPUT.
      MODULE pbo.
    PROCESS AFTER INPUT.
      MODULE pai.
    main program.
    *       CLASS lcl_event_responder DEFINITION                           *
    CLASS lcl_event_responder DEFINITION.
      PUBLIC SECTION.
        DATA  : ls_changed_cell TYPE  lvc_s_modi,
                lv_language     TYPE  spras..
        METHODS refresh_changed_data  FOR EVENT data_changed
                                      OF cl_gui_alv_grid
                                      IMPORTING er_data_changed
                                                e_ucomm.
    ENDCLASS.                    "event_responder DEFINITION
    TYPES tt_makt TYPE STANDARD TABLE OF makt.
    DATA: go_handler         TYPE REF TO lcl_event_responder,
          go_grid            TYPE REF TO cl_gui_alv_grid,
          gt_fieldcat        TYPE lvc_t_fcat,
          gv_language        TYPE spras VALUE 'E',
          gt_outtab          TYPE tt_makt,
          gs_tableline       TYPE LINE OF tt_makt.
    FIELD-SYMBOLS : <changed_rows> TYPE tt_makt.
    CALL SCREEN 100.
    *       MODULE PBO OUTPUT                                             *
    MODULE pbo OUTPUT.
      SET PF-STATUS 'BASIC'.
      PERFORM create_and_init_alv CHANGING gt_outtab[]
                                           gt_fieldcat.
    ENDMODULE.                    "pbo OUTPUT
    *       MODULE PAI INPUT                                              *
    MODULE pai INPUT.
      LEAVE PROGRAM.
    ENDMODULE.                    "pai INPUT
    FORM create_and_init_alv CHANGING pt_outtab LIKE gt_outtab[]
                                      pt_fieldcat TYPE lvc_t_fcat.
      CHECK go_grid IS NOT BOUND.
      CREATE OBJECT go_grid
        EXPORTING
          i_parent = cl_gui_container=>default_screen.
      PERFORM build_display_table.
      PERFORM build_fieldcat CHANGING pt_fieldcat.
      go_grid->set_table_for_first_display( CHANGING  it_fieldcatalog      = pt_fieldcat
                                                      it_outtab            = pt_outtab ).
      go_grid->set_ready_for_input( 1 ).
    * raises the 'data_changed' event when we select another cell/any action after changing the data
      go_grid->register_edit_event( EXPORTING i_event_id = cl_gui_alv_grid=>mc_evt_enter ).
      CREATE OBJECT go_handler.
      SET HANDLER go_handler->refresh_changed_data FOR go_grid.
    ENDFORM.                               "CREATE_AND_INIT_ALV
    FORM build_display_table.
      FREE gt_outtab.
      SELECT * FROM makt UP TO 20 ROWS INTO TABLE gt_outtab WHERE spras EQ gv_language.
    ENDFORM.                               "build_display_table
    FORM build_fieldcat CHANGING pt_fieldcat TYPE lvc_t_fcat.
      DATA ls_fcat TYPE lvc_s_fcat.
      CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
        EXPORTING
          i_structure_name = 'MAKT'
        CHANGING
          ct_fieldcat      = pt_fieldcat.
      LOOP AT pt_fieldcat INTO ls_fcat.
        ls_fcat-edit       = abap_true.
        MODIFY pt_fieldcat FROM ls_fcat.
      ENDLOOP.
    ENDFORM.                               "build_fieldcat
    *       CLASS event_responder IMPLEMENTATION                          *
    CLASS lcl_event_responder IMPLEMENTATION.
      METHOD refresh_changed_data.
        ASSIGN er_data_changed->mp_mod_rows->* TO <changed_rows>.
        LOOP AT <changed_rows> INTO gs_tableline.
          BREAK-POINT.
        ENDLOOP.
      ENDMETHOD.                    "click
    ENDCLASS.                    "event_responder IMPLEMENTATION
    Cheers,
    Jose.

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

Maybe you are looking for

  • Can not import videos to iPhoto but they are on my desktop

    Hi I have just changed from a pc to a mac mini. I put all my photos and videos onto a samsung hard drive then dropped that file into my documents on the mac. I then imported all the photos and some videos to i photo. I photo then came up with a error

  • Edited Raw Files

    Why can't I find my RAW files after I edit and 'save as' a JPEG in Elements 13?

  • Still more Corba Marshal 1398079699 errors

    I am getting a "CORBA MARSHAL 1398079699" error while using the thin client "wlclient.jar" with an applet. Everything works fine with the fat client. I thought this was fixed in CR108332 and 8.1sp1 but it does not appear to be. Are there any other re

  • Charging problem leads to ipod touch 4g non working.

    Ok, so one day i used my ipod for an entire day. I decided to charge it at night (A routine that i always do). When i started to charge it, for maybe the first ten minutes, it was stuck in the red level of charging. It was charging. I checked on it s

  • Firefox 12 and proxy

    Firefox 12 installed on Windows XP SP3. Auto-detect proxy settings for this network are not working. Only way to make Firefox 12 go through the proxy is to manual configure. Have a IIS server setup with wpad.dat. When Firefox 12 is auto-detect, from