ALV  issue - capturing user changes in editable fields using custom button?

Hi,
I created a custom button in ALV tool bar.   And also in my ALV grid I have couple of fields Editable option. User can change values for these 2 fields.
My question is -
After changing values for these editable fields(more than 1 record)  , user will click on custom button and then I have to update all the user changed values in to my internal table(lt_tab)  and then I have to process logic.
Problem is when user click on Custom button in ALV tool bar it is not having the changed values in lt_tab table.
Only when user clicks  some thing on ALV grid records or fields then it is getting all the changed values in to lt_tab.
Can any one tell me how I can get changed values when user clicks on custom button?
1. Can we place custom button in ALV Grid? instead of ALV tool bar? 
or
How I can capture user changes when they click on custom button?
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
TABLES
      T_OUTTAB                          = lt_tab
Please check this logic-
CASE r_ucomm.
    WHEN '&IC1'.
- It_tab  having all changed field values
  WHEN 'custom button'.
      lt_tab  - not having any changed values - showing all initial lt_tab values.
I highly appreciate your answers on this.
Thanks.
Rajesh.

Hi,
Use this code, its working:-
*&      Form  ALV_DISPLAY
*       SUB-ROUTINE ALV_DISPLAY IS USED TO SET THE PARAMETERS
*       FOR THE FUNCTION MODULE REUSE_ALV_GRID_DISPLAY
*       AND PASS THE INTERNAL TABLE EXISTING THE RECORDS TO BE
*       DISPLAYED IN THE GRID FORMAT
FORM alv_display .
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
   EXPORTING
*     I_INTERFACE_CHECK                 = ' '
*     I_BYPASSING_BUFFER                = ' '
*     I_BUFFER_ACTIVE                   = ' '
     i_callback_program                = v_rep_id       " report id
     i_callback_pf_status_set          = 'PF'           " for PF-STATUS
     i_callback_user_command           = 'USER_COMMAND' " for User-Command
*     I_CALLBACK_TOP_OF_PAGE            = ' '
*     I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
*     I_CALLBACK_HTML_END_OF_LIST       = ' '
*     I_STRUCTURE_NAME                  =
*     I_BACKGROUND_ID                   = ' '
*     I_GRID_TITLE                      =
*     I_GRID_SETTINGS                   =
     is_layout                         = wa_layout      " for layout
     it_fieldcat                       = it_field       " field catalog
*     IT_EXCLUDING                      =
*     IT_SPECIAL_GROUPS                 =
     it_sort                           = it_sort        " sort info
*     IT_FILTER                         =
*     IS_SEL_HIDE                       =
*     I_DEFAULT                         = 'X'
     i_save                            = 'A'
     is_variant                        = wa_variant     " variant name
*     IT_EVENTS                         =
*     IT_EVENT_EXIT                     =
*     IS_PRINT                          =
*     IS_REPREP_ID                      =
*     I_SCREEN_START_COLUMN             = 0
*     I_SCREEN_START_LINE               = 0
*     I_SCREEN_END_COLUMN               = 0
*     I_SCREEN_END_LINE                 = 0
*     I_HTML_HEIGHT_TOP                 = 0
*     I_HTML_HEIGHT_END                 = 0
*     IT_ALV_GRAPHICS                   =
*     IT_HYPERLINK                      =
*     IT_ADD_FIELDCAT                   =
*     IT_EXCEPT_QINFO                   =
*     IR_SALV_FULLSCREEN_ADAPTER        =
*   IMPORTING
*     E_EXIT_CAUSED_BY_CALLER           =
*     ES_EXIT_CAUSED_BY_USER            =
    TABLES
      t_outtab                          = it_final      " internal table
   EXCEPTIONS
     program_error                     = 1
     OTHERS                            = 2.
  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.
ENDFORM.                    " ALV_DISPLAY
*&      Form  USER_COMMAND
*       SUB-ROUTINE USER_COMMAND IS USED TO HANDLE THE USER ACTION
*       AND EXECUTE THE APPROPIATE CODE
*      -->LV_OKCODE   used to capture the function code
*                     of the user-defined push-buttons
*      -->L_SELFIELD   text
FORM user_command USING lv_okcode LIKE sy-ucomm l_selfield TYPE slis_selfield.
* assign the function code to variable v_okcode
  lv_okcode = sy-ucomm.
* handle the code execution based on the function code encountered
  CASE lv_okcode.
* when the function code is EXECUTE then process the selected records
    WHEN 'EXECUTE'. "user-defined button
* to reflect the data changed into internal table
      DATA : ref_grid TYPE REF TO cl_gui_alv_grid. "new
      IF ref_grid IS INITIAL.
        CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
          IMPORTING
            e_grid = ref_grid.
      ENDIF.
      IF NOT ref_grid IS INITIAL.
        CALL METHOD ref_grid->check_changed_data.
      ENDIF.
* refresh the ALV Grid output from internal table
      l_selfield-refresh = c_check.
  ENDCASE.
ENDFORM.
This will reflect all the changes in the internal table. Now you can include your logic as per your requirement.
Hope this solves your problem.
Thanks & Regards,
Tarun Gambhir

Similar Messages

  • Unable to capture context attributes of editable fields

    Hello All,
    In my application, there are two trans. containers. One holds set of material info fields at top and in the bottom the container holds a table with quantity data of the material.
    The material info container has a edit button and 3 fields are editable and saved from the container. In the bottom container there is button to move to next material. Before moving, I check if any data is changed in material info container and display pop up to save it.
    Now, when i click the save button in the mat info container the ediatbel fields data is passed and gets saved. But, when the same save method is called from the confirmation pop up in the bottom container table the editable fields data is not passed. No idea on the reason behind this behaviour.
    The code used to retrieve the data is      
    nd_vipos_mat_master->get_static_attributes(
                IMPORTING
                  static_attributes = lr_vipos_mat_info ).
    Kindly assist.
    Regards,
    Sharath

    Hi ,
    When you are saving data using popup, you must have subscribed an action with popup button. I hope it is not the same action which you are using with SAVE button.
    You can try subscribing the same action for popup which you used in Save button. Ex: if on saving directly, you are calling action "OnSave" and from popup, the triggered action is "OnActionSaveFrom Popup".  So dont use this new action while subscription with popup button. use "OnSave" with popup button also.
    if it is working with save button, it should be fine with popup also.
    Thanks
    Vishal

  • Email Alert Template Issue - List Alerts (Alert Me) emails not using customized XML alert template

    We have recently customized the XML alerts template (AlertTemplates.xml) for our site collection in SharePoint 2010 to exclude specific fields in the email when users who have subscribed using the "Alert Me" feature. We have renamed the
    custom alerts XML file and loaded the custom template in the following directory (%ProgramFiles%\Common Files\Microsoft Shared\Web server extensions\14\TEMPLATE\XML) and restarted IIS.  Once users subscribe to the alerts using the list "alert me"
    function they received the customized email as intended.
    We needed to auto-subscribe users to the email alerts so what we did was use a powershell script to add users to the alert subscriptions using the script shown below:
    Import-Csv D:\Temp\filename.csv | ForEach-Object{
    $webUrl=$_.WebUrl
    $listTitle=$_.List
    $alertTitle=$_.AlertTitle
    $subscribedUser=$_.SubscribedUser
    $alertType=$_.AlertType
    $deliveryChannel=$_.DeliveryChannel
    $eventType=$_.EventType
    $frequency=$_.Frequency
    $oldAlertID=$_.ID
    $web=Get-SPWeb $webUrl
    $testAlert = $web.Alerts | WHERE { $_.ID -eq $oldAlertID }
    IF ($testAlert) {
    $web.Alerts.Delete([GUID]$oldAlertID)
    Write-Host Old alert $oldAlertID deleted. -Foregroundcolor Cyan
    $list=$web.Lists.TryGetList($listTitle)
    $user = $web.EnsureUser($subscribedUser)
    $newAlert = $user.Alerts.Add()
    $newAlert.Title = $alertTitle
    $newAlert.AlertType=[Microsoft.SharePoint.SPAlertType]::$alertType
    $newAlert.List = $list
    $newAlert.DeliveryChannels = [Microsoft.SharePoint.SPAlertDeliveryChannels]::$deliveryChannel
    $newAlert.EventType = [Microsoft.SharePoint.SPEventType]::$eventType
    $newAlert.AlertFrequency = [Microsoft.SharePoint.SPAlertFrequency]::$frequency
    if($frequency -ne "Immediate"){
    $AlertTime=$_.AlertTime
    $newAlert.AlertTime=$AlertTime
    $newAlert.Update()
    Write-Host Created $newAlert.Title for $subscribedUser . -Foregroundcolor Cyan
    } ELSE {
    Write-Host Alert $alertTitle for $subscribedUser already done. Moving on. -Foregroundcolor Magenta
    When we ran the script and added the users and restarted the service, all users who were auto-subscribed via this method get the email without the customizations that were done in teh custom alert template.  All users who manually subscribed on their
    own to the list using the "Alert Me" function would get the customized email.
    Does anyone know why users who manually subscribe to the alerts get the customized email, and users who were auto-subscribed using the powershell script do not get the customized email and get the standard generic email template?

    Hi  ,
    According to your code, it create a new alert using SPUser.Alerts.Add() method. For this method, it will create a new alert based on the predefined alert template by default.
    If you only assigned the custom alert template to the list, users who manually subscribe to the alerts get the customized email, but users who were auto-subscribed using the PowerShell script get the standard
    generic email template.
    For your issue, you can set the new alert ‘s alert template:
    http://social.technet.microsoft.com/Forums/en-US/1b19c12f-fc37-48cf-8b59-6c09f095dc23/custom-alert-email-templates-issue-list-alerts-emails-not-using-customized-xml-alert-template?forum=sharepointgeneralprevious
    Here is a good blog you can have a look:
    http://blogs.msdn.com/b/sharepointdeveloperdocs/archive/2007/12/07/customizing-alert-notifications-and-alert-templates-in-windows-sharepoint-services-3-0.aspx
    Thanks,
    Eric
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support,
    contact [email protected]
    Eric Tao
    TechNet Community Support

  • How to Calculate sum for the selected rows in ALV gird using custom button

    Hi I am trying to implement an ALV Grid display where the user can select few rows in the output and if he click on some custom button he should get the sum for only those rows.
    Can anyone give me some idea regarding this.
    Thanks in advance

    While building the fieldcatalog for amount field use gt_fieldcat-do_sum = 'X'. And use the below for doc type sorting and subtotal.
    *  ALV data declarations
      data: it_sortcat   type slis_sortinfo_alv occurs 1,
            wa_sort like line of it_sortcat.
    perform build_sortcat.
    *&      Form  build_sortcat
    *       Build Sort catalog
    FORM build_sortcat .
      wa_sort-spos      = 1.
      wa_sort-fieldname = 'EBELN'.
      wa_sort-SUBTOT    = 'X'. "subtotals any totals column by this field
    *  gd_sortcat-tabname
      APPEND wa_sort TO it_sortcat.
      wa_sort-spos      = 2.
      wa_sort-fieldname = 'EBELP'.
    *  gd_sortcat-tabname
      APPEND wa_sort TO it_sortcat.
    ENDFORM.                    " build_sortcat
    call function 'REUSE_ALV_LIST_DISPLAY'
           exporting
                i_callback_program      = gd_repid
                i_callback_top_of_page   = 'TOP-OF-PAGE'
                is_layout               = gd_layout
                it_fieldcat             = fieldcatalog[]
                it_sort                 = it_sortcat
                i_save                  = 'X'
           tables
                t_outtab                = it_ekko
           exceptions
                program_error           = 1
                others                  = 2.
    Regards,
    Chandru

  • Editable Grid vs Custom Buttons

    Hi all,
    I have a grid in edit mode (created with the standard function REUSE_ALV etc etc) and i have a custom User Interface with a button to add a line (just a simple append in my internal table displayed in the grid).
    All it's ok and works, but if a put a value in my editable cell and i press the button WITHOUT press "ENTER" or move the cursor in another cell, the method handle_data_changed doesn't raise and i lost my new entries. If i use another button (for example sort, select all, filter) the event raise and the grid save my modification.
    So what is the problem? is something to configure in User Interface? i have debugged the FM without success and i haven't idea
    thx
    Francesco

    Have u decalared the USER BUTTON in class?
    If yes use HANDLE METHOD and the case e_comm.
    in this u have to write the code for the BUTTON declared.
    Also use the method get_selected_rows instead of handle_data_changed .
    I hope this helps

  • Populating the Addressee field using Customer Interface program

    Hello All,
    Can any body tell me how to populate the "Addressee" column in the HZ_Party_Sites table using Customer Interface Program. Which field should be populated in RA_Customers_Interface_All table inorder to populate the "Addressee" field.
    Thank you,
    Vijay

    You can post this thread in this
    Customers as well.
    Thanks
    GM

  • How to change color when I using delete button?

    Hi experts,
      When I using delete button on input schedule before enter any data, it display the same color on the data range, how can fix the color after using delete button? or is it a formatting problem?
    BPC ver : 7.5 sp3 for NW
    best regard
    Evans.

    Evans,
           Is delete button custom made? i think it is possible with Formatting Range.
          check the below for advanced formatting.
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/70573b01-657a-2b10-a2b2-ec54bb0a9c8c?quicklink=index&overridelayout=true
    I think you need use CHANGED  as value for CRITERIA.  I don't think NW doesn't support CHANGED value for CRITERIA i guess.
    Thanks,
    Ben.

  • How to identify column name in ALV tree when user clicks a particular field

    Hi All,
    In My requirement i am displaying ALV Tree.
    In Which When the user clicks on a particular header column it should navigate to other transaction.
    Now the issue is it is navigating to other transaction when we click on any column of the header row.
    But, the user requires only for particular column .
    Is there any method  to catch the field name in CLASS 'CL_GUI_ALV_TREE'.
    Regards,
    Bhanu.R

    Check out for CUCOL system field.
    Regards,
    Lalit Mohan Gupta.

  • How can we change Non-Editable field in MM02

    Hi,
    I want to change some fields value through MM02, but they are non-changable mode (GRAY).
    Please let me know the SPRO setting, from where I can change that fields or some other option is there in SAP..
    Thanks

    Hi,
    The Fields can be made EDITABLE in the Transaction code  OMS9
    Goto the Transaction code OMS9 and enter the FIELD SELECTION GROUP of the  Field ( from drop down)
    and  in the below screen you can find the Details like
    HIDE,
    DISPLAY
    OPTIONAL
    REQUIRED
    You can check the filed as per your requirement.
    regards,
    santosh

  • Track changes to any field in Custom transaction and then call pop-up FM ?

    Hi Friends,
    I have created a custom transaction with 2 screens. Only if user has made some changes to any of the 40 fields in those 2 screens, I should ask user if they want to save by calling pop-up function module ? Rather than checking each field content with database content, is there any easy way to monitor the changes and call pop-up function module ?
    Any help is suitably rewarded.
    Niranjan

    Thanks Amit for the reply.
    I have 2 questions
    1) Is there any easy way that SAP will keep track by itself, say in SYST structure, and I can just check in SY structure if something has changed ?
    2) Along with 40 fields, I have 2 more sub-screens; Text editor AND table control. I need to check contents of these also and then call SAVE pop-up function module.
    Pl let me know,
    Niranjan

  • Issue with fill in the blank field and back button.

    I am working in CP4 AS2.  I have create a page of fill in the blank fields to simulate filling in a form.  On the next slide, I show the answers by extracting the variables into text boxes.  I have a back and a next button and instruct the user to review their answers and if incorrect, to select the back button in order to reenter the data.  I have the back button set to jump to the previous slide by number (i've tried previous, last slide, etc...)
    The flash movie freezes when I select the back button.  I think flash is having trouble going back to the fill in the blank fields from the displayed variables.  Any ideas? or work arounds for this.  The idea solution would take them back to the page with the data already in the fields so they could correct the errors only and then return to the review page.
    Thanks
    Scott

    Hi there
    Is scoring enabled on these? If so, perhaps your quiz settings are preventing backward movement.
    Cheers... Rick
    Helpful and Handy Links
    Captivate Wish Form/Bug Reporting Form
    Adobe Certified Captivate Training
    SorcerStone Blog
    Captivate eBooks

  • User exit  with a field in custom z table

    hi ..
    I have a custom z table with a z field in it. This z field is linked with t800d data base table. when a report is executed using this t800d table they want text data from the z field, but it is not displaying . they said the possible solution would be defining  a user exit. how can i do this?

    Hi,
    Your requirement is not clear. Can you explain a bit.
    Regards,
    Atish

  • Trigger change badi when click a custom button

    hello guys i want to trigger the change badi when a user clicks on a button.  Any help would be create?
    I am using the set change by client setting it to true and then firing the refresh but it is not working?  Any clues?  Thank you.

    As I told you in that linked thread, I'd suggest trying to use SET_CHANGED_BY_CLIENT method on the context of your webdynpro. This is sufficient to make the system aware of a change and trigger the CHANGE badi.
    As far as I've observed doing my tests, the CHANGE badi is then triggered after an event that will follow the SET_CHANGED_BY_CLIENT execution.
    So I'd suggest two test:
    - pre-exit of the method you trigger when the user press your custom buttom: set_changed_by_client and then execute your code. See if the badi is then triggered;
    - if not: you could "force" a subsequent action after the button press, for example, a simple REFRESH of the view. Then I'm sure that, after the set_changed_by_client method, the badi will surely be triggered.
    Please be aware that I'm absolutely NOT a guru on these arguments, so I'm trying to give you some workarounds I implemented on an SRM 7 system. Probably some guru will have better and cleaner solution for your task, but as far as I've seen, these ones should meet your needs.

  • Issue in keeping the InfoView session valid using Custom JSP Open Document

    Hi
    We are using OpenDocument URL in custom JSP to show BO Web Intelligence Document.  The documents are opening fine but some of our WebI documents have links to other WebI document,  when the link is clicked it takes to Info View Login Page.
    If I login and logout once from InfoView then the WebI document links work fine.
    Can you please guide me on how to make the session valid for WebI internal links?  Do I need to create a Cookie or use URL Encoding?
    Following is the sample JSP code:
    <%@ page import="com.crystaldecisions.sdk.exception.SDKException" %>
    <%@ page import="com.crystaldecisions.sdk.framework.CrystalEnterprise" %>
    <%@ page import="com.crystaldecisions.sdk.framework.IEnterpriseSession" %>
    <%@ page import="com.crystaldecisions.sdk.framework.ISessionMgr" %>
    <%@ page import="com.crystaldecisions.sdk.occa.infostore.IInfoStore" %>
    <%@ page import="com.crystaldecisions.sdk.occa.security.ILogonTokenMgr"%>
    <%
    try{
    String systemName = "ServerName";
    String userName = "user";
    String password = "pass";
    String authType = "secEnterprise";
    IEnterpriseSession enterpriseSession=null;
    if (enterpriseSession == null)
    ISessionMgr enterpriseSessionMgr = CrystalEnterprise.getSessionMgr();
    enterpriseSession = enterpriseSessionMgr.logon(userName, password, systemName, authType);
    ILogonTokenMgr logonTokenMgr = enterpriseSession.getLogonTokenMgr();
    String defaultToken = logonTokenMgr.createWCAToken("",20,10);
    response.sendRedirect("http://boServer:port/OpenDocument/opendoc/openDocument.jsp?iDocID=16894&token="+defaultToken);
    catch(Exception e)
    e.printStackTrace();
    %>

    Thanks Aasavari for responding. My problem is solved. 
    I need not create any cookie or create token using getLogonToken
    Some of the URLs in the webi documents were incorrect and so Info View was taking to the Info View Login page.  
    But I am surprised though why info view not complain about incorret and rather takes to the login page.
    Thanks for your help again.

  • Setting Default values for field using custom.pll

    Hi All,
    I have an rquirement to set the default values on Meterial Tranasction screen for some condition
    I tried it in both ways via Form Personalization and using custom.pll
    i m using the following code in custom.pll
    form_name      varchar2(30):= name_in('system.current_form');
    block_name varchar2(30):= name_in('system.cursor_block');
    trx_type           varchar2(30);
    subinv                varchar2(30);
    begin
    if form_name='WIPTXMAT' and block_name ='MTL_TRX_LINE' then
    if event_name ='WHEN-VALIDATE-RECORD' then
         trx_type:=name_in('WIPTXMAT.TRANSACTION_TYPE');
    if trx_type ='WIP Return' THEN
         copy(10,'MTL_TRX_LINE.TRANSACTION_QUANTITY');
              copy(10,'MTL_TRX_LINE.NUMBER_OF_LOTS_ENTERED');
              sinv:=trim(name_in('MTL_TRX_LINE.SUBINVENTORY_CODE'));
              if sinv is null then
                   copy(subinv,'MTL_TRX_LINE.SUBINVENTORY_CODE');
                   copy(fr_locator,'MTL_TRX_LINE.LOCATOR');
                   FND_MESSAGE.SET_STRING(sinv);
                   FND_MESSAGE.SHOW;
              end if;
         end if;
    end if;
    end if;
    end event;
    Problem is that default values are getting set but not for all rows . if there are 4 records then values are set for only first 2 rows and if there are 2 rows then defaults are set for 1st row only.
    Same behaviour happens when i do it via form personalization
    i couldn't understand the behaviour of WHILE-VALIDATE-RECORD event..
    Please provide some suggestion on it. its really urgent.
    Thanks in Advance
    Renu

    Works Now...

Maybe you are looking for

  • ICloud seriously screwed me up & I'm not sure how to fix it

    Okay, so I upgrade to IOS5. I get hoodwinked into creating a new apple ID, much to my dismay. After restarting my iPhone, I don't want the new ID, so I try to log into Apple ID with my previous ID, however it won't accept my password and makes me res

  • Adapter-Specific Attributes Retrieval

    Hello, I am trying to retrieve the filename from the sender message type to be used in the mapping. In order to achieve this I ticked the Adapter-Specific message properties on both Sender and receiver CC. I created a user-defined function FilenameY

  • How to list AUR packages in terminal with yaourt or other helper?

    I can list packages I have installed from AUR, for example to find all the developer components of Xfce that I have installed, I can run the following command:     pacman -Qim | grep -E "Name           : xf".+devel Which outputs:     Name           :

  • Is hard-coded subview sizing brittle or best practice?

    Coming from a web background, where explicit sizing is generally not considered best practice, I am not used to 'hardcoding' positioning values. For example, is it perfectly acceptable to create custom UITableViewCells with hardcoded values for subvi

  • Flatten a hierarchy

    I'm trying to flatten a hierarchy. I have a table with a parent/child relationship in the following order Parent_ID Child_ID 1234 1234 1234 1235 1235 1236....etc I would like to transform the hierarchy to 1234 , 1235, 1236 If I use a sys_connect_by I