Like SM30 ,table should be display in editable ALV Grid(for Dynamic DB )

Hi Friends,
plese help me how to display  ALV grid in editable mode for differnt types of data base tables.
same as like SM30 transaction.
Moderator message: please search for available information/documentation/previous discussions before asking.
Edited by: Thomas Zloch on Nov 11, 2010 6:40 PM

Hi,
In SLIS_T_FIELDCAT_ALV you specify the field as edit = X.
Give it as mentioned, where you assign fieldname and positions etc.
Thanks&Regards

Similar Messages

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

  • Two Internal tables to be displayed as separate ALV grid.

    Hi Friends,
    I have 2 internal tables say i_tab1 and i_tab2.
    I_TAB1 contains 10 records.
    I_TAB2 contains 15 records.
    My requirement is to display I_TAB1 with title 'Success Records' and ITAB2 with title 'Missed Records'.
    It should be done thro ALV grid Display. I can do using ALV LIST Display. But I need using GRID display.
    Its version 4.6C.
    How to do this?
    Regards,
    Viji

    Hi,
    Use a container and the spliters as below:
    DATA: container1   TYPE REF TO cl_gui_container,
          container2   TYPE REF TO cl_gui_container,
          container3   TYPE REF TO cl_gui_container,
          main1        TYPE REF TO cl_gui_custom_container,
          splitter1    TYPE REF TO cl_gui_splitter_container,
          grid1        TYPE REF TO cl_gui_alv_grid,
          grid2        TYPE REF TO cl_gui_alv_grid,
          grid3        TYPE REF TO cl_gui_alv_grid,
          ls_layo      TYPE lvc_s_layo,
          count        TYPE i VALUE 0,
          g_okcode     LIKE sy-ucomm,
          r1,r2.
    DATA: alv_fcat     TYPE lvc_t_fcat WITH HEADER LINE.
    * First Main Container
    CREATE OBJECT main1
           EXPORTING container_name = 'MAIN_CONTAINER'.
    * First Splitter Container
    CREATE OBJECT splitter1
           EXPORTING parent  = main1
                     rows    = 2
                     columns = 1.
    * Place Container1 in First row First column
    CALL METHOD splitter1->get_container
      EXPORTING
        row       = 1
        column    = 1
      RECEIVING
        container = container1.
    * Place Container2 in Second row First column
    CALL METHOD splitter1->get_container
      EXPORTING
        row       = 2
        column    = 1
      RECEIVING
        container = container2.
    * Create grids
      CREATE OBJECT grid1
             EXPORTING i_parent      = container1.
      CREATE OBJECT grid2
             EXPORTING i_parent      = container2.
    CALL METHOD grid1->set_table_for_first_display
        EXPORTING
          is_layout       = ls_layo
        CHANGING
          it_outtab       = itab1[]
          it_fieldcatalog = alv_fcat[].
    * Display itab2 in grid2
      CALL METHOD grid2->set_table_for_first_display
        EXPORTING
          is_layout       = ls_layo
        CHANGING
          it_outtab       = itab2[]
          it_fieldcatalog = alv_fcat[].

  • Display in editable alv grid.

    Hi,
    This is my source code of uploading excel into sap and displaying the list.Please give the code for displaying the excel  data in editable alv.
    <<The code came from [here|https://wiki.sdn.sap.com/wiki/display/Snippets/ABAP-UploaddatafromExceltoSapusing+OO]>>
    Thanks in advance.
    am just a beginner in learning abap objects.pls help.
    Edited by: Matt on Aug 6, 2009 4:26 PM

    It wasn't your source code, was it?
    Please take the time to read the rules of engagement.  As it stands, your question is far too general.  There are examples of editable alvs in many location on the net.  You must search for them.  Please note these are not training forums, they are expert forums.  When you have a specific question, we'll be glad to assist.
    Post locked
    matt

  • From which table can I display PGI (material and quantity)for a spesific cu

    Dear gurus,
    From which table can I display PGI (material and quantity)for a spesific customer order?
    Thanks in advance

    HI
    PGI and material quantity can be available in MSEG table
    for this enter the sales order number in KDAUF or* MAT_KDAUF* fields in MSEG table
    Also try with LIPS delivery item table and LIKP table
    regards
    SAP SD
    Edited by: sapkpit_sd on Jul 22, 2010 8:14 AM

  • 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

  • Display ALV GRID Using Dynamic Internal Table

    Hi all,
    I try to display ALV Grid using Dynamic Internal Table, but when i activate my program, i get an error message "DYN_TABLE" is not type-compatible with formal parameter "IT_OUTTAB". ( DYN_TABLE is my Dynamic Itab).
    Anybody can help me how to passing Dynamic Itab into ALV Grid ?? Of ALV Grid only accept static Itab ??
    Thanks,

    Hi Vijay,
    It's doesn't work, and make new error "Formal parameter "IT_OUTTAB[]" does not exist. However, the parameter "IT_OUTTAB" has a similar name."
    Because the method is:
    CALL METHOD <ref. var. to CL_GUI_ALV_GRID>->set_table_for_first_display
    EXPORTING
    I_BUFFER_ACTIVE = <any type (ANY)>
    I_STRUCTURE_NAME = <string of type DD02L-TABNAME>
    IS_VARIANT = <structure of type DISVARIANT>
    I_SAVE = <var. of type CHAR01>
    I_DEFAULT = <var. of type CHAR01>
    IS_LAYOUT = <structure of type LVC_S_LAYO>
    IS_PRINT = <structure of type LVC_S_PRNT>
    IT_SPECIAL_GROUPS = <internal table of type LVC_T_SGRP>
    IT_TOOLBAR_EXCLUDING = <internal table of type UI_FUNCTIONS>
    IT_HYPERLINK = <internal table of type LVC_T_HYPE>
    IT_ALV_GRAPHICS = <internal table of type DTC_T_TC>
    CHANGING
    IT_OUTTAB = <internal table>
    IT_FIELDCATALOG = <internal table of type LVC_T_FCAT>
    IT_SORT = <internal table of type LVC_T_SORT>
    IT_FILTER = <internal table of type LVC_T_FILT>
    Thanks,

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

  • Edit ALV GRID

    hi,
    I have successfully displayed data in the ALV GRID(in Read-ONLY mode) by using the function of class "CL_GUI_ALV_GRID"  . But I have not been able to display the data in the edit mode .I want that the user should be able to edit the data displayed in the ALV GRID (and final data should be stored in the transparent table), but I have not been able to add that functionality . Can anyone please tell me how to do the same (any function that I need to call ??)  .
    Thanx
    sagar

    Hi Sagar,
    there was a similar question in this forum and Vijay Babu Dudla wrote a nice sample report:
    editing alv output
    Best Regards,
    Stefan

  • Editable ALV Grid: Append new rows

    Hi All,
    I have developed a report which will displays output in editable ALV grid list. Users can modify the values in output and save. These values will be stored in one custom table.
    My requirement is whenever user clicks on '+' mark (Create entries or Append or Copy: Standard toolbar) report should allow to enter new entries and save. How do I capture the selected function code? why becuase i need to display one value from the custom table in that added new row...
    Regards,
    Ramesh.

    Hi Ramesh,
    please check changed data event.....
    please go through the reference link......
    https://wiki.sdn.sap.com/wiki/display/Snippets/UpdatingtheInternalTable-AfterEditinALVusingFunctionModules
    Regards,
    Venkat

  • 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

  • Display amount in ALV Grid with different Decimal Places based on Currency

    HI Experts,
    Working with ALV Report i have one Amount field NETWR which is having Length 15 and Decimal Places 2.
    we have two different types of currency's AED and KWD and AED having 2 decimal Places and KWD having 3 decimal places.
    im using FM: REUSE_ALV_GRID_DISPLAY for Display. value storing in Table was like this
    AED---22.56
    KWD---225.65
    i need to display values like AED : 22.56

    HI Experts,
    Working with ALV Report i have one Amount field NETWR which is having Length 15 and Decimal Places 2. we have two different types of currency's AED and KWD and AED having 2 decimal Places and KWD having 3 decimal places.
    im using FM: REUSE_ALV_GRID_DISPLAY for Display. value storing in Table was like this
    AED---22.56
    KWD---225.65 (converting this value to 22.565 using BAPI_CURRENCY_GETDECIMALS according to currency in my Report)
    i need to display values like AED : 22.56
                                             KWD---22.565 but here field is NETWR with 2 decimal.
    Need to Display amount in ALV Grid with different Decimal Places based on Currency
    Regards,
    Dileep Kumar Reddy

  • 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

  • Generic function displaying alv grid for undefined structure

    Hi experts,
    I'm doing my first steps on abap development (Totally noob).
    I'm writing some little reports based on simple selections (1 or 2 tables).
    In every report, I've defined a structure (internal table) that i'm displaying with an ALV Grid.
    In every report, I need to create a catalog for my structure in order to make the alv grid working.
    What I would like to do is :
    Create a function that receives a undefined structure (for all my reports) as a parameter.
    This function sould create the catalog for the coresponding structure and call the alv grid function to display the data's contained in this structure.
    The goal is : In every report, I would like to use this function to show the selected data's without taking care of catalogs, alv grid, etc...
    Is it possible ?
    I really don't see how I can do that... Does anybody already tried something like that ?
    Thank you for your help
    Regards
    Quentin

    Hi,
    In this method Pass the structure name-
    CALL METHOD gh_grid->set_table_for_first_display
    EXPORTING
    I_BUFFER_ACTIVE =
    I_BYPASSING_BUFFER =
    I_CONSISTENCY_CHECK =
    I_STRUCTURE_NAME = "<- here pass the structure
    IS_VARIANT =
    I_SAVE =
    I_DEFAULT = 'X'
    IS_LAYOUT = "<-Layout variable if using layout
    IS_PRINT =
    IT_SPECIAL_GROUPS =
    IT_TOOLBAR_EXCLUDING =
    IT_HYPERLINK =
    IT_ALV_GRAPHICS =
    IT_EXCEPT_QINFO =
    CHANGING
    it_outtab = gt_line[]
    it_fieldcatalog = gt_fieldcat
    IT_SORT =
    IT_FILTER =
    EXCEPTIONS
    invalid_parameter_combination = 1
    program_error = 2
    too_many_lines = 3
    OTHERS = 4

Maybe you are looking for