Save changes automatically in alvgrid

Hello all,
How do i save changes automatically in alvgrid. I display data with fields which can be editable & some which are not.
The fields which are editable should be saved automatically. These fields should be saved in global internal table.
I have save button, but I invoke only when the changed data is saved in database table via global internal table.
Looking forward for your reply.
regards
Madhavi.

Hi
Check the sample code:
*-- Display Report
  CALL METHOD o_alvgrid->set_table_for_first_display
    EXPORTING
      i_save                        = c_a
      is_layout                     = p_layout
      it_toolbar_excluding          = i_excl_func
    CHANGING
      it_outtab                     = p_output[]
      it_fieldcatalog               = p_fieldcat[]
    EXCEPTIONS
      invalid_parameter_combination = 1
      program_error                 = 2
      too_many_lines                = 3
      OTHERS                        = 4.
  IF sy-subrc <> 0.
    MESSAGE s001(zesspa) WITH text-029.    " Error in Displaying
    LEAVE LIST-PROCESSING.
  ELSE.
<b>* Register events
    CALL METHOD o_alvgrid->register_edit_event
      EXPORTING
        i_event_id = cl_gui_alv_grid=>mc_evt_enter.
    CALL METHOD o_alvgrid->register_edit_event
      EXPORTING
        i_event_id = cl_gui_alv_grid=>mc_evt_modified.
This registering event will make the data changes to be automatically update to the internal table.
Then write the code in the data changed event to modify the global internal table.
</b>
*-- ALV Grid data declaration
      CLASS v_lcl_event_receiver DEFINITION
CLASS lcl_event_receiver DEFINITION.
  PUBLIC SECTION.
    METHODS:
    handle_data_changed      FOR EVENT data_changed OF cl_gui_alv_grid
                             IMPORTING er_data_changed,
ENDCLASS.                    "o_lcl_event_receiver DEFINITION
      CLASS LCL_EVENT_RECEIVER IMPLEMENTATION
CLASS lcl_event_receiver IMPLEMENTATION.
"handle_data_changed
  METHOD handle_data_changed.
      PERFORM handle_data_changed USING er_data_changed.
  ENDMETHOD.                    "handle_data_changed
ENDCLASS.                    "lcl_event_receiver IMPLEMENTATION
*&      Form  f2200_handle_data_changed
      Handle Data Changed in the ALV grid
FORM handle_data_changed  USING    ir_data_changed
                                         TYPE REF TO
                                         cl_alv_changed_data_protocol.
  DATA : ls_mod_cell TYPE lvc_s_modi,
        lv_value TYPE lvc_value,
         lws_date TYPE scal-date.
  DATA: lws_contrlife LIKE zspa_es_contlife-zzcontrlife,
        lwa_contrlife TYPE zspa_es_contlife,
        lws_mod_eff_code TYPE zspa_es_mod_code-zzmod_eff_code,
        lwa_mod_eff_code TYPE zspa_es_mod_code.
  SORT ir_data_changed->mt_mod_cells BY row_id .
  LOOP AT ir_data_changed->mt_mod_cells
                     INTO ls_mod_cell
                     WHERE fieldname = text-025   "ZZCONTRLIFE
                     OR    fieldname = text-026   "ZZMOD_EFF_CODE
                     OR    fieldname = text-027   "DATE
                     OR    fieldname = text-028.  "CLIENT_AGGR.
    READ TABLE i_final INTO wa_final
                       INDEX ls_mod_cell-row_id.
    IF sy-subrc = 0.
      IF ls_mod_cell-fieldname = text-025.     "ZZCONTRLIFE
        lws_contrlife = ls_mod_cell-value.
        SELECT SINGLE * FROM zspa_es_contlife
               INTO lwa_contrlife WHERE zzcontrlife = lws_contrlife.
        IF sy-subrc NE 0.
          CALL METHOD ir_data_changed->modify_cell
            EXPORTING
              i_row_id    = ls_mod_cell-row_id
              i_fieldname = text-025
              i_value     = ''.
          MESSAGE s001(zesspa) WITH text-035.
          EXIT.
        ELSE.
          CALL METHOD ir_data_changed->modify_cell
            EXPORTING
              i_row_id    = ls_mod_cell-row_id
              i_fieldname = text-025
              i_value     = lws_contrlife.
          wa_final-zzcontrlife = lws_contrlife.
          MODIFY i_final FROM wa_final INDEX ls_mod_cell-row_id.
        ENDIF.
      ENDIF.
      IF ls_mod_cell-fieldname = text-026.     "ZZMOD_EFF_CODE
        lws_mod_eff_code = ls_mod_cell-value.
        SELECT SINGLE * FROM zspa_es_mod_code
               INTO lwa_mod_eff_code
               WHERE zzmod_eff_code = lws_mod_eff_code.
        IF sy-subrc NE 0.
          CALL METHOD ir_data_changed->modify_cell
            EXPORTING
              i_row_id    = ls_mod_cell-row_id
              i_fieldname = text-026
              i_value     = ''.
          MESSAGE s001(zesspa) WITH text-036.
          EXIT.
        ELSE.
          CALL METHOD ir_data_changed->modify_cell
            EXPORTING
              i_row_id    = ls_mod_cell-row_id
              i_fieldname = text-026
              i_value     = lws_mod_eff_code.
          wa_final-zzmod_eff_code = lws_mod_eff_code.
          IF wa_final-zzmod_eff_code = 1 OR
             wa_final-zzmod_eff_code = 2.
            wa_final-date = ''.
            CALL METHOD ir_data_changed->modify_cell
              EXPORTING
                i_row_id    = ls_mod_cell-row_id
                i_fieldname = text-027
                i_value     = ''.
          ENDIF.
          MODIFY i_final FROM wa_final INDEX ls_mod_cell-row_id.
**-- No Edit control for Date when mode eff code = '1', '2'.
          PERFORM no_edit_for_date TABLES i_final.
*This perform Refresh's the ALV list and Set's the Focus to
*Current Cell and keep the Scroll bar in the same place.
          PERFORM alv_refresh.
        ENDIF.
      ENDIF.
      IF ls_mod_cell-fieldname = text-027.     "DATE
        CONCATENATE ls_mod_cell-value+6(4)
                    ls_mod_cell-value+3(2)
                    ls_mod_cell-value+0(2) INTO lws_date.
        IF lws_date NE ''.
          IF lws_date > sy-datum.
            wa_final-date = lws_date.
            CALL METHOD ir_data_changed->modify_cell
              EXPORTING
                i_row_id    = ls_mod_cell-row_id
                i_fieldname = text-027
                i_value     = lws_date.
            MODIFY i_final FROM wa_final INDEX ls_mod_cell-row_id.
          ELSE.
            CALL METHOD ir_data_changed->modify_cell
              EXPORTING
                i_row_id    = ls_mod_cell-row_id
                i_fieldname = text-027
                i_value     = ''.
            MESSAGE s001(zesspa) WITH text-037.
            EXIT.
          ENDIF.
        ENDIF.
      ENDIF.
      IF ls_mod_cell-fieldname = text-028.     "CLIENT_AGGR
        TRANSLATE ls_mod_cell-value TO UPPER CASE.        "#EC SYNTCHAR
*"#EC TRANSLANG
        IF ls_mod_cell-value EQ c_s OR ls_mod_cell-value EQ c_n.
          CALL METHOD ir_data_changed->modify_cell
            EXPORTING
              i_row_id    = ls_mod_cell-row_id
              i_fieldname = text-028
              i_value     = ls_mod_cell-value.
          wa_final-client_aggr = ls_mod_cell-value.
          MODIFY i_final FROM wa_final INDEX ls_mod_cell-row_id.
        ELSE.
          CALL METHOD ir_data_changed->modify_cell
            EXPORTING
              i_row_id    = ls_mod_cell-row_id
              i_fieldname = text-028
              i_value     = ''.
          MESSAGE s001(zesspa) WITH text-039.
          EXIT.
        ENDIF.
      ENDIF.
    ENDIF.
  ENDLOOP.
ENDFORM.                    " handle_data_changed

Similar Messages

  • Save Changes Automatically to Picture?

    Whenever I make any adjustments to a picture inside Lightroom, I want to do things with it and the changes that I've made. I've tried to drag and drop the picture from Lightroom to the desktop or to an email. But the adjustments I made are not on the picture - only in Lightroom.
    How do I get Lightroom to automatically apply the changes I make to a picture directly to the picture file itself instead of just on Lightroom then I'd have to export the ones I want to use?
    Thanks!

    Particularly E-mail, you really should use Export, if only to decrease the size of the image to a reasonable size, assuming you're dealing with images from a camera, not already downsized jpegs.

  • InDesign CC 2014.2 has stopped asking me if I want to save changes when I close a file. It's automatically saving, but I don't always want to save changes.

    InDesign CC 2014.2 has stopped asking me if I want to save changes when I close a file. It's automatically saving, but I don't always want to save changes. Can anyone help?

    See: Replace Your Preferences

  • Messages save location changes automatically from ...

    Hi everybody
    I have a Nokia 5800 with v51.0.006 firmware. My problem is that randomly when i receive text messages the memory change automatically from memory card to phone memory. 
    Any ideea why?

    Hi skyb0y,
    this is the function which I miss on the N8 :-)
    Once you connect your phone to your computer, the card will no longer be available for your phone .(your computer has access on the card)
    In this case your phone uses the internal memory.
    You've to change it manually, if you want to use the SD card again
    Tim

  • Dynamic Action on change automatically submit

    Hi,
    I have a tabular form (manually handled) with a text item that can be changed (Apex 4.0.2.00.07).
    Each time the user changes the value of the text item, the changes automatically will be submitted.
    Therefore I defined a dynamic action:
    event:onchange
    selection type: region
    with javascriptcode: apex.submit({request:'SAVE'});
    When I leave changed text item with tab-key everything works fine.
    But when I leave changed text item through a button Click only the submit of dynamic action is performed and the button functionality is ignored.
    The button click initiates the onchange event at the changed text item and then ignores everything after this event.
    The enduser will not be able to understand the behavior of the application.
    I have less experience in Java and JavaScript.
    Is it possible to get the information if and which button was clicked, so I can decide at javascriptcode of the dynamic action what is to do?
    Thanks,
    Brigitte

    Region static id shouldn be in bracketsYou missed the '#' informt of the region id.
    why my original PL/SQL process did not work
    FOR i IN 1 .. apex_application.g_f08.COUNTThis works only when the application array has values and that happens only when the page is submitted.When you submit the dynamic action , it isn't.
    This script combined with script to detect changes makes apex page running very slowIf you use that PLSQL code(assuming it works as expected) , then its going to take a server request every-time you change a field in the tabular form and loop though all the array values(if they would be submitted before) and recalculate and compare the checksums . Isn't that going to be very inefficient.
    As for that JS code, it only runs at the client side. You can do all the server side checks on submit, when the user expects some delay due to processing.

  • Recurring inspection lot status "created" changed automatically to "Release" without change history

    Dear Experts,
    I observed that for few materials recurring inspection lot (inspection lot origin 09) status from "CRTD CHCR SPRQ" to "REL  CALC SPRQ PRSI" changed automatically without manual interruption.
    I have thoroughly checked the change documents in status management, but the there is change history found.
    can anyone help me understand the root cause of the issue?
    Regards,
    A.Suresh

    Hi
    Pls check this link
    QM - Recurring Inspection (type 09)
    Inspection type 09 process
    Note : System status CRTD because there is no Insp.plan master data for particular material
    Check & create Inspection plan for material & also check the Material master QM view Insp.set up tab.
    Suppose if already created Insp.plan for material,then you need to assign Insp.plan manually in QA32 select the insp.lot line & click change Insp.lot icon in Header ,click spec.& save
    Then system status change from CRTD to REL.
    Thanks in advance

  • Would you like to save changes.. no changes to save

    hi guys, I currently have a master detail relationship but i have a problem. When a query is entered in my master block it automatically queries the detail block, this is fine, however , if i then want to enter a new query, thus entering query mode in the master block I get a prompt asking me if i want to save changes, but I havent made any changes.
    I do however have an idea for the cause of the problem. I have 2 non database items on my detail block which are just there to provide additional information to the user. How they work is that when the id from the detail block is brought back I have in a post query trigger that I open a cursor and bring data back from another table and display it to the user in these NON database items. however i did not think this would cause a prompt to save changes as this inforrmation was going into a non databse item. I am simply assuming this is my problem.
    Anyone any ideas how I could resolve this?
    Thank you.

    Hi user13390506
    i do agree with Ahmed; no Tricks needed it's obvious and strait forward that's to say i supposed that u did the following ...
    1. created Lov for the FK ( id) selecting the id and desc
    2.u returned the selected id from the Query to the FK (id) in the form
    3.u can display it or set it's width to 0
    through previous steps u garanteed returning the id just once as u selected it from ur form at runtime during the insertion process.
    On Post-Query Trigger ....
    This trigger functionality is to display only the desc or the name of the item related to the FK (id) in ur current form that is already existed in a related Look-up table or whatever...
    Through this u display data that can't be displayed by ur current table but related to another table u can get it through using the id currently fetched from the db
    By using the Post-Query u may cause the same id to be stored Twice which is useless,wasting time,and effort upon u and the db itself.
    Hope i clear it as i recognize it.
    Best Regards,
    Abdetu...

  • Agents state getting changed automatically from NotReady to Ready

    Agents state getting changed automatically from NotReady to Ready on random position during break time. Can some help me out?
    UCCE version 8.5 

    Hello Ahmad,
    Bug below describes a scenario where the agent is transitioned to the Ready state without manually changing it.
    Also effects 8.5.
    CSCty97770
    Save Bug
    UCCX: Agent Incorrectly Set To Ready After RNA On ICD Extension
    Symptom:
    A Unified Contact Center Express (UCCX) agent may transition to the Ready state without manual intervention.
    Conditions:
    This occurs when, while on a call on the personal line, the agent receives a consult transfer from another agent on the ICD line, does not answer this call and the call is disconnected by the calling agent. When processing this disconnect, the agent state is incorrectly transitioned to Ready even though the call is still in progress ...more
    Details
    Known Affected Releases: (2)
    8.5(1)SU2 | 8.0(2)SU4
    Known Fixed Releases: (1)
    9.0(.96000.398)
    Product: Cisco Unified Contact Center Express
    Hope this helps,
    Please rate helpful posts.
    Thanks.

  • Do you want to save changes - appears twice in master-detail form.

    Hello.
    Sometimes ago i wanted "Do you want to save changes" message in my own language.
    So i created trigger:
    if :system.form_status IN ('CHANGED') then
         alert_response := show_alert('CHANGES');
         if alert_response = alert_button1 then
              commit_form;
         elsif alert_response = alert_button2 then
              clear_block(no_commit);
         elsif alert_response = alert_button3 then
              raise form_trigger_failure;
         end if;
    end if;
    I call that trigger in many other triggers like enter_query, ...
    Everything worked fine until i created form with master_detail block.
    The problem:
    I have a form with two blocks. One master, one detail.
    If i change something in detail block, go to master block item and press enter_query problem appears.
    First i get the message "Do you ..." in my language. When i press NO or CANCEL i get again the message "Do you ..." in original (english) language?
    Why is that?
    Should i call my trigger somewhere else and not just in enter_query trigger (for this problem) or is checking form_status not enough?
    Thanks.

    When you create relation, 3 procedures are automatically created for you.
    Check_Package_Failure, Clear_All_Master_Details and Query_Master_Details.
    When you execute clear_block(no_commit) on the master block -
    Clear_All_Master_Details will fire.
    If you check Clear_All_Master_Details you will find following code there:
    Go_Block(curblk);
    Check_Package_Failure;
    Clear_Block(ASK_COMMIT); -- This statement causing "Do you want to save changes" to appear

  • 'Do you want to save changes you have made' while closing the form

    Hi Everyone,
    I am working on Oracle Applications 11.5.10.2 version. I have created a new form as per the client requirement and registered with APPS. I met all the requirements, but when ever closing the form getting the error 'Do you want to save changes you have made' without entering or modifying records in he form.
    Please help in this regard, bit urgent.
    Thanks in Advance..
    Venky.

    Hi,
    You can suppress messages depending on their message level. For a full description and examples on this topic, please see the help in Forms Builder (press F1 in your Builder) and search for :system.message_level.
    or the other way would be.
    As you are using the copy command for moving the data from one block to the other block , the status of the block will be changed to "Modified".As per oracle standards when every the block status is modified it fire the meassage 'Do you want to save changes you have made' .
    To avoid the message you need to change status of each line to "Query" .Once you do this the block status automatically changes to "query" .Once it is in query mode when you try to close the form it will not pop-up the above message.
    To change the line status use POST command . To get help on this command you can use form builder help.
    Hope this serves your purpose.
    Let me know if you need any further clarification.
    Rgds,
    Naveen.

  • Save Changes Dialog Stops Batch?

    Hi,
    I created a simple batch action that makes a small change to an EPS file, and then exports to WMF. 
    On the last step, I record File>Close.  This opens the "Save Changes to original doc?" dialog window below (see graphic).  I choose "Don't Save", and stop the action. 
    However, each time it stops the batch on this dialog box.
    Is there anyway to automate this step so that it will not interrupt my batch?
    Thanks for any suggestions.  I'm losing work hours!
    -t

    Hi Mylenium,
    Thank you!  I used the controls in the batch settings window to "Save and Close" instead of explictly closing as a step in the batch.  That bypassed the dialog window, and the batch worked without stopping.
    However, I did not see any "Suppress all Dialogs" option anywhere.  Where would I find that for future reference?
    I'm using a Mac, CS5.1.  Here's what I see:
    Tom

  • Save changes when there are no changes

    Why is it that when I open a subvi and close it making absolutely no changes, I'm prompted to 'save changes'?

    Hi wb2nvy,
    "Why would anyone NOT want to include the subvis when the main vi is recompiled to a newer version?"
    Maybe you have linked to subVIs also used with the older LV version and so don't want to save subVIs automatically?
    As said before: no other IDE I know of automatically saves referenced files to a newer version...
    And:
    You should get asked to save subVIs before closing the mainVI. You always have the option to save them. You always are presented with reason why LV wants to save. You always have to decide between saving or not saving... You always have the mass compile option.
    It's your duty to decide when to upgrade VIs - LV will and cannot take that decision!
    Message Edited by GerdW on 06-02-2010 04:37 PM
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • PCUI - Pop-up "save changes" appears every time we switch between the list

    Hi Experts,
    maybe you can help me with the following issue:
    We work with PCUI EP 7.0 and CRM 5.0 and if we start a pcui application (Salesorder for example) and open the
    enhanced search, put some data in the search criterias and then press search - the system gives us the "save changes"
    pop-up?!? The same behaviour occurs if we switch between the list and the detailed view - and we haven't done any changes
    Do you know this problem and do you have a solution for this?
    regards
    marc

    Hi,
           This pop up is related to the WorkProtect mode,
    It will be configured in the portal,
    There will be 3 options available
    if Workprotect mode is 0--- then navigate automatically
    1-- pop up and then navigate
    2- navigate with out saving.
    i'm not sure about the values.
    WorkProtect mode can be seen in the personalize link and this link is available if eu_role is assigned to the corresponding user.
    Please contact portal admin team regarding this.
    Anilkumar

  • How do I stop Photoshop CS6 from asking to save changes to a file when closing the file, after "savi

    I save a lot of files to "save for web". After saving PS asks if I want to save changes to the original file. I never want to save the changes to the original. Since the default is to change the file I am afraid I will accidentally OK the change without wanting to. I would like it to stop asking and just not save it. Is there a way?

    Stephen Douge wrote:
    I never want to mess with originals. I am asking because I want to make sure I stated the question properly in the first place. Thanks.
    Then don't work on the original open the file using Photoshop menu file>open once its in Photoshop as a document dupe the document and close the original document. Photoshop will just close the original and not ask it you want to save the original document for no changes were made to it.  You could easily record an action to automate this process. The first step in the action would be an inserted menu item menu File>Open.  The second step Duplicate Document, third step select previous document the fourth and final step close. The action would look like this recorded Work in the dupe and save it under the name you want to where you want it saved. The First step is an interactive you will be able to open any file Photoshop has support for that you have access to.

  • After 9.5.1 iphoto doesn't save changes in its library

    Since I've updated iphoto to v9.5.1, iphoto doesn't save changes made to the library.
    When I
    - delete event
    - import event from aperture
    - import pictures
    everything goes well until I close and reopen iphoto. Than everything is the same as when I opened iphoto before the changes.
    So it doesn't save the changes in its library.
    Anyone experiencing the same problem?  Or anyone who has a solution?

    Option 1
    Back Up and try rebuild the library: hold down the command and option (or alt) keys while launching iPhoto. Use the resulting dialogue to rebuild. Choose to Rebuild iPhoto Library Database from automatic backup.
    If that fails:
    Option 2
    Download iPhoto Library Manager and use its rebuild function. This will create a new library based on data in the albumdata.xml file. Not everything will be brought over - no slideshows, books or calendars, for instance - but it should get all your albums and keywords back.
    Because this process creates an entirely new library and leaves your old one untouched, it is non-destructive, and if you're not happy with the results you can simply return to your old one. .
    Regards
    TD

Maybe you are looking for

  • Looking for a laser printer that can reproduce screens below 5%

    I need to purchase a new laserprinter. Much of our work involves documents with screens in the 2-10%range. Our current printers cannot reproduce screens below 5% black andperhaps 8% Reflex or say PMS 185. These are hard copy proofs for layout and our

  • Urgent basic question....

    Hello everybody Under pressing Time I need your help: 1.Where can I read more about SRSS' data store? 2.Is SRSS's Data Store a LDAP Server and a DBMS? If so, please provide more info about them (product name and vendor) Thanks in advance, aski

  • PortalComponentException: Error in init method

    Anyone know why I am getting this error below? #1.5#00101810DF7F00570000057E000012A4000428586D6BCD3D#1170260164912#com.sap.portal.portal#sap.com/irj#com.sap.portal.portal#klm1#50377##lssvrep02_EP2_212781850#klm1#c18d3c00b14511dbc4e300101810df7f#SAPEn

  • Cannot Enterprise Activation - Desktop manager 5.0.1

    Hi, I want to perfomr wired enterprise activation of my BB device on lab setup, Things I do not have I donot haveGSM/Edge  Blackberry plan and not register with any service provider Since I'm testing BB in my test lab, my exchange is confined to test

  • Want to restore previous version on firefox since my Norton toolbar is incompatible and can't do it.

    I upgraded to the 4.0 version then discovered my Norton toolbar is incompatible. I have been unable to restore my computer to before the upgrade.