Problem with focus with an ALV grid using object methods

Hi, i have an editable ALV and there is something wrong that we haven't been able to solve it yet, hope you can understand my explanation
Supose a grid 2 x 5
cell 1 - cell 2 - Cell 3 - Cell 4 - Cell 5
001      John      Doe
So when a press tab or enter to the any cell diferent from cell 1 the focus get back to the cell 1, and i have to tab ( in this example) 3 times to fill cell 4, and then 4 times to fill cell 5
Any ideas???
ttorres

Hi,
Use method :SET_CURRENT_CELL_VIA_ID of grid to set the cursor position in a cell.
Ex:
CALL METHOD O_GRID->SET_CURRENT_CELL_VIA_ID
      EXPORTING
        IS_ROW_ID    = V_ROW
        IS_COLUMN_ID = V_COLUMN
        IS_ROW_NO    = V_ROW_NUM.
use methods : get_current_cell_row_id, get_current_cell
to get the required parameters for SET_CURRENT_CELL_VIA_ID.
Regards
Appana

Similar Messages

  • Downloading ALV Grid (using objects) output to Excel

    Hi all,
    I'm using objects for ALV Grid. I have few other fields (few are above and few are below the custom control) on screen other than custom control. I want to download the entire screen to excel (including other fields). But using Export option I'm able to download only ALV Grid. I did tried with Excel in place option which is not pulling data from ALV Grid control.
    Please suggest me the solution.
    Regards
    Jaker.

    hi
    use this code in ALV format
    TABLES USR03.
    DATA: BEGIN OF ISAPDAT OCCURS 0,
              BNAME LIKE USR03-BNAME,
              NAME1 LIKE USR03-NAME1,
              NAME2 LIKE USR03-NAME2,
          END OF ISAPDAT.
    PARAMETERS P_FNAME LIKE RLGRAP-FILENAME
                        DEFAULT 'd:\sapdata.xls' OBLIGATORY.
    SELECT * FROM USR03 INTO CORRESPONDING FIELDS OF TABLE ISAPDAT.
    SORT ISAPDAT.
    CALL FUNCTION 'SAP_CONVERT_TO_XLS_FORMAT'
         EXPORTING
              I_FILENAME        = P_FNAME
         TABLES
              I_TAB_SAP_DATA    = ISAPDAT
         EXCEPTIONS
              CONVERSION_FAILED = 1
              OTHERS            = 2.
    IF SY-SUBRC EQ 0.
      WRITE:/ 'Download to Excel complete'.
    ELSE.
      WRITE:/ 'Error with download'.
    ENDIF.
    Code Formatted by: Alvaro Tejada Galindo on Jan 8, 2009 2:34 PM

  • Calling a Transaction from ALV Grid Using OO method

    Hi,
    My requirement is as follows....
    I have an ALV grid with columns such as PO no., GR no., Invoice no., etc...
    When I double click on any of these cells it should take me to the respective Transaction (say ME23n for PO no.) with the cell content as input in the transaction.
    Thanks and Regards,
    Navaneeth

    Hi,
      then u can write the code in HANDLE_DOUBLE_CLICK method
    CLASS LCL_EVENT_RECEIVER DEFINITION.
      PUBLIC SECTION.
        METHODS:
    *method used for double click
        HANDLE_DOUBLE_CLICK
            FOR EVENT DOUBLE_CLICK OF CL_GUI_ALV_GRID
                IMPORTING E_ROW E_COLUMN,
    ENDCLASS.                    "LCL_EVENT_RECEIVER DEFINITION
    CLASS LCL_EVENT_RECEIVER IMPLEMENTATION.
    *implementation of the method double click
    *when document no is double clicked in ALV GRID , its value is sent to
    *transaction FPE3 and the corresponding values of the document are
    *displayed
      METHOD HANDLE_DOUBLE_CLICK.
        CLEAR WA_WRT_OFF_FLDS.
        IF E_COLUMN = 'OPBEL'.
          READ TABLE ITAB INTO WA_IAB INDEX E_ROW-INDEX.
               set parameter....
               call transaction...
          endif.
           ENDMETHOD.                    "handle_double_click
    *method to remove unwanted icons from toolbar
    endclass.

  • ALV grid using Object oriented programming

    Hi,
    I need to display a report with 14 fields of which some fields need sub totals and some fields need average values and some other fields require both subtotals and totals. But if I need only the subtotals. I'm not able to find a way for doing so. Please help.
    Thanks and regards
    Radhika

    You will have to specify DO_SUM = X for the fields which you want to totalled or sub-totalled and set DO_SUM = C for getting the average of the field. This needs to be done in the field catalog.
    Also, specify the SORT criteria for the doing the sub-totals in the IT_SORT table, of the SET_TABLE method or the user can do that himself in the report.
    Regards,
    Ravi
    Note - Please mark all the helpful answers

  • Sizeable alv grid using set_table_for_first_display

    I would like to be able to resize the alv grid.
    The abap program is executing in a MS-Windows environment
    MS-window, with SAP session,  can be re-sized yet alv grid stays same size
    I would like to be able to re-size (make bigger or smaller) once the MS-window has been maximized
    Using
    CALL METHOD grid->set_table_for_first_display
        EXPORTING
          is_variant      = w_hr_data_grid_layout_variants
          i_save          = w_hr_data_save_layout_option
          is_layout       = gs_layout
        CHANGING
          it_fieldcatalog = gt_fieldcat[]
          it_outtab       = t_reported_pos_std_table
          it_sort         = it_sort.

    Hi,
    It may not be possible to resize the ALV grid using the methods of the CL_GUI_ALV_GRID. It would be possible through the methods of the custom container class CL_GUI_CUSTOM_CONTAINER because the grid id attached to the container. There is an event SIZE_CONTROL in the CL_GUI_CUSTOM_CONTAINER class which may be useful for you.
    regards,
    Sharat.

  • Header in alv grid using class

    Hello All,
        I developed alv grid using class method.
    First I created CREATE OBJECT GR_CCONTAINER
    then  CREATE OBJECT GR_ALVGRID
    then  PERFORM FIELD_CATALOG TABLES GT_FIELDCAT----
    for field catalog
        PERFORM LAYOUT CHANGING GS_LAYOUT.----
    for header
        p_gs_layout-grid_title = 'class method'.
      p_gs_layout-sel_mode = 'D'.
      APPEND P_GS_LAYOUT TO IT_LAYOUT.
    and finally CALL METHOD GR_ALVGRID->SET_TABLE_FOR_FIRST_DISPLAY
    the report is cooming fine but in header it comes only "class method".
    but i need also
    1. reporting date
    2. reporting time.
       can any body tell me how i can i put 2 more heading line
    Thanks,
    Rakesh

    Hi Dude,
    Please refer the below link how to handle  the header in alv using abap oo
    https://www.sdn.sap.com/irj/scn/wiki?path=/display/snippets/abapObjects-ALVModel-UsingHeaderand+Footer
    Hope it clears,..............
    Thanks & Regards
    Ramakrishna Pathi

  • How to merge rows with similar values in alv grid display in webdynpro

    Hi experts,
                   i want to know about how to merge rows with similar values in alv grid display of webdynpro.grouping rows is possible in table display in webdynpro but i am not able to do row grouping in the alv grid display in webdynpro.
    kindly suggest.
    thanks ,
    Anita.

    Hi Anita,
    did you find a solution for this? I have opened a Thread, if you know the answer maybe you could help me out:
    Is there an ALV function similar to the TABLE Row grouping?
    Thanx in advanced!!!
    Kind Regards,
    Gerardo J

  • Displaying items in a single line in ALV grid using  ALV_TOP_OF_PAGE.

    Hello Guys,
    I am having a problem in displaying items in a single line in the ALV Grid using event ALV_TOP_OF_PAGE.
    My requirement is to group items on a single line i.e. in the example below, Vendor code and posting date are on the same line. The next line the prints Vendor Name and Document no.
    Vendor Code: 123123                               Posting Date : 01.01.2011
    Vendor Name: ABCD                                 Document No: 152246598.
    Here is my code in subroutine 'ALV_TOP_OF_PAGE', 
      wa_list_comments-typ = 'S'. 
      wa_list_comments-key = ''.
      wa_list_comments-info = 'Vendor Code'.
      APPEND wa_list_comments TO it_list_comments.
      wa_list_comments-typ = 'S'. 
      wa_list_comments-key = ''.
      wa_list_comments-info = 'Posting Date'.
      APPEND wa_list_comments TO it_list_comments.
    The above code prints in the following format i.e one below the other,
    Vendor Code: 123123                              
    Posting Date : 01.01.2011.
    I also tried using HTML_TOP_OF_PAGE, but it didn't work.
    Can anybody please help me out with this.
    Regards,
    Danish.

    Hi Danish,
    Your problem is with the alignment and you need some fix positions .
    The solution i feel is u can use as below :
    In CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    use 
    i_callback_html_top_of_page       = 'HTML_TOP_OF_PAGE'.
    Now on calling routine call use cl_dd_document class :
    FORM html_top_of_page USING document TYPE REF TO cl_dd_document .
    data : doctable TYPE REF TO cl_dd_table_element,
              col1_t1 TYPE REF TO cl_dd_area,
              col2_t1 TYPE REF TO cl_dd_area,
              col1_t2 TYPE REF TO cl_dd_area,
              col2_t2 TYPE REF TO cl_dd_area.
    add quick table with five columns
        CALL METHOD lw_document->add_table
          EXPORTING
            no_of_columns               = 2
            border                      = '0'
         cell_background_transparent = ' '
            width                       = '100%'
          IMPORTING
            table                       = doctable.
    Filling columns in row
        CALL METHOD doctable->add_column
          EXPORTING
            width  = '40%'
          IMPORTING
            column = col1_t1.
    Filling columns in row
        CALL METHOD doctable->add_column
          EXPORTING
            width  = '60%'
          IMPORTING
            column = col2_t1.* Filling columns in row
    Call method doctable->new_row.
        CALL METHOD doctable->add_column
          EXPORTING
            width  = '40%'
          IMPORTING
            column = col1_t2.
    Filling columns in row
        CALL METHOD doctable->add_column
          EXPORTING
            width  = '60%'
          IMPORTING
            column = col2_t2.
    *Now adding the texts
    lw_text1 = 'your first text'
    CALL METHOD col1_t1->add_text
          EXPORTING
            text = lw_text.
    *Similarly add text for other columns
    *Adujust % in width to adjust the column as required
    Endform.
    Hope this will solve your problem .

  • Error whil adding Header to the ALV grid using OO

    Hi Guys,
                 I want to display the Header for the ALV grid using Splitter .
    when i am doing like that .I am getting  a screen on the top of that screen I am getting a EMPTY screen .I don't know why likat.
    What i need is just to display a Grid with header?Can anybody Please help me reagarding this problem.
    the Code is Below.
    *& Report  Z_TEST_PGM
    REPORT  Z_TEST_PGM NO STANDARD PAGE HEADING
                                      LINE-SIZE 120 MESSAGE-ID zotc.
    Tables : CKMLMV003 , CKMLMV001.
    TYPE-POOLS: slis.
    Types : Begin of t_CKMLMV003_out,
                 WERKS type CKMLMV003-WERKS,
                 MATNR type CKMLMV003-MATNR,
                 MISCH_VERH type CKMLMV003-MISCH_VERH,
                 KALNR_BAL type CKMLMV003-KALNR_BAL,
                 GJAHR type CKMLMV003-GJAHR,
                 PERIO type CKMLMV003-PERIO,
                 MGTYP type CKMLMV003-MGTYP,
            End of t_CKMLMV003_out,
            Begin of t_CKMLMV001_out,
                 MATNR type CKMLMV001-MATNR,
                 KALNR type CKMLMV001-KALNR,
                 LIFNR_ND type CKMLMV001-LIFNR_ND,
                 EKORG_ND type CKMLMV001-EKORG_ND,
            End of t_CKMLMV001_out,
            Begin of t_CKMLMV003_Temp,
                 MATNR type CKMLMV003-MATNR,
                 GJAHR type CKMLMV003-GJAHR,
                 PERIO type CKMLMV003-PERIO,
            End of t_CKMLMV003_Temp,
            Begin of t_Final_out,
                 MATNR type CKMLMV003-MATNR,
                 GJAHR type CKMLMV003-GJAHR,
                 PERIO type CKMLMV003-PERIO,
                 WERKS type CKMLMV003-WERKS,
                 LIFNR_ND1 type CKMLMV001-LIFNR_ND,
                 MISCH_VERH1 type CKMLMV003-MISCH_VERH,
                 LIFNR_ND2 type CKMLMV001-LIFNR_ND,
                 MISCH_VERH2 type CKMLMV003-MISCH_VERH,
                 LIFNR_ND3 type CKMLMV001-LIFNR_ND,
                 MISCH_VERH3 type CKMLMV003-MISCH_VERH,
                 LIFNR_ND4 type CKMLMV001-LIFNR_ND,
                 MISCH_VERH4 type CKMLMV003-MISCH_VERH,
                 LIFNR_ND5 type CKMLMV001-LIFNR_ND,
                 MISCH_VERH5 type CKMLMV003-MISCH_VERH,
                 LIFNR_ND6 type CKMLMV001-LIFNR_ND,
                 MISCH_VERH6 type CKMLMV003-MISCH_VERH,
                 LIFNR_ND7 type CKMLMV001-LIFNR_ND,
                 MISCH_VERH7 type CKMLMV003-MISCH_VERH,
                 LIFNR_ND8 type CKMLMV001-LIFNR_ND,
                 MISCH_VERH8 type CKMLMV003-MISCH_VERH,
                 LIFNR_ND9 type CKMLMV001-LIFNR_ND,
                 MISCH_VERH9 type CKMLMV003-MISCH_VERH,
                 LIFNR_ND10 type CKMLMV001-LIFNR_ND,
                 MISCH_VERH10 type CKMLMV003-MISCH_VERH,
                 LIFNR_ND11 type CKMLMV001-LIFNR_ND,
                 MISCH_VERH11 type CKMLMV003-MISCH_VERH,
                 LIFNR_ND12 type CKMLMV001-LIFNR_ND,
                 MISCH_VERH12 type CKMLMV003-MISCH_VERH,
                 LIFNR_ND13 type CKMLMV001-LIFNR_ND,
                 MISCH_VERH13 type CKMLMV003-MISCH_VERH,
             End of t_Final_out,
           Begin of t_Final_out1,
                 MATNR type CKMLMV003-MATNR,
                 GJAHR type CKMLMV003-GJAHR,
                 PERIO type CKMLMV003-PERIO,
                 LIFNR_ND1 type CKMLMV001-LIFNR_ND,
                 MISCH_VERH1 type CKMLMV003-MISCH_VERH,
                 LIFNR_ND2 type CKMLMV001-LIFNR_ND,
                 MISCH_VERH2 type CKMLMV003-MISCH_VERH,
                 LIFNR_ND3 type CKMLMV001-LIFNR_ND,
                 MISCH_VERH3 type CKMLMV003-MISCH_VERH,
                 LIFNR_ND4 type CKMLMV001-LIFNR_ND,
                 MISCH_VERH4 type CKMLMV003-MISCH_VERH,
                 LIFNR_ND5 type CKMLMV001-LIFNR_ND,
                 MISCH_VERH5 type CKMLMV003-MISCH_VERH,
                 LIFNR_ND6 type CKMLMV001-LIFNR_ND,
                 MISCH_VERH6 type CKMLMV003-MISCH_VERH,
                 LIFNR_ND7 type CKMLMV001-LIFNR_ND,
                 MISCH_VERH7 type CKMLMV003-MISCH_VERH,
                 LIFNR_ND8 type CKMLMV001-LIFNR_ND,
                 MISCH_VERH8 type CKMLMV003-MISCH_VERH,
                 LIFNR_ND9 type CKMLMV001-LIFNR_ND,
                 MISCH_VERH9 type CKMLMV003-MISCH_VERH,
                 LIFNR_ND10 type CKMLMV001-LIFNR_ND,
                 MISCH_VERH10 type CKMLMV003-MISCH_VERH,
                 LIFNR_ND11 type CKMLMV001-LIFNR_ND,
                 MISCH_VERH11 type CKMLMV003-MISCH_VERH,
                 LIFNR_ND12 type CKMLMV001-LIFNR_ND,
                 MISCH_VERH12 type CKMLMV003-MISCH_VERH,
                 LIFNR_ND13 type CKMLMV001-LIFNR_ND,
                 MISCH_VERH13 type CKMLMV003-MISCH_VERH,
             End of t_Final_out1.
                          Global Structures                              *
    Data : i_CKMLMV003_str   type   t_CKMLMV003_out,
           i_CKMLMV001_str   type   t_CKMLMV001_out,
           i_Final_str   type  t_Final_out,
           i_Final_str1   type  t_Final_out,
           i_CKMLMV003_Temp type   t_CKMLMV003_Temp.
                              Global Internal Tables                        *
    Data : i_CKMLMV003_out   type standard table of  t_CKMLMV003_out,
           i_CKMLMV001_out  type standard table of  t_CKMLMV001_out,
           i_Final_out   type standard table of  t_Final_out,
           i_Final_out1   type standard table of  t_Final_out.
    ALV Report Internal tables    *
    DATA : t_fieldcatalog TYPE slis_t_fieldcat_alv,
           s_fieldcatalog TYPE slis_fieldcat_alv,
           t_basic_fieldcatalog TYPE slis_t_fieldcat_alv,
           s_basic_fieldcatalog TYPE slis_fieldcat_alv,
           t_sort  TYPE slis_t_sortinfo_alv,
           v_repid TYPE sy-repid.
    *ALV Header declarations
    Data: t_header type slis_t_listheader,
          i_header_str type slis_listheader,
          i_line_event_str TYPE slis_alv_event,
          i_events TYPE slis_t_event,
          wa_layout  type slis_layout_alv.
    Data : grid1 type ref to cl_gui_alv_grid,
           g_custom_container1 type ref to cl_gui_custom_container,
           grid2 type ref to cl_gui_alv_grid,
           g_custom_container2 type ref to cl_gui_custom_container,
           i_FCAT TYPE  LVC_T_FCAT,
           i_FCAT_str type lvc_s_fcat,
    Structure  for layout
          i_layout_s   TYPE  lvc_s_layo,
           gt_final1 type table of  t_Final_out.
    DATA: CCCONTAINER1 TYPE SCRFNAME VALUE 'CCCONTAINER1',
          CCCONTAINER2 TYPE SCRFNAME VALUE 'CCCONTAINER2',
          G_PARENT_TOP TYPE REF TO CL_GUI_CONTAINER ,
          G_SPLITTER   TYPE REF TO CL_GUI_SPLITTER_CONTAINER,
          G_DYNDOC_ID  TYPE REF TO CL_DD_DOCUMENT,
          G_PARENT_GRID TYPE REF TO CL_GUI_CONTAINER.
                          Global Variables                              *
    Data :cnt(4) type n value '0',
          g_plant type CKMLMV003-WERKS ,
          g_QuanTStr type CKMLMV003-MGTYP ,
          g_PurchOrg type CKMLMV001-EKORG_ND,
          flag type n value '0',
          g_cnt6 type n value '0',
          g_cnt7 type n value '0',
          g_cnt8 type n value '0',
          g_cnt9 type n value '0',
          g_cnt10 type n value '0',
          g_cnt11 type n value '0',
          g_cnt12 type n value '0',
          g_cnt13 type n value '0'.
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-011.
    SELECTION-SCREEN: BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 2(20) TEXT-006 for field s_matnr.
    Select-Options : S_MATNR for CKMLMV003-MATNR .
    SELECTION-SCREEN: END OF LINE.
    SELECTION-SCREEN: BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 2(20) TEXT-007 for field S_WERKS.
    SELECT-OPTIONS:S_WERKS for CKMLMV003-WERKS Default '2003'.
    SELECTION-SCREEN: END OF LINE.
    SELECTION-SCREEN: BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 2(20) TEXT-008 for field S_GJAHR.
    SELECT-OPTIONS:S_GJAHR for CKMLMv003-GJAHR default Sy-DATUM(4) .
    SELECTION-SCREEN: END OF LINE.
    SELECTION-SCREEN: BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 2(20) TEXT-009 for field S_PERIO.
    SELECT-OPTIONS:S_PERIO for CKMLMV003-PERIO .
    SELECTION-SCREEN: END OF LINE.
    SELECTION-SCREEN: BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 2(25) TEXT-010 for field P_MGTYP.
    Parameters : P_MGTYP type CKMLMV003-MGTYP .
    SELECTION-SCREEN: END OF LINE.
    SELECTION-SCREEN END OF BLOCK b1 .
    At Selection-Screen on s_matnr .
      Perform Validate_MatNumber.
    At Selection-Screen on s_werks .
      Perform Validate_CostingPlant.
    At Selection-Screen on s_GJAHR .
      Perform Validate_FiscalYear.
    At Selection-Screen on s_PERIO .
      Perform Validate_Period.
    At Selection-Screen on p_MGTYP .
      Perform Validate_QuantityStrType.
    *&      Form  Validate_MatNumber
          text
    Form Validate_MatNumber.
      DATA l_MATNR TYPE CKMLMV003-MATNR.
      IF NOT S_MATNR[] IS INITIAL .
        CLEAR L_MATNR.
        SELECT  single MATNR FROM CKMLMV003
          INTO l_MATNR
          WHERE MATNR = s_MATNR-LOW or MATNR = s_MATNR-HIGH.
       ENDSELECT.
        IF sy-subrc NE 0.
          MESSAGE e999 WITH
                  'Enter a Valid Material Number'(001).
        ENDIF.
      ENDIF.
    ENDFORM.                    "Validate_MatNumber
    *&      Form  Validate_CostingPlant
          text
    Form Validate_CostingPlant.
      DATA l_werks TYPE CKMLMV003-WERKS.
      IF NOT S_WERKS[] IS INITIAL .
        CLEAR L_WERKS.
        SELECT single  WERKS FROM T001W
          INTO l_WERKS
          WHERE WERKS =  s_WERKS-low or  WERKS =  s_WERKS-high.
       ENDSELECT.
        IF sy-subrc NE 0.
          MESSAGE e999 WITH
                  'Enter a Valid Costing Plant'(002).
        ENDIF.
      ENDIF.
    ENDFORM.                    "Validate_CostingPlant
    *&      Form  Validate_FiscalYear
          text
    Form Validate_FiscalYear.
      DATA l_GJAHR TYPE CKMLMV003-GJAHR.
      IF NOT S_GJAHR-low IS INITIAL or S_GJAHR-high IS INITIAL.
        CLEAR L_GJAHR.
       SELECT SINGLE GJAHR FROM CKMLMV003
         INTO l_GJAHR
         WHERE GJAHR LE sy-DATUM(4) .
       IF NOT S_GJAHR-low LE sy-DATUM(4) or S_GJAHR-high LE sy-DATUM(4).
         MESSAGE e999 WITH
                 'Enter a Valid Fiscal year'(003).
       ENDIF.
      ENDIF.
    ENDFORM.                    "Validate_FiscalYear
    *&      Form  Validate_Period
          text
    Form Validate_Period.
      DATA l_PERIO TYPE CKMLMV003-PERIO.
      IF NOT S_PERIO[] IS INITIAL .
        CLEAR L_PERIO.
        SELECT single PERIO FROM CKMLMV003
          INTO l_PERIO
          WHERE PERIO GE 1 and PERIO LE 12 .
       ENDSELECT.
        IF sy-subrc NE 0.
          MESSAGE e999 WITH
                  'Enter a Valid Period'(004).
        ENDIF.
      ENDIF.
    ENDFORM.                    "Validate_Period
    *&      Form  Validate_QuantityStrType
          text
    Form Validate_QuantityStrType.
      DATA l_MGTYP TYPE CKMLMV003-MGTYP.
      IF NOT p_MGTYP IS INITIAL.
        CLEAR L_MGTYP.
        SELECT SINGLE MGTYP FROM CKMLMV003
          INTO l_MGTYP
          WHERE MGTYP = p_MGTYP .
        IF sy-subrc NE 0.
          MESSAGE e999 WITH
                  'Enter a Valid Quantity Structure Type'(005).
        ENDIF.
      ENDIF.
    ENDFORM.                    "Validate_QuantityStrType
    INITIALIZATION of Fields
    Class LCL_EVENT_HANDLER DEFINITION.
      Public section.
        Methods:
        TOP_OF_PAGE for Event TOP_OF_PAGE OF CL_GUI_ALV_GRID
                                IMPORTING E_DYNDOC_ID.
    ENDCLASS.                    "LCL_EVENT_HANDLER DEFINITION
    CLASS LCL_EVENT_HANDLER IMPLEMENTATION.
    METHOD TOP_OF_PAGE.
    Top-of-page event <br />
    PERFORM EVENT_TOP_OF_PAGE USING G_DYNDOC_ID.
    ENDMETHOD.                            "top_of_page
    ENDCLASS.       "LCL_EVENT_HANDLER IMPLEMENTATION
    Data : G_HANDLER TYPE REF TO LCL_EVENT_HANDLER.
    Initialization.
      v_repid = sy-repid.
    Start-of-Selection.
      Perform get_CKMLMV003.
      Perform get_CKMLMV001.
      Perform Get_Finaldata.
    Perform Layout_FieldCatalog.
      call screen '101'.
    Perform  ALVGrid_Final_Display.
    *&      Form  Layout_FieldCatalog
          text
    Form Layout_FieldCatalog.
      s_fieldcatalog-col_pos = 1.
      s_fieldcatalog-fieldname = 'MATNR'.
      s_fieldcatalog-tabname = 'I_FINAL_OUT1'.
      s_fieldcatalog-seltext_l = Text-024.
      append s_fieldcatalog to t_fieldcatalog.
      clear s_fieldcatalog.
      s_fieldcatalog-col_pos = 2.
      s_fieldcatalog-fieldname = 'GJAHR'.
      s_fieldcatalog-tabname = 'I_FINAL_OUT1'.
      s_fieldcatalog-seltext_l = Text-012.
      append s_fieldcatalog to t_fieldcatalog.
      clear s_fieldcatalog.
      s_fieldcatalog-col_pos = 3.
      s_fieldcatalog-fieldname = 'PERIO'.
      s_fieldcatalog-tabname = 'I_FINAL_OUT1'.
      s_fieldcatalog-seltext_l = Text-013.
      append s_fieldcatalog to t_fieldcatalog.
      clear s_fieldcatalog.
      s_fieldcatalog-col_pos = 4.
      s_fieldcatalog-fieldname = 'WERKS'.
      s_fieldcatalog-tabname = 'I_FINAL_OUT1'.
      s_fieldcatalog-seltext_l = Text-025.
      append s_fieldcatalog to t_fieldcatalog.
      clear s_fieldcatalog.
      s_fieldcatalog-col_pos = 5.
      s_fieldcatalog-fieldname = 'LIFNR_ND1'.
      s_fieldcatalog-tabname = 'I_FINAL_OUT1'.
      s_fieldcatalog-seltext_l = Text-014.
      append s_fieldcatalog to t_fieldcatalog.
      clear s_fieldcatalog.
      s_fieldcatalog-col_pos = 6.
      s_fieldcatalog-fieldname = 'MISCH_VERH1'.
      s_fieldcatalog-tabname = 'I_FINAL_OUT1'.
      s_fieldcatalog-seltext_l = Text-015.
      append s_fieldcatalog to t_fieldcatalog.
      clear s_fieldcatalog.
      s_fieldcatalog-col_pos = 7.
      s_fieldcatalog-fieldname = 'LIFNR_ND2'.
      s_fieldcatalog-tabname = 'I_FINAL_OUT1'.
      s_fieldcatalog-seltext_l = Text-016.
      append s_fieldcatalog to t_fieldcatalog.
      clear s_fieldcatalog.
      s_fieldcatalog-col_pos = 8.
      s_fieldcatalog-fieldname = 'MISCH_VERH2'.
      s_fieldcatalog-tabname = 'I_FINAL_OUT1'.
      s_fieldcatalog-seltext_l = Text-017.
      append s_fieldcatalog to t_fieldcatalog.
      clear s_fieldcatalog.
      s_fieldcatalog-col_pos = 9.
      s_fieldcatalog-fieldname = 'LIFNR_ND3'.
      s_fieldcatalog-tabname = 'I_FINAL_OUT1'.
      s_fieldcatalog-seltext_l = Text-018.
      append s_fieldcatalog to t_fieldcatalog.
      clear s_fieldcatalog.
      s_fieldcatalog-col_pos = 10.
      s_fieldcatalog-fieldname = 'MISCH_VERH3'.
      s_fieldcatalog-tabname = 'I_FINAL_OUT1'.
      s_fieldcatalog-seltext_l = Text-019.
      append s_fieldcatalog to t_fieldcatalog.
      clear s_fieldcatalog.
      s_fieldcatalog-col_pos = 11.
      s_fieldcatalog-fieldname = 'LIFNR_ND4'.
      s_fieldcatalog-tabname = 'I_FINAL_OUT1'.
      s_fieldcatalog-seltext_l = Text-020.
      append s_fieldcatalog to t_fieldcatalog.
      clear s_fieldcatalog.
      s_fieldcatalog-col_pos = 12.
      s_fieldcatalog-fieldname = 'MISCH_VERH4'.
      s_fieldcatalog-tabname = 'I_FINAL_OUT1'.
      s_fieldcatalog-seltext_l = Text-021.
      append s_fieldcatalog to t_fieldcatalog.
      clear s_fieldcatalog.
      s_fieldcatalog-col_pos = 13.
      s_fieldcatalog-fieldname = 'LIFNR_ND5'.
      s_fieldcatalog-tabname = 'I_FINAL_OUT1'.
      s_fieldcatalog-seltext_l = Text-022.
      append s_fieldcatalog to t_fieldcatalog.
      clear s_fieldcatalog.
      s_fieldcatalog-col_pos = 14.
      s_fieldcatalog-fieldname = 'MISCH_VERH5'.
      s_fieldcatalog-tabname = 'I_FINAL_OUT1'.
      s_fieldcatalog-seltext_l = Text-023.
      append s_fieldcatalog to t_fieldcatalog.
      clear s_fieldcatalog.
      if g_cnt6 <> '0'.
        s_fieldcatalog-col_pos = 14.
        s_fieldcatalog-fieldname = 'LIFNR_ND6'.
        s_fieldcatalog-tabname = 'I_FINAL_OUT1'.
       s_fieldcatalog-NO_OUT = 'X'.
        s_fieldcatalog-seltext_l = Text-022.
        append s_fieldcatalog to t_fieldcatalog.
        clear s_fieldcatalog.
        s_fieldcatalog-col_pos = 15.
        s_fieldcatalog-fieldname = 'MISCH_VERH6'.
        s_fieldcatalog-tabname = 'I_FINAL_OUT1'.
       s_fieldcatalog-NO_OUT = 'X'.
        s_fieldcatalog-seltext_l = Text-023.
        append s_fieldcatalog to t_fieldcatalog.
        clear s_fieldcatalog.
      ENDIF.
      if g_cnt7 <> '0'.
        s_fieldcatalog-col_pos = 16.
        s_fieldcatalog-fieldname = 'LIFNR_ND7'.
        s_fieldcatalog-tabname = 'I_FINAL_OUT1'.
       s_fieldcatalog-NO_OUT = 'X'.
        s_fieldcatalog-seltext_l = Text-022.
        append s_fieldcatalog to t_fieldcatalog.
        clear s_fieldcatalog.
        s_fieldcatalog-col_pos = 17.
        s_fieldcatalog-fieldname = 'MISCH_VERH7'.
        s_fieldcatalog-tabname = 'I_FINAL_OUT1'.
       s_fieldcatalog-NO_OUT = 'X'.
        s_fieldcatalog-seltext_l = Text-023.
        append s_fieldcatalog to t_fieldcatalog.
        clear s_fieldcatalog.
      ENDIF.
      if g_cnt8 <> '0'.
        s_fieldcatalog-col_pos = 18.
        s_fieldcatalog-fieldname = 'LIFNR_ND8'.
        s_fieldcatalog-tabname = 'I_FINAL_OUT1'.
       s_fieldcatalog-NO_OUT = 'X'.
        s_fieldcatalog-seltext_l = Text-022.
        append s_fieldcatalog to t_fieldcatalog.
        clear s_fieldcatalog.
        s_fieldcatalog-col_pos = 19.
        s_fieldcatalog-fieldname = 'MISCH_VERH8'.
        s_fieldcatalog-tabname = 'I_FINAL_OUT1'.
       s_fieldcatalog-NO_OUT = 'X'.
        s_fieldcatalog-seltext_l = Text-023.
        append s_fieldcatalog to t_fieldcatalog.
        clear s_fieldcatalog.
      ENDIF.
      if g_cnt9 <> '0'.
        s_fieldcatalog-col_pos = 20.
        s_fieldcatalog-fieldname = 'LIFNR_ND9'.
        s_fieldcatalog-tabname = 'I_FINAL_OUT1'.
       s_fieldcatalog-NO_OUT = 'X'.
        s_fieldcatalog-seltext_l = Text-022.
        append s_fieldcatalog to t_fieldcatalog.
        clear s_fieldcatalog.
        s_fieldcatalog-col_pos = 21.
        s_fieldcatalog-fieldname = 'MISCH_VERH9'.
        s_fieldcatalog-tabname = 'I_FINAL_OUT1'.
       s_fieldcatalog-NO_OUT = 'X'.
        s_fieldcatalog-seltext_l = Text-023.
        append s_fieldcatalog to t_fieldcatalog.
        clear s_fieldcatalog.
      ENDIF.
      if g_cnt10 <> '0'.
        s_fieldcatalog-col_pos = 22.
        s_fieldcatalog-fieldname = 'LIFNR_ND10'.
        s_fieldcatalog-tabname = 'I_FINAL_OUT1'.
       s_fieldcatalog-NO_OUT = 'X'.
        s_fieldcatalog-seltext_l = Text-022.
        append s_fieldcatalog to t_fieldcatalog.
        clear s_fieldcatalog.
        s_fieldcatalog-col_pos = 23.
        s_fieldcatalog-fieldname = 'MISCH_VERH10'.
        s_fieldcatalog-tabname = 'I_FINAL_OUT1'.
       s_fieldcatalog-NO_OUT = 'X'.
        s_fieldcatalog-seltext_l = Text-023.
        append s_fieldcatalog to t_fieldcatalog.
        clear s_fieldcatalog.
      ENDIF.
      if g_cnt11 <> '0'.
        s_fieldcatalog-col_pos = 24.
        s_fieldcatalog-fieldname = 'LIFNR_ND11'.
        s_fieldcatalog-tabname = 'I_FINAL_OUT1'.
       s_fieldcatalog-NO_OUT = 'X'.
        s_fieldcatalog-seltext_l = Text-022.
        append s_fieldcatalog to t_fieldcatalog.
        clear s_fieldcatalog.
        s_fieldcatalog-col_pos = 25.
        s_fieldcatalog-fieldname = 'MISCH_VERH11'.
        s_fieldcatalog-tabname = 'I_FINAL_OUT1'.
       s_fieldcatalog-NO_OUT = 'X'.
        s_fieldcatalog-seltext_l = Text-023.
        append s_fieldcatalog to t_fieldcatalog.
        clear s_fieldcatalog.
      ENDIF.
      if g_cnt12 <> '0'.
        s_fieldcatalog-col_pos = 26.
        s_fieldcatalog-fieldname = 'LIFNR_ND12'.
        s_fieldcatalog-tabname = 'I_FINAL_OUT1'.
       s_fieldcatalog-NO_OUT = 'X'.
        s_fieldcatalog-seltext_l = Text-022.
        append s_fieldcatalog to t_fieldcatalog.
        clear s_fieldcatalog.
        s_fieldcatalog-col_pos = 27.
        s_fieldcatalog-fieldname = 'MISCH_VERH12'.
        s_fieldcatalog-tabname = 'I_FINAL_OUT1'.
       s_fieldcatalog-NO_OUT = 'X'.
        s_fieldcatalog-seltext_l = Text-023.
        append s_fieldcatalog to t_fieldcatalog.
        clear s_fieldcatalog.
      ENDIF.
      if g_cnt13 <> '0'.
        s_fieldcatalog-col_pos = 29.
        s_fieldcatalog-fieldname = 'LIFNR_ND13'.
        s_fieldcatalog-tabname = 'I_FINAL_OUT1'.
       s_fieldcatalog-NO_OUT = 'X'.
        s_fieldcatalog-seltext_l = Text-022.
        append s_fieldcatalog to t_fieldcatalog.
        clear s_fieldcatalog.
        s_fieldcatalog-col_pos = 30.
        s_fieldcatalog-fieldname = 'MISCH_VERH13'.
        s_fieldcatalog-tabname = 'I_FINAL_OUT1'.
       s_fieldcatalog-NO_OUT = 'X'.
        s_fieldcatalog-seltext_l = Text-023.
        append s_fieldcatalog to t_fieldcatalog.
        clear s_fieldcatalog.
      ENDIF.
    ENDFORM.                    "Layout_FieldCatalog
    *&      Form  get_CKMLMV003
          text
    Form get_CKMLMV003.
      Select WERKS
             MATNR
             MISCH_VERH
             KALNR_BAL
             GJAHR
             PERIO
             MGTYP
             from CKMLMV003
             into table i_CKMLMV003_out
             Where ( MATNR in s_MATNR and
                     WERKS in s_WERKS and
                     GJAHR in s_GJAHR and
                     PERIO in s_PERIO and
                     MGTYP = p_MGTYP ).
      Sort i_CKMLMV003_out by MATNR  KALNR_BAL.
    ENDFORM.                    "get_CKMLMV003
    *&      Form  get_CKMLMV001
          text
    Form get_CKMLMV001.
      If Not i_CKMLMV003_out is Initial.
        Select MATNR
               KALNR
               LIFNR_ND
               EKORG_ND
               from CKMLMV001
               into Table i_CKMLMV001_out
               for all entries in i_CKMLMV003_out
               Where ( KALNR = i_CKMLMV003_out-KALNR_BAL
                      and WERKS = i_CKMLMV003_out-WERKS
                      and MATNR = i_CKMLMV003_out-MATNR ).
        sort i_CKMLMV001_out by MATNR  KALNR.
      ENDIF.
    ENDFORM.                    "get_CKMLMV001
    *&      Form  Get_Finaldata
          text
    Form Get_Finaldata.
      Loop at  i_CKMLMV001_out into i_CKMLMV001_str.
        Loop at  i_CKMLMV003_out into i_CKMLMV003_str.
          If ( i_CKMLMV001_str-KALNR = i_CKMLMV003_str-KALNR_BAL  and i_CKMLMV003_str-MATNR = i_CKMLMV001_str-MATNR  ) .
            If ( flag = 0 ).
              g_plant = i_CKMLMV003_str-WERKS.
              g_PurchOrg = i_CKMLMV001_str-EKORG_ND.
              g_quantstr = i_CKMLMV003_str-MGTYP.
              flag = 1.
            ENDIF.
            Move i_CKMLMV003_str-MATNR  to  i_Final_str-MATNR.
            Move i_CKMLMV003_str-WERKS  to  i_Final_str-WERKS.
            Move i_CKMLMV003_str-GJAHR  to  i_Final_str-GJAHR.
            Move i_CKMLMV003_str-PERIO  to  i_Final_str-PERIO.
            Move i_CKMLMV003_str-MISCH_VERH  to  i_Final_str-MISCH_VERH1.
            Move i_CKMLMV001_str-LIFNR_ND  to  i_Final_str-LIFNR_ND1.
           Move-Corresponding i_CKMLMV003_str to i_CKMLMV003_temp.
            Append i_Final_str to i_Final_out.
            Clear : i_CKMLMV003_str   .
          ENDIF.
        ENDLOOP.
        Clear : i_CKMLMV001_str ,  i_Final_str , i_CKMLMV003_temp.
      ENDLOOP.
      Sort i_Final_out by WERKS MATNR GJAHR  PERIO .
      Loop at i_Final_out into i_Final_str.
        if i_Final_str-MATNR = i_Final_str1-MATNR and i_Final_str-GJAHR = i_Final_str1-GJAHR and i_Final_str-PERIO = i_Final_str1-PERIO and i_Final_str-WERKS = i_Final_str1-WERKS.
          cnt = cnt + 1.
          Case cnt.
            When 2.
              Move i_Final_str-MISCH_VERH1  to  i_Final_str1-MISCH_VERH2.
              Move i_Final_str-LIFNR_ND1  to  i_Final_str1-LIFNR_ND2.
            When 3.
              Move i_Final_str-MISCH_VERH1  to  i_Final_str1-MISCH_VERH3.
              Move i_Final_str-LIFNR_ND1  to  i_Final_str1-LIFNR_ND3.
            When 4.
              Move i_Final_str-MISCH_VERH1  to  i_Final_str1-MISCH_VERH4.
              Move i_Final_str-LIFNR_ND1  to  i_Final_str1-LIFNR_ND4.
            When 5.
              Move i_Final_str-MISCH_VERH1  to  i_Final_str1-MISCH_VERH5.
              Move i_Final_str-LIFNR_ND1  to  i_Final_str1-LIFNR_ND5.
            When 6.
              Move i_Final_str-MISCH_VERH1  to  i_Final_str1-MISCH_VERH6.
              Move i_Final_str-LIFNR_ND1  to  i_Final_str1-LIFNR_ND6.
              g_cnt6 = 1.
            When 7.
              Move i_Final_str-MISCH_VERH1  to  i_Final_str1-MISCH_VERH7.
              Move i_Final_str-LIFNR_ND1  to  i_Final_str1-LIFNR_ND7.
              g_cnt7 = 1.
            When 8.
              Move i_Final_str-MISCH_VERH1  to  i_Final_str1-MISCH_VERH8.
              Move i_Final_str-LIFNR_ND1  to  i_Final_str1-LIFNR_ND8.
              g_cnt8 = 1.
            When 9.
              Move i_Final_str-MISCH_VERH1  to  i_Final_str1-MISCH_VERH9.
              Move i_Final_str-LIFNR_ND1  to  i_Final_str1-LIFNR_ND9.
              g_cnt9 = 1.
            When 10.
              Move i_Final_str-MISCH_VERH1  to  i_Final_str1-MISCH_VERH10.
              Move i_Final_str-LIFNR_ND1  to  i_Final_str1-LIFNR_ND10.
              g_cnt10 = 1.
            When 11.
              Move i_Final_str-MISCH_VERH1  to  i_Final_str1-MISCH_VERH11.
              Move i_Final_str-LIFNR_ND1  to  i_Final_str1-LIFNR_ND11.
              g_cnt11 = 1.
            When 12.
              Move i_Final_str-MISCH_VERH1  to  i_Final_str1-MISCH_VERH12.
              Move i_Final_str-LIFNR_ND1  to  i_Final_str1-LIFNR_ND12.
              g_cnt12 = 1.
            When 13.
              Move i_Final_str-MISCH_VERH1  to  i_Final_str1-MISCH_VERH13.
              Move i_Final_str-LIFNR_ND1  to  i_Final_str1-LIFNR_ND13.
              g_cnt13 = 1.
          ENDCASE.
        ELSE.
          if cnt GE 1 .
            append i_Final_str1 to i_Final_out1.
            Clear : i_Final_str1.
          ENDIF.
          Move-Corresponding i_Final_str to i_Final_str1.
          cnt = 0.
          cnt = cnt + 1.
        ENDIF.
        Clear :  i_Final_str.
      Endloop.
      append i_Final_str1 to i_Final_out1.
       if i_Final_str-MATNR = i_Final_str1-MATNR and i_Final_str-GJAHR = i_Final_str1-GJAHR and i_Final_str-PERIO = i_Final_str1-PERIO .
         cnt = cnt + 1.
         Case cnt.
           When 2.
             Move i_Final_str-MISCH_VERH1  to  i_Final_str1-MISCH_VERH2.
             Move i_Final_str-LIFNR_ND1  to  i_Final_str1-LIFNR_ND2.
           When 3.
             Move i_Final_str-MISCH_VERH1  to  i_Final_str1-MISCH_VERH3.
             Move i_Final_str-LIFNR_ND1  to  i_Final_str1-LIFNR_ND3.
           When 4.
             Move i_Final_str-MISCH_VERH1  to  i_Final_str1-MISCH_VERH4.
             Move i_Final_str-LIFNR_ND1  to  i_Final_str1-LIFNR_ND4.
           When 5.
             Move i_Final_str-MISCH_VERH1  to  i_Final_str1-MISCH_VERH5.
             Move i_Final_str-LIFNR_ND1  to  i_Final_str1-LIFNR_ND5.
         ENDCASE.
    **Move-Corresponding i_Final_str to i_Final_str1.
       ELSE.
         if cnt GE 1 .
           append i_Final_str1 to i_Final_out1.
           Clear : i_Final_str1.
         ENDIF.
         Move-Corresponding i_Final_str to i_Final_str1.
         cnt = 0.
         cnt = cnt + 1.
       ENDIF.
       Clear :  i_Final_str.
    Endloop.
    append i_Final_str1 to i_Final_out1.
    ENDFORM.                    "Get_Finaldata
    *&      Form  top_of_page
          text
    Form top_of_page.
      clear t_header.
      refresh t_header.
      i_header_str-typ = 'H'.
      I_header_Str-info = Text-035.
      append I_header_str to t_header.
      clear I_header_str.
    Date
      I_header_str-typ = 'S'.
      I_header_str-key = Text-036.
      CONCATENATE sy-datum+6(2) '.'
      sy-datum+4(2) '.'
      sy-datum(4) INTO I_header_str-info. "todays date
      append I_header_str to t_header.
      clear: I_header_str.
      i_header_str-typ = 'S'.
      I_header_Str-Key = 'Quantity Structure Type :'.
      I_header_Str-info = g_QuantStr.
      append I_header_str to t_header.
      clear I_header_str.
      i_header_str-typ = 'S'.
      I_header_Str-Key = 'Purchase Org :'.
      I_header_Str-info = g_PurchOrg.
      append I_header_str to t_header.
      clear I_header_str.
      i_header_str-typ = 'S'.
      I_header_Str-Key = 'Plant :'.
      I_header_Str-info = g_Plant.
      append I_header_str to t_header.
      clear I_header_str.
      CLEAR i_line_event_str.
      i_line_event_str-name = 'TOP_OF_PAGE'.
      APPEND i_line_event_str TO i_events.
      call function 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          it_list_commentary = t_header.
    i_logo = 'Z_LOGO'.
    ENDFORM.                    "top_of_page
    *&      ALVGrid_Final_Display
    Form ALVGrid_Final_Display.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program     = v_repid
           i_DEFAULt              = c_valx
          i_callback_top_of_page = 'TOP_OF_PAGE'
           i_Save                 = c_valx
          it_fieldcat            = t_fieldcatalog
           it_sort                = t_sort
          it_events              = I_events
        TABLES
          t_outtab               = i_final_out1.
    ENDFORM.                    "ALVGrid_Final_Display
    *&      Form  ALVGRID_OO_Display
          text
    Form ALVGRID_OO_Display.
      i_FCAT_str-col_pos = 1.
      i_FCAT_str-fieldname = 'MATNR'.
      i_FCAT_str-tabname = 'I_FINAL_OUT1'.
    i_fcat_str-seltext = 'MATERIAL'.
      i_fcat_str-scrtext_m = Text-024.
      append i_FCAT_str to i_FCAT.
      clear i_FCAT_str.
      i_FCAT_str-col_pos = 2.
      i_FCAT_str-fieldname = 'GJAHR'.
      i_FCAT_str-tabname = 'I_FINAL_OUT1'.
      i_fcat_str-scrtext_m = Text-012.
      append i_FCAT_str to i_FCAT.
      clear i_FCAT_str.
      i_FCAT_str-col_pos = 3.
      i_FCAT_str-fieldname = 'PERIO'.
      i_FCAT_str-tabname = 'I_FINAL_OUT1'.
      i_fcat_str-scrtext_m = Text-013.
      append i_FCAT_str to i_FCAT.
      clear i_FCAT_str.
      i_FCAT_str-col_pos = 4.
      i_FCAT_str-fieldname = 'WERKS'.
      i_FCAT_str-tabname = 'I_FINAL_OUT1'.
      i_FCAT_str-scrtext_m = Text-025.
      append i_FCAT_str to i_FCAT.
      clear i_FCAT_str.
      i_FCAT_str-col_pos = 5.
      i_FCAT_str-fieldname = 'LIFNR_ND1'.
      i_FCAT_str-tabname = 'I_FINAL_OUT1'.
      i_fcat_str-scrtext_m = Text-014.
      append i_FCAT_str to i_FCAT.
      clear i_FCAT_str.
      i_FCAT_str-col_pos = 6.
      i_FCAT_str-fieldname = 'MISCH_VERH1'.
      i_FCAT_str-tabname = 'I_FINAL_OUT1'.
      i_FCAT_str-scrtext_m = Text-015.
      append i_FCAT_str to i_FCAT.
      clear i_FCAT_str.
      i_FCAT_str-col_pos = 7.
      i_FCAT_str-fieldname = 'LIFNR_ND2'.
      i_FCAT_str-tabname = 'I_FINAL_OUT1'.
      i_FCAT_str-scrtext_m = Text-016.
      append i_FCAT_str to i_FCAT.
      clear i_FCAT_str.
      i_FCAT_str-col_pos = 8.
      i_FCAT_str-fieldname = 'MISCH_VERH2'.
      i_FCAT_str-tabname = 'I_FINAL_OUT1'.
      i_FCAT_str-scrtext_m = Text-017.
      append i_FCAT_str to i_FCAT.
      clear i_FCAT_str.
      i_FCAT_str-col_pos = 9.
      i_FCAT_str-fieldname = 'LIFNR_ND3'.
      i_FCAT_str-tabname = 'I_FINAL_OUT1'.
      i_FCAT_str-scrtext_m = Text-018.
      append i_FCAT_str to i_FCAT.
      clear i_FCAT_str.
      i_FCAT_str-col_pos = 10.
      i_FCAT_str-fieldname = 'MISCH_VERH3'.
      i_FCAT_str-tabname = 'I_FINAL_OUT1'.
      i_FCAT_str-scrtext_m = Text-019.
      append i_FCAT_str to i_FCAT.
      clear i_FCAT_str.
      i_FCAT_str-col_pos = 11.
      i_FCAT_str-fieldname = 'LIFNR_ND4'.
      i_FCAT_str-tabname = 'I_FINAL_OUT1'.
      i_FCAT_str-scrtext_m = Text-020.
      append i_FCAT_str to i_FCAT.
      clear i_FCAT_str.
      i_FCAT_str-col_pos = 12.
      i_FCAT_str-fieldname = 'MISCH_VERH4'.
      i_FCAT_str-tabname = 'I_FINAL_OUT1'.
      i_FCAT_str-scrtext_m = Text-021.
      append i_FCAT_str to i_FCAT.
      clear i_FCAT_str.
      i_FCAT_str-col_pos = 13.
      i_FCAT_str-fieldname = 'LIFNR_ND5'.
      i_FCAT_str-tabname = 'I_FINAL_OUT1'.
      i_FCAT_str-scrtext_m = Text-022.
      append i_FCAT_str to i_FCAT.
      clear i_FCAT_str.
      i_FCAT_str-col_pos = 14.
      i_FCAT_str-fieldname = 'MISCH_VERH5'.
      i_FCAT_str-tabname = 'I_FINAL_OUT1'.
      i_FCAT_str-scrtext_m = Text-023.
      append i_FCAT_str to i_FCAT.
      clear i_FCAT_str.
       if g_cnt6 <> '0'.
        i_FCAT_str-col_pos = 15.
        i_FCAT_str-fieldname = 'LIFNR_ND6'.
        i_FCAT_str-tabname = 'I_FINAL_OUT1'.
       s_fieldcatalog-NO_OUT = 'X'.
        i_FCAT_str-scrtext_m = Text-022.
        append i_FCAT_str to i_FCAT.
        clear i_FCAT_str.
        i_FCAT_str-col_pos = 16.
        i_FCAT_str-fieldname = 'MISCH_VERH6'.
        i_FCAT_str-tabname = 'I_FINAL_OUT1'.
       s_fieldcatalog-NO_OUT = 'X'.
        i_FCAT_str-scrtext_m = Text-023.
        append i_FCAT_str to i_FCAT.
        clear i_FCAT_str.
      ENDIF.
    *if  not grid1 is Initial.
    If sy-SUBRC = 0.
      Call Method grid1->set_table_for_first_display
        CHANGING
          it_outtab                     = i_final_out1[]
          it_fieldcatalog               = I_FCAT
        EXCEPTIONS
          Invalid_parameter_combination = 1
          program_error                 = 2
          too_many_lines                = 3
          Others                        = 4.
      If sy-subrc <> 0.
      ENDIF.
    CALL METHOD G_DYNDOC_ID->INITIALIZE_DOCUMENT
        EXPORTING
        BACKGROUND_COLOR = CL_DD_AREA=>COL_TEXTAREA.
    Processing events <br />
      CALL METHOD GRID1->LIST_PROCESSING_EVENTS
        EXPORTING
        I_EVENT_NAME = 'TOP_OF_PAGE'
        I_DYNDOC_ID = G_DYNDOC_ID.
    Call Method grid2->set_table_for_first_display
       CHANGING
         it_outtab                     = i_final_out1[]
         it_fieldcatalog               = I_FCAT
       EXCEPTIONS
         Invalid_parameter_combination = 1
         program_error                 = 2
         too_many_lines                = 3
         Others                        = 4.
    If sy-subrc <> 0.
    ENDIF.
       ENDIF.
      ENDIF.
    Endform.                    "ALVGRID_OO_Display
    Form EVENT_TOP_OF_PAGE using  DG_DYNDOC_ID
                          TYPE REF TO CL_DD_DOCUMENT.
    DATA : DL_TEXT(255) TYPE C.
      CALL METHOD DG_DYNDOC_ID->ADD_TEXT
        EXPORTING
        TEXT = 'Flight Details'
        SAP_STYLE = CL_DD_AREA=>HEADING
        SAP_FONTSIZE = CL_DD_AREA=>LARGE
        SAP_COLOR = CL_DD_AREA=>LIST_HEADING_INT.
    Endform.
    *&      Module  STATUS_0101  OUTPUT
          text
    MODULE STATUS_0101 OUTPUT.
    SET PF-STATUS 'xxxxxxxx'.
    SET TITLEBAR 'xxx'.
    SET PF-STATUS 'STATUS'.
    SET TITLEBAR 'TITLE'.
      Create Object G_DYNDOC_ID
            EXPORTING STYLE = 'ALV_GRID'.
      if g_custom_container1 is initial .
        create object g_custom_container1
            Exporting
                Container_name = CCCONTAINER1
            Exceptions
                cntl_error = 1
                cntl_system_error = 2
                create_error = 3
                lifetime_error = 4
                Others = 5.
       Create Object G_SPLITTER
              Exporting PARENT = g_custom_container1.
      CALL METHOD G_SPLITTER->GET_CONTAINER
        EXPORTING
        ROW = 1
        COLUMN = 1
        RECEIVING
        CONTAINER = G_PARENT_TOP.
    *Assigning the Part 2 to GRID
      CALL METHOD G_SPLITTER->GET_CONTAINER
        EXPORTING
        ROW = 2
        COLUMN = 1
        RECEIVING
        CONTAINER = g_parent_grid.

    Hi,
    Check if any event is triggered from the event handler class, upon selection.
    Usually, the events are handled on double click or on hotspot etc.
    Regards,
    Satish Kanteti

  • ALV GRID Using oo abap example

    Hi Friends,
    I am new to oo abap, Can any one give me a basic example how i can create alv grid in oo abap.
    regards,
    DVNS

    HI,
    Programming for ALV grid display using the classes involves  creation of a screen and calling it for display.
    Since there has to be a linking between the program and the screen we have created , this comes in the form of a container. We use two important classes during the programming for displaying ALV grid, CL_GUI_ALV_GRID and CL_GUI_CUSTOM_CONTAINER.
    Steps To Use ALV Grid in a Program
    1. Declare reference variables for,
           Container (class CL_GUI_CUSTOM_CONTAINER) and
           Grid (class CL_GUI_ALV_GRID)
    Example
    DATA: grid  TYPE REF TO cl_gui_alv_grid,
                custom_container  TYPE REF TO cl_gui_custom_container
    2. Create Standard Screen and a container on that screen  and give a name to that container ( Use custom control button from tool bar) . This name will be used to link the container we have created on the screen with the object reference of class CL_GUI_CUSTOM_CONTAINER, which we have declared in the first step
    3. Call the screen which has been created
    4. Instantiate the container control and the ALV Grid Control in PBO of the screen.
    Example
    IF custom_container IS INITIAL.
      CREATE OBJECT custom_container
             EXPORTING
            CONTAINER_NAME = ‘MY_CONTAINER'.
    CREATE OBJECT grid
           EXPORTING
           I_PARENT = custom_container.
    ENDIF
    5. For displaying the data, call the method set_table_for_first_display of object reference of CL_GUI_ALV_GRID.
    Example
    CALL METHOD grid->set_table_for_first_display
    EXPORTING
    I_BUFFER_ACTIVE               =
    I_BYPASSING_BUFFER            =
    I_CONSISTENCY_CHECK           =
    I_STRUCTURE_NAME              =
    IS_VARIANT                    =
    I_SAVE                        =
    I_DEFAULT                     =
    IS_LAYOUT                     =
    IS_PRINT                      =
    IT_SPECIAL_GROUPS             =
    IT_TOOLBAR_EXCLUDING          =
    IT_HYPERLINK                  =
    IT_ALV_GRAPHICS               =
    IT_EXCEPT_QINFO               =
    CHANGING
    IT_OUTTAB                     =
    IT_FIELDCATALOG               =
    IT_SORT                       =
    IT_FILTER                     =
    EXCEPTION
    INVALID_PARAMETER_COMBINATION =
    PROGRAM_ERROR                 =
    TOO_MANY_LINES                =
    others                        =
    EXPLANATION OF SOME IMPORTANT PARAMETERS.
    I_BYPASSING_BUFFER & I_BUFFER_ACTIVE :
    When the program is run for the first time, the fields present in the output table and their positions are stored in a buffer.  So the buffer is taken as reference for the successive executions.  In order to bypass this buffer the above parameter values should be ‘X’ and  ‘ ‘(space)  respectively. If these values are not passed  to the function module, the changes made in the structure of the internal table will not be reflected in the output.
    I_STRUCTURE_NAME:
    If the structure of your output table corresponds to a structure stored in the Data Dictionary (DDIC), the ALV Grid Control can use this information to generate the field catalog automatically. Pass the table structure as parameter. In this case, all fields of this DDIC structure are displayed in the list.
    IS_VARIANT :
    It allows the user to save and reuse the layout. It is a structure of type DISVARIANT and contain the display variant name. It  facilitates pre-assignment for a layout, rather than displaying report and then choosing displaying variant.
    I_SAVE:
    This single character variable specifies whether the user specific display variants can be saved or not.
    The I_SAVE "Options for saving layouts" parameter can have the following values:
    U Only user specific layouts can be saved
    X Only global layouts can be saved
    A Both user specific and global layouts can be saved
    Space Layouts can not be saved
    IS_LAYOUT:
    This structure of type LVC_S_LAYO
    is used to control the layout of the ALV.  Two important fields are:
    GRID TITLE. : Title of grid
    ZEBRA : Alternate lines in list are displayed in different colors.
    IT_FIELDCATALOG:
    This internal table of type LVC_T_FCAT
    is used to specify the position of various fields in the report itab.
    There are three ways we can fill the field catalog table
    1. Automatically through data dictionary structure (DDIC). In this case we pass the table structure to I_STRUCTURE_NAME.
    2. Manually in ABAP program. Filling the internal table of type LVC_T_FCAT
    1.                  . With each row corresponding to each column of output table. Each row of this table will hold value like
    i). TABNAME & FIELDNAME specifies the reference fields for F1 help
    ii). CTABNAME & CFIELDNAME specifies the reference fields for currency formatting
    iii). QTABNAME & QFIELDNAME specifies the reference fields for quantity formatting
    iv). SELTEXT_L holds the long description of the field
    v).  SELTEXT_M holds the medium description of the field
    vi). SELTEXT_S holds the small description of the field
    vii). KEY specifies the Key field ( cannot be hidden )
    viii). OUTPUTLEN species the output length of the field
    ix). DO_SUM specifies that subtotal is required on this field
    x). NO_OUT specifies a hidden field
    3.  Semi-Automatically by combining the above 2 procedures.
    Call function Module REUSE_ALV_FIELDCATALOG_MERGE and pass DDIC
    structure or the output table to generate the field catalog.
    Add additional Rows or modify existing properties of the fields to be displayed.
    METHODS OF IMPLEMENTING SOME EXTRA FEATURES
    Set focus to the grid
    After CALL METHODgrid->set_table_for_first_display insert the following stament:
    CALL METHOD cl_gui_control=>set_focus EXPORTING control = grid
    Refresh grid display
    Use the grid method REFRESH_TABLE_DISPLAY
    Example:
    CALL METHOD grid->refresh_table_display.
    Set the title of the grid
    Fill the grid_title field of structure lvc_s_layo.
    DATA:
    gs_layout TYPE lvc_s_layo.
    gs_layout-grid_title = 'TITLE'.
    CALL METHOD go_grid->set_table_for_first_display
    EXPORTING i_structure_name = 'structure name'
    is_layout               = gs_layout
    CHANGING   it_outtab               = Output table.
    The structure lvc_s_layo contains fields for setting graphical properties, displaying exceptions, calculating totals and enabling specific interaction options
    Event Handling
    We can handle the events triggered by
    1. User defined Text Output
    2. Mouse-controlled Actions
    3. Self-defined and Standard Functions
    Steps for Event Handling
    1. Define a (local) class for event handling
    2. Define a method for each event you need to handle
    3. Implement your event handler methods.
    4. Create Object of the above class
    5. Link used events and event handler methods of the  receiver object and the grid
    object.
    Example program : Handling “Double Click” Event
    Step1.Define a class.
    class lcl_my_event_receiver definition.
    public section.
    methods:
    handle_double_click
    for event double_click of cl_gui_alv_grid.
    endclass.
    Step 2. Implement the class
    class lcl_my_event_receiver implementation.
    method handle_double_click.
    message i001(zz) with ' double click event - Triggerd '.
    endmethod.
    endclass.
    Step 3. Declare and create Object for the local class defined and implemented in steps 1 and 2 respectively
    o_receiver   TYPE REF TO lcl_my_event_receiver   (Declaration)
    create object o_receiver.                                            (Instantiation)
    Step 4. Link the method for handling the event with the grid object in the PBO of screen after instantiating the grid object
    set handler o_receiver->handle_double_click for grid.
    EXAMPLE PROGRAM TO CHANGE A CLASSICAL REPORT OUTPUT TO A ALV GRID
    This can be used as a template program to convert a classical report layout to a ALV grid.
    Report<Report name>
    Grid data Declarations----------------------------------------------*
      INCLUDE ZVINALVD.
    Internal table for ALV grid
    TYPES: BEGIN OF T_ALV,
             Field1 like table-field1,
             Field2 like table-field2,
           END OF T_ALV.
    DATA: I_ALV  TYPE TABLE OF T_ALV.
    DATA: WA_ALV TYPE T_ALV.
    -Class declarations----
      INCLUDE ZVINALVE.
    Add a checkbox in selection screen for ALV grid display. If it is unchecked
    output will be of classical type.
    SELECTION-SCREEN BEGIN OF BLOCK box01.
    SELECTION-SCREEN: BEGIN OF LINE.                           
    SELECTION-SCREEN: COMMENT 4(30) ‘To display repot output as a ALV grid’.                  
    PARAMETERS: p_alv AS CHECKBOX.                             
    SELECTION-SCREEN: END OF LINE.                             
    SELECTION-SCREEN END OF BLOCK box01.
    START-OF-SELECTION.
    Fill the ALV grid internal table
    END-OF-SELECTION.
    IF P_ALV = ‘X’.
      PERFORM ALV_DISPLAY.
    ELSE.
      PERFORM CLASSICAL_DISPLAY.
    ENDIF.
    Alv Display
    FORM ALV_DISPLAY.
      CALL SCREEN 100.
    ENDFORM.
    Module  STATUS_0100  OUTPUT
    PBO for ALV Grid
    MODULE STATUS_0100 OUTPUT.
      SET PF-STATUS 'GRID_DISPLAY'.
      DATA:
    For parameter IS_VARIANT that is used to set up options for storing
    the grid layout as a variant in method set_table_for_first_display
      l_layout TYPE disvariant.
      GS_LAYOUT-SEL_MODE = 'B'.
    Optimize column width
      GS_LAYOUT-CWIDTH_OPT = 'X'.
    Read data and create objects
      IF go_custom_container IS INITIAL.
    Create objects for container and ALV grid
        CREATE OBJECT go_custom_container
          EXPORTING container_name = 'ALV_CONTAINER'.
        CREATE OBJECT go_grid
          EXPORTING i_parent = go_custom_container.
    Create object for event_receiver class
    and set handlers
        CREATE OBJECT o_event_receiver.
        SET HANDLER o_event_receiver->handle_user_command FOR go_grid.
        SET HANDLER o_event_receiver->handle_toolbar FOR go_grid.
    Layout (Variant) for ALV grid
        l_layout-report = sy-repid. "Layout to report
    To built fieldcatalog
        PERFORM alv_build_fieldcatalog.
    Grid setup for first display
        CALL METHOD go_grid->set_table_for_first_display
          EXPORTING
                    is_variant      = l_layout
                    i_save          = 'A'
                    is_layout       = gs_layout
          CHANGING  it_outtab       = I_ALV
                    it_fieldcatalog = fieldcat.
    Raise event toolbar to show the modified toolbar
        CALL METHOD go_grid->set_toolbar_interactive.
      ENDIF.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    Form ALV_BUILD_FIELDCATALOG.
    Store contents of selected line in a internal table
    FORM alv_build_fieldcatalog.
      CLEAR afield.
      afield-fieldname = 'FIELD1'.
      afield-tabname   = 'I_ALV'.
      afield-coltext   = ‘Field Name 1’.
      afield-lzero     = ' '.
      afield-key       = 'X'.
      afield-outputlen =  XX.
      APPEND afield TO fieldcat.
      CLEAR afield.
      afield-fieldname = 'FIELD2'.
      afield-tabname   = 'I_ALV'.
      afield-coltext   = ‘Field Name 2’.
      APPEND afield TO fieldcat.
    ENDFORM.                    " alv_build_fieldcatalog
    Module  USER_COMMAND_0100  INPUT
    PAI for ALV Grid
    MODULE USER_COMMAND_0100 INPUT.
      CASE OK_100.
        WHEN 'BACK'.
          LEAVE TO SCREEN 0.
        WHEN 'EXIT'.
          LEAVE PROGRAM.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    Form  SELECT_LINE
    Store contents of selected line in a internal table
    FORM SELECT_LINE.
      DATA:l_lines TYPE i.
      REFRESH gi_index_rows.
      CLEAR   g_selected_row.
    Read index of selected rows
      CALL METHOD go_grid->get_selected_rows
        IMPORTING et_index_rows = gi_index_rows.
    Check if any row are selected at all. If not
    table  gi_index_rows will be empty
      DESCRIBE TABLE gi_index_rows LINES l_lines.
      IF l_lines = 0.
        CALL FUNCTION 'POPUP_TO_DISPLAY_TEXT'
             EXPORTING
                  textline1 = 'You must choose a line'.
        EXIT.
      ENDIF.
    Read indexes of selected rows.
      LOOP AT gi_index_rows INTO g_selected_row.
        IF sy-tabix = 1.
          READ TABLE I_ALV INDEX g_selected_row-index INTO
                         WA_ALV.
        ENDIF.
      ENDLOOP.
    ENDFORM.                    " SELECT_LINE
    Includes:
    1. ZVINALVD for data declarations
    INCLUDE ZVINALVD .
    Type pool for icons - used in the toolbar
    TYPE-POOLS: icon.
    To allow the declaration of o_event_receiver before the
    lcl_event_receiver class is defined, decale it as deferred in the
    start of the program
    CLASS lcl_event_receiver DEFINITION DEFERRED.
    GLOBAL DATA FOR ALV GRID
    DATA:
    OK code for alv grid screen
      OK_100(4)           TYPE C,
    ALV control: Layout structure
      gs_layout           TYPE   lvc_s_layo,
    Declare reference variables to the ALV grid and the container
      go_grid             TYPE REF TO cl_gui_alv_grid,
      go_custom_container TYPE REF TO cl_gui_custom_container,
      o_event_receiver    TYPE REF TO lcl_event_receiver,
    Data for storing information about selected rows in the grid
    Internal table
      gi_index_rows       TYPE lvc_t_row,
    Information about 1 row
      g_selected_row      LIKE lvc_s_row.
    fieldcatalog
    DATA: fieldcat        TYPE LVC_T_FCAT,
          afield          TYPE LVC_S_FCAT.
    2. ZVINALVE for Class/object declarations
    INCLUDE ZVINALVE.
    C L A S S E S
    CLASS lcl_event_receiver DEFINITION.
      PUBLIC SECTION.
        METHODS:
          handle_toolbar FOR EVENT toolbar OF cl_gui_alv_grid
            IMPORTING e_object e_interactive,
          handle_user_command FOR EVENT user_command OF cl_gui_alv_grid
            IMPORTING e_ucomm.
    ENDCLASS.
    CLASS lcl_event_receiver IMPLEMENTATION
    CLASS lcl_event_receiver IMPLEMENTATION.
      METHOD handle_toolbar.
    Event handler method for event toolbar.
        CONSTANTS:
    Constants for button type
            c_button_normal           TYPE i VALUE 0,
            c_menu_and_default_button TYPE i VALUE 1,
            c_menu                    TYPE i VALUE 2,
            c_separator               TYPE i VALUE 3,
            c_radio_button            TYPE i VALUE 4,
            c_checkbox                TYPE i VALUE 5,
            c_menu_entry              TYPE i VALUE 6.
        DATA: ls_toolbar              TYPE stb_button.
    Append seperator to the normal toolbar
        CLEAR ls_toolbar.
        MOVE c_separator TO ls_toolbar-butn_type..
        APPEND ls_toolbar TO e_object->mt_toolbar.
    Append a new button that to the toolbar. Use E_OBJECT of
    event toolbar. E_OBJECT is of type CL_ALV_EVENT_TOOLBAR_SET.
    This class has one attribute MT_TOOLBAR which is of table type
    TTB_BUTTON. The structure is STB_BUTTON
        CLEAR ls_toolbar.
        MOVE 'DISPLAY'        TO ls_toolbar-function.
        MOVE  icon_DISPLAY    TO ls_toolbar-icon.
        MOVE 'Displaying customer' TO ls_toolbar-quickinfo.
        MOVE 'Display'        TO ls_toolbar-text.
        MOVE ' '             TO ls_toolbar-disabled.
        APPEND ls_toolbar    TO e_object->mt_toolbar.
      ENDMETHOD.
      METHOD handle_user_command.
    Handle own functions defined in the toolbar
        CASE e_ucomm.
          WHEN 'DISPLAY'.
            PERFORM SELECT_LINE.
        ENDCASE.
    ENDMETHOD.
    Reward if useful

  • ALV Grid Using Methods-handle_top_of_page

    riends please explain how to resolve the below issue.
      I am working on ALV Grid using methods & trying to display
    page heading using handle_top_of_page event.
      I have defined & implemented the above method and in the implementation I have
    given a write statement, which has to be displayed on the top of page.
      I have also set the handler for top of page.
    The program does not have any errors, but top of page event is not triggered, what might be the problem.
    Regards,
    Usha

    Hi,
    Check this code
    Class definition :
          CLASS v_lcl_event_receiver DEFINITION
    CLASS v_lcl_event_receiver DEFINITION.
      PUBLIC SECTION.
        METHODS:
        handle_print_top_of_page FOR EVENT print_top_of_page OF
                                           cl_gui_alv_grid,
        handle_top_of_page FOR EVENT top_of_page OF
                                     cl_gui_alv_grid.
    ENDCLASS.
          CLASS V_LCL_EVENT_RECEIVER IMPLEMENTATION
    CLASS v_lcl_event_receiver IMPLEMENTATION.
      METHOD handle_print_top_of_page.
        IF sy-pagno = 1.
            PERFORM top_of_page.
        ENDIF.
      ENDMETHOD.
      METHOD handle_top_of_page.
          PERFORM top_of_page.
      ENDMETHOD.
    ENDCLASS.
    DATA:        v_event_receiver      TYPE REF TO v_lcl_event_receiver.
    FORM top_of_page.
      WRITE: text-020,
    ENDFORM.                    " top_of_page
    In PBo of the screen
       DATA: v_split            TYPE REF TO cl_gui_easy_splitter_container,
             v_contnr_top       TYPE REF TO cl_gui_container,
             v_contnr_bot       TYPE REF TO cl_gui_container,
             v_grid_02          TYPE REF TO cl_gui_alv_grid,
             v_html             TYPE REF TO cl_dd_document,
             v_text20(255)      TYPE c,
             v_text16(255)      TYPE c,
    FORM f9000_objects_create.
      IF cl_gui_alv_grid=>offline( ) IS INITIAL.
    Create a container
        CREATE OBJECT o_dockingcontainer
          EXPORTING
            ratio                       = '95'
          EXCEPTIONS
            cntl_error                  = 1
            cntl_system_error           = 2
            create_error                = 3
            lifetime_error              = 4
            lifetime_dynpro_dynpro_link = 5
            others                      = 6.
        IF sy-subrc NE 0.
          MESSAGE i000 WITH text-e01."Error in creating Docking container
          LEAVE LIST-PROCESSING.
        ENDIF.
        CREATE OBJECT v_split
             EXPORTING
               parent            = o_dockingcontainer
             ORIENTATION       = 0
               sash_position     = 25
               with_border       = 0
             EXCEPTIONS
               cntl_error        = 1
               cntl_system_error = 2
               others            = 3.
        IF sy-subrc NE 0.
          MESSAGE i000 WITH text-e01."Error in creating Docking container
          LEAVE LIST-PROCESSING.
        ENDIF.
      Get the containers of the splitter control
        v_contnr_top = v_split->top_left_container.
        v_contnr_bot = v_split->bottom_right_container.
        CREATE OBJECT o_alvgrid
       EXPORTING
         i_parent = o_dockingcontainer.
      Create an instance of alv control
        CREATE OBJECT o_alvgrid
             EXPORTING i_parent = v_contnr_bot.
      Object for display of selection parameters in HTML top container
        CREATE OBJECT v_html
             EXPORTING
               style = 'ALV_GRID'.
      Must be after the SET HANDLER for TOP_OF_PAGE and foreground only
        CALL METHOD o_alvgrid->list_processing_events
                         EXPORTING i_event_name = 'TOP_OF_PAGE'
                                   i_dyndoc_id  = v_html.
        v_text20 = text-020(summary Record counts)Any text.
        CALL METHOD v_html->add_gap
                    EXPORTING
                      width         = 120.
        CALL METHOD v_html->add_text
               EXPORTING
                 text          = v_text20.
        CALL METHOD v_html->new_line.
    Display Text-016
        v_text16 = text-016.
        CALL METHOD v_html->add_gap
                    EXPORTING
                      width         = 1.
        CALL METHOD v_html->add_text
               EXPORTING
                 text          = v_text16.
        v_text16 = v_sap_recon.
        CALL METHOD v_html->add_gap
                    EXPORTING
                      width         = 1.
        CALL METHOD v_html->add_text
               EXPORTING
                 text          = v_text16.
        CALL METHOD v_html->new_line.
    Display the data
        CALL METHOD v_html->display_document
          EXPORTING
             parent             = v_contnr_top.
      Handle the event
        CALL METHOD o_alvgrid->list_processing_events
                            EXPORTING i_event_name = 'PRINT_TOP_OF_PAGE'.
    IN PBO while populating in the output table
    FORM f9004_display_data TABLES   p_report_tab
                                     p_fieldcat.
      CALL METHOD o_alvgrid->set_table_for_first_display
        EXPORTING
           is_variant                    = w_variant
           i_save                        = c_a
           is_layout                     = w_layout
        CHANGING
           it_outtab                     = p_report_tab[]
           it_fieldcatalog               = p_fieldcat[]
        EXCEPTIONS
           invalid_parameter_combination = 1
           program_error                 = 2
           too_many_lines                = 3
           OTHERS                        = 4.
      IF sy-subrc <> 0.
        MESSAGE i000 WITH text-e06."Error in ALV report display
        LEAVE LIST-PROCESSING.
      ENDIF.
    Create object
      IF v_event_receiver IS INITIAL.
        CREATE OBJECT v_event_receiver.
      ENDIF.
      SET HANDLER v_event_receiver->handle_print_top_of_page FOR o_alvgrid.
      SET HANDLER v_event_receiver->handle_top_of_page FOR o_alvgrid.
    Hope this helps.

  • ALV report for 5 Grids using Objects and Method

    I have few questions in ALV 5Grids ,could you please correct me in the following program logic...
    Using this program logic i am able to generate the five Grids and able to populate Header details from VBAK into Grid1,If you click in the Grid 1 and it is populating item details in Grid2 from VBAP,parallally populating the customer data in Grid5 from KNA1.
    Now the pending issue is ,
    if you click in the Grid2 then we should populate the shipping details in Grid3 and
    if you click in the Grid3 then we should populate the billing details in Grid4.
    Program Logic;
    REPORT  ZAREPAS20.
    Tables : vbak,vbap,likp,lips,vbrk,vbrp,kna1.
    DATA : OK_CODE              LIKE        SY-UCOMM,
           G_CONTAINER          TYPE SCRFNAME VALUE 'BCALV7_GRID_DEMO_0100_VASU',
           DOCKING              TYPE REF TO CL_GUI_DOCKING_CONTAINER,
           SPLITTER_1           TYPE REF TO CL_GUI_SPLITTER_CONTAINER,
           SPLITTER_2           TYPE REF TO CL_GUI_SPLITTER_CONTAINER,
           splitter_3           TYPE REF TO CL_GUI_SPLITTER_CONTAINER,
           CELL_TOP1            TYPE REF TO CL_GUI_CONTAINER,
           CELL_BOTTOM1         TYPE REF TO CL_GUI_CONTAINER,
           CELL_TOP2            TYPE REF TO CL_GUI_CONTAINER,
           CELL_BOTTOM2         TYPE REF TO CL_GUI_CONTAINER,
           CELL_LEFT            TYPE REF TO CL_GUI_CONTAINER,
           CELL_middle          TYPE REF TO CL_GUI_CONTAINER,
           CELL_RIGHT           TYPE REF TO CL_GUI_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,
           GRID4                TYPE REF TO CL_GUI_ALV_GRID,
           GRID5                TYPE REF TO CL_GUI_ALV_GRID.
    DATA : GT_VBAK              TYPE STANDARD TABLE OF VBAK,
           GT_VBAP              TYPE STANDARD TABLE OF VBAP,
           GT_LIKP              TYPE STANDARD TABLE OF likp,
           GT_LIPS              TYPE STANDARD TABLE OF lips,
           GT_VBRK              TYPE STANDARD TABLE OF vbrk,
           GT_VBRP              TYPE STANDARD TABLE OF vbrp,
           GT_KNA1              TYPE STANDARD TABLE OF kna1.
    DATA:begin of itab1 occurs 0,
         vbeln type likp-VBELN,                            
         erzet type likp-ERZET,                             
         lfart type likp-LFART,                             
         posnr type lips-POSNR,
         END OF ITAB1.
    DATA:begin of itab2 occurs 0,
         vbeln like vbrk-vbeln,                            
         posnr like vbrk-fktyp,                            
         fkart like vbrk-fkart,                             
         fklmg like vbrp-fklmg,                             
         end of itab2.
    *selection screen for selecting range of values
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE text-001.
    select-options: S_vbeln for VBAK-vbeln.     
    selection-screen end of block b1.
          CLASS lcl_eventhandler DEFINITION
    CLASS lcl_eventhandler DEFINITION.
      PUBLIC SECTION.
        CLASS-METHODS:
          handle_double_click FOR EVENT double_click OF cl_gui_alv_grid
            IMPORTING
              e_row
              e_column
              es_row_no
              sender.  " sending control, i.e. ALV grid that raised event
    ENDCLASS.                    "lcl_eventhandler DEFINITION
          CLASS lcl_eventhandler IMPLEMENTATION
    CLASS lcl_eventhandler IMPLEMENTATION.
    METHOD HANDLE_DOUBLE_CLICK.
    *DEFINE LOCAL DATA.
    DATA : itab_vbak type VBAK,
           itab_vbap type VBAP,
           itab_likp type likp,
           itab_lips type lips,
           itab_vbrk type vbrk,
           itab_vbrp type vbrp,
           itab_kna1 type kna1.
    *DISTINGUISH ACCORDING TO SENDING GRID INSTANCE
    CASE SENDER.
    WHEN GRID1.
       READ TABLE gt_VBAK INTO itab_vbak INDEX e_row-index.
           CHECK ( itab_vbak-vbeln IS NOT INITIAL ).
            CALL METHOD GRID1->set_current_cell_via_id
              EXPORTING
                 is_ROW_ID    =
                 is_COLUMN_ID =
                is_row_no    = es_row_no.
            Triggers PAI of the dynpro with the specified ok-code
            CALL METHOD cl_gui_cfw=>set_new_ok_code( 'ORDER_DETAILS' ).
    WHEN GRID2.
            READ TABLE gt_VBAP INTO itab_vbap INDEX e_row-index.
            CHECK ( itab_vbap-vbeln IS NOT INITIAL ).
            CALL METHOD GRID2->set_current_cell_via_id
              EXPORTING
                 is_ROW_ID    =
                 is_COLUMN_ID =
                is_row_no    = es_row_no.
            Triggers PAI of the dynpro with the specified ok-code
            CALL METHOD cl_gui_cfw=>set_new_ok_code( 'ORDER_DETAILS' ).
    WHEN GRID3.
            READ TABLE gt_LIPS INTO itab_LIPS INDEX e_row-index.
            CHECK ( itab_lips-vgbel IS NOT INITIAL ).
            CALL METHOD GRID3->set_current_cell_via_id
              EXPORTING
                 is_ROW_ID    =
                 is_COLUMN_ID =
                is_row_no    = es_row_no.
            Triggers PAI of the dynpro with the specified ok-code
            CALL METHOD cl_gui_cfw=>set_new_ok_code( 'DELIVERY_DETAILS' ).
    WHEN GRID4.
            READ TABLE gt_VBRP INTO itab_VBRP INDEX e_row-index.
            CHECK ( itab_vbrp-vgbel IS NOT INITIAL ).
            CALL METHOD GRID4->set_current_cell_via_id
              EXPORTING
                 is_ROW_ID    =
                 is_COLUMN_ID =
                is_row_no    = es_row_no.
            Triggers PAI of the dynpro with the specified ok-code
            CALL METHOD cl_gui_cfw=>set_new_ok_code( 'BILLING_DETAILS' ).
    WHEN GRID5.
            READ TABLE gt_KNA1 INTO itab_KNA1 INDEX e_row-index.
            CHECK ( itab_kna1-kunnr IS NOT INITIAL ).
          SET PARAMETER ID 'KUN' FIELD itab_KNA1-KUNNR.
           CALL TRANSACTION 'MM02' AND SKIP FIRST SCREEN.
          WHEN OTHERS.
            RETURN.
        ENDCASE.
    endmethod.
    endclass.    "lcl_eventhandler IMPLEMENTATION
    start-of-selection.
    *write :/ 'FEDEX INT''''L' .
    SELECT        * FROM  vbak INTO TABLE gt_VBAK
    where vbeln IN  S_VBELN.
    creating docking container
    create object docking
       exporting
        parent     = cl_gui_container=>screen0
        ratio      = 90
      exceptions
       others      = 6.
      if sy-subrc eq 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                 WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    Create splitter container
    CREATE OBJECT splitter_1
        EXPORTING
          parent            = docking
          rows              = 1
          columns           = 3
         NO_AUTODEF_PROGID_DYNNR =
         NAME              =
        EXCEPTIONS
          cntl_error        = 1
          cntl_system_error = 2
          OTHERS            = 3.
      IF sy-subrc  eq 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                 WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    Get cell container
      CALL METHOD splitter_1->get_container
        EXPORTING
          row       = 1
          column    = 1
        RECEIVING
          container = cell_left.
      CALL METHOD splitter_1->get_container
        EXPORTING
          row       = 1
          column    = 2
        RECEIVING
          container = cell_middle.
      CALL METHOD splitter_1->get_container
        EXPORTING
          row       = 1
          column    = 3
        RECEIVING
          container = cell_right.
    Create 2nd splitter container
      CREATE OBJECT splitter_2
      EXPORTING
          parent            = cell_left
          rows              = 2
          columns           = 1
         NO_AUTODEF_PROGID_DYNNR =
         NAME              =
        EXCEPTIONS
          cntl_error        = 1
          cntl_system_error = 2
          OTHERS            = 3.
      IF sy-subrc  eq 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                 WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    Get cell container
      CALL METHOD splitter_2->get_container
        EXPORTING
          row       = 1
          column    = 1
        RECEIVING
          container = cell_top1.
      CALL METHOD splitter_2->get_container
        EXPORTING
          row       = 2
          column    = 1
        RECEIVING
          container = cell_bottom1.
    Create 3rd splitter container
    CREATE OBJECT splitter_3
        EXPORTING
          parent            = cell_middle
          rows              = 2
          columns           = 1
         NO_AUTODEF_PROGID_DYNNR =
         NAME              =
        EXCEPTIONS
          cntl_error        = 1
          cntl_system_error = 2
          OTHERS            = 3.
      IF sy-subrc  eq 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                 WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    Get cell container
      CALL METHOD splitter_3->get_container
        EXPORTING
          row       = 1
          column    = 1
        RECEIVING
          container = cell_top2.
      CALL METHOD splitter_3->get_container
        EXPORTING
          row       = 2
          column    = 1
        RECEIVING
          container = cell_bottom2.
    Create ALV grids
      CREATE OBJECT grid1
        EXPORTING
          i_parent          = cell_top1
        EXCEPTIONS
          OTHERS            = 5.
      IF sy-subrc  eq 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                 WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      CREATE OBJECT grid2
        EXPORTING
          i_parent          = cell_bottom1
        EXCEPTIONS
          OTHERS            = 5.
      IF sy-subrc  eq 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                 WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      CREATE OBJECT grid3
        EXPORTING
          i_parent          = cell_top2
        EXCEPTIONS
          OTHERS            = 5.
      IF sy-subrc  eq 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                 WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      CREATE OBJECT grid4
        EXPORTING
          i_parent          = cell_bottom2
        EXCEPTIONS
          OTHERS            = 5.
      IF sy-subrc  eq 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                 WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      CREATE OBJECT grid5
        EXPORTING
          i_parent          = cell_right
        EXCEPTIONS
          OTHERS            = 5.
      IF sy-subrc  eq 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                 WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    Set event handler
      SET HANDLER: lcl_eventhandler=>handle_double_click FOR grid1.
      SET HANDLER: lcl_eventhandler=>handle_double_click FOR grid2.
      SET HANDLER: lcl_eventhandler=>handle_double_click FOR grid3.
      SET HANDLER: lcl_eventhandler=>handle_double_click FOR grid4.
      SET HANDLER: lcl_eventhandler=>handle_double_click FOR grid5.
    Display data
      CALL METHOD grid1->set_table_for_first_display
        EXPORTING
          i_structure_name = 'VBAK'
        CHANGING
          it_outtab        = gt_VBAK
        EXCEPTIONS
          OTHERS           = 4.
      IF sy-subrc  eq 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                 WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    REFRESH: gt_vbap.
      CALL METHOD grid2->set_table_for_first_display
        EXPORTING
          i_structure_name = 'VBAP'
        CHANGING
          it_outtab        = gt_VBAP    " empty !!!
        EXCEPTIONS
          OTHERS           = 4.
      IF sy-subrc  eq 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                 WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    REFRESH: gt_LIPS.
      CALL METHOD grid3->set_table_for_first_display
        EXPORTING
          i_structure_name = 'LIPS'
        CHANGING
          it_outtab        = gt_LIPS    " empty !!!
        EXCEPTIONS
          OTHERS           = 4.
      IF sy-subrc  eq 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                 WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    REFRESH: gt_VBRP.
      CALL METHOD grid4->set_table_for_first_display
        EXPORTING
          i_structure_name = 'VBRP'
        CHANGING
          it_outtab        = gt_VBRP    " empty !!!
        EXCEPTIONS
          OTHERS           = 4.
      IF sy-subrc  eq 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                 WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    REFRESH: gt_KNA1.
      CALL METHOD grid5->set_table_for_first_display
        EXPORTING
          i_structure_name = 'KNA1'
        CHANGING
          it_outtab        = gt_KNA1    " empty !!!
        EXCEPTIONS
          OTHERS           = 4.
      IF sy-subrc  eq 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                 WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    Link the docking container to the target dynpro
      CALL METHOD docking->link
        EXPORTING
          repid                       = syst-repid
          dynnr                       = '0100'
         CONTAINER                   =
        EXCEPTIONS
          OTHERS                      = 4.
      IF sy-subrc  eq 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                 WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    NOTE: dynpro does not contain any elements (ok_code -> GD_OKCODE)
      CALL SCREEN '0100'.
    Flow logic of dynpro:
    *PROCESS BEFORE OUTPUT.
    MODULE STATUS_0100.
    *PROCESS AFTER INPUT.
    MODULE USER_COMMAND_0100.
    end-of-selection.
    *&      Module  STATUS_0100  OUTPUT
          text
    MODULE STATUS_0100 OUTPUT.
      SET PF-STATUS 'STATUS_0100'.
    SET TITLEBAR 'xxx'.
    Refresh display of detail ALV list
      CALL METHOD grid2->refresh_table_display
       EXPORTING
         IS_STABLE      =
         I_SOFT_REFRESH =
        EXCEPTIONS
          OTHERS         = 2.
      IF sy-subrc  eq 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                 WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    Refresh display of detail ALV list
      CALL METHOD grid3->refresh_table_display
       EXPORTING
         IS_STABLE      =
         I_SOFT_REFRESH =
        EXCEPTIONS
          OTHERS         = 2.
      IF sy-subrc  eq 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                 WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    Refresh display of detail ALV list
      CALL METHOD grid4->refresh_table_display
       EXPORTING
         IS_STABLE      =
         I_SOFT_REFRESH =
        EXCEPTIONS
          OTHERS         = 2.
      IF sy-subrc  eq 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                 WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    Refresh display of detail ALV list
      CALL METHOD grid5->refresh_table_display
       EXPORTING
         IS_STABLE      =
         I_SOFT_REFRESH =
        EXCEPTIONS
          OTHERS         = 2.
      IF sy-subrc  eq 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                 WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    *&      Module  USER_COMMAND_0100  INPUT
          text
    MODULE USER_COMMAND_0100 INPUT.
    CASE SY-UCOMM.
    WHEN 'BACK' OR
         'EXIT'  OR
         'CANCEL'.
         SET SCREEN 0.LEAVE SCREEN.
    USER HAS PUSHED BUTTON "DISPLAY OREDERS"
         WHEN 'ORDER_DETAILS'.
          PERFORM ORDER_SHOW_DETAILS.
          when 'DELIVERY_DETAILS'.
            PERFORM DELIVERY_SHOW_DETAILS.
          WHEN 'BILLING_DETAILS'.
             PERFORM BILLING_SHOW_DETAILS.
         WHEN OTHERS.
    ENDCASE.
    CLEAR : OK_CODE.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    *&      Form  ORDER_SHOW_DETAILS
          text
    -->  p1        text
    <--  p2        text
    FORM order_show_details .
    define local data
      DATA:
        ld_row      TYPE i,
        itab_VBAK     TYPE VBAK.
      CALL METHOD grid1->get_current_cell
        IMPORTING
          e_row = ld_row.
      READ TABLE gt_VBAK INTO itab_VBAK INDEX ld_row.
      CHECK ( syst-subrc = 0 ).
      SELECT        * FROM  KNA1 INTO TABLE gt_KNA1
             WHERE  KUNNR  = itab_VBAK-KUNNR.
      SELECT        * FROM  VBAP INTO TABLE gt_VBAP
             WHERE  VBELN  = ITAB_VBAK-VBELN.
    *REFRESH: gt_LIPS.
    ENDFORM.                    " ORDER_SHOW_DETAILS
    *&      Form  DELIVERY_SHOW_DETAILS
          text
    -->  p1        text
    <--  p2        text
    FORM DELIVERY_SHOW_DETAILS .
    define local data
      DATA:
        ld_row      TYPE i,
        itab_VBAP     TYPE VBAP.
      CALL METHOD grid1->get_current_cell
        IMPORTING
          e_row = ld_row.
      READ TABLE gt_VBAP INTO itab_VBAP INDEX ld_row.
      CHECK ( syst-subrc = 0 ).
      SELECT LIKPVBELN LIKPERZET LIKPLFART LIPSVBELN
           INTO CORRESPONDING FIELDS OF TABLE ITAB1
           FROM ( LIKP INNER JOIN LIPS ON LIKPVBELN = LIPSVBELN )
           WHERE LIKP~VBELN IN S_VBELN.
    *REFRESH: gt_LIPS.
    ENDFORM.                    " DELIVERY_SHOW_DETAILS
    *&      Form  BILLING_SHOW_DETAILS
          text
    -->  p1        text
    <--  p2        text
    FORM BILLING_SHOW_DETAILS .
    define local data
      DATA:
        ld_row      TYPE i,
        itab_LIPS     TYPE LIPS.
      CALL METHOD grid1->get_current_cell
        IMPORTING
          e_row = ld_row.
      READ TABLE gt_LIPS INTO itab_LIPS INDEX ld_row.
      CHECK ( syst-subrc = 0 ).
      SELECT VBRKVBELN VBRKFKTYP VBRKFKART VBRPFKLMG
           INTO CORRESPONDING FIELDS OF TABLE ITAB2
           FROM ( VBRK INNER JOIN VBRP ON VBRKVBELN = VBRPVBELN )
           WHERE VBRK~VBELN IN S_VBELN.
    ENDFORM.                    " BILLING_SHOW_DETAILS

    Hi,
    ALV means ABAP List Viewer. Most convenient way to use it is through reuse library (cf.
    transaction se83) available from release 4.6 of SAP R/3.
    ALV is available in two modes: list and grid. List mode is good old list processing with
    standard functionnalities, and grid mode is using a new OCX object displaying grids.
    Classical reports needs more coding to set the horizontal and vertical lines.we need to adjust
    the lines manually.Even interactive also takes lot of code.
    ALV reports reduces the code when compared to classical reports.we use function modules to
    generate the output.
    that r REUSE_ALV_LIST_DISPLAY,REUSE_ALV_GRID_DISPLAY,REUSE_ALV_HIERSEQ_LIST_DISPLAY etc..
    the following threads will give some examples of the functions which you are expecting
    Header
    regarding function module
    hide ALV field
    Simply Display selection parameter values in the ALV OUTPUT
    Drag and drop in a report
    https://www.sdn.sap
    Reprots
    http://www.sapgenie.com/abap/reports.htm
    http://www.allsaplinks.com/material.html
    http://www.sapdevelopment.co.uk/reporting/reportinghome.htm
    ALV
    1. Please give me general info on ALV.
    http://www.sapfans.com/forums/viewtopic.php?t=58286
    http://www.sapfans.com/forums/viewtopic.php?t=76490
    http://www.sapfans.com/forums/viewtopic.php?t=20591
    http://www.sapfans.com/forums/viewtopic.php?t=66305 - this one discusses which way should you
    use - ABAP Objects calls or simple function modules.

  • Display error message in ALV grid  using OOPS

    Hi,
    I have a requirement to display report in ALV. I have created ALV grid using OOPS with three editable cells and 1 button on toolbar. When user enter values in Ediatble cell  and click on the Toolbar button, sales order item should be assigned to contract.
    When the user select  the row and click on toolbar button, a salesorder item should be assigned  to contract and i am using BAPI and fine with BAPI. All the error message should be displayed in a popup and the corresponding failed row  should change its color .
    Once the user identified the failed row, he can edit the value in the ediatble cells and should reprocess in the same screen ( without going back to selection screen).
    To display POP Up, I  am using FM BAL_LOG_CREATE, BAL_LOG_MSG_ADD, BAL_DSP_PROFILE_NO_TREE_GET, BAL_CNTL_CREATE.
    by using above 4 FM , i can display POP UP. but i cannot change the color of the failed row. 
    Once I identified the failed row and reprocess from the same screen , I am successful in processing the failed row, but my error log still has the reprocessed row as failed row because,  error log is not refreshing.
    Please suggest me how to clear error log which was created by using the above FM's and change the color of the failed row .
    Thanks in Advance

    Hi
    Please suggest me how to clear error log which was created by using the above FM's....
    U can use BAL_LOG_REFRESH
    ....and change the color of the failed row
    You need to insert a new field for Colour Attributes in your output table and input its name in the layout structure:
    IS_LAYOUT-INFO_FNAME = <field name for colour>
    The field has to be a CHAR 3 and its value can be -
    > Cxy
    C is a constant
    x is the colour number (from 1 to 9)
    y is intensified (0 = off, 1 = on)
    After changing the value of output table you need to run the method REFRESH_TABLE_DISPLAY for refreshing the output
    Max

  • Is it possbile to create ALV Grid using Class &  without using SE51

    Is it possible to create a alv grid using Class, with out using the screen painter(SE51).

    Hi Preethi,
    It is possible to creat ALV grid using class, provided u have to create a custom control in the screen dialog.
    Try with the foll code. This is an example for flight detail.
    DATA: container TYPE REF TO cl_gui_custom_container,
          alv_con TYPE REF TO cl_gui_alv_grid.
    data : it_sflight like table of wa with header line,
           g_fieldcat type lvc_t_fcat.
    /* Paste the code the PBO
        CREATE OBJECT container
          EXPORTING
            container_name              = 'C_SPFLI'. "Specify the container name which u created in the dialog screen.
        CREATE OBJECT alv_con
          EXPORTING
            i_parent          = container.
    /* Use the foll. to dislay the report
    CALL METHOD cl_grid->set_table_for_first_display
            EXPORTING
             I_STRUCTURE_NAME              = 'SFLIGHT'
            CHANGING
              it_outtab                     = it_sflight[]
              IT_FIELDCATALOG               = g_fieldcat.
    First create the container and then place the ALV in the container and for dislaying pass the necessary table.
    Hope this will useful for u.
    Get back if u r unable to do it.
    Regards
    Router

  • Possible to have vertical scroll bar for a cell in ALV Grid (using methods)

    Hi All,
    I have a field with length 100 characters on a ALV Grid (using methods)..User doesn't want to scroll all the 100 characters horizontally to see the whole text rather he wants to have a vertical scroll bar for the cell so that he can scroll vertically.
    Is it possible to have split the cell text into lines and have a vertical scroll bar for a cell in ALV Grid?
    Regards
    Jaker.

    Thanks for the suggestion Balu.I tried this , but while scrolling,headers also getting scrolled.
    Becoz of this , if i scroll down to the last row,headers are getting hidden.
    Headers should always be static.only the data should scroll.
    Since h:datatable is being rendered as one table , i can div tag for this table alone.
    If i have seperate datatable for headers alone i can do this .But i should not use two datatables.

Maybe you are looking for

  • NT realm works, but appears slow and unconfigurable

    Using WLS 6.1sp1 I successfully have authentication working using the NT realm. The most simplistic cases work but I'm having trouble with the more complex cases. BEA does not provide examples on these: #1. Listing Users/Groups from the console is ex

  • HT1495 1 apple id for 2 ipods

    Hi, Can I use my existing Apple ID for both of my kids Ipods (touch)? Thanks, C

  • Need a little help: How to move images in a video?

    Hi! I've been searching this throughout the whole forum but was not able to find this. I probably do not have the right terms as I'm not really familiar with Premiere Pro yet. I hope someone can explain me how to do the following: I have a video frag

  • Can't get my FCP project into Motion

    Working with FCP 5.1.4 and Motion 2.1.2. I tried to send the Final Cut project I'm working on via: File > Send to "Motion Project" Error I keep getting says "wrong file type" Am I just a *******? Anyone know what I'm doing wrong? Thanks much, Art

  • Tcode to list open POs like me2l (Purchasing Documents per Vendor)

    Hello, Is there any transaction code to list Open PO by vendor with the following columns ? me2l looks good, but I don't know how to show the column Schedule Line.     - Purchasing Document,     - Item     - Schedule Line     - Schedule Quantity