ALV Editable  ( Validate changed Value  )

Hi Gurus,
I have a requiremnet on ALV.
I have a program ZTEST with screen no 9000.
I have a container places on the screen 9000
from PBO module of screen 9000
I am passing an internal table gt_xvbep with 3 values
VBELN ,   TIMEFROM , TIMETO
234000    10:00:00   12:00:00
234002    13:00:00   15:00:00
Fields TIMEFROM and TIMETO are 'editable" and of type DATS
When user enters a values on screen
TIMEFROM should be always greater than TIMETO.
I need to validate the above scenario
When ever user enters TIMEFROM > TIMETO ans press enter I need to show an error message "TO time should be greater than FRom time"
Please let me know how I can catch "ENTER"  event in ALV in OOPS and validate the fields
Regards
Avi.

<br>Hi Avi
<br>1) Catch the enter event or modified event. Enter event is caught whenever you press enter after edit a field. If you edit a <br>field and then press TAB to go to another field than the Enter event is NOT CAUGHT. However if you use MODIFY
<br>event then ENTER event is also caught.
<br>
<br>Example:
<br>
<br>* Create the event or modified hanlder object
<br>  CREATE OBJECT g_events.
<br>  SET HANDLER g_events->data_changed FOR gref_alv_list.
<br>
<br>* Modify  Event
<br>  CALL METHOD gref_alv_list->register_edit_event
<br>    EXPORTING
<br>      i_event_id = cl_gui_alv_grid=>mc_evt_modified.
<br>
<br>* Or Enter Event
<br>  CALL METHOD gref_alv_list->register_edit_event
<br>    EXPORTING
<br>      i_event_id = cl_gui_alv_grid=>mc_evt_enter.
<br>
<br>2) To be able to check data, you could do the following
<br>    First, create class definition
<br>   -
<br>
<br>        CLASS lcl_events DEFINITION.
<br>           PUBLIC SECTION.
<br>              METHODS:
<br>                 data_changed FOR EVENT data_changed OF cl_gui_alv_grid
<br>                            IMPORTING er_data_changed
<br>                                               e_onf4
<br>                                               e_onf4_before
<br>                                               e_onf4_after
<br>                                               e_ucomm.
<br>
<br>         ENDCLASS.                  
<br>
<br>   Second, implementation
<br>   -
<br>
<br>   METHOD data_changed.
<br>    DATA: ls_mod TYPE lvc_s_modi,
<br>          ls_ins TYPE lvc_s_moce,
<br>          ls_del TYPE lvc_s_moce.
<br>
<br>*  To get rows that have been deleted if needed
<br>    LOOP AT er_data_changed->mt_deleted_rows INTO ls_del.
<br>    ENDLOOP.
<br>
<br>*  To get rows that have been inserted if needed
<br>    LOOP AT er_data_changed->mt_inserted_rows INTO ls_ins.
<br>    ENDLOOP.
<br>
<br>*  To get cells that have been changed if needed
<br>    LOOP AT er_data_changed->mt_mod_cells INTO ls_mod.
<br>
<br>*       You do your verififcation here
<br>*       Add Message error if necessary by calling add_protocol_entry
<br>
<br>       call method er_data_changed->add_protocol_entry
<br>        exporting
<br>            i_msgid     = sy-msgid
<br>            i_msgty     = sy-msgty
<br>            i_msgno     = sy-msgno
<br>            i_msgv1     = sy-msgv1
<br>            i_msgv2     = sy-msgv2
<br>             i_msgv3     = sy-msgv3
<br>            i_msgv4     = sy-msgv4
<br>            i_fieldname = Your table filed name here or any other value
<br>            i_row_id    = Your table row number here or any other value
<br>
<br>*      Display message error if necessary by calling add_protocol_entry
<br>      CALL METHOD er_data_changed->display_protocol.
<br>
<br>    ENDLOOP.
<br>  ENDMETHOD.                    "data_changed
<br>Dean Q.
<br>Good luck
Edited by: Dean Q on Nov 3, 2009 9:52 PM

Similar Messages

  • Web Form Cancel Edit button changes value of List View item when clicked

    I have a web form, I shows 3 buttons, Edit, Save, And cancel. When the user presses the edit button it enables editing. When the user makes an edit and presses the save button it saves the changes. When the user presses the cancel button, it does cancel
    the edit ok but it changes the vale in the left list view to a different value.  For instance my left list view has a list of vendor names.  When I click cancel, the vendor name shown for the selected record, changes to the vendor number.  I
    have experimented with different values to show in the list view, I have turned off sorting, etc.  No matter what everytime I click cancel button it changes the vendor name to the vendor number.
    Even stranger is when I scroll the list up and the item that changed is move out of view and then you scroll back down to put it in view it puts the value back to the vendor name.
    This isn't consistent as I have created some forms where it doesn't do this. 
    Also when I create a new list view, does anyone know how to get it into the tile pane .  the only way to get anything in that list appears to be that I have to create a whole new table.
    Jim

    This forum is for the desktop user interface Windows Forms, its classes, apis and components.
    For a webform try the ASP.Net forums.
    http://forums.asp.net
    Success
    Cor

  • Urgent..getting default & changed values in ALV editable....have ur point.s

    Hi all,
    I m using interactive ALV grid with 1 column editable with some default values, When i m clicking on SAVE button, only the values which are changed by the user in that column are coming in the internal table, & the default values are automatically deleted by the following code....
    But my requirement is to save all the default & changed values of the ALV column....
    <b>Help me out & have ur points.</b>
    DATA ref1 TYPE REF TO cl_gui_alv_grid.
    CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
    importing
                   e_grid                           = ref1
    CALL METHOD ref1->check_changed_data
    IMPORTING
       e_valid   =
    CHANGING
       c_refresh = 'X'

    Pradeep,
    When ur doing the CHECK_CHANGED_DATA, u ll get the edited values inside this callback sub -routine only. so here u trap the values those are changed ( thats after editing).
    Once the control goes back to the original program ( calling prog ) , u ll end up with ur old data ( before editing).
    you ll have to handle that explictly in your code, or shift to OO alv grid like this -
    REPORT ZSKC_GRID.
    TABLES : EQUI.
    DATA   : BEGIN OF T_EQUI OCCURS 0,
              EQUNR TYPE EQUI-EQUNR,
              AENAM TYPE EQUI-AENAM,
             END   OF T_EQUI.
    DATA : T_FCAT  TYPE LVC_T_FCAT,
           G_FCODE TYPE SY-UCOMM.
    DATA : G_GRID TYPE REF TO CL_GUI_ALV_GRID.
    SELECT-OPTIONS: S_EQUNR FOR EQUI-EQUNR.
    START-OF-SELECTION.
    * get data.
      PERFORM SUB_GET_DATA.
    * Populate catalog.
      PERFORM SUB_BUILD_CATALOG CHANGING T_FCAT.
    * Display the grid.
      PERFORM SUB_SHOW_GRID.
      CALL SCREEN 9001.
    *&      Form  SUB_GET_DATA
    *       Get data
    FORM SUB_GET_DATA .
      SELECT EQUNR AENAM
      FROM   EQUI
      INTO   TABLE T_EQUI
      WHERE  EQUNR IN S_EQUNR.
      IF SY-SUBRC NE 0.
    *  Give some message if needed
      ENDIF.
    ENDFORM.                    " SUB_GET_DATA
    *&      Form  SUB_BUILD_CATALOG
    *       text
    *      <--P_T_FCAT  text
    FORM SUB_BUILD_CATALOG  CHANGING PT_FCAT TYPE LVC_T_FCAT.
      DATA : WA_CAT TYPE LVC_S_FCAT.
      CLEAR WA_CAT.
      WA_CAT-FIELDNAME = 'EQUNR'.
      WA_CAT-TABNAME   = 'T_EQUI'.
      WA_CAT-REF_FIELD = 'EQUNR'.
      WA_CAT-REF_TABLE = 'EQUI'.
      APPEND WA_CAT TO PT_FCAT.
      CLEAR WA_CAT.
      WA_CAT-FIELDNAME = 'AENAM'.
      WA_CAT-TABNAME   = 'T_EQUI'.
      WA_CAT-REF_FIELD = 'AENAM'.
      WA_CAT-REF_TABLE = 'EQUI'.
      WA_CAT-EDIT      = 'X'.
      APPEND WA_CAT TO PT_FCAT.
    ENDFORM.                    " SUB_BUILD_CATALOG
    *&      Form  SUB_SHOW_GRID
    *       Show grid
    FORM SUB_SHOW_GRID .
    * create the Grid Object.
      CREATE OBJECT G_GRID
        EXPORTING
           I_PARENT          = CL_GUI_CONTAINER=>SCREEN0
        EXCEPTIONS
          ERROR_CNTL_CREATE = 1
          ERROR_CNTL_INIT   = 2
          ERROR_CNTL_LINK   = 3
          ERROR_DP_CREATE   = 4
          OTHERS            = 5.
      CHECK SY-SUBRC EQ 0.
    * Display contents,
      CALL METHOD G_GRID->SET_TABLE_FOR_FIRST_DISPLAY
        CHANGING
          IT_OUTTAB                     = t_equi[]
          IT_FIELDCATALOG               = t_fcat
        EXCEPTIONS
          INVALID_PARAMETER_COMBINATION = 1
          PROGRAM_ERROR                 = 2
          TOO_MANY_LINES                = 3
          others                        = 4.
    ENDFORM.                    " SUB_SHOW_GRID
    *&      Module  STATUS_9001  OUTPUT
    *       text
    MODULE STATUS_9001 OUTPUT.
       SET PF-STATUS 'PF_9001'.
       SET TITLEBAR 'TITLE_9001'.
    ENDMODULE.                 " STATUS_9001  OUTPUT
    *&      Module  USER_COMMAND_9001  INPUT
    *       text
    MODULE USER_COMMAND_9001 INPUT.
      CASE G_FCODE.
        WHEN 'BACK' OR 'CANC' OR 'EXIT'.
          LEAVE TO SCREEN 0.
        WHEN 'HAVE'.
    *    After editing everything user presses this button.
         PERFORM SUB_GET_EDITED_DATA.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_9001  INPUT
    *&      Form  SUB_GET_EDITED_DATA
    *       Read the ALV grid and get current internal table.
    FORM SUB_GET_EDITED_DATA .
    DATA : T_OLD_DATA LIKE T_EQUI OCCURS 0.
    * hold the old values if u need them.
      t_old_data[] = t_equi[].
    * This will update the global internal table.
      CALL METHOD G_GRID->CHECK_CHANGED_DATA.
    * Now t_equi have changed here. u have the old data in the T_OLD_DATA.
      BREAK-POINT.
    ENDFORM.                    " SUB_GET_EDITED_DATA
    Create a blank screen called 9001. and Pf-staus has a buton with fcode "HAVE". ( alongwith BACK canc exit).

  • How to capture changed value in ALV Grid

    Hi Guys,
    I have an ALV grid report where I have 'Edit On' for one of the quantity fields in the report. How do I capture the new (changed) value in the suboutine for user command when user changes the value in the report and clicks on a button ?
    Points assured for helpful replies.

    FORM USER_COMMAND USING P_UCOMM LIKE SY-UCOMM...........
    Data ref1 type ref to cl_gui_alv_grid.
    CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
    IMPORTING
    E_GRID = ref1.
    call method ref1->check_changed_data
    ENDFORM.
    Also chk the blog
    /people/community.user/blog/2007/01/10/displaychange-mode-of-editable-fields-in-alv-using-function-modules-but-not-custom-containers

  • Alv output capturing changed Output values

    hi all,
    I have an alv grid output. In this output i have one column which is input enabled . I will be changing the values and I have a pushbutton in the application tool bar. When I press the pushbutton, by selecting the row with the changed value, that row should be captured in the internal table of a program.
    How can I achieve this.
    Thanks
    Saravana

    Hi,
    If you are using OOp
      call method grid1->get_selected_rows
        importing
          et_index_rows = i_sel_alvrows[].
      call method cl_gui_cfw=>flush.
      describe table i_sel_alvrows lines v_dbcnt.
      if i_sel_alvrows[] is initial.
    * Info message : Please select a row
        message i176.                        " Please select a row'.
      endif.
      if v_dbcnt gt 1.
    * Info message : Multiple Row Selection not  possible
        message i177.                        " Multiple Row Selection not
        " possible'
      else.
       read table i_output into wa_output index wa_sel_alvrows-index.
    Here wa_output contains the selected row.
    aRs

  • Dynamically change values of dropdown column of webdynpro ALV

    Hi All,
    In our webdynpro application we are using a ALV in which we need to display one column as dropdown, now values in this dropdown needs to be changed based on some other selection on the screen. I tried changing the value set of the attribute binded to this column and refreshiing the ALV after setting the value set with iwci_salv_wd_table->refresh( ) method but it doesn't work. The dropdown always shows the values which I set in the value set in wdinit method.
    Please let me know how this can be acheived?
    Thanks,
    Anuj Tanwar

    in the selections action you can overwrite the ITAB that is bind to your ALV and then bind_table( the new itab ) to the context node that is bind to your ALV.
    WDDOINIT you have an itab that I will call itab_1 and after you set up the value_set for the dropdown and the rest of the values in the itab 1 you should have a line of code like  lond_context->bind_table( itab_1) right?
    so now you have other user interface that has different selections and the user have to select something and the dropdown should change....
    no behind the ACTION of the user interface you should do the same as wddoinit but now your itab_1 should have the new values that you code to be depending on the selections so now you should bind the new itab_1 to the context node, same way you did in wddoinit.
    thanks!
    Jason PV

  • Changing value of input field in interactive report

    Hi all,
    I have created interactive report. On 3rd list, i had calculated total for netwr filed and it is displayed at bottom.
    netwr field on list is editable. If value in netwr changed by user , value for total should be changed on same list.
    Can anybody help me out?
    Thanks and Regards,
    Rakesh.

    Hi Rakesh
    Within the third alv's usercommand, Try this code.
    FORM user_command1 USING r_ucomm LIKE sy-ucomm
           rs_selfield TYPE slis_selfield.
        CASE r_ucomm.
             WHEN 'EDIT'.
                 <code>
                 CALL METHOD <alv_instance>->refresh_table_display
                     EXPORTING
                     is_stable = <third_alv_internal_table>
                     EXCEPTIONS
                     finished = 1
                     OTHERS = 2.
      ENDCASE.
    ENDFORM.
    This will refresh the internal table each item a edit operation is done, after this write the code to find the sum.
    Thanks and Regards,
    Rinzy Deena Mathews

  • How to handle 'ENTER' Key on ALV Editable Grid on sub screen (Tabstrips)

    Hello Experts ,
    I have 2 questions with ALV Editable grid;
    please help me if you have answers.
    I created ALV grid on one of sub screens on a Tab Strip,
    As soon as user types one of the columns of the ALV grid and press u2018ENTERu2019 key, it has to return corresponding details for that line.
    I tried to implement this logic in ALV grid event u2018handle_data_changedu2019, but ALV internal table is not getting populated with new entry entered in the grid. but u2018double_clicku2019 event working my purpose, but user might need enter key.
    and I thought I would do implement that logic in PAI event of the sub screen, u2018ENTERu2019 key not getting trigger on PAI event of the screen until cursor is on grid.
    Another question 2:  How do I control and not to be deleted a line on the grid (based on validation), where do I validate and by pass the delete function for a particular line, or suggest me to gray out only one line on the grid .
    I would like to have delete function to work as it is ,except for some validations..
    Can I implement using PAI event of the sub screen or any by ALV event.
    Please suggest me..
    Edited by: Ravindranath Arusam on May 13, 2010 2:42 PM

    In DATA_CHANGED event, you will get the modified row into the attribute MP_MOD_ROWS of the impoerting object ER_DATA_CHANGED. Since this MP_MOD_ROWS is the Object reference to Data, you need to have the field symbol to get the value.
      FIELD-SYMBOLS:  <lft_mod_output>  TYPE t_t_output.
      ASSIGN  er_data_changed->mp_mod_rows->* TO <lft_mod_output>.
    You can get the Value of the Cell by using the method GET_CELL_VALUE of the same ER_DATA_CHANGED object and use the method MODIFY_CELL To update the value back to ALV.
    To Restrict the row deletion:
    When the row is deleted it is being added to Attribute mt_deleted_rows of the object ER_DATA_CHANGED. You can put the data back to the table in the DATA_CHANGE_FINISHED event. Visit this post http://help-abap.blogspot.com/2008/10/alv-disable-delete-key-on-keyboard-in.html for more information.
    Regards,
    Naimesh Patel

  • ALV Grid - Display/change Problem

    Hi Guys,
    I have a peculiar problem. I have developed a Module pool application containing two screens. In the first screen I have a input field and 2 buttons for display and change. When I enter the value and press Displaythe second screen is called which shows an ALV grid in the respective display mode. But If I come back and press change I could not get the change mode for the ALV grid still it remains in the Display mode. Again if rerun the transaction and press change it shows the ALV grid in change mode but if we press back and choose display then it is not getting changed still remains as such. In all at the first run what ever the mode is chosen it remains stationery. I am using OOALV and i have tried flushing the container, grid and also refreshing the ALV. But could not trace the problem. If you guys have worked or can put some inputs please reply back.
    Jagath.

    Please find the attached code...
    from the first screen 100 i am assigning the flag w_display or w_change based on the okcode. in the second screen 200 PBO i have the following code:
    MODULE status_0200 OUTPUT.
      SET PF-STATUS 'STAT200'.
      SET TITLEBAR 'TIT200'.
      if w_display eq 'X'.
      perform grid_display.
      else.
      perform grid_change.
      endif.
    ENDMODULE.                 " STATUS_0200  OUTPUT
    Now in perform display I have the following code:
    form grid_display .
    Set the Fieldcatalog.
      REFRESH t_fieldcat.
      PERFORM get_field_catalog.
    set the Layout.
      CLEAR wa_layout.
      wa_layout-cwidth_opt = 'X'.
    wa_layout-stylefname = 'CELLTAB'.
    set the Variant
      w_variant-report = sy-repid.
    Create the Instance for container
      IF lcl_custom_disp IS INITIAL.
        CREATE OBJECT lcl_custom_disp
          EXPORTING
           PARENT                      =
            container_name              = 'CONTAINER1'
          EXCEPTIONS
            cntl_error                  = 1
            cntl_system_error           = 2
            create_error                = 3
            lifetime_error              = 4
            lifetime_dynpro_dynpro_link = 5
            OTHERS                      = 6.
        IF sy-subrc <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                   WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
    create the object for ALV grid
        CREATE OBJECT lcl_grid_disp
          EXPORTING
            i_parent          = lcl_custom_disp
          EXCEPTIONS
            error_cntl_create = 1
            error_cntl_init   = 2
            error_cntl_link   = 3
            error_dp_create   = 4
            OTHERS            = 5.
        IF sy-subrc <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                   WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
    Create the object for events
        CREATE OBJECT lcl_events.
        SET HANDLER lcl_events->handle_top_of_list FOR lcl_grid_disp.
    Display the  ALV.
        CALL METHOD lcl_grid_disp->set_table_for_first_display
          EXPORTING
            is_variant                    = w_variant
            i_save                        = ' '
            is_layout                     = wa_layout
          CHANGING
            it_outtab                     = t_final[]
            it_fieldcatalog               = t_fieldcat
          EXCEPTIONS
            invalid_parameter_combination = 1
            program_error                 = 2
            too_many_lines                = 3
            OTHERS                        = 4.
        IF sy-subrc <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                   WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
      ELSE.
    Refresh the ALV grid
        CALL METHOD lcl_grid_disp->refresh_table_display
       EXPORTING
         IS_STABLE      =
         I_SOFT_REFRESH =
          EXCEPTIONS
            finished       = 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.
      ENDIF.
    endform.                    " grid_display
    In the perform change the same code is followed for different object with the fieldcatalog  is changed to edit based on flag.
    Set the Fieldcatalog.
      REFRESH t_fieldcat.
      PERFORM get_field_catalog.
    set the Layout.
      CLEAR wa_layout.
      wa_layout-cwidth_opt = 'X'.
    wa_layout-stylefname = 'CELLTAB'.
    set the Variant
      w_variant-report = sy-repid.
    Create the Instance for container
      IF lcl_custom_chng IS INITIAL.
        CREATE OBJECT lcl_custom_chng
          EXPORTING
           PARENT                      =
            container_name              = 'CONTAINER1'
          EXCEPTIONS
            cntl_error                  = 1
            cntl_system_error           = 2
            create_error                = 3
            lifetime_error              = 4
            lifetime_dynpro_dynpro_link = 5
            OTHERS                      = 6.
        IF sy-subrc <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                   WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
    create the object for ALV grid
        CREATE OBJECT lcl_grid_chng
          EXPORTING
            i_parent          = lcl_custom_chng
          EXCEPTIONS
            error_cntl_create = 1
            error_cntl_init   = 2
            error_cntl_link   = 3
            error_dp_create   = 4
            OTHERS            = 5.
        IF sy-subrc <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                   WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
    Create the object for events
        CREATE OBJECT lcl_events.
        SET HANDLER lcl_events->handle_top_of_list FOR lcl_grid_chng.
        SET HANDLER lcl_events->handle_data_changed FOR lcl_grid_chng.
        SET HANDLER lcl_events->handle_data_changed_finished FOR lcl_grid_chng.
    Display the  ALV.
        CALL METHOD lcl_grid_chng->set_table_for_first_display
          EXPORTING
            is_variant                    = w_variant
            i_save                        = ' '
            is_layout                     = wa_layout
          CHANGING
            it_outtab                     = t_final[]
            it_fieldcatalog               = t_fieldcat
          EXCEPTIONS
            invalid_parameter_combination = 1
            program_error                 = 2
            too_many_lines                = 3
            OTHERS                        = 4.
        IF sy-subrc <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                   WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
      ELSE.
    Refresh the ALV grid
        CALL METHOD lcl_grid_chng->refresh_table_display
       EXPORTING
         IS_STABLE      =
         I_SOFT_REFRESH =
          EXCEPTIONS
            finished       = 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.
      ENDIF.
    Please let me know if you require some more inputs?
    Jagath

  • Run time error in ALV editable on Class implementation

    I am getting a runtime error GETWA_NOT_ASSIGNED again ( This error was resolved yesterday thanks to an expert ) after I implemented a class to handle screen events in an editable ALV . Without the class the program was working and was able to insert the changed values into the internal table. I want to use these values to make changes another field on the same row . Is there a solution .
    I have copied the code from BCALV_EDIT_03. I can post my code.
    I am almost reaching my deadline date so , I will appreciate any help.

    Yes , I have altered a lot in handle_data_change . Its only when I try to use the pr_data_changed->modify_cell
    method call , I get into the runtime error.
    This is the syntax that I have used. :
    CALL METHOD pr_data_changed->modify_cell
                    EXPORTING i_row_id    = ps_good_planetype-row_id
                              i_fieldname = 'BAL_QUANT'
                              i_value     = ls_saplane-sel_quant.

  • ALV Editable

    HI all,
    i am working on ALV Editable display where i need to save the edited data.i have a pblm while saving the data.when i am changing one cell the remaining cells data is getting as blank.please help here is my code in the perform of the evernt data_changed_finished.
    loop at p_et_good_cells into wa_et_good_cells.
    READ TABLE it_final ASSIGNING <fs_final> INDEX wa_et_good_cells-row_id.
        IF sy-subrc = 0.
          CASE wa_et_good_cells-fieldname.
            WHEN 'DATE25'.
             <fs_final>-date25 = wa_et_good_cells-value.
              PERFORM change_hrs_sd CHANGING it_final.
            WHEN 'DATE26'.
              <fs_final>-date26 = wa_et_good_cells-value.
            WHEN 'DATE27'.
              <fs_final>-date27 = wa_et_good_cells-value.
            WHEN 'DATE28'.
              <fs_final>-date28 = wa_et_good_cells-value.
            WHEN 'DATE29'.
              <fs_final>-date29 = wa_et_good_cells-value.
            WHEN 'DATE30'.
              <fs_final>-date30 = wa_et_good_cells-value.
            WHEN 'DATE31'.
              <fs_final>-date31 = wa_et_good_cells-value.
            WHEN 'DATE32'.
              <fs_final>-date32 = wa_et_good_cells-value.
            WHEN 'DATE33'.
              <fs_final>-date33 = wa_et_good_cells-value.
            WHEN 'DATE34'.
              <fs_final>-date34 = wa_et_good_cells-value.
            WHEN 'DATE35'.
              <fs_final>-date35 = wa_et_good_cells-value.
            WHEN 'DATE36'.
              <fs_final>-date36 = wa_et_good_cells-value.
            WHEN 'DATE37'.
              <fs_final>-date37 = wa_et_good_cells-value.
            WHEN 'DATE38'.
              <fs_final>-date38 = wa_et_good_cells-value.
            WHEN 'DATE39'.
              <fs_final>-date39 = wa_et_good_cells-value.
            WHEN 'DATE40'.
              <fs_final>-date40 = wa_et_good_cells-value.
            WHEN 'DATE41'.
              <fs_final>-date41 = wa_et_good_cells-value.
            WHEN 'DATE42'.
              <fs_final>-date42 = wa_et_good_cells-value.
            WHEN 'DATE43'.
              <fs_final>-date43 = wa_et_good_cells-value.
            WHEN 'DATE44'.
              <fs_final>-date44 = wa_et_good_cells-value.
            WHEN 'DATE45'.
              <fs_final>-date45 = wa_et_good_cells-value.
            WHEN 'DATE46'.
              <fs_final>-date46 = wa_et_good_cells-value.
            WHEN 'DATE47'.
              <fs_final>-date47 = wa_et_good_cells-value.
            WHEN 'DATE48'.
              <fs_final>-date48 = wa_et_good_cells-value.
          ENDCASE.
          clear wa_et_good_cells.
          unassign <fs_final>.
        ENDIF.
      ENDLOOP.
    please help.

    Hi Kiran,
       u can try the same thing like this:-
      METHOD handle_data_changed.
        error_in_data = space.
        CALL METHOD perform_checks( er_data_changed ).
        IF error_in_data = 'X'.
          CALL METHOD er_data_changed->display_protocol.
        ENDIF.
      ENDMETHOD.                    "handle_data_changed
    METHOD perform_checks.
        PERFORM data_checks USING pr_data_changed
                         CHANGING error_in_data.
      ENDMETHOD.  
    FORM data_checks  USING
         p_data_changed TYPE REF TO cl_alv_changed_data_protocol
         CHANGING p_error.
      DATA: ls_good TYPE lvc_s_modi.
    Data:    l_tabix    LIKE sy-tabix.
      DATA: ls_fcat    LIKE LINE OF p_data_changed->mt_fieldcatalog.
      FIELD-SYMBOLS: <l_fs> TYPE ANY.
      LOOP AT p_data_changed->mt_mod_cells INTO ls_good.
        CLEAR:l_htype.
        CASE ls_good-fieldname.
          WHEN 'your field name here'.
            CHECK ls_good-value IS NOT INITIAL.
             variable = ls_good-value.
              p_error = 'X'.
        IF NOT p_error = 'X'.
          CALL METHOD p_data_changed->get_cell_value
            EXPORTING
              i_row_id    = ls_good-row_id
              i_fieldname = 'IField name here'
            IMPORTING
              e_value     = l_instance.
    Checking the ALV Grid from which the method is being called
          READ TABLE p_data_changed->mt_fieldcatalog
          INTO ls_fcat WITH KEY fieldname = 'field name here'.
          IF sy-subrc <> 0.
           Message.
    Modifying the Main Internal Table--Level 1 and 2
    *&>>
            READ TABLE <dyn_table> INTO <dyn_wa> INDEX ls_good-row_id.
            IF sy-subrc = 0.
              ASSIGN COMPONENT ls_good-fieldname OF
                  STRUCTURE <dyn_wa> TO <l_fs>.
              <l_fs> = ls_good-value.
              MOVE-CORRESPONDING <dyn_wa> TO wa_final.
              MODIFY <dyn_table> FROM <dyn_wa> INDEX ls_good-row_id
                ASSIGNING <l_fs> TRANSPORTING (ls_good-fieldname).
    *Code for capturing the changed data in first grid "29/9/2008
              READ TABLE <dyn_table> INTO <dyn_wa> INDEX ls_good-row_id.
              READ TABLE it_final WITH KEY instance = l_instance.
              MOVE-CORRESPONDING it_final TO it_final_tmp.
              MOVE-CORRESPONDING <dyn_wa> TO it_final_tmp.
              APPEND it_final_tmp. (same as your final table)
            ENDIF.
      PERFORM insert_modify_table USING p_data_changed CHANGING p_error.
    ENDFORM.                    " DATA_CHECKS
    In form insert_modify_table u can use the function module to save data.
    Thanks & Regards
    Ruchi Tiwari

  • ALV Edit Mask isn't applied when exporting as "Spread Sheet".

    Hi all,
    One of our program has "Edit Mask" as XXXXX____ for displaying data in ALV (Mask first 5 numbers as X, display last 4 numbers as it is).  However, when data is exported as "Spread Sheet", the edit mask is not applied.  Does anyone know how to force edit mask when data is exported as SpreadSheet (MHTML)?  If you export as "local File" and then do "SpreadSheet", the edit mask works.. it is just when the direct "SpreadSheet" done, it doesn't work. 
    (i.e. CL_GUI_ALV_GRID->EXPORT_TO_SPREAD_SHEET doesn't apply EDIT Masks set in Field Catalog.)
    Here is more technical info.  We are on ECC 6.
    Field Catalog is of type LVC_T_FCAT.
    for a specific field, "EDIT_MASK" is set to XXXXX____.
    The ALV is called using
    My_ALV_CLASS->SET_TABLE_FOR_FIRST_DISPLAY
    exporting
    is_layout = My_layout
    is_toolbar_excluding = my_toolbar_exclude
    changing
    it_outtab = My_data_table
    it_fieldcatalog = MY_FIELD_CATALOG_DEFINATION_WHERE_EDIT_MASK_IS_SET
    exceptions...
    Thanks in advance!

    Hello,
    This is first time I am giving an answer.
    Instead of using a function module to merge the field catalog, try doing it one by one.
    for example,
    pt_fieldcat-col_pos = 01.
    pt_fieldcat-fieldname = 'KUNNR'.
    APPEND pt_fieldcat.
    pt_fieldcat-col_pos = 02.
    pt_fieldcat-fieldname = 'IP'.
    pt_fieldcat-edit = 'X'.
    pt_fieldcat-edit_mask = '-.-.-.-'.
    APPEND pt_fieldcat.
    and use the structure Z_IPADDR in method parameters instead of a function.
    CALL METHOD go_grid_ip->set_table_for_first_display
    EXPORTING
         i_structure_name = 'Z_IPADDR'
         it_toolbar_excluding = lt_exclude
         is_layout = ls_layout
    CHANGING
         it_fieldcatalog = pt_fieldcat
         it_outtab = p_t_auth_ip.
    CALL METHOD go_grid_ip->set_ready_for_input
    EXPORTING
    i_ready_for_input = 1.
    and also you can use following function module to check if the edited value is still in ALV or not
    CALL METHOD grid->check_changed_data
        IMPORTING
          e_valid = l_valid.
      IF l_valid IS NOT INITIAL.
    then the edited data in alv is successfully changed in internal table behind that.
    Debugging may find you an answer.
    Kind Regards,
    Manisha

  • Change Value While Uploading data From Excel File

    Dear Expert,
    Please guide me is it Possible?, if yes then How?
    We have one BDC Uploader there After uploading data from Excel File, i want to check one field like this....
    if it_f65data-newbs contains any Alphabet.
    then user Should be able to change value on the same time while executing Program in table.
    Please tell me how i can change value in running program
    Regards'
    Shelly Malik

    Hi,
    What you can probably do is, perform a consistency check on your data in the internal table and segregate all those rows that have inconsistent data (in your case, the field NEWBS containing albhabets) into another temporary internal table. Display the temporary internal table in an editable ALV grid saying that these data have not been inserted to the database, coz they have inconsistent data in the field NEWBS. Allow the user to edit and then save the data which will consequently refresh the internal table contents.

  • Send sample prg for alv editable from ztable

    Hi ,
    Need of prg for alv editable . get data from ztable in standard tool bar i need to create record insert ,delete ,modify existing records .
    Thanks in advance.
    Regarding,
    kumar

    Hi Anil,
    > Try like this code i wrote this code for fetch some records from database table and approve/ reject
    > the records by clicking buttons.
    REPORT  zcl_timesheet_approval MESSAGE-ID zcl_msg.
    CLASS L_CL_EVENTS DEFINITION                                        *
    Class for inserting buttons on the toolbar                          *
    CLASS l_cl_events DEFINITION.
      PUBLIC SECTION.
        METHODS:
          toolbar FOR EVENT toolbar
                  OF cl_gui_alv_grid
                  IMPORTING e_object
                            e_interactive,
          user_command FOR EVENT user_command
                       OF cl_gui_alv_grid
                       IMPORTING e_ucomm .
    ENDCLASS.                              " L_CL_EVENTS DEFINITION
    CLASS L_CL_EVENTS IMPLEMENTATION                                    *
    Implementation of class L_CL_EVENTS                                 *
    CLASS l_cl_events IMPLEMENTATION.
      METHOD toolbar.
        PERFORM event_toolbar USING e_object.
      ENDMETHOD.                           " TOOLBAR
      METHOD user_command.
        PERFORM event_ucomm USING e_ucomm.
      ENDMETHOD.                           " USER_COMMAND
    ENDCLASS.                              " L_CL_EVENTS IMPLEMENTATION
    Tables decalration..................................................
    TABLES:
        zcl_timesheet.                     " Employee master table
    CONSTANTS:
       c_boolean_yes(1)     TYPE c         " Boolean - yes
                           VALUE 'X',
       c_approve_status(1)  TYPE c         " Approval status
                           VALUE 'A',
       c_rej_status(1)      TYPE c         " Rejected status
                           VALUE 'R',
       c_save_status(1)     TYPE c         " Save status
                           VALUE 'S',
       c_fcode_approve(7)   TYPE c         " Function code - APPROVE
                           VALUE 'APPROVE',
       c_fcode_rej(6)       TYPE c         " Function code - REJECT
                           VALUE 'REJECT',
       c_fcode_back(4)      TYPE c         " Function code - BACK
                           VALUE 'BACK',
       c_fcode_onli(4)      TYPE c         " Function code - EXECUTE
                           VALUE 'ONLI',
       c_fcode_exit(4)      TYPE c         " Function code - EXIT
                           VALUE 'EXIT',
       c_fcode_cancel(6)    TYPE c         " Function code - CANCEL
                           VALUE 'CANCEL',
       c_zero(1)            TYPE c         " Constant value 0
                           VALUE '0',
       c_alv_scr(7)         TYPE c         " GUI status : ALV screen
                           VALUE 'ALV_SCR'.
    Type definition...................................................
    Type definition of the structure to hold  data from table            *
    zcl_timesheet.                                                      *
    TYPES:
      BEGIN OF type_s_time,
        empid        TYPE zcl_timesheet-empid,
                                           " Employee ID
        workdate     TYPE zcl_timesheet-workdate,
                                           " Date
        groupid      TYPE zcl_timesheet-groupid,
                                           " Group ID
        projectid    TYPE zcl_timesheet-projectid,
                                           " Project ID
        projectname  TYPE zcl_timesheet-projectname,
                                           " Project name
        objectid     TYPE zcl_timesheet-objectid,
                                           " Object ID
        objectname   TYPE zcl_timesheet-objectname,
                                           " Object name
        activityid   TYPE zcl_timesheet-activityid,
                                           " Activity ID
        activityname TYPE zcl_timesheet-activityname,
                                           " Activity name
        timeworked   TYPE zcl_timesheet-timeworked,
                                           " Time spent on work
        description  TYPE zcl_timesheet-description,
                                           " Description
        taskstatus   TYPE zcl_timesheet-taskstatus,
                                           " Status of the proj
        billstatus   TYPE zcl_timesheet-billstatus,
                                           " Billing status
        appstatus    TYPE zcl_timesheet-appstatus,
                                           " Staus of the record
        wstatus      TYPE zcl_timesheet-wstatus,
                                           " Working status
        mngcomment   TYPE zcl_timesheet-mngcomment,
                                           " Managers comment
      END OF type_s_time.
    Field-string declarations...........................................
    DATA:
    Field-string to build fieldcat.
       fs_fcat TYPE lvc_s_fcat,
    Field-string for t_timesheet
       fs_timesheet TYPE zcl_timesheet.
    Working variables...................................................
    DATA:
       w_valid(1)   TYPE c,                " To get the flag from check_data
       w_display(1) TYPE c,                " Flag to display all records
       ok_code      TYPE syst-ucomm,       " Function code on dialog screens
       w_okcode     TYPE syst-ucomm,       " Temporary function code
       w_first(1)   TYPE c,                " To place buttons for first time
       w_submit(1)  TYPE c,                " Flag to display submitted records
       w_empid      TYPE zcl_emprecord-empid.
    " Employee ID for GET parameter
    Internal table declarations........................................
    DATA:
    Internal table to build fieldcat.
       t_fcat      TYPE lvc_t_fcat,
    Internal table to display data.
       t_time      TYPE TABLE OF type_s_time,
    Internal table to hold submitted data.
       t_timesheet TYPE TABLE OF zcl_timesheet.
    For ALV ...........................................................
    DATA:
    To create instance for cl_gui_custom_container
      g_grid      TYPE REF TO cl_gui_custom_container,
    To create instance for cl_gui_alv_grid
      g_alv       TYPE REF TO cl_gui_alv_grid,
    To create instance for l_cl_events
      g_events    TYPE REF TO l_cl_events,
    To assign name for custom container
      g_container TYPE scrfname VALUE 'CONTAINER',
    To assign layout
      g_fcatlayo  TYPE lvc_s_layo.
    Selection screen elements............................................
    SELECTION-SCREEN BEGIN OF BLOCK blck WITH FRAME TITLE text-000.
    SELECT-OPTIONS:
      s_group FOR zcl_timesheet-groupid    " Group ID
                             NO INTERVALS,
      s_prjid FOR zcl_timesheet-projectid, " Project ID
      s_empid FOR zcl_timesheet-empid,     " Employee ID
      s_date  FOR zcl_timesheet-workdate.  " Date
    SELECTION-SCREEN END OF BLOCK blck.
    SELECTION-SCREEN BEGIN OF BLOCK blck1 WITH FRAME TITLE text-015.
    PARAMETERS:
      p_app  RADIOBUTTON GROUP g1  USER-COMMAND app ,
                                           " To approve timesheet
      p_disp RADIOBUTTON GROUP g1.         " To display timesheet
    SELECTION-SCREEN END OF BLOCK blck1.
               AT SELECTION-SCREEN EVENT                                 *
    AT SELECTION-SCREEN.
    To perform user actions on the selection screen
      PERFORM user_command.
    MODULE  STATUS_0100  OUTPUT                                         *
    This module will create the objects for the instance and display    *
    the records                                                         *
    MODULE status_0100 OUTPUT.
      SET PF-STATUS c_alv_scr.
      PERFORM set_titlebar USING w_display.
    If program executed in foreground.
      IF sy-batch IS INITIAL.
    If g_grid is empty.
        IF g_grid IS INITIAL.
    To create object for instance grid
          CREATE OBJECT g_grid
            EXPORTING
              container_name = g_container.
    To create object for object grid
          CREATE OBJECT g_alv
            EXPORTING
              i_parent = g_grid.
        ELSE.
          CALL METHOD g_alv->refresh_table_display.
        ENDIF.                             " IF G_GRID IS INITIAL
      ENDIF.                               " IF SY-BATCH IS INITIAL
      REFRESH t_fcat.
    If w_display eq 'X' .
      IF w_display EQ c_boolean_yes.
    To display all records except saved data
        PERFORM display_allrecords.
      ENDIF.                               " IF W_FLAG EQ C_BOOLEAN_YES
      IF w_submit EQ c_boolean_yes.
    To display submitted records
        PERFORM submitted_records.
      ENDIF.                               " IF W_SUBMIT EQ C_BOOLEAN_YES
    ENDMODULE.                             " STATUS_0100  OUTPUT
    MODULE USER_COMMAND_0100  INPUT                                     *
    To perform user actions in the screen 100                           *
    MODULE user_command_0100 INPUT.
    To update the data in the ALV grid
      PERFORM check_changed_data.
      w_okcode = ok_code.
      CLEAR ok_code.
      CASE w_okcode.
        WHEN c_fcode_back.
          LEAVE TO SCREEN 0.
        WHEN c_fcode_exit OR c_fcode_cancel.
          LEAVE PROGRAM.
      ENDCASE.                             " CASE W_OKCODE
    ENDMODULE.                             " USER_COMMAND_0100
    FORM GET_DATA                                                       *
    To get the submitted data from zcl_timesheet                        *
    No parameters are passsed to this subroutine                        *
    FORM get_data .
      SELECT *
        FROM zcl_timesheet
        INTO TABLE t_timesheet
       WHERE empid     IN s_empid
         AND workdate  IN s_date
         AND groupid   IN s_group
         AND projectid IN s_prjid
         AND appstatus EQ c_boolean_yes.
      IF sy-subrc NE 0.
        MESSAGE e000 .
      ELSE.
        CALL SCREEN 100.
      ENDIF.                               " IF SY-SUBRC NE 0
    ENDFORM.                               " GET_DATA
    FORM BUILD_FCAT                                                     *
    To build the field catalog giving managers comment in editable mode *
    -->PR_Tabname   type lvc_tname                                      *
    -->PR_Fieldname type lvc_fname                                      *
    -->PR_Coltext   type lvc_txtcol                                     *
    -->PR_Colpos    type lvc_colpos                                     *
    FORM build_fcat USING pr_tabname   TYPE lvc_tname
                          pr_fieldname TYPE lvc_fname
                          pr_coltext   TYPE lvc_txtcol
                          pr_colpos    TYPE lvc_colpos.
      CLEAR fs_fcat.
      fs_fcat-tabname   = pr_tabname.
      fs_fcat-fieldname = pr_fieldname.
      fs_fcat-coltext   = pr_coltext.
      fs_fcat-col_pos   = pr_colpos.
      IF fs_fcat-fieldname EQ 'MNGCOMMENT'.
        fs_fcat-edit      = c_boolean_yes.
        fs_fcat-lowercase = c_boolean_yes.
        fs_fcat-dd_outlen = 60.
      ELSE.
        fs_fcat-edit      = space.
      ENDIF.                               " IF FS_FCAT-FIELDNAME...
      APPEND fs_fcat TO t_fcat.
    ENDFORM.                               " BUILD_FCAT
      FORM BUILD_FCATD                                                   *
    To build fieldcatalog in the display mode                           *
    -->pr_Tabname   type lvc_tname                                      *
    -->pr_Fieldname type lvc_fname                                      *
    -->pr_Coltext   type lvc_txtcol                                     *
    -->pr_Colpos    type lvc_colpos                                     *
    FORM build_fcatd USING pr_tabname   TYPE lvc_tname
                           pr_fieldname TYPE lvc_fname
                           pr_coltext   TYPE lvc_txtcol
                           pr_colpos    TYPE lvc_colpos .
      CLEAR fs_fcat.
      fs_fcat-tabname   = pr_tabname.
      fs_fcat-fieldname = pr_fieldname.
      fs_fcat-coltext   = pr_coltext.
      fs_fcat-col_pos   = pr_colpos.
      fs_fcat-edit      = space.
      APPEND fs_fcat TO t_fcat.
    ENDFORM.                               " BUILD_FCATD
    FORM ALV_DISPLAY                                                    *
    To display data in ALV                                              *
    --> pr_table type standard table                                    *
    --> pr_fcat  type lvc_t_fcat                                        *
    FORM alv_display USING pr_table TYPE STANDARD TABLE
                           pr_fcat  TYPE lvc_t_fcat .
    Local data declaration....
      DATA: lt_exclude TYPE ui_functions.
    To exclude buttons on the ALV grid
      PERFORM exclude_tb_functions CHANGING lt_exclude.
    To display ALV
      CALL METHOD g_alv->set_table_for_first_display
        EXPORTING
          i_default            = space
          is_layout            = g_fcatlayo
          it_toolbar_excluding = lt_exclude
        CHANGING
          it_outtab            = pr_table[]
          it_fieldcatalog      = pr_fcat[].
    ENDFORM.                               " ALV_DISPLAY
    FORM EVENT_TOOLBAR                                                  *
    Setting toolbar in the alv grid                                     *
    -->E_OBJECT TYPE REF TO CL_ALV_EVENT_TOOLBAR_SET                    *
    FORM event_toolbar USING e_object
                             TYPE REF TO cl_alv_event_toolbar_set.
    Local declaration for the button.
      DATA: ls_toolbar TYPE stb_button.
    To add Approve button
      ls_toolbar-function  = c_fcode_approve.
      ls_toolbar-butn_type = c_zero.
      ls_toolbar-text      = text-001.
      APPEND ls_toolbar TO e_object->mt_toolbar.
    To add Reject button
      CLEAR ls_toolbar.
      ls_toolbar-function  = c_fcode_rej.
      ls_toolbar-butn_type = c_zero.
      ls_toolbar-text      = text-013.
      APPEND ls_toolbar TO e_object->mt_toolbar.
    ENDFORM.                               " EVENT_TOOLBAR
    FORM EXCLUDE_TB_FUNCTIONS                                           *
    To exclude buttons from ALV grid                                    *
    <--> PR_EXCLUDE TYPE UI_FUNCTIONS                                   *
    FORM exclude_tb_functions  CHANGING pr_exclude TYPE ui_functions.
    Local data declaration...
      DATA ls_exclude TYPE ui_func.
    To remove the buttons on the ALV grid.
      ls_exclude = cl_gui_alv_grid=>mc_fc_loc_copy_row.
      APPEND ls_exclude TO pr_exclude.
      ls_exclude = cl_gui_alv_grid=>mc_fc_loc_delete_row.
      APPEND ls_exclude TO pr_exclude.
      ls_exclude = cl_gui_alv_grid=>mc_fc_loc_append_row.
      APPEND ls_exclude TO pr_exclude.
      ls_exclude = cl_gui_alv_grid=>mc_fc_loc_insert_row.
      APPEND ls_exclude TO pr_exclude.
      ls_exclude = cl_gui_alv_grid=>mc_fc_loc_move_row.
      APPEND ls_exclude TO pr_exclude.
    ENDFORM.                               " EXCLUDE_TB_FUNCTIONS
    FORM EVENT_UCOMM                                                    *
    After Input in the ALV grid,if user select record and press         *
    approve or reject then the record will get updated                  *
    --> PR_ucomm type sy-ucomm                                          *
    FORM event_ucomm USING pr_ucomm LIKE sy-ucomm.
      CASE pr_ucomm.
    If e_ucomm contains 'APP' i.e.function code for Approve button
        WHEN c_fcode_approve.              " To approve selected record
          PERFORM app_timesheet USING c_approve_status.
    If e_ucomm contains 'REJ' i.e. function code for Reject
        WHEN c_fcode_rej.                  " To reject selected record
          PERFORM app_timesheet USING c_rej_status.
      ENDCASE.                             " CASE E_UCOMM
    ENDFORM.                               " EVENT_UCOMM
    FORM APP_TIMESHEET                                                  *
    To get the selected records and update the records in database      *
      --> pr_status type char01                                          *
    FORM app_timesheet USING pr_status TYPE char01 .
    Local data declaration......
      DATA:
       lt_marked_rows TYPE lvc_t_roid,     " Table to get rowid
       l_fs_marked_row LIKE LINE OF lt_marked_rows.
      " Field-string for lt_marked_rows
    To get all the selected rows in the table lt_marked_rows
      CALL METHOD g_alv->get_selected_rows
        IMPORTING
          et_row_no = lt_marked_rows.
    Reading each row id and updating the database.
      LOOP AT lt_marked_rows INTO l_fs_marked_row.
    Reading the table t_timesheet with rowid
        READ TABLE t_timesheet INTO fs_timesheet INDEX
                                                 l_fs_marked_row-row_id.
    If record is there in the table.
        IF sy-subrc EQ 0.
          CLEAR fs_timesheet-appstatus.
          GET PARAMETER ID 'ZEMPID' FIELD w_empid.
    Changing the appstatus.
          fs_timesheet-appstatus = pr_status.
          fs_timesheet-approvedby = w_empid.
    Updating the database table.
          UPDATE zcl_timesheet FROM fs_timesheet.
          IF sy-subrc EQ 0.
            DELETE t_timesheet INDEX l_fs_marked_row-row_id.
            PERFORM refresh_table USING pr_status.
          ENDIF.                           " IF SY-SUBRC EQ 0.
        ENDIF.                             " IF SY-SUBRC EQ 0
      ENDLOOP.                             " LOOP AT LT_MARKED_ROWS...
    ENDFORM.                               " APP_TIMESHEET
    FORM CHECK_CHANGED_DATA                                             *
    To change the data                                                  *
    No parameters are passsed to this subroutine                        *
    FORM check_changed_data .
    To change the data.
      CALL METHOD g_alv->check_changed_data.
    ENDFORM.                               " CHECK_CHANGED_DATA
    FORM  DISPLAY_ALL                                                   *
    To display all the records                                          *
    No parameters are passsed to this subroutine                        *
    FORM display_all .
      SELECT empid                         " Employee ID
             workdate                      " Workdate
             groupid                       " Groupid
             projectid                     " Project ID
             projectname                   " Project name
             objectid                      " Object ID
             objectname                    " Object name
             activityid                    " Activity ID
             activityname                  " Activity name
             timeworked                    " Time worked
             description                   " Description
             taskstatus                    " Task status
             billstatus                    " Bill status
             appstatus                     " Approved status
             wstatus                       " Working status
             mngcomment                    " Manager comment
        FROM zcl_timesheet
        INTO TABLE t_time
       WHERE empid     IN s_empid
         AND workdate  IN s_date
         AND groupid   IN s_group
         AND projectid IN s_prjid
         AND appstatus NE c_save_status.
      IF sy-subrc NE 0.
        MESSAGE e000.
      ELSE.
        CALL SCREEN 100.
      ENDIF.                               " IF SY-SUBRC NE 0
    ENDFORM.                               " DISPLAY_ALL
    FORM REFFRESH_TABLE                                                 *
    To refresh output table and  issue message according p_status       *
    -->PR_STATUS TYPE CHAR01                                            *
    FORM refresh_table  USING pr_status TYPE char01.
    To refresh output table.
      CALL METHOD g_alv->refresh_table_display.
    Depending upon pr_status message is given.
      IF pr_status EQ c_approve_status.
        MESSAGE s001.
      ELSE.
        MESSAGE s002.
      ENDIF.                               " IF P_STATUS EQ C_APPROVE_STATUS
    ENDFORM.                               " REFRESH_TABLE
    FORM SET_TITLEBAR                                                   *
    To set titlebar on the screen 100.                                  *
    -->PR_STATUS TYPE CHAR01                                            *
    FORM set_titlebar USING pr_status TYPE char01.
    If pr_status eq 'X'.
      IF pr_status EQ c_boolean_yes.
        SET TITLEBAR c_alv_scr WITH text-017.
      ELSE.
        SET TITLEBAR c_alv_scr WITH text-018.
      ENDIF.                               " IF P_STATUS EQ C_BOOLEAN_YES
    ENDFORM.                               " SET_TITLEBAR
    FORM USER_COMMAND                                                   *
    According to sy-ucomm the action is performed in the screen 100     *
    No parameters are passsed to this subroutine                        *
    FORM user_command .
      CASE sy-ucomm.
    If p_app is selected, submitted data will be displayed for approval
        WHEN c_fcode_onli OR c_fcode_approve.
          CLEAR sy-ucomm.
    To display the submitted records.
          IF p_app EQ c_boolean_yes.
            w_submit = c_boolean_yes.
    To get submitted records
            PERFORM get_data.
          ENDIF.                           " IF P_APP EQ C_BOOLEAN_YES
    To display all records according to selection.
          IF p_disp EQ c_boolean_yes.
            w_display = c_boolean_yes.
    To display
            PERFORM display_all.
            CLEAR w_display.
          ENDIF.                           " IF P_DISP EQ C_BOOLEAN_YES
      ENDCASE.                             " CASE SY-UCOMM
    ENDFORM.                               " USER_COMMAND
    FORM  DISPLAY_ALLRECORDS                                            *
    To display all the records in the display mode                      *
    No parameters are passsed to this subroutine                        *
    FORM display_allrecords .
      CLEAR w_display.
      PERFORM build_fcatd USING 'T_TIME' 'WORKDATE'     text-002 '1'.
      PERFORM build_fcatd USING 'T_TIME' 'EMPID'        text-009 '2'.
      PERFORM build_fcatd USING 'T_TIME' 'PROJECTID'    text-003 '3'.
      PERFORM build_fcatd USING 'T_TIME' 'PROJECTNAME'  text-004 '4'.
      PERFORM build_fcatd USING 'T_TIME' 'OBJECTID'     text-005 '5'.
      PERFORM build_fcatd USING 'T_TIME' 'OBJECTNAME'   text-006 '6'.
      PERFORM build_fcatd USING 'T_TIME' 'ACTIVITYID'   text-007 '7'.
      PERFORM build_fcatd USING 'T_TIME' 'ACTIVITYNAME' text-008 '8'.
      PERFORM build_fcatd USING 'T_TIME' 'TIMEWORKED'   text-010 '9'.
      PERFORM build_fcatd USING 'T_TIME' 'DESCRIPTION'  text-011 '10'.
      PERFORM build_fcatd USING 'T_TIME' 'APPSTATUS'    text-012 '11'.
      PERFORM build_fcatd USING 'T_TIME' 'BILLSTATUS'   text-016 '12'.
      PERFORM build_fcatd USING 'T_TIME' 'MNGCOMMENT'   text-014 '13'.
      PERFORM alv_display USING t_time t_fcat.
    ENDFORM.                               " DISPLAY_ALLRECORDS
    FORM SUBMITTED_RECORDS                                              *
    To display submitted records for the manager to approve             *
    No parameters are passsed to this subroutine                        *
    FORM submitted_records .
      CLEAR w_submit.
    To create object for instance g_events
      CREATE OBJECT g_events.
    If w_first equal to space
      IF w_first IS INITIAL.
        SET HANDLER g_events->toolbar
                FOR g_alv.
        w_first = c_boolean_yes.
      ENDIF.                               " IF W_FIRST IS INITIAL..
      SET HANDLER g_events->user_command
              FOR g_alv.
      g_fcatlayo-sel_mode = c_approve_status.
      REFRESH t_fcat.
      PERFORM build_fcat USING 'T_TIMESHEET' 'WORKDATE'     text-002 '1'.
      PERFORM build_fcat USING 'T_TIMESHEET' 'EMPID'        text-009 '2'.
      PERFORM build_fcat USING 'T_TIMESHEET' 'PROJECTID'    text-003 '3'.
      PERFORM build_fcat USING 'T_TIMESHEET' 'PROJECTNAME'  text-004 '4'.
      PERFORM build_fcat USING 'T_TIMESHEET' 'OBJECTID'     text-005 '5'.
      PERFORM build_fcat USING 'T_TIMESHEET' 'OBJECTNAME'   text-006 '6'.
      PERFORM build_fcat USING 'T_TIMESHEET' 'ACTIVITYID'   text-007 '7'.
      PERFORM build_fcat USING 'T_TIMESHEET' 'ACTIVITYNAME' text-008 '8'.
      PERFORM build_fcat USING 'T_TIMESHEET' 'TIMEWORKED'   text-010 '9'.
      PERFORM build_fcat USING 'T_TIMESHEET' 'DESCRIPTION'  text-011 '10'.
      PERFORM build_fcat USING 'T_TIMESHEET' 'APPSTATUS'    text-012 '11'.
      PERFORM build_fcat USING 'T_TIMESHEET' 'BILLSTATUS'   text-016 '12'.
      PERFORM build_fcat USING 'T_TIMESHEET' 'MNGCOMMENT'   text-014 '13'.
      PERFORM alv_display USING t_timesheet t_fcat.
    ENDFORM.                               " SUBMITTED_RECORDS
    Plzz Reward if it is useful,
    Mahi.

  • How do I edit or enter values on multiple sheets at the same time in Numbers?  I can do this Excel but don't know procedure in Numbers.  Thanks.

    How do I edit or enter values on multiple sheets at the same time in Numbers?  I can do it in Excel but I don't the procedure in Numbers.  Thank you!

    The only I way I can think of to modify a single value and have that value change in multipl locations is to have all "the other places" reference a single cell.  There is not way without a referene to modify a set of cells simulateously.
    This may be something like what you want:
    Enter a value in the table "Original Data" cell A1 and the A1 cells of tables Ref1, Ref2 and Ref2-1 will change

Maybe you are looking for