Help needed for editable alv grid program

hi,
Can you please tell me how to set a ‘update’ button in application toolbar of alv griv without suppressing it and how to write the code for that update button so that if I change my editable column data and press the update button my updated data should be stored in my database table.
the code what i wrote is:
TABLES: vbak,vbap.
TYPE-POOLS: slis. "ALV Declarations
*Data Declaration
TYPES: BEGIN OF t_final,
vbeln LIKE vbak-vbeln,
erdat LIKE vbak-erdat,
matnr LIKE vbap-matnr,
posnr LIKE vbap-posnr,
END OF t_final.
DATA: i_final TYPE STANDARD TABLE OF t_final INITIAL SIZE 0,
wa_final TYPE t_final.
*ALV data declarations
DATA: fieldcatalog TYPE slis_t_fieldcat_alv WITH HEADER LINE,
gd_tab_group TYPE slis_t_sp_group_alv,
gd_layout TYPE slis_layout_alv,
gd_repid LIKE sy-repid.
*Start-of-selection.
START-OF-SELECTION.
PERFORM data_retrieval.
PERFORM build_fieldcatalog.
PERFORM build_layout.
PERFORM display_alv_report.
*& Form BUILD_FIELDCATALOG
•     Build Fieldcatalog for ALV Report
FORM build_fieldcatalog.
fieldcatalog-fieldname = 'VBELN'.
fieldcatalog-seltext_m = 'sales order'.
fieldcatalog-col_pos = 0.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'ERDAT'.
fieldcatalog-seltext_m = 'date'.
fieldcatalog-col_pos = 1.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'MATNR'.
fieldcatalog-seltext_m = 'material no.'.
fieldcatalog-col_pos = 2.
fieldcatalog-edit = 'X'.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'POSNR'.
fieldcatalog-seltext_m = 'line item no.'.
fieldcatalog-col_pos = 3.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
ENDFORM. " BUILD_FIELDCATALOG
*& Form BUILD_LAYOUT
•     Build layout for ALV grid report
FORM build_layout.
gd_layout-no_input = 'X'.
gd_layout-colwidth_optimize = 'X'.
gd_layout-totals_text = 'Totals'(201).
•     gd_layout-totals_only = 'X'.
•     gd_layout-f2code = 'DISP'. "Sets fcode for when double
•     "click(press f2)
•     gd_layout-zebra = 'X'.
•     gd_layout-group_change_edit = 'X'.
•     gd_layout-header_text = 'helllllo'.
ENDFORM. " BUILD_LAYOUT
*& Form DISPLAY_ALV_REPORT
•     Display report using ALV grid
FORM display_alv_report.
gd_repid = sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = gd_repid
•     i_callback_top_of_page = 'TOP-OF-PAGE' "see FORM
i_callback_user_command = 'USER_COMMAND'
i_grid_title = outtext
is_layout = gd_layout
it_fieldcat = fieldcatalog[]
•     it_special_groups = gd_tabgroup
•     IT_EVENTS = GT_XEVENTS
i_save = 'X'
•     is_variant = z_template
TABLES
t_outtab = i_final
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. " DISPLAY_ALV_REPORT
*& Form DATA_RETRIEVAL
•     Retrieve data form EKPO table and populate itab it_ekko
FORM data_retrieval.
SELECT avbeln aerdat bmatnr bposnr FROM vbak AS a
INNER JOIN vbap AS b ON avbeln = bvbeln
INTO TABLE i_final WHERE avbeln = bvbeln.
•     ENDFORM. " DATA_RETRIEVAL
thanks in advance.

hi sudhir,
thanks for ur reply.
after seeing the code u send to me i made changes to my program.but still when i click on update button,nothing is happening.can u please suggest me an idea.
TABLES: vbak,vbap.
TYPE-POOLS: slis.                                 "ALV Declarations
TYPES: BEGIN OF t_final,
     vbeln LIKE vbak-vbeln,
     erdat LIKE vbak-erdat,
     matnr LIKE vbap-matnr,
     posnr LIKE vbap-posnr,
     END OF t_final.
DATA: i_final TYPE STANDARD TABLE OF t_final WITH HEADER LINE,
      wa_final TYPE t_final.
*DATA:i_final LIKE vbap OCCURS 0.
*DATA:wa_final LIKE vbap.
*ALV data declarations
DATA: fieldcatalog TYPE slis_t_fieldcat_alv WITH HEADER LINE,
      gd_tab_group TYPE slis_t_sp_group_alv,
      gd_layout    TYPE slis_layout_alv,
      gd_repid LIKE sy-repid.
*Start-of-selection.
START-OF-SELECTION.
  PERFORM data_retrieval.
  PERFORM build_fieldcatalog.
  PERFORM build_layout.
  PERFORM display_alv_report.
*&      Form  BUILD_FIELDCATALOG
      Build Fieldcatalog for ALV Report
FORM build_fieldcatalog.
  fieldcatalog-fieldname   = 'VBELN'.
  fieldcatalog-seltext_m   = 'sales order'.
  fieldcatalog-col_pos     = 0.
  APPEND fieldcatalog TO fieldcatalog.
  CLEAR  fieldcatalog.
  fieldcatalog-fieldname   = 'ERDAT'.
  fieldcatalog-seltext_m   = 'date'.
  fieldcatalog-col_pos     = 1.
  APPEND fieldcatalog TO fieldcatalog.
  CLEAR  fieldcatalog.
  fieldcatalog-fieldname   = 'MATNR'.
  fieldcatalog-seltext_m   = 'material no.'.
  fieldcatalog-col_pos     = 2.
  fieldcatalog-edit        = 'X'.
  APPEND fieldcatalog TO fieldcatalog.
  CLEAR  fieldcatalog.
  fieldcatalog-fieldname   = 'POSNR'.
  fieldcatalog-seltext_m   = 'line item no.'.
  fieldcatalog-col_pos     = 3.
  APPEND fieldcatalog TO fieldcatalog.
  CLEAR  fieldcatalog.
ENDFORM.                    " BUILD_FIELDCATALOG
*&      Form  BUILD_LAYOUT
      Build layout for ALV grid report
FORM build_layout.
  gd_layout-no_input          = 'X'.
  gd_layout-colwidth_optimize = 'X'.
  gd_layout-totals_text       = 'Totals'(201).
gd_layout-totals_only        = 'X'.
gd_layout-f2code            = 'DISP'.  "Sets fcode for when double
                                        "click(press f2)
gd_layout-zebra             = 'X'.
gd_layout-group_change_edit = 'X'.
gd_layout-header_text       = 'helllllo'.
ENDFORM.                    " BUILD_LAYOUT
*&      Form  DISPLAY_ALV_REPORT
      Display report using ALV grid
FORM display_alv_report.
  gd_repid = sy-repid.
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
            i_callback_program      = gd_repid
           i_callback_top_of_page   = 'TOP-OF-PAGE'  "see FORM
            i_callback_user_command = 'USER_COMMAND'
            i_callback_pf_status_set = 'GUI_STAT'
           i_grid_title           = outtext
            is_layout               = gd_layout
            it_fieldcat             = fieldcatalog[]
           it_special_groups       = gd_tabgroup
           it_events                = it_events
            i_save                  = 'X'
           is_variant              = z_template
       TABLES
            t_outtab                = i_final
       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.                    " DISPLAY_ALV_REPORT
*&      Form  DATA_RETRIEVAL
      Retrieve data form EKPO table and populate itab it_ekko
FORM data_retrieval.
  SELECT avbeln aerdat bmatnr bposnr FROM vbak AS a
  INNER JOIN vbap AS b ON avbeln = bvbeln
  INTO TABLE i_final WHERE avbeln = bvbeln.
ENDFORM.                    " DATA_RETRIEVAL
      FORM GUI_STAT                                                 *
-->  RT_EXTAB                                                      *
FORM gui_stat USING rt_extab TYPE slis_t_extab.
  SET PF-STATUS 'UPDATE' EXCLUDING rt_extab.
ENDFORM.
      FORM USER_COMMAND                                             *
-->  U_COMM                                                        *
-->  RS_SELFIELD                                                   *
FORM user_command USING u_comm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
  DATA:selfield TYPE slis_selfield.
  CASE u_comm.
    WHEN 'UPDATE'.
      LOOP AT i_final ."into wa_final.
        i_final-matnr = vbap-matnr.
        update (vbap) from table i_final.
        IF sy-subrc = 0.
          MESSAGE s000(0) WITH 'records updated successfully'.
        ENDIF.
      ENDLOOP.
  ENDCASE.
ENDFORM.

Similar Messages

  • Help needed for edit images

    Could you please do me a favor for giving a Christmas gift to my young daughter.
    She is just 1 year old and I would like to insert her face into Christmas puppa's photo.So she will look
      like Christmas puppa's,I will give you both photos.If you can help me that will be great..

    Hello there!
    There are several links for you to accomplish what you want to do as long as you just review them beforehand.
    You can learn the basics at AdobeTV
    Please post back if you have any questions in completing your task
    janelle

  • Urgent : Problem with Editable  ALV Grid  for Quantity and Currency Fields

    Hi All,
    I am using Editable ALV Grid display and have quantity and value as editable fields in the display.
    When user changes these values these values are not changing properly .
    For the quantity field the domain is MENG13 with 3 deciamal places and here  if we enter 500 it takes it as 0.500   .
    The same problem is for the currency field. Here the Domain is WERT7 with 3 decimal places.
    Here also it takes last 2 digits after decimal places by default.
    Please advice how to get proper values in this case from ALV editable fields.
    Thanks and Regards
    Harshad
    Edited by: Harshad Rahirkar on Dec 25, 2007 7:39 AM

    for all the currency field , it will display like that only.
    u have to manipulate uin program before displaying.
    if they are giving 500, in program multiply with 100 and move it to table.
    when u are getting from table, divinde and display.
    this is what I am doing.
    Reward if helpfull.

  • Exception while creating f4 help for editable alv field

         hi experts
    i have created search help for editable alv field by following link
    http://scn.sap.com/docs/DOC-39832
    But i m getting an exception :  Field symbol has not yet been assigned.
    exception area code
       read table <tab1> into <ls_wa> index i_row_id.
        assign component m_cl_variant->ms_layout-stylefname
               of structure <ls_wa> to <l_field>.
        read table <l_field> into ls_style
                with table key fieldname = is_col_id-fieldname.
        if sy-subrc eq 0.
          if ls_style-style o mc_style_enabled.
            ready_for_input = 1.
            exit.
          elseif ls_style-style o mc_style_disabled.
            ready_for_input = 0.
            exit.
          endif.
    first read statement is giving sy-subrc =4.
    PS: exception from method..:IS_READY_FOR_INPUT
    kindly help

    Hello Ankush,
    read table <tab1>  ASSIGNING <ls_wa> index i_row_id.
    IF  <ls_wa> IS ASSIGNED.
        assign component m_cl_variant->ms_layout-stylefname
               of structure <ls_wa> to <l_field>.
        read table <l_field> into ls_style
                with table key fieldname = is_col_id-fieldname.
        if sy-subrc eq 0.
          if ls_style-style o mc_style_enabled.
            ready_for_input = 1.
            exit.
          elseif ls_style-style o mc_style_disabled.
            ready_for_input = 0.
            exit.
          endif.
    ENDIF.
    Regards,
    TP

  • Check_changed_data method on editable ALV Grid ( class cl_gui_alv_grid)

    Hi guys,
    I use the following method (register_edit_event) in the PBO soon after first display of an editable ALV grid to register enter as an event to do validations on fields like qty. If user enters some character like 'abc' for qty and hits enter on keyboard, ALV grid pop's up a standard message ( I haven't coded for this.Since I use DDIC structure in field catalog, the Std. ALV program takes care of it. ). THis takes care of the validation before I click on save.
    call method alv_grid->register_edit_event
                            exporting
                               i_event_id = cl_gui_alv_grid=>mc_evt_enter.
    This works fine. But I want this validation to run when I also click the SAVE button of the screen. Is it possible to run this standard validation in my PAI event eg. SAVE ? I thought I will be, by calling the method check_changed_data in my PAI event. But this is doing nothing. Does this method conflict with register_edit_event or something ? So , basically what I am looking for is to trigger the event or call the method which does the same work as the "check" button on ALV grid.
    Any advice or tips or sample code is greatly appreciated.
    Thanks,
    Shareen

    Hi Shareen,
    Handle the data_changed event in the grid.
    Whenever you make changes in the data in ALV Grid this event would be triggered. Here you can perform additional validations that you may need to perform.
        METHODS handle_data_changed
          FOR EVENT data_changed OF cl_gui_alv_grid
          IMPORTING er_data_changed.
    Implementation:
      METHOD handle_data_changed.
        PERFORM validations USING er_data_changed.
      ENDMETHOD.
    FORM validations USING er_data_changed TYPE REF TO cl_alv_changed_data_protocol.
      DATA: ls_good TYPE lvc_s_modi.
      DATA  wa LIKE LINE OF lt_good_cells.
      CALL METHOD g_grid->register_edit_event
        EXPORTING
          i_event_id = cl_gui_alv_grid=>mc_evt_modified.
      LOOP AT er_data_changed->mt_good_cells INTO ls_good.
        CASE ls_good-fieldname.
        WHEN 'FIELDNAME'. "Your fieldname
            CALL METHOD er_data_changed->get_cell_value "Get the changed value
              EXPORTING
                i_row_id    = ls_good-row_id
                i_fieldname = ls_good-fieldname
              IMPORTING
                e_value     = temp. "Your temp variable
            "Make your validations here.
        ENDCASE.
    Ps: Reward points if helpful.
    Regards,
    Wenceslaus.

  • Determining Duplicate Entries in Editable ALV Grid

    Hopefully this question is not as obvious as it may seem at first. Thanks for any input or ideas...read carefully, it is not just a simple duplicate check with which I'm having a problem.
    I have an editable ALV grid and I need to ensure that the user doesn't try to enter the same material number twice. I used the program BCALV_EDIT_03 and 04 as a model. I can tell if in my session a user is trying to put in the material number twice. Not a problem. I can also tell if the user is trying to add a material to the ones already on the grid that is a duplicate. That is not a problem either. Here is the catch...and I'd like to point out that BCALV_EDIT_04 has the same problem.
    The user enters line 10 with material 0245 and line 20 with 0345. There is no duplicate. Then they say, 'Oooops, I got them backward' and then move 0345 to line 10 and 0245 to line 20.  When you hit enter, the change handler says that line 10 and 20 were changed and the field MATNR was changed. It then compares the new fields to what is already in the grid...low and behold the grid already has these two entries and the protocol adds the error for both lines.
    I will add the code here, but it is pretty much exactly as in BCALV_EDIT_04. If you want to see the error in that program execute it, put in two new lines with the same airline and two different dates and hit save. Everything is fine. Then swap the dates and hit Save again...it will say these are duplicates, which they are not...this program is not saving to the database. The only difference between mine and bcalv_edit_04 is that mine uses an 'ENTER' event and not a 'SAVE'.
    I'm looking for good ideas on how to compare the two...the mt_good_cells (session active) and the grid itself to know when a user has 'moved' data. The current workaround is for the user to copy the line and then reapply it...but that seems a bit glitchy.
    Thanks in advance, I appreciate any sage advice. : )
    METHOD check_double_entries.
        DATA: lt_good_cells TYPE lvc_t_modi,
              ls_good TYPE lvc_s_modi,
              l_matnr TYPE matnr,
              l_del_row TYPE lvc_s_moce,
              ls_rosi LIKE LINE OF i_rosi,
              l_reentered TYPE c.
        LOOP AT pr_data_changed->mt_good_cells INTO ls_good.
          CASE ls_good-fieldname.
            WHEN 'MATNR'.
              CALL METHOD pr_data_changed->get_cell_value
                EXPORTING
                  i_row_id    = ls_good-row_id
                  i_fieldname = ls_good-fieldname
                IMPORTING
                  e_value     = l_matnr.
              READ TABLE lt_good_cells WITH KEY
                                value = l_matnr
                                TRANSPORTING NO FIELDS.
              IF sy-subrc = 0.
                CALL METHOD pr_data_changed->add_protocol_entry
                  EXPORTING
                    i_msgid     = '0K'
                    i_msgno     = '000'
                    i_msgty     = 'E'
                    i_msgv1     = text-m01
                    i_fieldname = ls_good-fieldname
                    i_row_id    = ls_good-row_id.
                error_in_data = 'X'.
              ELSE.
                ls_good-value = l_matnr.
                APPEND ls_good TO lt_good_cells.
              ENDIF.
          ENDCASE.
        ENDLOOP.
        LOOP AT lt_good_cells INTO ls_good.
          l_matnr = ls_good-value.
          READ TABLE i_rosi WITH KEY matnr = l_matnr
                        TRANSPORTING NO FIELDS.
          IF sy-subrc = 0.
            l_reentered = space.
            LOOP AT pr_data_changed->mt_deleted_rows INTO l_del_row.
              READ TABLE i_rosi INTO ls_rosi INDEX l_del_row-row_id.
              IF sy-subrc NE 0.
                MESSAGE i000(0k) WITH text-e01.
              ELSEIF ls_rosi-matnr EQ ls_good-value.
                l_reentered = 'X'.
              ENDIF.
            ENDLOOP.
            IF l_reentered NE 'X'.
              CALL METHOD pr_data_changed->add_protocol_entry
                EXPORTING
                  i_msgid     = '0K'
                  i_msgno     = '000'
                  i_msgty     = 'E'
                  i_msgv1     = text-m01
                  i_fieldname = ls_good-fieldname
                  i_row_id    = ls_good-row_id.
              error_in_data = 'X'.
            ENDIF.
          ENDIF.
        ENDLOOP.
      ENDMETHOD.                    "check_double_entries

    Hi Greg,
    please check your posting in the prview tab. If the code is not formatted, you posted too much. Reduce and try again, then somebody may be willing to read.
    Regards,
    Clemens

  • Mandatory Fields on Editable ALV Grid

    Hi. I am using oops method to make an editable ALV grid.
    How do I sent some columns for mandatory data entry?
    Here are my declarations
    gs_layout TYPE lvc_s_layo, "Layout declaration
    go_grid TYPE REF TO cl_gui_alv_grid,  "Grid
    go_custom_container TYPE REF TO cl_gui_custom_container,"Container
    go_fieldcat type lvc_t_fcat, "Field Catalog
    Thanks,
    Shareen

    Hi Shareen Hegde ,
    Try this program.
    report zshail_alv_new .
    tables: sflight.
    type-pools: icon.
    data: pt_sort type lvc_t_sort.
    data: my_column type table of lvc_s_ceno with header line.
    data: t_hype type LVC_T_HYPE.
    class shail_event definition.
    public section.
    methods:
    handle_toolbar for event toolbar of cl_gui_alv_grid
    importing e_object e_interactive,
    handle_user_command for event user_command of cl_gui_alv_grid importing
    e_ucomm,
    handle_contextmenu_request for event context_menu_request of
    cl_gui_alv_grid importing e_object.
    endclass.
    class shail_event implementation.
    method handle_toolbar.
    perform handler_toolbar using e_object e_interactive.
    endmethod.
    method handle_user_command.
    perform handler_user_command using e_ucomm.
    endmethod.
    method handle_contextmenu_request.
    perform handler_contextmenu_request using e_object.
    endmethod.
    endclass.
    data: go_container type ref to cl_gui_custom_container,
          go_grid type ref to cl_gui_alv_grid,
          field_catalog type lvc_t_fcat,
          layout type lvc_s_layo.
    data: begin of itab occurs 0.
    include structure sflight.
    data: end of itab.
    data: obj type ref to shail_event.
    data: button_exclude type ui_functions.
    start-of-selection.
    call screen 200.
    *&      Module  STATUS_0100  OUTPUT
          text
    module status_0100 output.
    SET PF-STATUS 'xxxxxxxx'.
    SET TITLEBAR 'xxx'.
    if go_container is initial.
    create object go_container
      exporting
       PARENT                      =
        container_name              = 'ALV_CONTAINER'
       STYLE                       =
       LIFETIME                    = lifetime_default
       REPID                       =
       DYNNR                       =
       NO_AUTODEF_PROGID_DYNNR     =
    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 object go_grid
      exporting
       I_SHELLSTYLE      = 0
       I_LIFETIME        =
        i_parent          = go_container
       I_APPL_EVENTS     = space
       I_PARENTDBG       =
       I_APPLOGPARENT    =
       I_GRAPHICSPARENT  =
       I_USE_VARIANT_CLASS = SPACE
       I_NAME            =
    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 object obj.
    set handler obj->handle_toolbar for go_grid.
    set handler obj->handle_user_command for go_grid.
    set handler obj->handle_contextmenu_request for go_grid.
    select * from sflight into corresponding fields of table itab.
    perform catalog_fill changing field_catalog.
    perform layout_fill changing layout.
    perform prepare_sort_table changing pt_sort.
    call method go_grid->set_table_for_first_display
      exporting
       I_BYPASSING_BUFFER            =
       I_BUFFER_ACTIVE               =
       I_CONSISTENCY_CHECK           =
       I_STRUCTURE_NAME              = 'SFLIGHT'
       IS_VARIANT                    =
       I_SAVE                        =
       I_DEFAULT                     = 'X'
        is_layout                     = layout
       IS_PRINT                      =
       IT_SPECIAL_GROUPS             =
        it_toolbar_excluding          = button_exclude
        IT_HYPERLINK                  = t_hype
       IT_ALV_GRAPHICS               =
       IT_EXCEPT_QINFO               =
      changing
        it_outtab                     = itab[]
        it_fieldcatalog               = field_catalog
        it_sort                       = pt_sort
       IT_FILTER                     =
    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.
    call method go_grid->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.
    endmodule.                 " STATUS_0100  OUTPUT
    *&      Module  USER_COMMAND_0100  INPUT
          text
    module user_command_0100 input.
    case sy-ucomm.
    when 'BACK'.
    LEAVE TO SCREEN 0.
    endcase.
    endmodule.                 " USER_COMMAND_0100  INPUT
    *&      Form  CATALOG_FILL
          text
         <--P_FIELD_CATALOG  text
    form catalog_fill changing p_field_catalog.
    data ls_fcat type lvc_s_fcat .
    ls_fcat-fieldname = 'CARRID' .
    ls_fcat-inttype = 'C' .
    ls_fcat-outputlen = '20' .
    ls_fcat-coltext = 'Carrier ID' .
    ls_fcat-web_field = 'carrid_handle'.
    ls_fcat-edit = 'X'.
    *ls_fcat-emphasize = 'C310'.   "needed for column coloring
    append ls_fcat to field_catalog .
    clear ls_fcat .
    ls_fcat-fieldname = 'FLDATE' .
    ls_fcat-ref_table = 'SFLIGHT' .
    ls_fcat-ref_table = 'FLDATE' .
    ls_fcat-outputlen = '20' .
    ls_fcat-coltext = 'Flight Date' .
    ls_fcat-web_field = 'fldate_handle'.
    append ls_fcat to field_catalog .
    clear ls_fcat .
    ls_fcat-fieldname = 'PRICE' .
    ls_fcat-ref_table = 'SFLIGHT' .
    ls_fcat-ref_table = 'PRICE' .
    ls_fcat-outputlen = '20' .
    ls_fcat-coltext = 'Airfare' .
    append ls_fcat to field_catalog .
    clear ls_fcat .
    ls_fcat-fieldname = 'SEATSMAX' .
    ls_fcat-ref_table = 'SFLIGHT' .
    ls_fcat-ref_table = 'SEATSMAX' .
    ls_fcat-outputlen = '20' .
    ls_fcat-coltext = 'Maximum seats' .
    append ls_fcat to field_catalog .
    endform.                    " CATALOG_FILL
    *&      Form  LAYOUT_FILL
          text
         <--P_LAYOUT  text
    form layout_fill changing p_layout type lvc_s_layo.
    p_layout-zebra = 'X' .
    p_layout-grid_title = 'Flights' .
    p_layout-smalltitle = 'X' .
    p_layout-no_merging = 'X'.
    *p_layout-sel_mode = 'A'.
    *p_layout-info_fname = 'rowcolor'.
    endform.                    " LAYOUT_FILL
    *&      Form  exclude_std_buttons
          text
         <--P_BUTTON_EXCLUDE  text
    form exclude_std_buttons changing p_button_exclude type ui_functions.
    the various buttons are details,sort asc,sort desc,find,set filter,
    total, subtotal,
    print,view,export,changelayout,display graphic, eu documentation
    MC_FC_DETAIL,MC_FC_FIND,MC_FC_FILTER,MC_FC_GRAPHIC,MC_FC_SORT_ASC,
    MC_FC_SORT_DSC,MC_FC_SUBTOT,MC_FC_SUM,MC_FC_PC_FILE,MC_FC_VIEWS
    data: ls_exclude type ui_func.
    ls_exclude = cl_gui_alv_grid=>mc_fc_detail.
    append ls_exclude to p_button_exclude.
    ls_exclude = cl_gui_alv_grid=>mc_fc_find.
    append ls_exclude to p_button_exclude.
    ls_exclude = cl_gui_alv_grid=>mc_fc_filter.
    append ls_exclude to p_button_exclude.
    ls_exclude = cl_gui_alv_grid=>mc_fc_graph.
    append ls_exclude to p_button_exclude.
    ls_exclude = cl_gui_alv_grid=>mc_fc_sort_asc.
    append ls_exclude to p_button_exclude.
    ls_exclude = cl_gui_alv_grid=>mc_fc_sort_dsc.
    append ls_exclude to p_button_exclude.
    ls_exclude = cl_gui_alv_grid=>mc_fc_subtot.
    append ls_exclude to p_button_exclude.
    ls_exclude = cl_gui_alv_grid=>mc_fc_sum.
    append ls_exclude to p_button_exclude.
    ls_exclude = cl_gui_alv_grid=>mc_fc_print.
    append ls_exclude to p_button_exclude.
    ls_exclude = cl_gui_alv_grid=>mc_fc_views.
    append ls_exclude to p_button_exclude.
    endform.                    " exclude_std_buttons
    *&      Form  handle_toolbar
          text
         -->P_E_OBJECT  text
         -->P_E_INTERACTIVE  text
         -->P_ENDMETHOD  text
    form handler_toolbar using    p_e_object type ref to
    cl_alv_event_toolbar_set
                                 p_e_interactive                   .
    data: ls_toolbar type stb_button.
    clear ls_toolbar.
    move 'PER' to ls_toolbar-function. "#EC NOTEXT
    move icon_display_text to ls_toolbar-icon.
    move 'Test Info'(201) to ls_toolbar-quickinfo.
    move 'Test Info'(201) to ls_toolbar-text.
    move ' ' to ls_toolbar-disabled. "#EC NOTEXT
    append ls_toolbar to p_e_object->mt_toolbar.
    endform.                    " handle_toolbar
    *&      Form  handle_user_command
          text
         -->P_E_UCOMM  text
    form handler_user_command using    p_e_ucomm.
    case p_e_ucomm.
    when 'PER'.
    perform selected_columns.
    when 'CREA'.
    message i001(zmess).
    endcase.
    endform.                    " handle_user_command
    *&      Form  prepare_sort_table
          text
         <--P_PT_SORT  text
    form prepare_sort_table changing p_pt_sort type lvc_t_sort.
    data: ls_sort type lvc_s_sort.
    ls_sort-spos = '1'.
    ls_sort-fieldname = 'FLDATE'.
    ls_sort-up = space.
    ls_sort-down = 'X'.
    append ls_sort to p_pt_sort.
    endform.                    " prepare_sort_table
    *&      Form  handler_contextmenu_request
          text
         -->P_E_OBJECT  text
    form handler_contextmenu_request using    p_e_object type ref to
    cl_ctmenu.
    *CALL METHOD p_e_object->hide_functions
    EXPORTING
       fcodes = LT_FCODES
    CALL METHOD p_e_object->clear
    *break-point.
    CALL METHOD p_e_object->add_function
      EXPORTING
        fcode       = 'CREA'
        text        = 'Add Function'
       ICON        =
       FTYPE       =
       DISABLED    =
       HIDDEN      =
       CHECKED     =
       ACCELERATOR =
    endform.                    " handler_contextmenu_request
    *&      Form  selected_columns
          text
    -->  p1        text
    <--  p2        text
    form selected_columns.
    CALL METHOD go_grid->get_selected_cells_id
       IMPORTING
         ET_CELLS = my_column[]
    loop at my_column.
    this will specify the id of the selected cell
    message i001(zmess) with my_column-row_id.
    message i002(zmess) with my_column-col_id.
    endloop.
    endform.                    " selected_columns
    *&      Form  display_values
          text
         -->P_ROW_ID  text
    *&      Form  prepare_hyp_tab
          text
         <--P_T_HYPE  text
    form prepare_hyp_tab changing p_t_hype type lvc_t_hype.
    endform.                    " prepare_hyp_tab
    *&      Module  STATUS_0200  OUTPUT
          text
    module STATUS_0200 output.
    SET PF-STATUS 'xxxxxxxx'.
    SET TITLEBAR 'xxx'.
    endmodule.                 " STATUS_0200  OUTPUT
    *&      Module  USER_COMMAND_0200  INPUT
          text
    module USER_COMMAND_0200 input.
    CASE SY-UCOMM.
    WHEN 'NEXT'.
    CALL SCREEN 100.
    WHEN 'EXIT'.
    LEAVE PROGRAM.
    ENDCASE.
    endmodule.                 " USER_COMMAND_0200  INPUT
    Good Luck and REWARD ME for the same
    Thanks
    Ashok.N

  • How to create editable ALV grid/list

    Hi,
    I want to create editable ALV grid/list so that user can modify the data in the ALV.
    And when user presses save button data will get saved in Z table.
    I dont know how to create editable ALV so could anybody please help me regarding this?
    Thanks & regards,
    Sameer Dhuke

    HI
    check the demo programs BCALV_FULLSCREEN_GRID_EDIT
    BCALV_GRID_EDIT
    BCALV_TEST_GRID_EDIT_01
    BCALV_TEST_GRID_EDITABLE
    REUSE_ALV_GRID EDITABLE
    ALV Grid editable fields
    Just to make things a bit easy
    In the layout,there is a property called edit, make it 'X' for the particular field whichever you want to make editable.
    Hope this helps,
    Suruchi
    Message was edited by:
            Suruchi Mahajan

  • Shortdump @ alv grid program

    Hi,
    we have a problem with our alv grid program.
    Here is the coding:
    *Varibalendeklaration
    DATA:   wa_buero TYPE zd06_buero.
    DATA:   it_buero LIKE TABLE OF wa_buero.
    *Selectierung und Sortierung
    SELECT agencynum COUNT( * ) AS zcount
           INTO CORRESPONDING FIELDS OF TABLE it_buero
           FROM sbook
           GROUP BY agencynum
           ORDER BY zcount DESCENDING.
    *Den Dynpro aufrufen
    CALL SCREEN 103.
    *&      Module  STATUS_0103  OUTPUT
    *       text
    MODULE status_0103 OUTPUT.
    *Aufrufen des von Hendrik erstellten Funktionsbaustein zum Aufruf des
    *Alv Grids
      CALL FUNCTION 'ZD06_06_ALV'
        EXPORTING
          container_name_in   = 'CONTAINER_1'
          i_structure_name_in = 'ZD06_BUERO'
        CHANGING
          it_outtab_in        = it_buero.
    ENDMODULE.                 " STATUS_103  OUTPUT
    We have just create an new DDIC Structure with the points we need.
    Our referent can't solve the problem and know I need your help.
    Thanks.
    Best Regards,
    Marcus

    Hi,
    thank you for answering.
    The programm take a travelagencynumber from dbtab sbook. There also is a counter who sort and count the agencynumbers. The programm should tell us, how many books are done with this agency. e.g.: Travelagency 98565    1358 books
    ZD06_06_ALV is a function for alv grid. The code for this function is:
    *"*"Lokale Schnittstelle:
    *"  IMPORTING
    *"     REFERENCE(CONTAINER_NAME_IN) TYPE  CHAR30
    *"     REFERENCE(I_STRUCTURE_NAME_IN)
    *"  CHANGING
    *"     REFERENCE(IT_OUTTAB_IN)
      DATA: container_r TYPE REF TO cl_gui_custom_container,
            grid_r      TYPE REF TO cl_gui_alv_grid.
      CREATE OBJECT container_r
       EXPORTING container_name = container_name_in.
      CREATE OBJECT grid_r
      EXPORTING i_parent = container_r.
      CALL METHOD grid_r->set_table_for_first_display
        EXPORTING
          i_structure_name = i_structure_name_in
        CHANGING
          it_outtab        = it_outtab_in.
    ENDFUNCTION.
    The dump reason is
    Runtime error: DBIF_RSQL_INVALID_RSQL
    We set a breakpoint at the select statement and there is the problem. exactly there is the dump.
    Best Regards.
    Marcu

  • Enter Key Event in Editable ALV Grid

    Hi all,
    I am trying to create and editable ALV grid using the REUSE ALV FM.
    On the grid after changing a value, if I press enter key the pai is not triggered. I have tried the various example programs (BCALV*) but could not find anything relevant.
    Basically I need similar functionality to normal module pool programming as in validations on screen done when enter key is pressed after screen entry.
    Is it possible to capture the Enter keypress on the ALV grid?

    Hello Preet
    I can only tell you how I would solve this using the ALV grid control (CL_GUI_ALV_GRID) because I have abandoned using ALV function modules.
    The problem with running through PAI is whether the focus (i.e. the cursor) is still on the control or already on the (surrounding) main program. If the control has the focus, you do not run through PAI.
    I would add a "Refresh" button to the toolbar of the ALV list. Normally, this button is already there or you only have to make it visible.
    When the user pushes this button you catch the corresponding user-command and call the CHECK_DATA_CHANGED method to see if values have been changed on the editable grid. If so, the previous method will fire event DATA_CHANGED.
    Now, in the event handler method (e.g. HANDLE_DATA_CHANGED) you receive as input a data change object (CL_ALV_CHANGED_DATA_PROTOCOL). This object contains all changed values. These values you will need to make your checks.
    I assume that the logic will be similar using ALV function modules.
    Regards
       Uwe

  • Runtime Error - TABLE_FREE_IN_LOOP in editable ALV GRID

    While modifying editable ALV Grid, (CL_GUI_ALV_GRID) I am getting an unexpected dump as follows -
    "Runtime Error          TABLE_FREE_IN_LOOP".
       In a Editable ALV grid whenever new row is added using standard append row button, And while saving, i check for any initial values, in that case iam displaying a warning message. So after that when i try to modify the row, and press enter key, Iam getting this dump "TABLE_FREE_IN_LOOP".
    Can you please help on this regard.
    Thanks in advance..
    Best regards,
    Prasad.

    Hello Krishna
    take a additional internal table which is exactly of same type of the internal table which you want to modify . try modifying the second internal table. and then proceed for db update(if required).
    Regards,
    Suvendu

  • Mark fields (columns) in editable ALV Grid as mandatory

    Hi,
    could you please help me to set up a column in an editable alv grid as mandatory? I had a look in several references and also did not find anything in the fieldcatalog structure.
    Best regards,
    Fabian

    Hello Fabian
    Here is some coding to explain what I meant.
    *& Report  ZUS_SDN_ALV_ERROR_LOG
    REPORT  zus_sdn_alv_error_log.
    DATA:
      er_data_changed    TYPE REF TO cl_alv_changed_data_protocol.
    START-OF-SELECTION.
    * Dynpro is empty (contains no elements)
      CALL SCREEN '0100'.
    END-OF-SELECTION.
    *&      Module  PBO_0100  OUTPUT
    *       text
    MODULE pbo_0100 OUTPUT.
    * Event DATA_CHANGED was fired due to changes in the editable ALV grid
      IF ( er_data_changed IS BOUND ).
    * User did not change any values
      ELSE.
        CREATE OBJECT er_data_changed
    *      EXPORTING
    *        I_CONTAINER =
    *        I_CALLING_ALV = <your ALV grid instance>
      ENDIF.
    * That is how your code probably looks like
    *  LOOP AT gt_outtab INTO gs_outtab.
    *    IF ( gs_outtab-obligatory IS INITIAL ).
    *      CALL METHOD go_alvlog->add_protocol_entry
    *        EXPORTING
    *          i_msgid     = '00'
    *          i_msgty     = 'E'
    *          i_msgno     = '398'
    *          I_MSGV1     = 'Field OBLIGATORY must not be empty'
    **          I_MSGV2     =
    **          I_MSGV3     =
    **          I_MSGV4     =
    *          i_fieldname = 'OBLIGATORY'
    **          I_ROW_ID    =
    *          I_TABIX     = syst-tabix
    *    ENDIF.
    *  ENDLOOP.
    * Generate a protocol for testing purposes
      DO 5 TIMES.
        CALL METHOD er_data_changed->add_protocol_entry
          EXPORTING
            i_msgid     = '00'
            i_msgty     = 'E'
            i_msgno     = '398'
            i_msgv1     = 'Field OBLIGATORY must not be empty'
    *          I_MSGV2     =
    *          I_MSGV3     =
    *          I_MSGV4     =
            i_fieldname = 'OBLIGATORY'
            i_row_id    = syst-index
            i_tabix     = syst-index
      ENDDO.
      CALL METHOD er_data_changed->display_protocol
    *    EXPORTING
    *      I_CONTAINER =
    ENDMODULE.                 " PBO_0100  OUTPUT
    Please note that this report dumps as soon as you close the log popup. However, this will not happen within your event handler method.
    Regards
      Uwe

  • How to Transfer Data from editable ALV grid control to internal table?

    Hi,
    Can anyone give me a simple example by which I can transfer data from editable alv grid control back to the internal table. The ALV has been created by OO approach.
    I would appreciate if the solution is provided without handling any events.
    Regards,
    Auro

    Hello Auro
    You simply need to call method <b>go_grid->check_changed_data</b> at PAI of the dynpro displaying the ALV grid. If data have been changed on the editable ALV grid then this method will raise event DATA_CHANGED. If you do not want or need to handle this event (e.g. for validating the edited values) then you do not define any event handler method.
    Regards
      Uwe

  • Help needed for writing query

    help needed for writing query
    i have the following tables(with data) as mentioned below
    FK*-foregin key (SUBJECTS)
    FK**-foregin key (COMBINATION)
    1)SUBJECTS(table name)     
    SUB_ID(NUMBER) SUB_CODE(VARCHAR2) SUB_NAME (VARCHAR2)
    2           02           Computer Science
    3           03           Physics
    4           04           Chemistry
    5           05           Mathematics
    7           07           Commerce
    8           08           Computer Applications
    9           09           Biology
    2)COMBINATION
    COMB_ID(NUMBER) COMB_NAME(VARCHAR2) SUB_ID1(NUMBER(FK*)) SUB_ID2(NUMBER(FK*)) SUB_ID3(NUMBER(FK*)) SUBJ_ID4(NUMBER(FK*))
    383           S1      9           4           2           3
    384           S2      4           2           5           3
    ---------I actually designed the ABOVE table also like this
    3) a)COMBINATION
    COMB_ID(NUMBER) COMB_NAME(VARCHAR2)
    383           S1
    384           S2
    b)COMBINATION_DET
    COMBDET_ID(NUMBER) COMB_ID(FK**) SUB_ID(FK*)
    1               383          9
    2               383          4
    3               383          2
    4               383          3
    5               384          4
    6               384          2          
    7               384          5
    8               384          3
    Business rule: a combination consists of a maximum of 4 subjects (must contain)
    and the user is less relevant to a COMB_NAME(name of combinations) but user need
    the subjects contained in combinations
    i need the following output
    COMB_ID COMB_NAME SUBJECT1 SUBJECT2      SUBJECT3      SUBJECT4
    383     S1     Biology Chemistry      Computer Science Physics
    384     S2     Chemistry Computer Science Mathematics Physics
    or even this is enough(what i actually needed)
    COMB_ID     subjects
    383           Biology,Chemistry,Computer Science,Physics
    384           Chemistry,Computer Science,Mathematics,Physics
    you can use any of the COMBINATION table(either (2) or (3))
    and i want to know
    1)which design is good in this case
    (i think SUB_ID1,SUB_ID2,SUB_ID3,SUB_ID4 is not a
    good method to link with same table but if 4 subjects only(and must) comes
    detail table is not neccessary )
    now i am achieving the result by program-coding in C# after getting the rows from oracle
    i am using oracle 9i (also ODP.NET)
    i want to know how can i get the result in the stored procedure itsef.
    2)how it could be designed in any other way.
    any help/suggestion is welcome
    thanks for your time --Pradeesh

    Well I forgot the table-alias, here now with:
    SELECT C.COMB_ID
    , C.COMB_NAME
    , (SELECT SUB_NAME
    FROM SUBJECTS
    WHERE SUB_ID = C.SUB_ID1) AS SUBJECT_NAME1
    , (SELECT SUB_NAME
    FROM SUBJECTS
    WHERE SUB_ID = C.SUB_ID2) AS SUBJECT_NAME2
    , (SELECT SUB_NAME
    FROM SUBJECTS
    WHERE SUB_ID = C.SUB_ID3) AS SUBJECT_NAME3
    , (SELECT SUB_NAME
    FROM SUBJECTS
    WHERE SUB_ID = C.SUB_ID4) AS SUBJECT_NAME4
    FROM COMBINATION C;
    As you need exactly 4 subjects, the columns-solution is just fine I would say.

  • How can we find out data in an editable ALV grid has been changed or not?

    Hi Experts,
    How can we find out whether a data in an editable ALV grid has been changed or not.
    I am using the
    FM -> REUSE_ALV_GRID_DISPLAY_LVC
    for ALV display.
    I have to chekc whther data has been changed or not befor saving. if changed then only i want to
    SAVE
    . I cannot use the internal table comparison method for this purpose also i am not using OOP ALV.
    So kindly sugest me an alternative.
    Thanks and Regards,
    Shahana

    Hi,
    Thanks for your answer. I already saw this post.
    See this method.
    CALL METHOD reuse_alv_grid->check_changed_data
    IMPORTING
    e_valid = lv_check.
    This will update the internal table with the edited values. Then we can go for internal table comparison.
    But my scenario will not allow me for itab comparisons.I just want to know the ALV data has been changed or not.
    Regards,
    Shahana

Maybe you are looking for

  • Color issue only with finder on a dell U2410 screen

    Hello... I've got a macbookpro 15' with snow leopard. I've just connected a second display screen (DELL U2410) through a mini display to DVI adapter. On te Dell, when i look a photo in the finder/cover flow, the reds are satured. And when i look the

  • Slingbox with new FiOS DVR (CHS 435HDC)

    I just had FiOS installed with the CHS 435HDC DVR box.  The Slingbox website says it's not a supported set-top box.  Is there anything I can do?  Or will I have to cancel FiOS in a matter of hours after it being installed? Please help, Mike 

  • Ntoskrln.exe blue screen...!!!!

    Hi Im one of those who have constant problem with freezing up. This is what happens. In game, it freezes, then when restarting. this message appears: adress. 804518CE base at 80400000 datestamp 3d366b8b ntoskrln.exe I have disconnected one of the cd-

  • Stopping the assembler from deleting the war file

    Is there any way to stop the Web Services assembler from deleting the build directory (or the war file) after it is done packaging the ear file? I want to take the war file and package it into my own ear file.

  • Not burning at 16x

    I'm having issues with my internal NEC 3550A and LG GSA-H10N. I've updated the firmware for each to the most currrent. But at 16x burn, I'm only getting up to 9x on the first 35 sec of burning then starts to drop down and settle at about 5x. I've use