ALV error.

Hi All,
      I've a report which is using  
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'.
It displays the data correctly, but when i press back button it gives a short dump!
The error is :
Runtime Errors         MOVE_TO_LIT_NOTALLOWED_NODATA
I've checked that field catalogs are done correctly.
You help is greatly appreciated!
Thanks,
Rohit.

Hi All,
      The dump occurs at some code which i've not created.
Also, i've checked that all the parameters are properly passed to the function.
Dump occurs in (Include-)Programms "LSLVC_FULLSCREENF02".
source code extract:
  656   if not gt_grid-s_layout-box_fieldname is initial.                    
  657     call method gt_grid-grid->get_selected_rows                        
  658       importing                                                        
  659         et_index_rows = lt_rows.                                       
  660     delete lt_rows where rowtype ne ' '.                               
  661     sort lt_rows by index.                                             
  662     assign component gt_grid-s_layout-box_fieldname                    
  663                                              of structure t_outtab     
  664     to <l_box>.                                                        
  665     data: l_sel_lines type i.                                          
  666     data: l_tab_lines type i.                                          
  667     data: ls_rows type lvc_s_row.                                      
  668 * check                                                                
  669     if r_ucomm = '&SAL' or r_ucomm = '&ALL'.                           
  670       l_ucomm = r_ucomm.                                               
  671     else.                                                              
  672       describe table lt_rows lines l_sel_lines.                        
  673       describe table t_outtab lines l_tab_lines.                       
  674       if l_sel_lines = 0.                                              
  675         l_ucomm = '&SAL'.                                              
  676       endif.                                                           
  677       if l_sel_lines = l_tab_lines.                                    
  678         l_ucomm = '&ALL'.                                              
  679       endif.                                                           
  680     endif.                                                             
  681 * set/unset <box> of all items                                         
  682     if l_ucomm eq '&SAL' or l_ucomm eq '&ALL'.                         
  683       if l_ucomm eq '&SAL'.                                            
  684         loop at t_outtab.                                              
  685           l_tabix = l_tabix + 1.                                       
>>>>>           <l_box> = ' '.                                               
  687           modify t_outtab index l_tabix.                               
  688         endloop.                                                  -

Similar Messages

  • Editable Alv: ERROR in er_data_changed- display_protocol

    I have one fields "Emp_dept" in the record of the ALV Grid which can be edited, but when I edit this field  with  enter  event it will generate a error in display protocal, I want it to save in database , I debuged the program it reflect the in internal table but failed to reflect the in change in data base, as i Just started dveelopment in abap programing i searched the whole web for this problem but couldnot sucessfull please help me in this regarrd
    Here is my code:
    I am using module pool programing and I am following abap slandered program Bcalv_edit_03.
    FUNCTION-POOL Z_EMPLOYEE.                   "MESSAGE-ID ..
    * INCLUDE LZ_EMPLOYEED...                    " Local class definition
    TABLES:ZEMPLOYEE, ZEMP_COMM.
    DATA: zemploye TYPE TABLE OF zemployee  WITH HEADER LINE,
      WA TYPE zemployee .
    DATA: ZEMP_COM TYPE TABLE OF ZEMP_COMM   WITH HEADER LINE.
      DATA : WACOMM TYPE ZEMP_COMM.
    DATA: ZEMP_ADR TYPE TABLE OF ZEMP_ADRESS  WITH HEADER LINE,
    WA_ADR TYPE ZEMP_ADRESS.
    DATA: ZEMP_EDU TYPE TABLE OF ZEMP_EDUCATION1  WITH HEADER LINE,
    WA_EDU1 TYPE ZEMP_EDUCATION1.
    DATA EMPD TYPE ZEMP_ID.
    *data empd LIKE zemployee-emp_id.
      data: O_DOCKING TYPE REF TO CL_GUI_DOCKING_CONTAINER,
    O_GRID TYPE REF TO CL_GUI_ALV_GRID,"Grid
       i_selected_rows TYPE lvc_t_row,"Selected Rows
            w_selected_rows TYPE lvc_s_row,
       WA_LAYOUT TYPE LVC_S_LAYO,
    class lcl_event_receiver definition deferred.
    data: g_event_receiver type ref to lcl_event_receiver.
    types:BEGIN OF i_zemployee ,
        emp_id type zemployee-emp_id,
       emp_name type zemployee-emp_name,
       D_O_BIRTH TYPE ZEMPLOYEE-D_O_BIRTH,
       D_o_jOIN TYPE ZEMPLOYEE-D_o_jOIN,
       EMP_DEPT TYPE ZEMPLOYEE-EMP_DEPT,
       EMP_NO type ZEMP_COMM-EMP_NO,
       eemp_id type zemp_comm-emp_id,
       EMP_ADRESS TYPE ZEMP_ADRESS-EMP_ADRESS,
       EMP_RES_ADDR TYPE ZEMP_ADRESS-EMP_RES_ADDR,
       EMP_EDU1 TYPE ZEMP_EDUCATION1-EMP_EDU1,
      END OF i_zemployee.
       Data:
         i_tb type i_zemployee,
         emp_itb like table of i_tb.
         data:t_fcat TYPE lvc_t_fcat,
         wa_fcat TYPE lvc_s_fcat.
    DATA:
       screen  TYPE n LENGTH 4 VALUE 0100,
       screen1  TYPE n LENGTH 4 VALUE 0110,
       screen2  TYPE n LENGTH 4 VALUE 0120,
       screen3  TYPE n LENGTH 4 VALUE 0130,
        ok_code LIKE sy-ucomm.
       FORM FREE_OBJECTS .
       CALL METHOD O_GRID->FREE
         EXCEPTIONS
           CNTL_ERROR        = 1
           CNTL_SYSTEM_ERROR = 2
           OTHERS            = 3.
       IF SY-SUBRC <> 0.
         MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
       ENDIF.
       FREE O_GRID.
       CALL METHOD O_DOCKING->FREE
         EXCEPTIONS
           CNTL_ERROR        = 1
           CNTL_SYSTEM_ERROR = 2
           OTHERS            = 3.
       IF SY-SUBRC <> 0.
         MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
       ENDIF.
      FREE O_DOCKING.
    ENDFORM.
      form sol using emp_idd .
        data l_num(5) type n.
        l_num = emp_idd.
    * CALL FUNCTION 'NUMBER_GET_NEXT'
    *         EXPORTING
    *              nr_range_nr             = '01'
    *              object                  = 'ZEMP_AUTO'
    *         IMPORTING
    *              number                  = l_num
    *         EXCEPTIONS
    *              interval_not_found      = 1
    *              number_range_not_intern = 2
    *              object_not_found        = 3
    *              quantity_is_0           = 4
    *              quantity_is_not_1       = 5
    *              interval_overflow       = 6
    *              buffer_overflow         = 7
    *              OTHERS                  = 8.
        l_num = l_num + 1.
    EMP_IDD = L_NUM.
    endform.
      class lcl_event_receiver definition.
      public section.
         methods:
           handle_data_changed
              for event data_changed of cl_gui_alv_grid
                  importing er_data_changed.
      private section.
    * This flag is set if any error occured in one of the
    * following methods:
         data: error_in_data type c.
    * Methods to modularize event handler method HANDLE_DATA_CHANGED:
         methods: check_planetype
          importing
             ps_good_planetype type lvc_s_modi
             pr_data_changed type ref to cl_alv_changed_data_protocol.
    *    methods: ch_new_plane_v_new_seatsocc
    *           importing
    *              psg_plane type lvc_s_modi
    *              psg_socc type lvc_s_modi
    *              ps_saplane type saplane
    *              pr_data_changed type ref to cl_alv_changed_data_protocol.
    *    methods: ch_new_plane_v_old_seatsocc
    *           importing
    *              psg_plane type lvc_s_modi
    *              ps_saplane type saplane
    *              pr_data_changed type ref to cl_alv_changed_data_protocol.
    *    methods: check_seatsocc
    *           importing
    *              ps_good type lvc_s_modi
    *              pr_data_changed type ref to cl_alv_changed_data_protocol.
    * This is a suggestion how you could comment your checks in each method:
    * CHECK: fieldname(old/new value) !<comp> fieldname(old/new value)
    * IF NOT: (What to tell the user is wrong about the input)
    * Remarks:
    *  fieldname:       fieldname of table for the corresponding column
    *  (old/new value): ckeck with value of GT_OUTTAB or MT_GOOD_CELLS.
    *  !<comp>        : the value is valid if the condition <comp> holds.
    * Example:
    *  CHECK seatsocc(new) !>= seatsmax(old)
    *  IF NOT: There are not enough number of seats according to this
    *          planetype.
    endclass.
    class lcl_event_receiver implementation.
       method handle_data_changed.
         data: ls_good type lvc_s_modi.
        error_in_data = space.
         loop at er_data_changed->mt_good_cells into ls_good.
           case ls_good-fieldname.
    * check if column PLANETYPE of this row was changed
             when 'EMP_DEPT'.
               call method check_planetype
                      exporting
                         ps_good_planetype = ls_good
                         pr_data_changed   = er_data_changed.
          endcase.
         endloop.
    *§7.Display application log if an error has occured.
         if error_in_data eq 'X'.
            call method er_data_changed->display_protocol.  ( Error line)        <-------------------------------
         endif.
       endmethod.
       method check_planetype.
         data: l_planetype type zemp_dept,
               ls_saplane type zemployee,
               ls_good_seatsocc type lvc_s_modi.
         call method pr_data_changed->get_cell_value
               exporting i_row_id =    ps_good_planetype-row_id
                         i_fieldname = ps_good_planetype-fieldname
               importing e_value     = l_planetype.
    MODIFY ZEMPLOYEE FROM TABLE emp_itb.
         select single * from zemployee into ls_saplane where
                                          emp_dept = l_planetype.
               if sy-subrc ne 0.
           call method pr_data_changed->add_protocol_entry
            exporting
               i_msgid = '0K' i_msgno = '000'  i_msgty = 'E'
               i_msgv1 = text-m03           "Flugzeugtyp
               i_msgv2 = l_planetype
               i_msgv3 = text-m05           "exitstiert nicht
               i_fieldname = ps_good_planetype-fieldname
               i_row_id = ps_good_planetype-row_id.
           error_in_data = 'X'.
           exit. "plane does not exit, so we're finished here!
         endif.
    endmethod.
    endclass.
    **********************************************Module output****************
    MODULE STATUS_0120 OUTPUT.
      SET PF-STATUS 'START'.
      SET TITLEBAR 'STARTT'.
    IF O_DOCKING IS INITIAL.
    *   Creating Docking Container
        data: lt_exclude type ui_functions.
           CREATE OBJECT O_DOCKING
                  EXPORTING
                    RATIO                       = '95'.
           IF SY-SUBRC EQ 0.
    *   Creating Grid
             CREATE OBJECT O_GRID
                 EXPORTING
                    I_PARENT          = O_DOCKING.
           ENDIF.
    endif.
    * Filling the fieldcatalog table
    *    CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
    *      EXPORTING
    *        I_STRUCTURE_NAME       = 'i_tb'
    *      CHANGING
    *        CT_FIELDCAT            = t_fcat
    *      EXCEPTIONS
    *        INCONSISTENT_INTERFACE = 1
    *        PROGRAM_ERROR          = 2
    *        OTHERS                 = 3.
       WA_LAYOUT-GRID_TITLE = 'EMPLOYEE TABLE DETAILS'.
       WA_LAYOUT-ZEBRA = 'X'.
       WA_LAYOUT-EDIT = 'X'.
    IF T_FCAT is  initial.
    *  wa_fcat-fieldname = 'EMP_ID'.
    *  wa_fcat-ref_table = 'ZEMPLOYEE'.
    *  wa_fcat-ref_field = 'EMP_ID'.
    *  wa_fcat-col_pos = 2.
    *  APPEND wa_fcat TO t_fcat.
    *  CLEAR wa_fcat.
       wa_fcat-fieldname = 'EMP_NAME'.
       wa_fcat-ref_table = 'ZEMPLOYEE'.
       wa_fcat-ref_field = 'EMP_NAME'.
       wa_fcat-col_pos = 3.
       APPEND wa_fcat TO t_fcat.
       CLEAR wa_fcat.
        wa_fcat-fieldname = 'EMP_DEPT'.
       wa_fcat-ref_table = 'ZEMPLOYEE'.
       wa_fcat-ref_field = 'EMP_DEPT'.
       wa_fcat-col_pos = 4.
       APPEND wa_fcat TO t_fcat.
       CLEAR wa_fcat.
          wa_fcat-fieldname = 'D_O_BIRTH'.
       wa_fcat-ref_table = 'ZEMPLOYEE'.
       wa_fcat-ref_field = 'D_O_BIRTH'.
       wa_fcat-col_pos = 5.
       APPEND wa_fcat TO t_fcat.
       CLEAR wa_fcat.
       wa_fcat-fieldname = 'D_O_JOIN'.
      wa_fcat-ref_table = 'ZEMPLOYEE'.
      wa_fcat-ref_field = 'D_O_JOIN'.
      wa_fcat-col_pos = 6.
       APPEND wa_fcat TO t_fcat.
       CLEAR wa_fcat.
    wa_fcat-fieldname = 'EMP_NO'.
      wa_fcat-ref_table = 'ZEMP_COMM'.
      wa_fcat-ref_field = 'EMP_NO'.
      wa_fcat-col_pos = 7.
       APPEND wa_fcat TO t_fcat.
       CLEAR wa_fcat.
       wa_fcat-fieldname = 'EMP_ADRESS'.
       wa_fcat-ref_table = 'ZEMP_ADRESS'.
       wa_fcat-ref_field = 'EMP_ADRESS'.
       wa_fcat-col_pos = 7.
       APPEND wa_fcat TO t_fcat.
       CLEAR wa_fcat.
       wa_fcat-fieldname = 'EMP_RES_ADDR'.
       wa_fcat-ref_table = 'ZEMP_ADRESS'.
       wa_fcat-ref_field = 'EMP_RES_ADDR'.
       wa_fcat-col_pos = 8.
       APPEND wa_fcat TO t_fcat.
       CLEAR wa_fcat.
       wa_fcat-fieldname = 'EMP_EDU1'.
       wa_fcat-ref_table = 'ZEMP_EDUCATION1'.
       wa_fcat-ref_field = 'EMP_EDU1'.
       wa_fcat-col_pos = 9.
       APPEND wa_fcat TO t_fcat.
       CLEAR wa_fcat.
    ENDIF.
    * CALL METHOD o_grid->register_edit_event
    *    EXPORTING  i_event_id = cl_gui_alv_grid=>mc_evt_modified.
    *    W_VARIANT-REPORT = SY-REPID.
    * Displaying the output
         CALL METHOD O_GRID->SET_TABLE_FOR_FIRST_DISPLAY
           EXPORTING
    *       IS_VARIANT                    = VARIANT
             I_SAVE                        = 'A'
            I_STRUCTURE_NAME       = 'i_tb'
             IS_LAYOUT                     = WA_LAYOUT
             it_toolbar_excluding  = lt_exclude
           CHANGING
           IT_OUTTAB                     =  emp_itb
             IT_FIELDCATALOG               = t_fcat
           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.
    *call method cl_gui_control=>set_focus exporting control = O_GRID.
    *      call method cl_gui_cfw=>flush.
           CALL METHOD o_grid->set_ready_for_input
          EXPORTING
            I_READY_FOR_INPUT = 1.
      CALL METHOD O_GRID->REGISTER_EDIT_EVENT
         EXPORTING
           I_EVENT_ID = CL_GUI_ALV_GRID=>mc_evt_enter.
    *    EXCEPTIONS
    *      ERROR      = 1
    *      OTHERS     = 2.
    **** UPDATE zemployee FROM TABLE emp_itb.
      create object g_event_receiver.
       set handler g_event_receiver->handle_data_changed for o_grid.
    *  IF SY-SUBRC <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    *  ENDIF.
    ENDMODULE.                 " STATUS_0120  OUTPUT
    *&      Module  USER_COMMAND_0120  INPUT
    *       text
    MODULE USER_COMMAND_0120 INPUT.
    DATA LV_UCOMM TYPE SY-UCOMM.
    *  data: ok_code like sy-ucomm .
      LV_UCOMM = SY-UCOMM.
       CASE LV_UCOMM.
      WHEN 'CANCEL' OR 'EXIT'.
           PERFORM FREE_OBJECTS.
           LEAVE PROGRAM.
         WHEN 'BACK'.
            CALL METHOD o_grid->set_frontend_fieldcatalog
             EXPORTING
               it_fieldcatalog = t_fcat[].
            if o_grid is not initial.
        CALL METHOD o_grid->refresh_table_display
           EXCEPTIONS
             finished = 1
             OTHERS   = 2.
    endif.
           PERFORM FREE_OBJECTS.
           CALL SCREEN 110.
    *      SET SCREEN '0'.
    *      LEAVE SCREEN.
       ENDCASE.
    ENDMODULE.   
    Please help me to solve this porblem..

    Hi suhas,
    my issue is not the lack of data .....
    my issue is about the error handling in data_changed event in alv oops application....am able to display the error log using display_protocol method..,.. but after displaying the error log am still able to save the changes which should not happen....the thing is we should not be able to save the changes...... am having the same issue as the following thread
    Re: CL_ALV_CHANGED_DATA_PROTOCOL - Protocol Popup is not modal
    if u still require any clarifications...pls let me know ur mail-id ill post my code to u ..
    thanks
    suresh

  • ALV Error: Fieldcatalog not found...

    Hello Experts,
    I am currently creating a new report that uses object oriented ALV with
    custom control. But when I run my program it always gives me that there is no fieldcatalog
    found. I will paste my code below so you can see. Hope you can help me out here guys.
    Thank you and take care!
    *=====================================================================
    * Program Name : ZSD_ORDERSTAGE
    * Author       : Aris Hidalgo
    * Date Created : May 4, 2007
    * Description  : Display sales orders for a given customer on a given
    *                date range
    *=====================================================================
    REPORT  zsd_orderstage
            NO STANDARD PAGE HEADING.
    * Data Dictionary Table/s                      *
    TABLES: vbak.
    * Global Structure/s                           *
    TYPES: BEGIN OF t_vbak,
              vbeln TYPE vbak-vbeln,
              posnr TYPE vbap-posnr,
              erdat TYPE vbak-erdat,
              ernam TYPE vbak-ernam,
              auart TYPE vbak-auart,
              kunnr TYPE vbak-kunnr,
              vkgrp TYPE vbak-vkgrp,
             END OF t_vbak.
    TYPES: BEGIN OF t_vbfa,
            vbelv   TYPE vbfa-vbelv,
            posnv   TYPE vbfa-posnv,
            vbtyp_n TYPE vbfa-vbtyp_n,
            vbtyp_v TYPE vbfa-vbtyp_v,
            vbeln   TYPE vbfa-vbeln,
           END OF t_vbfa.
    TYPES: BEGIN OF t_likp,
            vgbel TYPE lips-vgbel,
            vgpos TYPE lips-vgpos,
            vbeln TYPE likp-vbeln,
            posnr TYPE lips-posnr,
            kunnr TYPE likp-kunnr,
           END OF t_likp.
    TYPES: BEGIN OF t_vbrk,
            aubel TYPE vbrp-aubel,
            aupos TYPE vbrp-aupos,
            vbeln TYPE vbrk-vbeln,
           END OF t_vbrk.
    TYPES: BEGIN OF t_output,
            salesorder    TYPE vbak-vbeln,
            salesitem     TYPE vbap-posnr,
            salesgroup    TYPE vbak-vkgrp,
            custcode      TYPE vbak-kunnr,
            shipto        TYPE likp-kunnr,
            creation_date TYPE vbak-erdat,
            created_by    TYPE vbak-ernam,
            delorder      TYPE likp-vbeln,
            invnumber     TYPE vbrk-vbeln,
           END OF t_output.
    * Global Internal Table/s                      *
    DATA: gt_vbak   TYPE STANDARD TABLE OF t_vbak,
          gt_vbfa   TYPE STANDARD TABLE OF t_vbfa,
          gt_likp   TYPE STANDARD TABLE OF t_likp,
          gt_vbrk   TYPE STANDARD TABLE OF t_vbrk,
          gt_output TYPE STANDARD TABLE OF t_output.
    * SELECTION-SCREEN                             *
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    PARAMETERS:     p_kunnr TYPE vbak-kunnr OBLIGATORY.
    SELECT-OPTIONS: s_vkgrp FOR vbak-vkgrp,
                    s_auart FOR vbak-auart,
                    s_erdat FOR vbak-erdat  OBLIGATORY,
                    s_ernam FOR vbak-ernam.
    SELECTION-SCREEN END OF BLOCK b1.
    CLASS lcl_event_receiver DEFINITION DEFERRED.
    * Data Declaration/s                           *
    DATA: ok_code             TYPE sy-ucomm,
          save_ok             TYPE sy-ucomm,
          g_max               TYPE i VALUE 100,
          g_repid             TYPE sy-repid,
          gs_layout           TYPE lvc_s_layo,
          cont_for_flights    TYPE scrfname VALUE 'BCALV_GRID_02_100',
          grid1               TYPE REF TO cl_gui_alv_grid,
          custom_container    TYPE REF TO cl_gui_custom_container,
          grid2               TYPE REF TO cl_gui_alv_grid,
    * reference to dialogbox container.
          dialogbox_container TYPE REF TO cl_gui_dialogbox_container,
          event_receiver      TYPE REF TO lcl_event_receiver.
    *       CLASS lcl_event_receiver DEFINITION
    CLASS lcl_event_receiver DEFINITION.
      PUBLIC SECTION.
        METHODS:
        handle_double_click
            FOR EVENT double_click OF cl_gui_alv_grid
                IMPORTING e_row e_column,
        handle_close
            FOR EVENT close OF cl_gui_dialogbox_container
                IMPORTING sender,
        create_detail_list.
      PRIVATE SECTION.
        DATA: dialogbox_status TYPE c.  "'X': does exist, SPACE: does not ex.
    ENDCLASS.                    "lcl_event_receiver DEFINITION
    *       CLASS lcl_event_receiver IMPLEMENTATION
    CLASS lcl_event_receiver IMPLEMENTATION.
    * §3.At doubleclick(1): The event DOUBLE_CLICK provides
    *    parameters of the clicked row and column.
    *    Use row parameter to select a line of the
    *    corresponding internal table.
      METHOD handle_double_click.
    *    DATA: ls_sflight LIKE LINE OF gt_sflight.
    * read selected row from internal table gt_sflight
    *    READ TABLE gt_sflight INDEX e_row-index INTO ls_sflight.
    * §4.At Doubleclick(2): Select booking data
    *    PERFORM select_table_sbook USING ls_sflight
    *                               CHANGING gt_sbook.
    * §5.At doubleclick(3): Create dialogbox to show detail list
    *   (if not already existent)
        IF dialogbox_status IS INITIAL.
          dialogbox_status = 'X'.
    *      PERFORM create_detail_list.
          CALL METHOD me->create_detail_list.
        ELSE.
          CALL METHOD dialogbox_container->set_visible
            EXPORTING
              visible = 'X'.
          CALL METHOD grid2->refresh_table_display.
        ENDIF.
      ENDMETHOD.                    "handle_double_click
      METHOD handle_close.
    * §6.Handle the CLOSE-button of the dialogbox
    * set dialogbox invisible
    * (the dialogbox is destroyed outomatically when the user
    * switches to another dynpro).
        CALL METHOD sender->set_visible
          EXPORTING
            visible = space.
    * In this example closing the dialogbox leads
    * to make it invisible. It is also conceivable to destroy it
    * and recreate it if the user doubleclicks a line again.
    * Displaying a great amount of data has a greater impact on performance.
      ENDMETHOD.                    "handle_close
      METHOD create_detail_list.
    * create dialogbox container as dynpro-instance
    * When the user switches to another screen, it is
    * destroyed by lifetime mangagement of CFW
        CREATE OBJECT dialogbox_container
            EXPORTING
              top = 150
              left = 150
              lifetime = cntl_lifetime_dynpro
              caption = 'Sales Orders'(200)
              width = 800
              height = 200.
        CREATE OBJECT grid2
            EXPORTING i_parent = dialogbox_container.
    * Register ABAP OO event 'CLOSE'. It is not necessary to register this
    * event at the frontend (this is done during creation).
        SET HANDLER event_receiver->handle_close FOR dialogbox_container.
    * display data
        gs_layout-grid_title = space.
        CALL METHOD grid2->set_table_for_first_display
          EXPORTING
            i_structure_name = 'T_OUTPUT'
            is_layout        = gs_layout
          CHANGING
            it_outtab        = gt_output.
        CALL METHOD cl_gui_control=>set_focus
          EXPORTING
            control = grid2.
      ENDMETHOD.                    "create_detail_list
    ENDCLASS.                    "lcl_event_receiver IMPLEMENTATION
    *       CLASS lcl_get_so DEFINITION
    CLASS lcl_get_so DEFINITION.
      PUBLIC SECTION.
        METHODS: get_sales_orders
                    EXPORTING
                       ex_vbak LIKE gt_vbak.
    ENDCLASS.                    "lcl_get_so DEFINITION
    *       CLASS lcl_get_so IMPLEMENTATION
    CLASS lcl_get_so IMPLEMENTATION.
      METHOD get_sales_orders.
        SELECT vbak~vbeln vbap~posnr vbak~erdat
               vbak~ernam vbak~auart vbak~kunnr
               vbak~vkgrp
          FROM vbak
          INNER JOIN vbap
          ON vbak~vbeln = vbap~vbeln
          INTO TABLE gt_vbak
         WHERE vbak~erdat IN s_erdat
           AND vbak~ernam IN s_ernam
           AND vbak~auart IN s_auart
           AND vbak~vkgrp IN s_vkgrp
           AND vbak~kunnr = p_kunnr.
        IF NOT gt_vbak[] IS INITIAL.
          ex_vbak[] = gt_vbak[].
        ENDIF.
      ENDMETHOD.                    "get_sales_orders
    ENDCLASS.                    "lcl_get_so IMPLEMENTATION
    *       CLASS lcl_get_do DEFINITION
    CLASS lcl_get_do DEFINITION.
      PUBLIC SECTION.
        METHODS: get_delivery_orders
                    IMPORTING
                       value(im_vbak) LIKE gt_vbak
                    EXPORTING
                       value(ex_likp) LIKE gt_likp.
    ENDCLASS.                    "lcl_get_do DEFINITION
    *       CLASS lcl_get_do IMPLEMENTATION
    CLASS lcl_get_do IMPLEMENTATION.
      METHOD get_delivery_orders.
        IF NOT im_vbak[] IS INITIAL.
          SELECT lips~vgbel lips~vgpos
                 likp~vbeln lips~posnr
                 likp~kunnr
            FROM likp
           INNER JOIN lips
              ON likp~vbeln = lips~vbeln
            INTO TABLE gt_likp
             FOR ALL ENTRIES IN im_vbak
           WHERE vgbel = im_vbak-vbeln
             AND vgpos = im_vbak-posnr.
        ENDIF.
        IF NOT gt_likp[] IS INITIAL.
          ex_likp[] = gt_likp[].
        ENDIF.
      ENDMETHOD.                    "get_delivery_orders
    ENDCLASS.                    "lcl_get_do IMPLEMENTATION
    *       CLASS lcl_get_bd DEFINITION
    CLASS lcl_get_bd DEFINITION.
      PUBLIC SECTION.
        METHODS: get_billing_documents
                   IMPORTING
                     value(im_vbak) LIKE gt_vbak
                   EXPORTING
                     value(ex_vbrk) LIKE gt_vbrk.
    ENDCLASS.                    "lcl_get_bd DEFINITION
    *       CLASS lcl_get_bd IMPLEMENTATION
    CLASS lcl_get_bd IMPLEMENTATION.
      METHOD get_billing_documents.
        IF NOT im_vbak[] IS INITIAL.
          SELECT vbrp~aubel vbrp~aupos vbrk~vbeln
            FROM vbrk
           INNER JOIN vbrp
              ON vbrk~vbeln = vbrp~vbeln
            INTO TABLE gt_vbrk
             FOR ALL ENTRIES IN im_vbak
           WHERE aubel = im_vbak-vbeln
             AND aupos = im_vbak-posnr.
        ENDIF.
        IF NOT gt_vbrk[] IS INITIAL.
          ex_vbrk[] = gt_vbrk[].
        ENDIF.
      ENDMETHOD.                    "get_billing_documents
    ENDCLASS.                    "lcl_get_bd IMPLEMENTATION
    *       CLASS lcl_combine_data DEFINITION
    CLASS lcl_combine_data DEFINITION.
      PUBLIC SECTION.
        METHODS: combine_data
                   IMPORTING
                     value(im_vbak) LIKE gt_vbak
                     value(im_likp) LIKE gt_likp
                     value(im_vbrk) LIKE gt_vbrk
                   EXPORTING
                     value(ex_output) LIKE gt_output.
    ENDCLASS.                    "lcl_combine_data DEFINITION
    *       CLASS lcl_combine_data IMPLEMENTATION
    CLASS lcl_combine_data IMPLEMENTATION.
      METHOD combine_data.
        FIELD-SYMBOLS: <fs_vbak> LIKE LINE OF im_vbak,
                       <fs_likp> LIKE LINE OF im_likp,
                       <fs_vbrk> LIKE LINE OF im_vbrk.
        DATA: wa_output LIKE LINE OF ex_output.
        SORT im_vbak ASCENDING BY: vbeln posnr.
        SORT im_likp ASCENDING BY: vgbel vgpos.
        SORT im_vbrk ASCENDING BY: aubel aupos.
        LOOP AT im_vbak ASSIGNING <fs_vbak>.
          READ TABLE im_likp ASSIGNING <fs_likp>
                             WITH KEY vgbel = <fs_vbak>-vbeln
                                      vgpos = <fs_vbak>-posnr
                                      BINARY SEARCH.
          IF sy-subrc = 0.
            MOVE: <fs_vbak>-vbeln TO wa_output-salesorder,
                  <fs_vbak>-posnr TO wa_output-salesitem,
                  <fs_vbak>-vkgrp TO wa_output-salesgroup,
                  <fs_vbak>-kunnr TO wa_output-custcode,
                  <fs_likp>-kunnr TO wa_output-shipto,
                  <fs_vbak>-erdat TO wa_output-creation_date,
                  <fs_vbak>-ernam TO wa_output-created_by,
                  <fs_likp>-vbeln TO wa_output-delorder.
          ENDIF.
          READ TABLE im_vbrk ASSIGNING <fs_vbrk>
                             WITH KEY aubel = <fs_vbak>-vbeln
                                      aupos = <fs_vbak>-posnr
                                      BINARY SEARCH.
          IF sy-subrc = 0.
            MOVE <fs_vbrk>-vbeln TO wa_output-invnumber.
          ENDIF.
          APPEND wa_output TO ex_output.
          CLEAR wa_output.
        ENDLOOP.
        DELETE ex_output WHERE salesorder IS INITIAL.
      ENDMETHOD.                    "combine_data
    ENDCLASS.                    "lcl_combine_data IMPLEMENTATION
    * START-OF-SELECTION                           *
    START-OF-SELECTION.
      DATA: lt_vbak_dum    LIKE gt_vbak,
            lt_likp_dum    LIKE gt_likp,
            lt_vbrk_dum    LIKE gt_vbrk.
      DATA: o_get_so         TYPE REF TO lcl_get_so,
            o_get_do         TYPE REF TO lcl_get_do,
            o_get_bd         TYPE REF TO lcl_get_bd,
            o_combine_data   TYPE REF TO lcl_combine_data.
      CREATE OBJECT: o_get_so,
                     o_get_do,
                     o_get_bd,
                     o_combine_data.
    END-OF-SELECTION.
      CALL SCREEN 100.
    *&      Module  STATUS_0100  OUTPUT
    *       text
    MODULE status_0100 OUTPUT.
      SET PF-STATUS 'MAIN100'.
    *  SET TITLEBAR 'xxx'.
      g_repid = sy-repid.
      IF custom_container IS INITIAL.
        CALL METHOD o_get_so->get_sales_orders
          IMPORTING
            ex_vbak = lt_vbak_dum.
        CALL METHOD o_get_do->get_delivery_orders
          EXPORTING
            im_vbak = lt_vbak_dum
          IMPORTING
            ex_likp = lt_likp_dum.
        CALL METHOD o_get_bd->get_billing_documents
          EXPORTING
            im_vbak = lt_vbak_dum
          IMPORTING
            ex_vbrk = lt_vbrk_dum.
        CALL METHOD o_combine_data->combine_data
          EXPORTING
            im_vbak   = lt_vbak_dum
            im_likp   = lt_likp_dum
            im_vbrk   = lt_vbrk_dum
          IMPORTING
            ex_output = gt_output.
    *Create a custom container control for our ALV Control
        CREATE OBJECT custom_container
            EXPORTING
                container_name = cont_for_flights
            EXCEPTIONS
                cntl_error = 1
                cntl_system_error = 2
                create_error = 3
                lifetime_error = 4
                lifetime_dynpro_dynpro_link = 5.
        IF sy-subrc NE 0.
    *Add your handling, for example
          CALL FUNCTION 'POPUP_TO_INFORM'
            EXPORTING
              titel = g_repid
              txt2  = sy-subrc
              txt1  = 'The control could not be created'(510).
        ENDIF.
    *Create an instance of alv control
        CREATE OBJECT grid1
             EXPORTING i_parent = custom_container.
    *Set a titlebar for the grid control
        gs_layout-grid_title = 'List of Sales Orders'(100).
        CALL METHOD grid1->set_table_for_first_display
          EXPORTING
    *        i_structure_name = 'T_OUTPUT'
            is_layout        = gs_layout
          CHANGING
            it_outtab        = gt_output.
    *Create Object to receive events and link them to handler methods.
    *When the ALV Control raises the event for the specified instance
    *the corresponding method is automatically called.
        CREATE OBJECT event_receiver.
        SET HANDLER event_receiver->handle_double_click FOR grid1.
      ENDIF.
      CALL METHOD cl_gui_control=>set_focus
        EXPORTING
          control = grid1.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    *&      Module  USER_COMMAND_0100  INPUT
    *       text
    MODULE user_command_0100 INPUT.
      save_ok = ok_code.
      CASE save_ok.
        WHEN 'BACK'.
          CALL METHOD custom_container->free.
          CALL METHOD cl_gui_cfw=>flush.
          IF sy-subrc <> 0.
    *Add your handling, for example
            CALL FUNCTION 'POPUP_TO_INFORM'
              EXPORTING
                titel = g_repid
                txt2  = sy-subrc
                txt1  = 'Error in FLush'(500).
          ENDIF.
          LEAVE PROGRAM.
        WHEN 'EXIT'.
          CALL METHOD custom_container->free.
          CALL METHOD cl_gui_cfw=>flush.
          IF sy-subrc <> 0.
    *Add your handling, for example
            CALL FUNCTION 'POPUP_TO_INFORM'
              EXPORTING
                titel = g_repid
                txt2  = sy-subrc
                txt1  = 'Error in FLush'(500).
          ENDIF.
          LEAVE PROGRAM.
        WHEN 'CANCEL'.
          CALL METHOD custom_container->free.
          CALL METHOD cl_gui_cfw=>flush.
          IF sy-subrc <> 0.
    *Add your handling, for example
            CALL FUNCTION 'POPUP_TO_INFORM'
              EXPORTING
                titel = g_repid
                txt2  = sy-subrc
                txt1  = 'Error in FLush'(500).
          ENDIF.
          LEAVE PROGRAM.
      ENDCASE.
      CLEAR save_ok.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT

    Hi Viraylab,
                       You need to craete a fieldcat to print data in ALV and pass this table to the method written below :
    CALL METHOD grid1->set_table_for_first_display
          EXPORTING
           i_structure_name = 'T_OUTPUT'
            is_layout        = gs_layout
          CHANGING
            it_outtab        = gt_output.
           i_fieldcat        = gt_fieldcat
    u can bulid afield catlog table like this :
    form FIELDCAT  using    p_i_fieldcat TYPE SLIS_T_FIELDCAT_ALV.
    DATA : L_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
    FOR MATERIAL NO
    CLEAR L_FIELDCAT.
    L_FIELDCAT-COL_POS = '1'.
    L_FIELDCAT-FIELDNAME = 'MATNR'.
    L_FIELDCAT-TABNAME = 'IT_MATSTOCK'.
    L_FIELDCAT-seltext_l   = 'MATERIAL NO'.                     " LONG TEXT FOR HEADER.
    L_FIELDCAT-seltext_m   = 'MAT NO'.                     " MEDIUM TEXT FOR HEADER.
    L_FIELDCAT-seltext_s   = 'MATNO'.                     " SHORT TEXT FOR HEADER.
    L_FIELDCAT-EMPHASIZE = 'C410'.                           " COLOR OF THIS COLUMN.
    L_FIELDCAT-OUTPUTLEN = '20'.
    APPEND L_FIELDCAT TO P_I_FIELDCAT.
    FOR MATERIAL TYPE
    CLEAR L_FIELDCAT.
    L_FIELDCAT-COL_POS = '2'.
    L_FIELDCAT-FIELDNAME = 'MTART'.
    L_FIELDCAT-TABNAME = 'IT_MATSTOCK'.
    L_FIELDCAT-seltext_l   = 'MATERIAL TYPE'.                     " LONG TEXT FOR HEADER.
    L_FIELDCAT-seltext_m   = 'MAT TYPE'.                     " MEDIUM TEXT FOR HEADER.
    L_FIELDCAT-seltext_s   = 'MAT TYP'.                     " SHORT TEXT FOR HEADER.
    L_FIELDCAT-EMPHASIZE = 'C510'.                           " COLOR OF THIS COLUMN.
    L_FIELDCAT-OUTPUTLEN = '6'.
    APPEND L_FIELDCAT TO P_I_FIELDCAT.
    FOR MATERIAL DESCRIPTION
    CLEAR L_FIELDCAT.
    L_FIELDCAT-COL_POS = '3'.
    L_FIELDCAT-FIELDNAME = 'MAKTX'.
    L_FIELDCAT-TABNAME = 'IT_MATSTOCK'.
    L_FIELDCAT-seltext_l   = 'MAT DESCRIP'.                     " LONG TEXT FOR HEADER.
    L_FIELDCAT-seltext_m   = 'M DESCRIP'.                     " MEDIUM TEXT FOR HEADER.
    L_FIELDCAT-seltext_s   = 'MDESCRIP'.                     " SHORT TEXT FOR HEADER.
    L_FIELDCAT-EMPHASIZE = 'C310'.                           " COLOR OF THIS COLUMN.
    L_FIELDCAT-OUTPUTLEN = '40'.
    APPEND L_FIELDCAT TO P_I_FIELDCAT.
    Reward points if helpful.
    Regards,
    Hemant

  • ALV ERROR in Function Module Fieldcatlog Merge .

    Hi
    I have added 2 more fileds in internral table . this is alv report there is no syntax error .
    i have user function module
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
    i_program_name = w_repid
    i_internal_tabname = 'T_BSIK'
    I_STRUCTURE_NAME =
    I_CLIENT_NEVER_DISPLAY = 'X'
    i_inclname = w_repid
    i_bypassing_buffer = 'X'
    I_BUFFER_ACTIVE =
    CHANGING
    ct_fieldcat = T_FIELDCAT
    EXCEPTIONS
    inconsistent_interface = 1
    program_error = 2
    OTHERS = 3
    IF sy-subrc 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    LOOP AT t_fieldcat INTO wa_fieldcat.
    CASE wa_fieldcat-fieldname.
    WHEN 'ZFBDT'.
    wa_fieldcat-key = ''.
    wa_fieldcat-reptext_ddic = 'Net Due Dt.'.
    wa_fieldcat-seltext_l = 'Net Due Dt.'.
    wa_fieldcat-seltext_m = 'Net Due Dt.'.
    wa_fieldcat-seltext_s = 'Net Due Dt.'.
    WHEN 'KUNNR'.
    IF p_kunnr IS INITIAL.
    wa_fieldcat-no_out = 'X'.
    ENDIF.
    WHEN 'LIFNR'.
    IF NOT p_kunnr IS INITIAL.
    wa_fieldcat-no_out = 'X'.
    ENDIF.
    WHEN 'SHKZG'.
    wa_fieldcat-no_out = 'X'.
    WHEN 'ZBD1T'.
    wa_fieldcat-no_out = 'X'.
    WHEN 'BELNR'.
    wa_fieldcat-key = 'X'.
    WHEN OTHERS.
    wa_fieldcat-key = ''.
    ENDCASE.
    MODIFY t_fieldcat FROM wa_fieldcat.
    ENDLOOP.
    I am getting error on that.
    ERROR is :
    The Internal table "\UNCTION= K_KKB_FIELDCAT_MERGE\DATA=L_ABAP_SOURCE[]" IS 72 CHARACTERS Wide
    .the program line is 79 characters wide.
    Thanks
    Chandra

    Hi Chandra,
    For ALV reports the length should not be greater than 72. (please change the same)
    You can also achive the same
    Goto SE38
    Open your program in edit
    Utilities --> Settings --> Set "Downwards-Comp Line Length" falg to X and save. (This wil auotmatically set ur code to 72 chars)
    Hope this helps,
    Nag

  • ALV Error messages

    Is there a list of what specific error messages mean that are returned from ALV function calls.  I have the following code that has data in the IMAT table but the 'REUSE_ALV_LIST_DISPLAY' returns a 1 error code. 
    REPORT  Z_ALVGRID_INTERNAL.
    tables:
    pa0001, zhr_adweather.
    types: begin of ts_imat ,
    orgeh like  PA0001-ORGEH,
    ename like PA0001-ENAME,
    pernr like PA0001-PERNR,
    wapernr  like zhr_adweather-pernr,
    wa_date_taken  like zhr_adweather-date_taken,
    wa_hours_taken  like zhr_adweather-hours_taken,
    wa_expire_date  like zhr_adweather-expire_date,
    wa_makeup_date  like zhr_adweather-makeup_date,
    wa_makeup_hours  like zhr_adweather-makeup_hours,
    wa_results  like zhr_adweather-results,
    end of ts_imat.
    Data:
          imat type table of ts_imat, " internal table
          gs_imat type ts_imat. " work area for the table
    data:
          gs_zhr_adweather type zhr_adweather,
          gs_pernr like pa0001-pernr,
          gs_orgeh like pa0001-orgeh,
          gs_ename like pa0001-ename.
    data i_repid like sy-repid.
    data i_lines like sy-tabix.
    TYPE-POOLS: SLIS.
    data int_fcat type SLIS_T_FIELDCAT_ALV.
    start-of-selection.
      select single pernr orgeh ename from pa0001
      into (gs_imat-pernr, gs_imat-orgeh, gs_imat-ename)
      where pernr = '00000053'.
      select single * from zhr_adweather
    into gs_zhr_adweather
    where pernr = '00000053'.
      if sy-subrc = 0.
        gs_imat-wapernr = gs_zhr_adweather-pernr.
        gs_imat-wa_date_taken = gs_zhr_adweather-date_taken.
       gs_imat-wa_hours_taken = gs_zhr_adweather-hours_taken.
       gs_imat-wa_expire_date = gs_zhr_adweather-expire_date.
       gs_imat-wa_makeup_date = gs_zhr_adweather-makeup_date.
       gs_imat-wa_makeup_hours = gs_zhr_adweather-makeup_hours.
       gs_imat-wa_results = gs_zhr_adweather-results.
      endif.
      append gs_imat to imat.
      clear i_lines.
      describe table imat lines i_lines.
      if i_lines lt 1.
        write: /
        'No materials found.'.
        exit.
      endif.
    end-of-selection.
      i_repid = sy-repid.
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
        EXPORTING
          I_PROGRAM_NAME         = i_repid
          I_INTERNAL_TABNAME     = 'IMAT'  "capital letters!
          I_INCLNAME             = i_repid
        CHANGING
          CT_FIELDCAT            = int_fcat
        EXCEPTIONS
          INCONSISTENT_INTERFACE = 1
          PROGRAM_ERROR          = 2
          OTHERS                 = 3.
      IF SY-SUBRC <> 0.
        write: /
        'Returncode',
        sy-subrc,
        'from FUNCTION REUSE_ALV_FIELDCATALOG_MERGE'.
      ENDIF.
       write: /
        'Returncode',
        sy-subrc,
        'from FUNCTION REUSE_ALV_FIELDCATALOG_MERGE'.
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
           EXPORTING
              I_CALLBACK_PROGRAM = 'Z_ALV_SIMPLE_EXAMPLE_WITH_ITAB'
               I_CALLBACK_PROGRAM = i_repid
                IT_FIELDCAT        = int_fcat
                I_SAVE             = 'A'
           TABLES
                T_OUTTAB           = IMAT
           EXCEPTIONS
                PROGRAM_ERROR      = 1
                OTHERS             = 2.
      IF SY-SUBRC <> 0.
        write: /
        'Returncode',
        sy-subrc,
        'from FUNCTION REUSE_ALV_LIST_DISPLAY'.
      ENDIF.

    I was able to get it working by moving values to int_fcat.
    (see FORM BUILD_FIELDCATA .)
    REPORT  Z_ESP_ALVGRID_INTERNAL.
    tables:
    pa0001, zhr_adweather.
    types: begin of ts_imat ,
    orgeh like  PA0001-ORGEH,
    ename like PA0001-ENAME,
    pernr like PA0001-PERNR,
    wapernr  like zhr_adweather-pernr,
    wa_date_taken  like zhr_adweather-date_taken,
    wa_hours_taken  like zhr_adweather-hours_taken,
    wa_expire_date  like zhr_adweather-expire_date,
    wa_makeup_date  like zhr_adweather-makeup_date,
    wa_makeup_hours  like zhr_adweather-makeup_hours,
    wa_results  like zhr_adweather-results,
    wa_outstanding  like zhr_adweather-hours_taken,
    end of ts_imat.
    Data:
          imat type standard table of ts_imat, " internal table
          gs_imat type ts_imat. " work area for the table
    data:
          gs_zhr_adweather type zhr_adweather,
          gs_pernr like pa0001-pernr,
          gs_orgeh like pa0001-orgeh,
          gs_ename like pa0001-ename.
    data i_repid like sy-repid.
    data i_lines like sy-tabix.
    TYPE-POOLS: SLIS.
    data int_fcat type SLIS_T_FIELDCAT_ALV with header line.
    start-of-selection.
    SELECT-OPTIONS:
    S_PERNR FOR gs_pernr.
      select single pernr orgeh ename from pa0001
      into (gs_imat-pernr, gs_imat-orgeh, gs_imat-ename)
      where pernr = s_PERNR.
          if sy-subrc = 0.
              endif.
      select single * from zhr_adweather
    into gs_zhr_adweather
    where pernr = s_PERNR.
      if sy-subrc = 0.
        gs_imat-wapernr = gs_zhr_adweather-pernr.
        gs_imat-wa_date_taken = gs_zhr_adweather-date_taken.
        gs_imat-wa_hours_taken = gs_zhr_adweather-hours_taken.
        gs_imat-wa_expire_date = gs_zhr_adweather-expire_date.
        gs_imat-wa_makeup_date = gs_zhr_adweather-makeup_date.
        gs_imat-wa_makeup_hours = gs_zhr_adweather-makeup_hours.
        gs_imat-wa_results = gs_zhr_adweather-results.
         gs_imat-wa_outstanding = gs_zhr_adweather-hours_taken - gs_zhr_adweather-makeup_hours.
      endif.
      append gs_imat to imat.
      clear i_lines.
      describe table imat lines i_lines.
      if i_lines lt 1.
        write: /
        'No materials found.'.
        exit.
      endif.
    end-of-selection.
    perform build_fieldcata.
      i_repid = sy-repid.
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
           EXPORTING
               I_CALLBACK_PROGRAM = 'Z_ALV_SIMPLE_EXAMPLE_WITH_ITAB'
                IT_FIELDCAT        = int_fcat[]
           TABLES
                T_OUTTAB           = IMAT
           EXCEPTIONS
                PROGRAM_ERROR      = 1
                OTHERS             = 2.
      IF SY-SUBRC <> 0.
        write: /
        'Returncode',
        sy-subrc,
        'from FUNCTION REUSE_ALV_LIST_DISPLAY'.
      ENDIF.
    *&      Form  BUILD_FIELDCATA
          text
    -->  p1        text
    <--  p2        text
    FORM BUILD_FIELDCATA .
    clear int_fcat.
    int_fcat-fieldname = 'ORGEH'.
    int_fcat-seltext_l  = 'ORGANIZATIONAL UNIT'.
    int_fcat-col_pos = 1.
    append int_fcat.
    clear int_fcat.
    int_fcat-fieldname = 'ENAME'.
    int_fcat-seltext_l  = 'EMPLOYEE NAME'.
    int_fcat-col_pos = 2.
    append int_fcat.
    clear int_fcat.
    int_fcat-fieldname = 'PERNR'.
    int_fcat-seltext_l  = 'PERSONNEL NUMBER'.
    int_fcat-col_pos = 3.
    append int_fcat.
    clear int_fcat.
    int_fcat-fieldname = 'WAPERNR'.
    int_fcat-seltext_l  = 'Z-PERNR'.
    int_fcat-col_pos = 4.
    append int_fcat.
    clear int_fcat.
    int_fcat-fieldname = 'WA_HOURS_TAKEN'.
    int_fcat-seltext_l  = 'HOURS TAKEN'.
    int_fcat-col_pos = 6.
    append int_fcat.
    clear int_fcat.
    int_fcat-fieldname = 'WA_DATE_TAKEN'.
    int_fcat-seltext_l  = 'DATE OF AW LEAVE TAKEN'.
    int_fcat-col_pos = 5.
    append int_fcat.
    clear int_fcat.
    int_fcat-fieldname = 'WA_EXPIRE_DATE'.
    int_fcat-seltext_l  = 'EXPIRATION DATE'.
    int_fcat-col_pos = 7.
    append int_fcat.
    clear int_fcat.
    int_fcat-fieldname = 'WA_MAKEUP_DATE'.
    int_fcat-seltext_l  = 'DATE OF AW MAKEUP'.
    int_fcat-col_pos = 8.
    append int_fcat.
    clear int_fcat.
    int_fcat-fieldname = 'WA_MAKEUP_HOURS'.
    int_fcat-seltext_l  = 'HOURS OF AW MAKEUP'.
    int_fcat-col_pos = 9.
    append int_fcat.
    clear int_fcat.
    int_fcat-fieldname = 'WA_OUTSTANDING'.
    int_fcat-seltext_l  = 'OUTSTANDING BALANCE'.
    int_fcat-col_pos = 10.
    append int_fcat.
    clear int_fcat.
    int_fcat-fieldname = 'WA_RESULTS'.
    int_fcat-seltext_l  = 'EXPIRED LEAVE RESULTS'.
    int_fcat-col_pos = 11.
    append int_fcat.
    ENDFORM.

  • ALV - error protocol

    Hi All
    I'm writing an ALV report to do table maintenance of a Z table.
    I've used bits of BCALV03 & 04 and other BCALV’s.
    I can add new lines and edit fields in the report screen.
    I have build F4 to get possible values into my screen fields.
    <b>My problem is if I find errors in the form Combi_check and the last
    change to a field was made via F4 – my Log-protocol is not shown.
    If my last change to a field  before Combi_check was done manuelly –
    my Log-protocol is shown OK.
    What are I doing wrong ?</b>
    I'm using
    handle_data_changed
    for event data_changed of cl_gui_alv_grid
    importing er_data_changed.
    method handle_data_changed.
    data: ls_good type lvc_s_modi.
    loop at er_data_changed->mt_good_cells into ls_good.
      perform combi_check………
    if lv_error ne space.
    Create Error-protocol
       loop at it_error_tab into wa_error_tab.
         if not wa_error_tab-error eq space.
           CALL METHOD er_data_changed->add_protocol_entry
                EXPORTING
                  i_msgid     = '0K'
                  i_msgno     = '000'
                  i_msgty     = 'E'
                  i_msgv1     = wa_error_tab-txt
                  i_fieldname = wa_error_tab-fieldname
                  i_row_id    = ls_good-row_id.
         endif.
       endloop.
       clear it_error_tab[].
       clear lv_error.
    endloop.
    LOOP AT  er_data_changed->mt_deleted_rows INTO ls_delete.
    Endloop.
    endmethod. "handle_data_changed
    Best regards
    Svend Frederiksen
    Frederiksen IT Consulting ApS
    ABAP Developer / DK

    Hello Svend
    As Rich has already implied the DATA_CHANGED event is not yet raised when you call a search help on the ALV list. However, the event will should be raised after hitting the ENTER button which causes the dynpro to run into PAI where you, most  likely, call method go_grid->check_changed_data.
    If you want to validate the values selected from a search help then you need to define a handler for event <b>ON_F4</b>. In addition, you need to call method <b>go_grid->register_f4_for_fields</b> (for more details see sample report <b>BCALV_TEST_GRID_F4_HELP</b>).
    Regards
      Uwe

  • Alv error: error "The system is configured incorrectly "

    hi,
    I am getting the following error while doing alv in webdynpro.
    error "The system is configured incorrectly "
    The error occurred on the application server CDNSRV_CDN_00 and in the work process 0 .
    The termination type was: RABAX_STATE
    i have embeeded the view with the ui container.
    but still its not working...
    Thanks & regards,
    satti

    Hi Satish,
    you might check if the solution provided in SAP Note [1164829|https://service.sap.com/sap/support/notes/1164829] "WD ABAP ALV dump during filtering" fits to your case.
    Best regards,
      Andreas

  • ALV: Error calling add_protocol_entry

    Hi,
    I want to avoid to call the fm 'POPUP_TO_INFORM' for showing an error message in my alv. I'd like to collect all errors and set the field in error (red). I am trying to follow the following steps:
    1) DATA pr_data_changed type ref to cl_alv_changed_data_protocol.
    2)             call method pr_data_changed->add_protocol_entry
                                exporting
                     i_msgid = '0K' i_msgno = '000'  i_msgty = 'E'
                     i_msgv1 = text-i03
                     i_fieldname = 'MATNR'
                     i_row_id = 1.
    3)  CALL METHOD pr_data_changed->display_protocol.
    I receive this error when the step 2 is executed.
    You attempted to use a 'NULL' object reference (access a component (variable: "PR_DATA_CHANGED").
    Any help will be well appreciated.
    Thanks in advance.
    Regards,
           Giovanni

    Hi and thanks for the suggestion but is it possible ti have an example how to create the PR_DATA_CHANGED object?
    Thanks.
       Giovanni

  • Editable ALV Error

    I am displaying a ALV table and have editable field for Quantity ( 13 char; 3 decimal).
    If the user enters quantity which is more than 13 chars; I am getting a error
    "The entered value has too many digits in the integer part".
    I have a event handler method for ON_DATA_CHECK was expecting to catch this cell in the t_error_cells table; however this method is not called...
    I am looking for some pointers in resolving the issue.

    Hi,
    you get this error rightly. If you want this to work you may have to consider changing the data element type to quan or P or C or simply string .
    You may have to have the conversion routine to match the database type.

  • ALV : Error row highlighted

    Hi Experts,
    On my ALV , few fields are editable. If the user enters a wrong value and tries to save , then I want the particular field or row highlighted .
    Sapmle code would be very helpful
    Thanks.
    Ajith

    Hello,
    You can look at the links below:
    [Re: Is it possible to color a text in ALV GRID;
    [Re: Setting cell color in ALV;
    Thanks,
    Jayant

  • ALV error log

    Hello,
    i'm using class CL_ALV_CHANGED_DATA_PROTOCOL, and adding entries using method ADD_PROTOCOL_LOG.
    I would like to hide the log that is displayed. I saw method PROTOCOL_IS_VISIBLE, but it has no importing parameters, only an exporting parameter. any ideas?

    can u try using FM - BAL_LOG_DELETE

  • Error on ALV toolbar click

    Hi everybody,
    I am quite desprate. I am calling standard OO ALV. This ALV is docked in docking container.
    When I press for example 'search' button in standard button everyrhing goes well.
    But when I press 'print' button I am getting error popup with message 'Program errors', nothing else, no runtime error.
    When I close this popup program exits to SAP standard menu.
    So, some button works well, but some producing errors.
    I didn't see enything like this :(.
    Please help.

    Hi,
    This kind of ALV Error's are sometime very difficult to predict. You just need to review your code and you might figure out something or you can debugg as well.
    Refer to the below thread as well:
    PF-Status

  • Short dump while doing subtotal in the ALV report

    Hi All,
    I am getting run time error while doing the sub total and total in the ALV .
    error is "MESSAGE_TYPE_X" and
    discription is  "The current application program detected a situation which really
    should not occur. Therefore, a termination with a short dump was
    triggered on purpose by the key word MESSAGE (type X)."
    Can anyone help me regarding this.
    My alv field catog is like below
      DATA: ls_fieldcat TYPE slis_fieldcat_alv,
            ls_sort     TYPE SLIS_SORTINFO_ALV.
      CLEAR:ls_fieldcat,
            ls_sort.
      REFRESH ot_fieldcat.
      ls_fieldcat-FIELDNAME   = 'LEASE_NUMBER'.
      ls_fieldcat-SELTEXT_M   = 'Lease Number'(001).
      ls_fieldcat-COL_POS     = 0.
      ls_fieldcat-OUTPUTLEN   = 10.
      ls_fieldcat-DO_SUM      = 'X'.
      ls_fieldcat-KEY         = 'X'.
      APPEND ls_fieldcat TO ot_fieldcat.
      CLEAR  ls_fieldcat.
      ls_fieldcat-FIELDNAME   = 'LEASE_TYPE'.
      ls_fieldcat-SELTEXT_M   = 'Lease Type'(002).
      ls_fieldcat-COL_POS     = 1.
      ls_fieldcat-OUTPUTLEN   = 5.
      APPEND ls_fieldcat TO ot_fieldcat.
      CLEAR  ls_fieldcat.
      ls_fieldcat-FIELDNAME   = 'LEGACY_NUM'.
      ls_fieldcat-SELTEXT_M   = 'Legacy Contract No'(003).
      ls_fieldcat-COL_POS     = 2.
      ls_fieldcat-OUTPUTLEN   = 10.
      APPEND ls_fieldcat TO ot_fieldcat.
      CLEAR  ls_fieldcat.
      ls_fieldcat-FIELDNAME   = 'CUSTOMER'.
      ls_fieldcat-SELTEXT_M   = 'Customer'(004).
      ls_fieldcat-COL_POS     = 3.
      APPEND ls_fieldcat TO ot_fieldcat.
      CLEAR  ls_fieldcat.
      ls_fieldcat-FIELDNAME   = 'STATUS'.
      ls_fieldcat-SELTEXT_M   = 'Status'(017).
      ls_fieldcat-COL_POS     = 16.
      ls_fieldcat-OUTPUTLEN   = 10.
      APPEND ls_fieldcat TO ot_fieldcat.
      CLEAR  ls_fieldcat.
      ls_fieldcat-FIELDNAME   = 'GATEIN_DT'.
      ls_fieldcat-SELTEXT_M   = 'Gate In Date'(018).
      ls_fieldcat-COL_POS     = 17.
      ls_fieldcat-OUTPUTLEN   = 10.
      APPEND ls_fieldcat TO ot_fieldcat.
      CLEAR  ls_fieldcat.
      ls_fieldcat-FIELDNAME   = 'SVALUE'.
      ls_fieldcat-COL_POS     = 18.
      ls_fieldcat-DO_SUM      = 'X'.
      ls_fieldcat-OUTPUTLEN   = 12.
      APPEND ls_fieldcat TO ot_fieldcat.
      CLEAR  ls_fieldcat.
    DATA SORTING AND SUBTOTAL
      CLEAR ls_sort.
      ls_sort-FIELDNAME = 'LEASE_NUMBER'.
      ls_sort-SPOS      = 0.
      ls_sort-UP        = 'X'.
      ls_sort-SUBTOT    = 'X'.
      APPEND ls_sort TO GT_SORT.
    If i coment the code relate dto 'SVALUE' i am getting output without sub total and total.
    if i uncomment the same then I am getting short dump.

    Hi,
    Try this coding,
    TYPE-POOLS: SLIS.                      " ALV GLOBAL TYPES
    *      FORM  F_READ_DATA
    FORM F_READ_DATA.
      SELECT * INTO CORRESPONDING FIELDS OF TABLE GT_VBAK
               FROM VBAK
                 UP TO P_MAX ROWS
              WHERE KUNNR IN S_KUNNR
                AND VBELN IN S_VBELN
                AND VKORG IN S_VKORG.
    ENDFORM.                               " F_READ_DATA
    *      FORM  F_DISPLAY_DATA
    FORM F_DISPLAY_DATA.
      DEFINE M_FIELDCAT.
        ADD 1 TO LS_FIELDCAT-COL_POS.
        LS_FIELDCAT-FIELDNAME   = &1.
        LS_FIELDCAT-REF_TABNAME = 'VBAK'.
        LS_FIELDCAT-DO_SUM      = &2.
        LS_FIELDCAT-CFIELDNAME  = &3.
        APPEND LS_FIELDCAT TO LT_FIELDCAT.
      END-OF-DEFINITION.
      DEFINE M_SORT.
        ADD 1 TO LS_SORT-SPOS.
        LS_SORT-FIELDNAME = &1.
        LS_SORT-UP        = 'X'.
        LS_SORT-SUBTOT    = &2.
        APPEND LS_SORT TO LT_SORT.
      END-OF-DEFINITION.
      DATA:
        LS_FIELDCAT TYPE SLIS_FIELDCAT_ALV,
        LT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
        LT_SORT     TYPE SLIS_T_SORTINFO_ALV,
        LS_SORT     TYPE SLIS_SORTINFO_ALV,
        LS_LAYOUT   TYPE SLIS_LAYOUT_ALV.
      M_FIELDCAT 'VKORG' ''  ''.
      M_FIELDCAT 'KUNNR' ''  ''.
      M_FIELDCAT 'VBELN' ''  ''.
      M_FIELDCAT 'NETWR' 'X' 'WAERK'.
      M_FIELDCAT 'WAERK' ''  ''.
      M_SORT 'VKORG' 'X'.                  " SORT BY VKORG AND SUBTOTAL
      M_SORT 'KUNNR' 'X'.                  " SORT BY KUNNR AND SUBTOTAL
      M_SORT 'VBELN' ''.                   " SORT BY VBELN
      LS_LAYOUT-CELL_MERGE = 'X'.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
           EXPORTING
                IS_LAYOUT   = LS_LAYOUT
                IT_FIELDCAT = LT_FIELDCAT
                IT_SORT     = LT_SORT
           TABLES
                T_OUTTAB    = GT_VBAK.
    ENDFORM.                               " F_DISPLAY_DATA
    Regards,
    Nikhil.

  • Alv grid / method cl_alv_changed_data_protocol-add_protocol_entry

    I used the demo program BCALV_GRID_EDIT to implement my editable grid and now I got stuck in the
    method data_changed, where I do that loop:
    LOOP AT rr_data_changed->mt_good_cells INTO ls_mod_cells.
    where I check, get the values and modify the cells.
    If something is wrong, I call the alv error protocol like this:
              CALL METHOD rr_data_changed->add_protocol_entry
                EXPORTING
                  i_msgid     = '0K'
                  i_msgno     = '000'
                  i_msgty     = 'E'
                  i_msgv1     = text-004 "Buchungskreis
                  i_msgv2     = l_rbukrs
                  i_msgv3     = text-006 "exisitiert nicht
                  i_fieldname = ls_mod_cells-fieldname
                  i_row_id    = ls_mod_cells-row_id.
    The right wrong value is highlighted in red, the message is displayed, everything works fine until I change the value back to normal.
    Then I get a run time error TSV_TNEW_PAGE_ALLOC_FAILED because MT_GOOD_CELLS couldn't be expanded.
    It happened in class CL_ALV_CHANGED_DATA_PROTOCOL, in method MODIFY_STYLE in line 41.
    append ls_modi to mt_good_cells.
    I already tried to debug that method, to see what went wrong, but the debugger doesn't work any more at this point.
    I guess I use the method wrong.
    Does it has got something to do with
    cl_gui_control=>www_active which is not active in my test? (p_loce in BCALV_GRID_EDIT)
    I tried already many things with refresh_protocol and protocol_is_visible but the problem does not change.
    Any suggestions? Should I simply choose to a message_list class and do the highlighting manually?

    My problem is solved, because the method modify_style was the reason for the run time error.
    I called for one special field in the loop at mt_good_cells the method modify style
    which tried to append a line to it.
    append ls_modi to mt_good_cells.
    in a loop to change the internal table the loop is based on isn't a good idea.
    So the memory ran out and the system hang up when the memory size for the table was overrun.
    Thanks for listening, the problem is solved.

  • Allow to erase values under the input-check of the ALV Grid Control

    Hi,<br />
    in my ALV Grid I do have a cell which automatically checks the values entered by the user. When the user does not enter the values belonging to the DDIC Domain Value Range of the data element, the cell is rendered with a red border and an ALV error message comes up telling the user to enter the correct values from the F4 help.
    In general, this is really great, but in case the user needs to erase the value, this automatical ALV Grid error message keeps popping up asking him to enter at least one value from the value range.
    (I assume this is due to the fact that the Domain value range does not contain the value 'empty'.)
    <br />
    I would like to keep the functionality of checking the entered value but want to switch off the error message in case nothing was entered. How can I achive this?
    <br /> <br />
    This is what I did so far: <br />
    1. Upon initializing ALV Grid, I define the field catalog like this: <br />
    ls_fieldcat-fieldname = 'REACTION'.                       "#EC NOTEXT <br />
      ls_fieldcat-edit       = abap_true. <br />
      ls_fieldcat-coltext   = 'Reaction'.                       "#EC NOTEXT <br />
      ls_fieldcat-outputlen = '8'.                              "#EC NOTEXT  <br />
    <br />
    * This forces the user to set at least one value; not allowing him to delete it!! <br />
      ls_fieldcat-ref_table = 'CRMS_ES_FOREIGN_ATTRIBUTE'.      "#EC NOTEXT <br />
      ls_fieldcat-ref_field =  'REACTION'. <br />
      ls_fieldcat-key = abap_true. <br />
    <br />
      ls_fieldcat-checktable = '!'. <br />
      ls_fieldcat-f4availabl  = 'X'. "shows the handle for F4 help <br />
      ls_fieldcat-col_id = 7.
    <br />
    (I would assume here that the ls_fieldcat - structure would allow an additional field which allows empty values, but I could not find one!) <br />
    <br />
    2. For my ALV Grid instance, I am registering the F4 during initialization:<br />
    call method gr_fkt_grid->register_f4_for_fields <br />
            exporting <br />
              it_f4 = lt_f4. <br />
    <br />
          ls_f4-fieldname  = 'REACTION'.   "EC SYNTCHAR <br />
          ls_f4-register   = abap_true. <br />
          insert ls_f4 into table lt_f4. <br />
          call method gr_fkt_grid->register_f4_for_fields <br />
            exporting <br />
              it_f4 = lt_f4. <br />
    <br /> <br />
    3. Then I am setting the handler while initializing: <br />
          set handler lr_grid_event_receiver->handle_f4 <br />
          for all instances. <br />
    <br /> <br />
    4. I also have checking methods in PAI for the ALV cells, but they do not apply in this case, <br />
        since ALV itself performs this check described above. I cannot see a chance for <br />
        interfering myself in PAI. <br />
    <br />
    Does anyone have an idea how I could prevent the ALV Grid of bringing up the message "Enter a valid value" and <br />
    allowing to delete the cell content while keeping its checks in case the user enters a wrong value? <br />
    <br />
    Thank you very much,<br />
    regards,<br />
    Konrad<br />

    Hi Konrad,
    Inside the handler method for event DATA_CHANGED,  always suppress the error log by calling method activate_display_protocol with dialog = ''.
    Whenever u need error log call  method display_protocol based on ok_code(sy-ucomm).
    Ex:
    method data_changed.  " Handler method for event 'DATA_CHANGED'
    *Suppressing error log
        call method g_o_grid->activate_display_protocol        "  Always suppress error log when grid is changed
          exporting
            i_dialog = ''.
        if er_data_changed->mt_protocol[] is not initial.
          if ok_code = 'BACK' or ok_code = 'SAVE'.      "  Based  on  ok_code display error log
    *Display error log
            call method er_data_changed->display_protocol.
          endif.
        endif.
      endmethod.                    "data_changed
    Might solve ur problem
    Thanks,
    Edited by: Sap Fan on Oct 14, 2009 5:35 AM

Maybe you are looking for