ALV int report using field catalog  merge

Hi folks,
Can anyone here please provide me an alv interactive report?
K.Kiran.

report  zialv_edit_simple1            .
include <icon>.
Definition of Grid event-handler class
class lcl_grid_event_receiver definition.
  public section.
    methods:
      toolbar              for event toolbar
                            of cl_gui_alv_grid
                            importing e_object
                                      e_interactive
    ,user_command         for event user_command
                            of cl_gui_alv_grid
                            importing e_ucomm
.  " Period
endclass.
*mplementation of Grid event-handler class
class lcl_grid_event_receiver implementation.
Method for handling all creation/modification calls to the toolbar
  method toolbar.
    data : ls_toolbar type stb_button.
Define Custom Button in the toolbar
    clear ls_toolbar.
    move 0 to ls_toolbar-butn_type.
    move 'EDIT' to ls_toolbar-function.
    move space to ls_toolbar-disabled.
    move 'EDIT' to ls_toolbar-text.
    move icon_change_text to ls_toolbar-icon.
    move 'Click2Edit' to ls_toolbar-quickinfo.
    append ls_toolbar to e_object->mt_toolbar.
    clear ls_toolbar.
    move 0 to ls_toolbar-butn_type.
    move 'UPDA' to ls_toolbar-function.
    move space to ls_toolbar-disabled.
    move 'UPDATE' to ls_toolbar-text.
    move icon_system_save to ls_toolbar-icon.
    move 'Click2Update' to ls_toolbar-quickinfo.
    append ls_toolbar to e_object->mt_toolbar.
    clear ls_toolbar.
    move 0 to ls_toolbar-butn_type.
    move 'EXIT' to ls_toolbar-function.
    move space to ls_toolbar-disabled.
    move 'EXIT' to ls_toolbar-text.
    move icon_system_end to ls_toolbar-icon.
    move 'Click2Exit' to ls_toolbar-quickinfo.
    append ls_toolbar to e_object->mt_toolbar.
  endmethod.
Method to handle user commands from toolbar
  method user_command.
    case e_ucomm .
      when 'EDIT'.
        perform set_input.
      when 'UPDA'.
        perform refresh_disp.
        perform update_table.
      when 'EXIT'.
        leave program.
    endcase.
  endmethod.
endclass.
       Declarations
parameters:
  p_intab type dfies-tabname default 'SAPLANE'.
data :
  dref type ref to data,
  it_grid_fcat type lvc_t_fcat,
  struct_grid_lset type lvc_s_layo,
  tab_info like table of dfies.
field-symbols :
  <fs_tab> like line of tab_info,
Output Structure****
  <it_disptab> type table.
data :
    ok_code like sy-ucomm
   ,save_ok like sy-ucomm
Container Object [grid_container]
  ,grid_container type ref to cl_gui_custom_container
Control Object [grid]
  ,grid type ref to cl_gui_alv_grid
Event-Handler Object [grid_handler]
,grid_handler type ref to lcl_grid_event_receiver
  . " period
Begin of process logic
start-of-selection.
  call screen '0100'.
*&      Module  STATUS_0100  OUTPUT
     PBO module ...Displays the Grid
module status_0100 output.
A L V    G R I D
  if grid_container is initial.
    create object grid_container
        exporting
          container_name = 'CCONTAINER1'.
    create object grid
        exporting
           i_appl_events = 'X'
           i_parent = grid_container.
    create object grid_handler.
    set handler:
       grid_handler->user_command for grid,
       grid_handler->toolbar for grid .
*Assigning the input value to <fs_tab>-tabname
    assign p_intab to <fs_tab>-tabname .
    call function 'LVC_FIELDCATALOG_MERGE'
         exporting
              i_structure_name = <fs_tab>-tabname
         changing
              ct_fieldcat      = it_grid_fcat.
*Creating internal table
    call method cl_alv_table_create=>create_dynamic_table
       exporting
           it_fieldcatalog           = it_grid_fcat
       importing
           ep_table                  = dref.
    assign  dref->* to <it_disptab>.
    perform populate_grid_data .
    call method grid->set_ready_for_input
        exporting
          i_ready_for_input = 0.
*Enabling the grid to edit mode,
*setting table name as title of the grid
    struct_grid_lset-edit = 'X'. "To enable editing in ALV
    struct_grid_lset-grid_title  = p_intab.
    call method grid->set_table_for_first_display
      exporting
        is_layout           = struct_grid_lset
      changing
        it_outtab             =  <it_disptab>
        it_fieldcatalog       =  it_grid_fcat
    .      " Period
  endif.
endmodule.
*&      Module  USER_COMMAND_0100  INPUT
module user_command_0100 input.
****User Commands are handled as events in method user_command.
endmodule.                 " USER_COMMAND_0100  INPUT
*&      Form  EXIT_PROGRAM
form exit_program.
  call method grid_container->free.
  call method cl_gui_cfw=>flush.
  leave program.
endform.                  " EXIT_PROGRAM
*&      Form  populate_grid_data
form populate_grid_data.
select * from (p_intab) into corresponding fields of table <it_disptab>.
endform.                     " populate_grid_data
      FORM refresh_disp                                             *
form refresh_disp.
  call method grid->refresh_table_display.
endform.
      FORM update_table                                             *
form update_table.
  modify (p_intab) from table <it_disptab>.
  call method grid->set_ready_for_input
      exporting
          i_ready_for_input = 0.
endform.
      FORM set_input                                                *
form set_input.
  call method grid->set_ready_for_input
     exporting
       i_ready_for_input = 1.
endform.
Screen Logic :
process before output.
  module status_0100.
process after input.
  module user_command_0100.

Similar Messages

  • How to display the fields in ALV Output without using Field catalog?

    How to display the fields in ALV Output without using Field catalog?
    Could you pls tell me the coding?
    Akshitha.

    Hi,
    u mean without building field catalog. is it? I that case, we can use the FM REUSE_ALV_FIELDCATALOG_MERGE.
    data: itab type table of mara.
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
    i_program_name = sy-repid
    i_structure_name = itab
    CHANGING
    ct_fieldcat = lt_fieldcat[]
    EXCEPTIONS
    inconsistent_interface = 1
    program_error = 2
    OTHERS = 3.
    *Pass that field catalog into the fillowing FM
    call function 'REUSE_ALV_GRID_DISPLAY'
           exporting
                i_callback_program      = gd_repid
                i_grid_title            = 'REPORTING'
                is_layout              = gt_layout
                it_fieldcat             = lt_fieldcat[]
           tables
                t_outtab                = itab.

  • Doubt in using field catalog merge function

    hi all,
        When I am using the function maodule reuse_alv_fieldcatalog_merge for building the field catalog in alv list,it was giving abend message as
    'Field catalog is empty'.
         what might be the reason for such message?can some one help me out with the solution to get rid of that.
        I cant populate the catalog manually because I need to display nearly 40 fields in the output.
             Thanks in advance.

    hI
    Supports the creation of the field catalog for the ALV function modules
    based either on a structure or table defined in the ABAP Data
    Dictionary, or a program-internal table.
    The program-internal table must either be in a TOP Include or its
    Include must be specified explicitly in the interface.
    The variant based on a program-internal table should only be used for
    rapid prototyping since the following restrictions apply:
    o Performance is affected since the code of the table definition must
    always be read and interpreted at runtime.
    o Dictionary references are only considered if the keywords LIKE or
    INCLUDE STRUCTURE (not TYPE) are used.
    If the field catalog contains more than 90 fields, the first 90 fields
    are output in the list by default whereas the remaining fields are only
    available in the field selection.
    If the field catalog is passed with values, they are merged with the
    'automatically' found information.
    Below is an example ABAP program which will populate a simple internal table(it_ekpo) with data and
    display it using the basic ALV grid functionality(including column total). The example details the main
    sections of coding required to implement the ALV grid functionality:
    Data declaration
    Data retrieval
    Build fieldcatalog
    Build layout setup
    *& Report ZDEMO_ALVGRID *
    *& Example of a simple ALV Grid Report *
    *& The basic requirement for this demo is to display a number of *
    *& fields from the EKKO table. *
    REPORT zdemo_alvgrid .
    TABLES: ekko.
    type-pools: slis. "ALV Declarations
    *Data Declaration
    TYPES: BEGIN OF t_ekko,
    ebeln TYPE ekpo-ebeln,
    ebelp TYPE ekpo-ebelp,
    statu TYPE ekpo-statu,
    aedat TYPE ekpo-aedat,
    matnr TYPE ekpo-matnr,
    menge TYPE ekpo-menge,
    meins TYPE ekpo-meins,
    netpr TYPE ekpo-netpr,
    peinh TYPE ekpo-peinh,
    END OF t_ekko.
    DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
    wa_ekko TYPE t_ekko.
    *ALV data declarations
    data: fieldcatalog type slis_t_fieldcat_alv with header line,
    gd_tab_group type slis_t_sp_group_alv,
    gd_layout type slis_layout_alv,
    gd_repid like sy-repid.
    *Start-of-selection.
    START-OF-SELECTION.
    perform data_retrieval.
    perform build_fieldcatalog.
    perform build_layout.
    perform display_alv_report.
    *& Form BUILD_FIELDCATALOG
    * Build Fieldcatalog for ALV Report
    form build_fieldcatalog.
    * There are a number of ways to create a fieldcat.
    * For the purpose of this example i will build the fieldcatalog manualy
    * by populating the internal table fields individually and then
    * appending the rows. This method can be the most time consuming but can
    * also allow you more control of the final product.
    * Beware though, you need to ensure that all fields required are
    * populated. When using some of functionality available via ALV, such as
    * total. You may need to provide more information than if you were
    * simply displaying the result
    * I.e. Field type may be required in-order for
    * the 'TOTAL' function to work.
    fieldcatalog-fieldname = 'EBELN'.
    fieldcatalog-seltext_m = 'Purchase Order'.
    fieldcatalog-col_pos = 0.
    fieldcatalog-outputlen = 10.
    fieldcatalog-emphasize = 'X'.
    fieldcatalog-key = 'X'.
    * fieldcatalog-do_sum = 'X'.
    * fieldcatalog-no_zero = 'X'.
    append fieldcatalog to fieldcatalog.
    clear fieldcatalog.
    fieldcatalog-fieldname = 'EBELP'.
    fieldcatalog-seltext_m = 'PO Item'.
    fieldcatalog-col_pos = 1.
    append fieldcatalog to fieldcatalog.
    clear fieldcatalog.
    fieldcatalog-fieldname = 'STATU'.
    fieldcatalog-seltext_m = 'Status'.
    fieldcatalog-col_pos = 2.
    append fieldcatalog to fieldcatalog.
    clear fieldcatalog.
    fieldcatalog-fieldname = 'AEDAT'.
    fieldcatalog-seltext_m = 'Item change date'.
    fieldcatalog-col_pos = 3.
    append fieldcatalog to fieldcatalog.
    clear fieldcatalog.
    fieldcatalog-fieldname = 'MATNR'.
    fieldcatalog-seltext_m = 'Material Number'.
    fieldcatalog-col_pos = 4.
    append fieldcatalog to fieldcatalog.
    clear fieldcatalog.
    fieldcatalog-fieldname = 'MENGE'.
    fieldcatalog-seltext_m = 'PO quantity'.
    fieldcatalog-col_pos = 5.
    append fieldcatalog to fieldcatalog.
    clear fieldcatalog.
    fieldcatalog-fieldname = 'MEINS'.
    fieldcatalog-seltext_m = 'Order Unit'.
    fieldcatalog-col_pos = 6.
    append fieldcatalog to fieldcatalog.
    clear fieldcatalog.
    fieldcatalog-fieldname = 'NETPR'.
    fieldcatalog-seltext_m = 'Net Price'.
    fieldcatalog-col_pos = 7.
    fieldcatalog-outputlen = 15.
    fieldcatalog-do_sum = 'X'. "Display column total
    fieldcatalog-datatype = 'CURR'.
    append fieldcatalog to fieldcatalog.
    clear fieldcatalog.
    fieldcatalog-fieldname = 'PEINH'.
    fieldcatalog-seltext_m = 'Price Unit'.
    fieldcatalog-col_pos = 8.
    append fieldcatalog to fieldcatalog.
    clear fieldcatalog.
    endform. " BUILD_FIELDCATALOG
    *& Form BUILD_LAYOUT
    * Build layout for ALV grid report
    form build_layout.
    gd_layout-no_input = 'X'.
    gd_layout-colwidth_optimize = 'X'.
    gd_layout-totals_text = 'Totals'(201).
    * gd_layout-totals_only = 'X'.
    * gd_layout-f2code = 'DISP'. "Sets fcode for when double
    * "click(press f2)
    * gd_layout-zebra = 'X'.
    * gd_layout-group_change_edit = 'X'.
    * gd_layout-header_text = 'helllllo'.
    endform. " BUILD_LAYOUT
    *& Form DISPLAY_ALV_REPORT
    * Display report using ALV grid
    form display_alv_report.
    gd_repid = sy-repid.
    call function 'REUSE_ALV_GRID_DISPLAY'
    exporting
    i_callback_program = gd_repid
    * i_callback_top_of_page = 'TOP-OF-PAGE' "see FORM
    * i_callback_user_command = 'USER_COMMAND'
    * i_grid_title = outtext
    is_layout = gd_layout
    it_fieldcat = fieldcatalog[]
    * it_special_groups = gd_tabgroup
    * IT_EVENTS = GT_XEVENTS
    i_save = 'X'
    * is_variant = z_template
    tables
    t_outtab = it_ekko
    exceptions
    program_error = 1
    others = 2.
    if sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    endform. " DISPLAY_ALV_REPORT
    *& Form DATA_RETRIEVAL
    * Retrieve data form EKPO table and populate itab it_ekko
    form data_retrieval.
    select ebeln ebelp statu aedat matnr menge meins netpr peinh
    up to 10 rows
    from ekpo
    into table it_ekko.
    endform. " DATA_RETRIEVAL

  • Field catalog merge in Classes

    Hi,
    I need to use field catalog merge without using FM . not manual field catalog.I want to call Class and use in ALV.
    Regards,
    Nandha

    Hi Nandha,
    why you can't use FM?
    it's common to use LVC_FIELDCATALOG_MERGE using ALV GRID CONTROLL (with class).

  • Re: Problem in ALV reports using Field symbols

    Hi Friends,
    Can you tell me how to convert a normal report using field symbols into ALV report
    can ypu please suggest me any solutions.I am sending the code along with this mail.
    Regards,
    Dinesh
    <b>Coding:</b>
    *& Report  YSDBTEMP                                                    *
    REPORT  YSDBTEMP                                .
    tables: ekko , ekpo .
    TYPE-POOLS: SLIS.
    *Internal Table Declaration
    data: begin of line ,
          ebeln like ekko-ebeln , "Purchasing Document No.
          bedat like ekko-bedat , "Purchasing Document Date
          matnr like ekpo-matnr , "Material No.
          netwr like ekpo-netwr , "Net Order Value in PO Currancy
          meins like ekpo-meins , "UOM
          change like ekpo-menge ,
    end of line .
    *Internal table Declaration
    DATA: IT_final like table of line  with header line.
    DATA :  FIELDCATALOG TYPE SLIS_T_FIELDCAT_ALV with header line.
    DATA :  V_REPID TYPE SYREPID.
    DATA :  IT_LISTHEADER TYPE SLIS_T_LISTHEADER.
    data :  i_layout type slis_layout_alv .
    Header for Main Grid Display
    data:i_header1 type slis_t_listheader with header line.
    Header for Interactive Report Display
    data:i_header2 type slis_t_listheader with header line.
    *Field Symbol declaration.
    FIELD-SYMBOLS: <FS> type any table.
    **select option Declaration
    selection-screen begin of block block.
    select-options: s_ebeln for ekko-ebeln .
    selection-screen end of block block .
    start-of-selection.
      perform get_data.
      perform field_cat.
      perform layout using i_layout .
      perform grid_display .
    *&      Form  get_data
          text
    -->  p1        text
    <--  p2        text
    FORM get_data .
    SELECT EKKO~EBELN
      EKKO~BEDAT
      EKPO~EBELP
      EKPO~MATNR
      EKPO~NETWR
      EKPO~MEINS
      EKPO~MENGE
      EKPO~BPRME
      INTO CORRESPONDING FIELDS OF table IT_FINAL
      FROM EKKO INNER JOIN EKPO ON EKKOEBELN = EKPOEBELN
      WHERE EKKO~EBELN IN S_EBELN.
    ENDFORM.                    " get_data
    *&      Form  field_cat
          text
    -->  p1        text
    <--  p2        text
    FORM field_cat .
      fieldcatalog-fieldname = 'EBELN'.
      fieldcatalog-seltext_m = 'Purchase Order No'.
      fieldcatalog-col_pos = 1.
       append fieldcatalog .
      clear fieldcatalog.
      fieldcatalog-fieldname = 'BEDAT'.
      fieldcatalog-seltext_m = 'Purchasing Document Date'.
      fieldcatalog-col_pos = 2.
       append fieldcatalog .
      clear fieldcatalog.
      fieldcatalog-fieldname = 'MATNR'.
      fieldcatalog-seltext_m = 'Material No'.
      fieldcatalog-col_pos = 3.
       append fieldcatalog .
      clear fieldcatalog.
      fieldcatalog-fieldname = 'MATNR'.
      fieldcatalog-seltext_m = 'Net order'.
      fieldcatalog-col_pos = 4.
       append fieldcatalog .
      clear fieldcatalog.
    ENDFORM.                    " field_cat
    *&      Form  layout
          text
         -->P_I_LAYOUT  text
    FORM layout  USING    P_I_LAYOUT.
      i_layout-lights_tabname = 'IT_FINAL'.
      i_layout-box_tabname = 'IT_FINAL'.
    ENDFORM.                    " layout
    *&      Form  grid_display
          text
    -->  p1        text
    <--  p2        text
    FORM grid_display .
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
      EXPORTING
      I_CALLBACK_PROGRAM = SY-REPID
    I_CALLBACK_PF_STATUS_SET = 'SET_PO_PF_STATUS'
      I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
      IS_LAYOUT = I_LAYOUT
      IT_FIELDCAT = FIELDCATALOG[]
    *IT_EVENTS = I_EVENT[]
      TABLES
      t_outtab = <fs>.
    endform.

    Hi,
    This is one sample program,
    Check this.
    I hope it is helpful to you.
    TABLES : zeastable_02,zeastable_04.
    TYPE-POOLS : slis.
    TYPES : BEGIN OF fieldst,
            name LIKE zeastable_02-name,
            znum LIKE zeastable_02-znum,
            empno LIKE zeastable_04-empno,
            zempsalary LIKE zeastable_04-zempsalary,
            END OF fieldst.
    DATA itab TYPE TABLE OF fieldst WITH HEADER LINE.
    DATA: w_report_id  LIKE sy-repid.            "Program name
    DATA: w_title   TYPE lvc_title VALUE    'Assignment 1 in ALV'.
    DATA: w_layout   TYPE slis_layout_alv.      "Layout setup
    DATA: w_fieldcat TYPE slis_t_fieldcat_alv.  "Field Catlog
    START-OF-SELECTION.
      SELECT-OPTIONS employee FOR zeastable_04-empno.
    SELECT zeastable_02name  zeastable_02znum
           zeastable_04empno zeastable_04zempsalary
           INTO CORRESPONDING FIELDS OF TABLE itab FROM
           zeastable_02 INNER JOIN zeastable_04 ON
           zeastable_02name = zeastable_04name
           WHERE  zeastable_04~empno IN employee.
    w_report_id = sy-repid.
    PERFORM i_layout CHANGING w_layout.
    PERFORM i_fieldcat CHANGING w_fieldcat.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
        i_callback_program                = 'ZEASALV_04'
         i_grid_title                      = w_title
         is_layout                         = w_layout
         it_fieldcat                       = w_fieldcat
         i_save                            = 'A'
        TABLES
          t_outtab                          = itab
       EXCEPTIONS
         program_error                     = 1
         OTHERS                            = 2
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
      PERFORM i_layout CHANGING w_layout.
      PERFORM i_fieldcat CHANGING w_fieldcat.
    *&      Form  i_layout
          text
         <--P_W_LAYOUT  text
    form i_layout  changing p_w_layout.
    clear w_layout.
      w_layout-colwidth_optimize = 'X'.
      w_layout-edit = ' '.
    endform.                    " i_layout
    *&      Form  i_fieldcat
          text
         <--P_W_FEILDCAT  text
    form i_fieldcat  changing p_w_feildcat.
    data: l_line_fieldcat type slis_fieldcat_alv.
    clear l_line_fieldcat.
      l_line_fieldcat-fieldname = 'NAME'.
      l_line_fieldcat-ref_tabname = 'itab'.
      l_line_fieldcat-seltext_m = 'NAME'.
      l_line_fieldcat-key  = 'X'.
       append l_line_fieldcat to w_fieldcat.
      clear l_line_fieldcat.
      l_line_fieldcat-fieldname = 'ZNUM'.
      l_line_fieldcat-ref_tabname = 'itab'.
      l_line_fieldcat-seltext_m = 'NUMBER'.
      l_line_fieldcat-key  = 'X'.
      append l_line_fieldcat to w_fieldcat.
      clear l_line_fieldcat.
      l_line_fieldcat-fieldname = 'EMPNO'.
      l_line_fieldcat-ref_tabname = 'itab'.
      l_line_fieldcat-seltext_m = 'EMPLNUM'.
    *l_line_fieldcat-key  = 'X'.
      append l_line_fieldcat to w_fieldcat.
      clear l_line_fieldcat.
      l_line_fieldcat-fieldname = 'ZEMPSALARY'.
      l_line_fieldcat-ref_tabname = 'itab'.
      l_line_fieldcat-seltext_m = 'SALARY'.
    *l_line_fieldcat-key  = 'X'.
      append l_line_fieldcat to w_fieldcat.
    endform.                    " i_fieldcat
    Reward for useful answers.

  • Radio button in ALV without using field catalog

    Hi All,
    My requirement is i want to create a RFC function module to display the header table.
    while executing the function module the output is of alv grid format.
    i have used the structure for this.
    i didnt create a layout and fieldcatalog.
    now i need to add a radio button in that alv grid display.
    how to create the radio button without using field catalog.
    Thank in Advance.

    Hi Aishwarya,
    You need to use the field catalog for displaying a field as a radio button in ALV grid.
    Please refer to this link for doing so. [Radio buttons in ALV Grid|http://wiki.sdn.sap.com/wiki/display/Snippets/ABAP-RadioButtonsinALVGRIDREPORT]
    You can use LVC_FIELDCATALOG_MERGE wherein you can use your structure and the Icon for Radiobutton.
    Refer to this link -[Radiobuttons in ALV Grid 2|http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/a02535ce-9eaf-2910-ae8c-f2f2afc1c8e7?quicklink=index&overridelayout=true]
    Best Regards,
    Sharmila
    Edited by: Sharmila Subramanian on Mar 18, 2011 12:34 PM

  • AlV!  Field Catalog Merge!

    Hi!
       What is Field catalog merge in ALV

    Hi,
    YOU HAVE TWO WAYS TO BUILD A FIELD CATALOG
    1) FIRST METHOD
    data w_fieldcat type slis_fieldcat_alv.
    type-pools : slis.
    tables : sflight.
    data : i_fieldcat type slis_T_fieldcat_alv.
    data v_repid like sy-repid.
    data : begin of i_sflight occurs 0,
           carrid like sflight-carrid,
           connid like sflight-connid,
           fldate like sflight-fldate,
            end of i_sflight.
    w_fieldcat-tabname = 'I_SFLIGHT'.
    w_fieldcat-fieldname = 'CARRID'.
    w_fieldcat-outputlen = '10'.
    w_fieldcat-col_pos = '1'.
    w_fieldcat-row_pos = '1'.
    w_fieldcat-seltext_l = 'Carrie ID'.
    w_fieldcat-seltext_M = 'Carrie ID'.
    w_fieldcat-seltext_S = 'Carrie ID'.
    w_fieldcat-HOTSPOT = 'X'.
    append w_fieldcat to i_fieldcat.
    clear w_fieldcat.
    w_fieldcat-tabname = 'I_SFLIGHT'.
    w_fieldcat-fieldname = 'CONNID'.
    w_fieldcat-outputlen = '10'.
    w_fieldcat-col_pos = '1'.
    w_fieldcat-row_pos = '1'.
    w_fieldcat-seltext_l = 'CONNI ID'.
    w_fieldcat-seltext_M = 'CONNI ID'.
    w_fieldcat-seltext_S = 'CONNIID'.
    w_fieldcat-HOTSPOT = 'X'.
    append w_fieldcat to i_fieldcat.
    clear w_fieldcat.
    w_fieldcat-tabname = 'I_SFLIGHT'.
    w_fieldcat-fieldname = 'FLDATE'.
    w_fieldcat-outputlen = '10'.
    w_fieldcat-col_pos = '1'.
    w_fieldcat-row_pos = '1'.
    w_fieldcat-seltext_l = 'FLDATE.
    w_fieldcat-seltext_M = 'FLDATE'.
    w_fieldcat-seltext_S = 'FLDATE'.
    w_fieldcat-HOTSPOT = 'X'.
    append w_fieldcat to i_fieldcat.
    clear w_fieldcat.
    2)  SECOND METHOD
    data w_fieldcat type slis_fieldcat_alv.
    type-pools : slis.
    tables : sflight.
    data : i_fieldcat type slis_T_fieldcat_alv.
    data v_repid like sy-repid.
    data : begin of i_sflight occurs 0,
           carrid like sflight-carrid,
           connid like sflight-connid,
           fldate like sflight-fldate,
            end of i_sflight.
    call function 'REUSE_ALV_FIELDCATALOG_MERGE'
           exporting
                i_program_name     = v_repid
                i_internal_tabname = 'I_SFLIGHT'
                i_inclname         = v_repid
           changing
                ct_fieldcat        = I_fieldcatalog_TYPE.
    Reward points if helpful
    THANKS
    Venki

  • ALV Interactive Report  using oops

    Hi All ,
                   Pls anybody send me the code for ALV interactive report using OOPS  , that reports covers the following things like Header , Logo , Total& subtotals  .....etc  ,
                   with this i can complete my object .
    thanks in Adv
    Rgds
    Rafi .

    Hi
    this code is helpful for u.check it.
    REPORT ZZ_22038_22098_002 NO STANDARD PAGE HEADING LINE-SIZE 650
    MESSAGE-ID ZZ_9838 .
    TYPE-POOLS: SLIS.
    *type declaration for values from ekko
    TYPES: BEGIN OF I_EKKO,
    EBELN LIKE EKKO-EBELN,
    AEDAT LIKE EKKO-AEDAT,
    BUKRS LIKE EKKO-BUKRS,
    BSART LIKE EKKO-BSART,
    LIFNR LIKE EKKO-LIFNR,
    END OF I_EKKO.
    DATA: IT_EKKO TYPE STANDARD TABLE OF I_EKKO INITIAL SIZE 0,
    WA_EKKO TYPE I_EKKO.
    *type declaration for values from ekpo
    TYPES: BEGIN OF I_EKPO,
    EBELN LIKE EKPO-EBELN,
    EBELP LIKE EKPO-EBELP,
    MATNR LIKE EKPO-MATNR,
    MENGE LIKE EKPO-MENGE,
    MEINS LIKE EKPO-MEINS,
    NETPR LIKE EKPO-NETPR,
    END OF I_EKPO.
    DATA: IT_EKPO TYPE STANDARD TABLE OF I_EKPO INITIAL SIZE 0,
    WA_EKPO TYPE I_EKPO .
    *variable for Report ID
    DATA: V_REPID LIKE SY-REPID .
    *declaration for fieldcatalog
    DATA: I_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
    WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
    DATA: IT_LISTHEADER TYPE SLIS_T_LISTHEADER.
    declaration for events table where user comand or set PF status will
    be defined
    DATA: V_EVENTS TYPE SLIS_T_EVENT,
    WA_EVENT TYPE SLIS_ALV_EVENT.
    declartion for layout
    DATA: ALV_LAYOUT TYPE SLIS_LAYOUT_ALV.
    declaration for variant(type of display we want)
    DATA: I_VARIANT TYPE DISVARIANT,
    I_VARIANT1 TYPE DISVARIANT,
    I_SAVE(1) TYPE C.
    *PARAMETERS : p_var TYPE disvariant-variant.
    *Title displayed when the alv list is displayed
    DATA: I_TITLE_EKKO TYPE LVC_TITLE VALUE 'FIRST LIST DISPLAYED'.
    DATA: I_TITLE_EKPO TYPE LVC_TITLE VALUE 'SECONDRY LIST DISPLAYED'.
    INITIALIZATION.
    V_REPID = SY-REPID.
    PERFORM BUILD_FIELDCATLOG.
    PERFORM EVENT_CALL.
    PERFORM POPULATE_EVENT.
    START-OF-SELECTION.
    PERFORM DATA_RETRIEVAL.
    PERFORM BUILD_LISTHEADER USING IT_LISTHEADER.
    PERFORM DISPLAY_ALV_REPORT.
    *& Form BUILD_FIELDCATLOG
    Fieldcatalog has all the field details from ekko
    FORM BUILD_FIELDCATLOG.
    WA_FIELDCAT-TABNAME = 'IT_EKKO'.
    WA_FIELDCAT-FIELDNAME = 'EBELN'.
    WA_FIELDCAT-SELTEXT_M = 'PO NO.'.
    APPEND WA_FIELDCAT TO I_FIELDCAT.
    CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'IT_EKKO'.
    WA_FIELDCAT-FIELDNAME = 'AEDAT'.
    WA_FIELDCAT-SELTEXT_M = 'DATE.'.
    APPEND WA_FIELDCAT TO I_FIELDCAT.
    CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'IT_EKKO'.
    WA_FIELDCAT-FIELDNAME = 'BUKRS'.
    WA_FIELDCAT-SELTEXT_M = 'COMPANY CODE'.
    APPEND WA_FIELDCAT TO I_FIELDCAT.
    CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'IT_EKKO'.
    WA_FIELDCAT-FIELDNAME = 'BUKRS'.
    WA_FIELDCAT-SELTEXT_M = 'DOCMENT TYPE'.
    APPEND WA_FIELDCAT TO I_FIELDCAT.
    CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'IT_EKKO'.
    WA_FIELDCAT-FIELDNAME = 'LIFNR'.
    WA_FIELDCAT-NO_OUT = 'X'.
    WA_FIELDCAT-SELTEXT_M = 'VENDOR CODE'.
    APPEND WA_FIELDCAT TO I_FIELDCAT.
    CLEAR WA_FIELDCAT.
    ENDFORM. "BUILD_FIELDCATLOG
    *& Form EVENT_CALL
    we get all events - TOP OF PAGE or USER COMMAND in table v_events
    FORM EVENT_CALL.
    CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
    EXPORTING
    I_LIST_TYPE = 0
    IMPORTING
    ET_EVENTS = V_EVENTS
    EXCEPTIONS
    LIST_TYPE_WRONG = 1
    OTHERS = 2
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    ENDFORM. "EVENT_CALL
    *& Form POPULATE_EVENT
    Events populated for TOP OF PAGE & USER COMAND
    FORM POPULATE_EVENT.
    READ TABLE V_EVENTS INTO WA_EVENT WITH KEY NAME = 'TOP_OF_PAGE'.
    IF SY-SUBRC EQ 0.
    WA_EVENT-FORM = 'TOP_OF_PAGE'.
    MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =
    WA_EVENT-FORM.
    ENDIF.
    READ TABLE V_EVENTS INTO WA_EVENT WITH KEY NAME = 'USER_COMMAND'.
    IF SY-SUBRC EQ 0.
    WA_EVENT-FORM = 'USER_COMMAND'.
    MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =
    WA_EVENT-NAME.
    ENDIF.
    ENDFORM. "POPULATE_EVENT
    *& Form data_retrieval
    retreiving values from the database table ekko
    FORM DATA_RETRIEVAL.
    SELECT EBELN AEDAT BUKRS BSART LIFNR FROM EKKO INTO TABLE IT_EKKO.
    ENDFORM. "data_retrieval
    *& Form bUild_listheader
    text
    -->I_LISTHEADEtext
    FORM BUILD_LISTHEADER USING I_LISTHEADER TYPE SLIS_T_LISTHEADER.
    DATA HLINE TYPE SLIS_LISTHEADER.
    HLINE-INFO = 'this is my first alv pgm'.
    HLINE-TYP = 'H'.
    ENDFORM. "build_listheader
    *& Form display_alv_report
    text
    FORM DISPLAY_ALV_REPORT.
    V_REPID = SY-REPID.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    I_CALLBACK_PROGRAM = V_REPID
    I_CALLBACK_PF_STATUS_SET = ' '
    I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
    I_CALLBACK_TOP_OF_PAGE = 'TOP_OF_PAGE'
    I_GRID_TITLE = I_TITLE_EKKO
    I_GRID_SETTINGS =
    IS_LAYOUT = ALV_LAYOUT
    IT_FIELDCAT = I_FIELDCAT[]
    IT_EXCLUDING =
    IT_SPECIAL_GROUPS =
    IT_SORT =
    IT_FILTER =
    IS_SEL_HIDE =
    i_default = 'ZLAY1'
    I_SAVE = 'A'
    is_variant = i_variant
    IT_EVENTS = V_EVENTS
    TABLES
    T_OUTTAB = IT_EKKO
    EXCEPTIONS
    PROGRAM_ERROR = 1
    OTHERS = 2
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    ENDFORM. "display_alv_report
    *& Form TOP_OF_PAGE
    text
    FORM TOP_OF_PAGE.
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
    IT_LIST_COMMENTARY = IT_LISTHEADER
    i_logo =
    I_END_OF_LIST_GRID =
    ENDFORM. "TOP_OF_PAGE
    *& Form USER_COMMAND
    text
    -->R_UCOMM text
    -->, text
    -->RS_SLEFIELDtext
    FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
    RS_SELFIELD TYPE SLIS_SELFIELD.
    CASE R_UCOMM.
    WHEN '&IC1'.
    READ TABLE IT_EKKO INTO WA_EKKO INDEX RS_SELFIELD-TABINDEX.
    PERFORM BUILD_FIELDCATLOG_EKPO.
    PERFORM EVENT_CALL_EKPO.
    PERFORM POPULATE_EVENT_EKPO.
    PERFORM DATA_RETRIEVAL_EKPO.
    PERFORM BUILD_LISTHEADER_EKPO USING IT_LISTHEADER.
    PERFORM DISPLAY_ALV_EKPO.
    ENDCASE.
    ENDFORM. "user_command
    *& Form BUILD_FIELDCATLOG_EKPO
    text
    FORM BUILD_FIELDCATLOG_EKPO.
    WA_FIELDCAT-TABNAME = 'IT_EKPO'.
    WA_FIELDCAT-FIELDNAME = 'EBELN'.
    WA_FIELDCAT-SELTEXT_M = 'PO NO.'.
    APPEND WA_FIELDCAT TO I_FIELDCAT.
    CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'IT_EKPO'.
    WA_FIELDCAT-FIELDNAME = 'EBELP'.
    WA_FIELDCAT-SELTEXT_M = 'LINE NO'.
    APPEND WA_FIELDCAT TO I_FIELDCAT.
    CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'I_EKPO'.
    WA_FIELDCAT-FIELDNAME = 'MATNR'.
    WA_FIELDCAT-SELTEXT_M = 'MATERIAL NO.'.
    APPEND WA_FIELDCAT TO I_FIELDCAT.
    CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'I_EKPO'.
    WA_FIELDCAT-FIELDNAME = 'MENGE'.
    WA_FIELDCAT-SELTEXT_M = 'QUANTITY'.
    APPEND WA_FIELDCAT TO I_FIELDCAT.
    CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'I_EKPO'.
    WA_FIELDCAT-FIELDNAME = 'MEINS'.
    WA_FIELDCAT-SELTEXT_M = 'UOM'.
    APPEND WA_FIELDCAT TO I_FIELDCAT.
    CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'I_EKPO'.
    WA_FIELDCAT-FIELDNAME = 'NETPR'.
    WA_FIELDCAT-SELTEXT_M = 'PRICE'.
    APPEND WA_FIELDCAT TO I_FIELDCAT.
    CLEAR WA_FIELDCAT.
    ENDFORM. "BUILD_FIELDCATLOG_EKPO
    *& Form event_call_ekpo
    we get all events - TOP OF PAGE or USER COMMAND in table v_events
    FORM EVENT_CALL_EKPO.
    CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
    EXPORTING
    I_LIST_TYPE = 0
    IMPORTING
    ET_EVENTS = V_EVENTS
    EXCEPTIONS
    LIST_TYPE_WRONG = 1
    OTHERS = 2
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    ENDFORM. "event_call_ekpo
    *& Form POPULATE_EVENT
    Events populated for TOP OF PAGE & USER COMAND
    FORM POPULATE_EVENT_EKPO.
    READ TABLE V_EVENTS INTO WA_EVENT WITH KEY NAME = 'TOP_OF_PAGE'.
    IF SY-SUBRC EQ 0.
    WA_EVENT-FORM = 'TOP_OF_PAGE'.
    MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =
    WA_EVENT-FORM.
    ENDIF.
    ENDFORM. "POPULATE_EVENT
    *& Form TOP_OF_PAGE
    text
    FORM F_TOP_OF_PAGE.
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
    IT_LIST_COMMENTARY = IT_LISTHEADER
    i_logo =
    I_END_OF_LIST_GRID =
    ENDFORM. "TOP_OF_PAGE
    *& Form USER_COMMAND
    text
    -->R_UCOMM text
    -->, text
    -->RS_SLEFIELDtext
    *retreiving values from the database table ekko
    FORM DATA_RETRIEVAL_EKPO.
    SELECT EBELN EBELP MATNR MENGE MEINS NETPR FROM EKPO INTO TABLE IT_EKPO.
    ENDFORM.
    FORM BUILD_LISTHEADER_EKPO USING I_LISTHEADER TYPE SLIS_T_LISTHEADER.
    DATA: HLINE1 TYPE SLIS_LISTHEADER.
    HLINE1-TYP = 'H'.
    HLINE1-INFO = 'CHECKING PGM'.
    ENDFORM.
    FORM DISPLAY_ALV_EKPO.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    I_INTERFACE_CHECK = ' '
    I_BYPASSING_BUFFER = ' '
    I_BUFFER_ACTIVE = ' '
    I_CALLBACK_PROGRAM = V_REPID
    I_CALLBACK_PF_STATUS_SET = ' '
    I_CALLBACK_USER_COMMAND = 'F_USER_COMMAND'
    I_CALLBACK_TOP_OF_PAGE = 'TOP_OF_PAGE'
    I_CALLBACK_HTML_TOP_OF_PAGE = ' '
    I_CALLBACK_HTML_END_OF_LIST = ' '
    I_STRUCTURE_NAME =
    I_BACKGROUND_ID = ' '
    I_GRID_TITLE = I_TITLE_EKPO
    I_GRID_SETTINGS =
    IS_LAYOUT =
    IT_FIELDCAT = I_FIELDCAT[]
    IT_EXCLUDING =
    IT_SPECIAL_GROUPS =
    IT_SORT =
    IT_FILTER =
    IS_SEL_HIDE =
    I_DEFAULT =
    I_SAVE = 'A'
    IS_VARIANT =
    IT_EVENTS = V_EVENTS
    TABLES
    T_OUTTAB = IT_EKPO
    EXCEPTIONS
    PROGRAM_ERROR = 1
    OTHERS = 2
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    ENDFORM.
    Regards,
    Sree

  • ALV Grid Report using OOPS

    Hi Friends,
    I have to develop the ALV Grid report using the Classes ie OOPS, as i am new to OOPS and know little bit of ALV,  so it will be little bit tough to develop the object so plz try to solve my query. I'm sending the Functional specs:
    The program should display the list of Purchase orders and Purchase requisitions created for specified materials. The output should be displayed in form of ALV grid. There should be separate ALV Grid for Purchase order and Purchase requisition list. The user should also have an option to save various ALV layouts and should be able to choose the ALV layout on the selection screen.The user should be able to navigate to the relevant document form the ALV grid. (Use hyperlink).
    The output must appear in the same screen.     
    Selection screen fields–
         Material Number
         Creation date (For both, PR and PO)
         Output fields –
              List one –
                  Po Number
                                        Po Item number
                                        Vendor
                                        Date
                                        Material Number
                                        Material Quantity
              List two –
                             PR Number
                                        Material Number
                                        Material Quantity
                                        Release status
                                        Date
                                        Reference
         Tables:  EKPO, EKKO, EBAN
         Transactions: ME23N
    HINT –      Use class - CL_GUI_ALV_GRID
    thnks in advance.....

    Hi,
    Check out these standard reports, they are enough to help you out .
    BCALV_GRID_01
    BCALV_GRID_02
    BCALV_GRID_03
    BCALV_GRID_04
    BCALV_GRID_05
    BCALV_GRID_06
    BCALV_GRID_07
    BCALV_GRID_08
    BCALV_GRID_09
    BCALV_GRID_10
    BCALV_GRID_11
    BCALV_GRID_AND_POPUP
    BCALV_GRID_DEMO
    Regards,
    Amit

  • How to download alv grid output(with field catalog) into excel file format

    Hi all,
    How to download alv grid output(with field catalogs) into excel file format and same file has to download to application server.
    Please help.
    Regards,
    Satya.

    Hi,
    On list where alv is displayed, select export icon( green color -> ),select spread sheet.
    This will display records in Excel sheet.

  • When do we need field catalog merge in ALV

    Hi all,
    When do we actually need fieldcatalog merge in ALV's
    Regards
    Saroja.

    Hi
    When you want the field catalog to be populated directly from the internal table or a structure, you can use this function module. If you are populating the field catalog from an internal table in an include other than your top include, then the include name also has to be passed to the function module.
    reward if helpful
    regards,
    madhu

  • Perform setting OOP ALV for multiple reports using Field Symbols

    Hi, Abapers ... i try to write a programme which using ONE oop ALV but 2 different structure internal table. the last result should be 2 radio button. first button is r_wbs and 2ns r_kpi. r_wbs will display 4 column answer and r_kpi will display 10 columns answer with different column name. i successfully implemented using FIELDS SYMBOLS but the problems i failed to perform customized setting forALV (report's tittle, column name, different layout etc)  for 2 different reports.  this is the programme. Please Give Opinion, simple example will be more helpful. Thanks You Very Much
    *&this report experimental how to print into ONE alv
    *&with 2 diffrent structure internal table
    REPORT  zfiroopalv.
    SELECTION-SCREEN BEGIN OF BLOCK mode WITH FRAME TITLE text-002.
    PARAMETERS r_wbs RADIOBUTTON GROUP mode DEFAULT 'X'.
    PARAMETERS r_kpi RADIOBUTTON GROUP mode.
    SELECTION-SCREEN END OF BLOCK mode.
    CLASS lcl_main DEFINITION.
    PUBLIC SECTION.
    CLASS-DATA: md_wbs TYPE c LENGTH 1.
    METHODS: process,
             write.
    DATA: mdo_data TYPE REF TO data.
    TYPES: BEGIN OF st_wbs,
    rsnum TYPE zmeime002a-rsnum,
    rspos TYPE zmeime002a-rspos,
    a TYPE zmmgitab01-menge,
    b TYPE zmeime002a-bdmng,
    c TYPE zmeime002a-bdmng,
    d TYPE zmeime002a-bdmng,
    e TYPE zmeime002a-bdmng,
    f TYPE zmmgitab01-menge,
    g TYPE zmmgitab01-menge,
    END OF st_wbs.
    TYPES: BEGIN OF st_kpi,
    regio TYPE zmeime002a-regio,
    gsber TYPE zmeime002a-gsber,
    gtext TYPE zmeime002a-gtext,
    x TYPE zmmgitab01-menge,
    y TYPE zmmgitab01-menge,
    z TYPE zmmgitab01-menge,
    END OF st_kpi.
    CLASS-DATA: it_wbs TYPE TABLE OF st_wbs,
                wa_wbs LIKE LINE OF it_wbs.
    CLASS-DATA: it_kpi TYPE TABLE OF st_kpi,
                wa_kpi LIKE LINE OF it_kpi.
    PRIVATE SECTION.
    DATA: set_display_setting TYPE REF TO cl_salv_table.
    DATA: display_settings TYPE REF TO cl_salv_display_settings.
    DATA: salv_table TYPE REF TO cl_salv_table.
    DATA: error TYPE REF TO cx_root.
    DATA: errtext TYPE string.
    ENDCLASS.
    CLASS lcl_kpi DEFINITION INHERITING FROM lcl_main.
    PUBLIC SECTION.
    METHODS: process_kpi.
    PRIVATE SECTION.
    ENDCLASS.
    * C.L.A.S.S lcl_main D.E.F.I.N.I.T.I.O.N
    CLASS lcl_wbs DEFINITION INHERITING FROM lcl_main.
    PUBLIC SECTION.
    METHODS: process_wbs.
    PRIVATE SECTION.
    ENDCLASS.
    * m.a.i.n. .p.r.o.g.r.a.m.
    START-OF-SELECTION.
      DATA: o_main TYPE REF TO lcl_main.
    DATA: p_wbs TYPE c.
    CREATE OBJECT o_main.
      CASE 'X'.
      WHEN r_wbs.
          o_main->md_wbs = 'X'.
      WHEN r_kpi.
          o_main->md_wbs = ' '.
      ENDCASE.
      o_main->process( ).
      o_main->write( ).
    CLASS lcl_main IMPLEMENTATION.
    *ENDMETHOD.
    METHOD process.  " NOTE: public method
    DATA: o_main TYPE REF TO lcl_main,
          o_wbs TYPE REF TO lcl_wbs,
          o_kpi TYPE REF TO lcl_kpi.
    CREATE OBJECT: o_wbs,o_kpi.
      IF ( me->md_wbs = 'X' ).
          CALL METHOD o_wbs->process_wbs( ).  " NOTE: private method
          GET REFERENCE OF me->it_wbs INTO me->mdo_data.
      ELSE.
          CALL METHOD o_kpi->process_kpi( ).  " NOTE: private method
          GET REFERENCE OF me->it_kpi INTO me->mdo_data.
      ENDIF.
    ENDMETHOD.
    METHOD write.
    FIELD-SYMBOLS:
      <lt_outtab>    TYPE table.
      ASSIGN me->mdo_data->* TO <lt_outtab>.
    cl_salv_table=>factory(
    EXPORTING
    list_display = if_salv_c_bool_sap=>false
    IMPORTING
    r_salv_table = salv_table
    CHANGING
    t_table = <lt_outtab>
    salv_table->display( ).
    ENDMETHOD.
    ENDCLASS.
    CLASS lcl_kpi IMPLEMENTATION.
    METHOD process_kpi.
    *********** run some select statement into it_kpi*******
    ENDMETHOD.
    ENDCLASS.
    CLASS lcl_wbs IMPLEMENTATION.
    METHOD process_wbs.
    *********** run some select statement into it_wbs*******
    ENDMETHOD.
    ENDCLASS.

    Hi,
    I had similar requirement wherein I was supposed to display different data using 2 different internal tables on a subscreen area.
    The screen consists of two parts: 1) selection-screen with few input fields and two buttons 2) Subscreen area where the report need to be displayed. This report is displayed based on the button that the user is selecting. For this I have done the following things:
    1. Capture the sy-ucomm when user is clicking on any of the two buttons in PAI. Then perform data fetch operation.
             MODULE USER_COMMAND_9003 INPUT.
                 CASE OK_CODE.
                     WHEN 'DETAIL'.
                       GV_RPT = OK_CODE.
                       PERFORM F_GET_DETAIL_DATA.
                     WHEN 'REPORT'.
                       GV_RPT = OK_CODE.
                       PERFORM F_GET_REPT_DATA.
                   ENDCASE.
             ENDMODULE.                 " USER_COMMAND_9003  INPUT
    2.  Declare two different ALV's with the fieldcat similar to 2 internal tables respectively. Use the above sy-ucomm PBO to call appropriate ALV.
             MODULE DISPLAY_ALV OUTPUT.
               IF GV_RPT EQ 'DETAIL'.
                 PERFORM F_FIELDCAT_DETAIL.
                 PERFORM F_LAYOUT_DETAIL.
                 PERFORM F_EXCLUDE_TOOLBAR_DETAIL.
                 PERFORM F_DISPLAY_ALV_DETAIL.
               ELSEIF GV_RPT EQ 'REPORT'.
                 PERFORM F_FIELDCAT_REPT.
                 PERFORM F_LAYOUT_REPT.
                 PERFORM F_EXCLUDE_TOOLBAR_REPT.
                 PERFORM F_DISPLAY_ALV_REPT.
               ENDIF.
             ENDMODULE.                 " DISPLAY_ALV  OUTPUT
    3. Before displaying ALV you need to free the container and ALV.
    FORM F_DISPLAY_ALV_DETAIL .
    IF GC_CONTAINER_ES IS NOT INITIAL.
        CALL METHOD GC_CONTAINER_ES->FREE
          EXCEPTIONS
            CNTL_ERROR        = 1
            CNTL_SYSTEM_ERROR = 2
            OTHERS            = 3.
        IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                   WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
      ENDIF.
      IF GC_ALV_GRID_ES IS NOT INITIAL.
        CALL METHOD GC_ALV_GRID_ES->FREE
          EXCEPTIONS
            CNTL_ERROR        = 1
            CNTL_SYSTEM_ERROR = 2
            OTHERS            = 3.
        IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                   WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
      ENDIF.
      IF GC_CONTAINER_TB IS NOT INITIAL.
        CALL METHOD GC_CONTAINER_TB->FREE
          EXCEPTIONS
            CNTL_ERROR        = 1
            CNTL_SYSTEM_ERROR = 2
            OTHERS            = 3.
        IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                   WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
      ENDIF.
      IF GC_ALV_GRID_TB IS NOT INITIAL.
        CALL METHOD GC_ALV_GRID_TB->FREE
          EXCEPTIONS
            CNTL_ERROR        = 1
            CNTL_SYSTEM_ERROR = 2
            OTHERS            = 3.
        IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                   WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
      ENDIF.
      CREATE OBJECT GC_CONTAINER_ES
        EXPORTING
          CONTAINER_NAME              = 'CC_9003'
        EXCEPTIONS
          CNTL_ERROR                  = 1
          CNTL_SYSTEM_ERROR           = 2
          CREATE_ERROR                = 3
          LIFETIME_ERROR              = 4
          LIFETIME_DYNPRO_DYNPRO_LINK = 5
          OTHERS                      = 6.
      CREATE OBJECT GC_ALV_GRID_ES
        EXPORTING
          I_PARENT          = GC_CONTAINER_ES
        EXCEPTIONS
          ERROR_CNTL_CREATE = 1
          ERROR_CNTL_INIT   = 2
          ERROR_CNTL_LINK   = 3
          ERROR_DP_CREATE   = 4
          OTHERS            = 5.
      CALL METHOD GC_ALV_GRID_ES->SET_TABLE_FOR_FIRST_DISPLAY
        EXPORTING
          IS_LAYOUT                     = GS_LAYOUT_ES
          IT_TOOLBAR_EXCLUDING          = GT_TOOLBAR_ES
        CHANGING
          IT_OUTTAB                     = GT_ES_REPT
          IT_FIELDCATALOG               = GT_FIELDCAT_ES
        EXCEPTIONS
          INVALID_PARAMETER_COMBINATION = 1
          PROGRAM_ERROR                 = 2
          TOO_MANY_LINES                = 3
          OTHERS                        = 4.
    ENDFORM.                    " F_DISPLAY_ALV_DETAIL
    Similarly define the FORM F_DISPLAY_ALV_REPT.     
    Hope this will be useful for you. If you have any more queries let me know.

  • ALV Display - Error in field catalog

    Hi ,
    I am facing a problem in ALV... Field catalot is not getting populated... I am getting a message field catalog not found...
    Can anyone please help me....... <URGENT DOES NOT EXIST HERE>...
    I am enclosing my code also.. please go thourh it and help it....
    REPORT ZINVENTORY
          LINE-SIZE  120
           LINE-COUNT 64.
          MESSAGE-ID Z2
          NO STANDARD PAGE HEADING..
    type-pools : slis.
    Tables                                                               *
    tables: zasset,
            anla,
            itob,
            equi.
    data: v_repid LIKE sy-repid.
    Selection Screen                                                     *
    SELECTION-SCREEN : BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001 .
    SELECT-OPTIONS : S_bukrs FOR anla-bukrs OBLIGATORY ,
                     S_kostl FOR itob-kostl .
    SELECTION-SCREEN : END OF BLOCK B1 .
    SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-t02.
    PARAMETERS: p_screen RADIOBUTTON GROUP gr1,
                p_list RADIOBUTTON GROUP gr1 DEFAULT 'X'.
    SELECTION-SCREEN END OF BLOCK b2.
    Internal Tables                                                      *
    types: BEGIN OF ty_zasset, " occurs 0,
             equnr  like zasset-equnr,
             ANLN1 LIKE zasset-ANLN1, " Asset number
             ANLN2 LIKE zasset-ANLN2, " Sub Asset number
             BUKRS LIKE zasset-BUKRS, " Company Code
             KOSTL  like zasset-kostl,
             SCANNEDBY type zasset-scannedby,
             SCANNINGDATE type zasset-SCANNINGDATE,
             SCANNINGTIME type zasset-scanningtime,
             UPDATEDATE   type zasset-updatedate,
             UPDATETIME type zasset-updatetime,
           END OF ty_zasset.
    DATA: wa_zasset   TYPE ty_zasset.
    DATA: it_zasset TYPE TABLE OF ty_zasset with header line..
    types: BEGIN OF ty_zasset1, " occurs 0,
            equnr  TYPE equi-equnr,
             ANLN1 LIKE anla-ANLN1, " Asset number
             ANLN2 LIKE anla-ANLN2, " Sub Asset number
             BUKRS LIKE anla-BUKRS, " Company Code
             ernam like anla-ernam,
             erdat like anla-erdat,
            KOSTL  like anlz-kostl,
            SCANNEDBY type zasset-scannedby,
            SCANNINGDATE type zasset-SCANNINGDATE,
            SCANNINGTIME type zasset-scanningtime,
            UPDATEDATE   type zasset-updatedate,
            UPDATETIME type zasset-updatetime,
           END OF ty_zasset1.
    DATA: wa_zasset1   TYPE ty_zasset1.
    DATA: it_zasset1 TYPE TABLE OF ty_zasset1 with header line..
    types: BEGIN OF ty_zasset2, " occurs 0,
             equnr  like itob-equnr,
             ANLNr LIKE itob-ANLNr, " Asset number
             ANLuN LIKE itob-ANLuN, " Sub Asset number
             BUKRS LIKE itob-BUKRS, " Company Code
             timbi like itob-timbi,
             kostl like itob-kostl,
            KOSTL  like anlz-kostl,
            SCANNEDBY type zasset-scannedby,
            SCANNINGDATE type zasset-SCANNINGDATE,
            SCANNINGTIME type zasset-scanningtime,
            UPDATEDATE   type zasset-updatedate,
            UPDATETIME type zasset-updatetime,
           END OF ty_zasset2.
    DATA: wa_zasset2   TYPE ty_zasset2.
    DATA: it_zasset2 TYPE TABLE OF ty_zasset2 with header line..
    types: begin of ty_final , "occurs 0,
            equnr like itob-equnr,
            anln1 like anla-anln1,
            anln2 like anla-anln2,
            bukrs like anla-bukrs,
           ernam
           erdat
            kostl like itob-kostl,
            end of ty_final.
    DATA: wa_final   TYPE ty_final.
    DATA: it_final TYPE TABLE OF ty_final with header line..
    *DATA: it_zasset TYPE TABLE OF ty_zasset.
    *data: it_zasset1 type table of ty_zasset1.
    *data:wa_zasset type ty_zasset.
    *data:wa_zasset1 type ty_zasset1.
    Flags and Variables                                                 *
    DATA : F_ERROR.                   " Flag for No Data
    *pop field cat for f7
    data: V_SYREPID LIKE SY-REPID,
          IT_FLDCAT type slis_t_fieldcat_alv , "with header line,
          wa_fldcat   type slis_fieldcat_alv.
    *DATA : IT_FLDCATS TYPE SLIS_T_FIELDCAT_ALV.
    data: itab_events type slis_t_event,
          wa_events   type slis_alv_event.
    *data: wa_layout type slis_layout_alv.
    DATA : IT_COMMENTS TYPE SLIS_T_LISTHEADER,
           WA_COMMENTS TYPE SLIS_LISTHEADER.
    DATA : IT_SORTINFO TYPE SLIS_T_SORTINFO_ALV,
           WA_SORTINFO TYPE SLIS_SORTINFO_ALV.
    Initialization                                                       *
    initialization.
      SY-REPID = V_REPID.
    At Selection Screen                                                  *
    AT SELECTION-SCREEN.
      PERFORM validation.
    Start Of Selection                                                   *
    start-of-selection.
    perform select_data.
    IF P_LIST = 'X'.
    perform get_field_catalog.
    PERFORM MODIFYFIELDCAT.
    perform get_events.
    perform write_comments.
    perform grid_display.
    *perform list_display.
    ENDIF.
    IF sy-subrc = 0.
       IF p_list = 'X'.
       loop at it_final.
       perform get_events.
       endloop.
       endif.
       endloop.
       else.
    *endif.
    End Of Selection                                                     *
    END-OF-SELECTION.
    *perform display_Recorsds.
    *loop at zasset.
    *&      Form  validation
          text
    -->  p1        text
    <--  p2        text
    FORM validation.
    *Local variables.
      DATA:
            lv_bukrs type anla-bukrs,
            lv_kostl type itob-kostl,
            lv_anln1 TYPE anla-anln1,        "MAterial Number
            lv_anln2 TYPE anla-anln2.
    *Validation for company code
      if not s_bukrs is initial.
        select single bukrs from anla
               into lv_bukrs
               where bukrs in s_bukrs.
        if sy-subrc <> 0.
    *Message used : Invalid company code.
        endif.
      endif    .
    Validation for cost center
      if not s_kostl is initial.
        select single kostl from itob
               into lv_kostl
               where kostl in s_kostl.
        if sy-subrc <> 0.
    *Message used : Invalid company code.
        endif.
      endif  .
    ENDFORM.                    " validation
    *&      Form  display
          text
    -->  p1        text
    <--  p2        text
    FORM display.
      write :/15 it_final-anln1,
      it_final-anln2,
                sy-vline.
    *-bukrs,
           it_zasset-anln1.
    ENDFORM.                    " display
    *&      Form  get_field_catalog
          text
    -->  p1        text
    <--  p2        text
    FORM get_field_catalog.
    *REFRESH IT_FLDCAT.
    *CLEAR IT_FLDCAT.
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
       I_PROGRAM_NAME               = V_REPID
       I_INTERNAL_TABNAME           = 'IT_FINAL'
       I_INCLNAME                   = V_REPID
      I_BYPASSING_BUFFER           =
      I_BUFFER_ACTIVE              =
      CHANGING
        CT_FIELDCAT                  = IT_FLDCAT
    EXCEPTIONS
       INCONSISTENT_INTERFACE       = 1
       PROGRAM_ERROR                = 2
       OTHERS                       = 3
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    ENDFORM.                    " get_field_catalog
    *&      Form  get_events
          text
    -->  p1        text
    <--  p2        text
    FORM get_events.
      WA_COMMENTS-TYP = 'H'.
      WA_COMMENTS-KEY = 'THIS IS THE HEADING.'.
      WA_COMMENTS-INFO = 'LIST OF SALES ORDERS'.
      APPEND WA_COMMENTS TO IT_COMMENTS.
    ENDFORM.                    " get_events
    *&      Form  grid_display
          text
    -->  p1        text
    <--  p2        text
    FORM grid_display.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      I_INTERFACE_CHECK                 = ' '
      I_BYPASSING_BUFFER                =
      I_BUFFER_ACTIVE                   = ' '
       I_CALLBACK_PROGRAM                = v_repid
      I_CALLBACK_PF_STATUS_SET          = ' '
      I_CALLBACK_USER_COMMAND           = ' '
       I_CALLBACK_TOP_OF_PAGE            = 'FIRST PAGE'
      I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
      I_CALLBACK_HTML_END_OF_LIST       = ' '
      I_STRUCTURE_NAME                  =
      I_BACKGROUND_ID                   = ' '
       I_GRID_TITLE                      =  'LIST OF FLIGHT DETAILS'
      I_GRID_SETTINGS                   =
      IS_LAYOUT                         =
       IT_FIELDCAT                       =  it_fldcat
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
      IT_SORT                           =
      IT_FILTER                         =
      IS_SEL_HIDE                       =
      I_DEFAULT                         = 'X'
      I_SAVE                            = ' '
      IS_VARIANT                        =
      IT_EVENTS                         =  itab_events
      IT_EVENT_EXIT                     =
      IS_PRINT                          =
      IS_REPREP_ID                      =
      I_SCREEN_START_COLUMN             = 0
      I_SCREEN_START_LINE               = 0
      I_SCREEN_END_COLUMN               = 0
      I_SCREEN_END_LINE                 = 0
      IT_ALV_GRAPHICS                   =
      IT_ADD_FIELDCAT                   =
      IT_HYPERLINK                      =
      I_HTML_HEIGHT_TOP                 =
      I_HTML_HEIGHT_END                 =
      IT_EXCEPT_QINFO                   =
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER           =
      ES_EXIT_CAUSED_BY_USER            =
      TABLES
        T_OUTTAB                          = it_final
    EXCEPTIONS
       PROGRAM_ERROR                     = 1
       OTHERS                            = 2
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    ENDFORM.                    " grid_display
    *&      Form  write_comments
          text
    -->  p1        text
    <--  p2        text
    FORM write_comments.
      WA_COMMENTS-TYP = 'H'.
      WA_COMMENTS-KEY = 'THIS IS THE HEADING.'.
      WA_COMMENTS-INFO = 'LIST OF SALES ORDERS'.
      APPEND WA_COMMENTS TO IT_COMMENTS.
    ENDFORM.                    " write_comments
    *&      Form  select_data
          text
    -->  p1        text
    <--  p2        text
    FORM select_data.
      clear: it_zasset, it_zasset[].
      select  equnr "bukrs
              anln1
              anln2
              bukrs
              KOSTL
              SCANNEDBY
              SCANNINGDATE
              SCANNINGTIME
              UPDATEDATE
              UPDATETIME
              into table it_zasset "(g_anln1,g_anln2)
              from zasset
              where bukrs = zasset-bukrs..
          and   kostl = zasset-kostl.
      if sy-subrc = 0.
        sort it_zasset by anln1 anln2.
      endif.
    append it_zasset.
      clear it_zasset1.
      select
             equnr
              anln1
              anln2
              bukrs
              ernam
              erdat
             bukrs
             KOSTL
             SCANNEDBY
             SCANNINGDATE
             SCANNINGTIME
             UPDATEDATE
             UPDATETIME
              into table it_zasset1 "(g_anln1,g_anln2)
              from  anla
             where bukrs = it_zasset-bukrs.
      WHERE BUKRS IN S_BUKRS.
    and   kostl = anla-kostl.
      if sy-subrc = 0.
        select equnr
               anlnr
               anlun
               bukrs
               timbi
               kostl
               into table it_zasset2
               from itob
               for all entries in it_zasset1
              where bukrs = it_zasset1-bukrs
               WHERE   anlnr = it_zasset1-anln1.
      endif.
      APPEND IT_ZASSET1.
      IF SY-SUBRC = 0.
    *loop at it_zasset1 into wa_zasset1.
    loop at it_ZASSET1 into wa_zasset1.
    move wa_zasset1-bukrs to wa_final-bukrs.
        move wa_zasset1-anln1 to wa_final-anln1.
        move wa_zasset1-anln2 to wa_final-anln2.
    append wa_final to it_final.
    endloop.
    ENDIF.
    sort it_final.
    *LOOP AT IT_FINAL.
    *ENDLOOP.
    *ENDIF.
    *if sy-subrc = 0.
    *loop at it_zasset into wa_asset.
    *read table it_zasset into wa_asset with key anln2 = wa_asset-anln2
    *binary search.
    *read table it_final into wa_final with key anln2 = wa_final-anln2
    *binary search.
    *if wa_asset-anln2 = wa_final-anln2.
    *write : / 'error'.
    *endif.
    If sy-subrc <> 0.
       f_error = 'X'.
       write :  'No data Exists for the given selection in FA table'.
    else.
       loop at it_final.
         perform display.
       endloop.
    records exits in anla table also.
    endif.
    ENDFORM.                    " select_data
    *&      Form  MODIFYFIELDCAT
          text
    -->  p1        text
    <--  p2        text
    FORM MODIFYFIELDCAT.
      LOOP AT IT_FLDCAT INTO WA_FLDCAT.
         CASE WA_FLDCAT-FIELDNAME.
            WHEN 'EQUNR'.
    WA_FLDCAT-COL_POS = 1.
              WA_FLDCAT-SELTEXT_L = 'aSSET'.
            WHEN 'ANLN1'.
            wa_FLDCAT-KEY = 'X'.
              WA_FLDCAT-COL_POS = 5.
              WA_FLDCAT-SELTEXT_L = 'aSSET'.
            WHEN 'ANLN2'.
              WA_FLDCAT-KEY = 'X'.
              WA_FLDCAT-COL_POS = 6.
            wa_FLDCAT-HOTSPOT = 'X'.
            WHEN 'BUKRS'.
              WA_FLDCAT-CURRENCY = 'INR'.
             WA_FLDCAT-SYMBOL = 'X'.
          ENDCASE.
        MODIFY IT_FLDCAT FROM WA_FLDCAT.
    *IT_FLDCAT-fieldname   = 'EQUNR'.
    IT_FLDCAT-seltext_m   = 'DOCUM_TYPE'.
    IT_FLDCAT-col_pos     = 1.
    IT_FLDCAT-outputlen   = 10.
    IT_FLDCAT-emphasize   = 'X'.
    IT_FLDCAT-key         = 'X'.
    fieldcatalog-do_sum      = 'X'.
    fieldcatalog-no_zero     = 'X'.
    append IT_FLDCAT TO IT_FLDCAT.
    IT_FLDCAT-fieldname   = 'ANLN1'.
    IT_FLDCAT-seltext_m   = 'DOCUM_TYPE'.
    IT_FLDCAT-col_pos     = 1.
    IT_FLDCAT-outputlen   = 10.
    IT_FLDCAT-emphasize   = 'X'.
    IT_FLDCAT-key         = 'X'.
    fieldcatalog-do_sum      = 'X'.
    fieldcatalog-no_zero     = 'X'.
    append IT_FLDCAT TO IT_FLDCAT.
      ENDLOOP.
    ENDFORM.                    " MODIFYFIELDCAT
    *&      Form  list_display
          text
    -->  p1        text
    <--  p2        text
    *FORM list_display.
    *CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
    EXPORTING
      I_INTERFACE_CHECK              = ' '
      I_BUFFER_ACTIVE                = ' '
      I_CALLBACK_PROGRAM             = V_SYREPID
      I_CALLBACK_PF_STATUS_SET       = ' '
      I_CALLBACK_USER_COMMAND        = 'FRM_USER_COMMAND'
      I_STRUCTURE_NAME               =
      IS_LAYOUT                      = wa_layout
      IT_FIELDCAT                    = IT_FLDCAT
      IT_EXCLUDING                   =
      IT_SPECIAL_GROUPS              =
      IT_SORT                        =
      IT_FILTER                      =
      IS_SEL_HIDE                    =
      I_DEFAULT                      = 'X'
      I_SAVE                         = 'A'
      IS_VARIANT                     =
      IT_EVENTS                      = ITAB_EVENTS
      IT_EVENT_EXIT                  =
      IS_PRINT                       =
      IS_REPREP_ID                   =
      I_SCREEN_START_COLUMN          = 0
      I_SCREEN_START_LINE            = 0
      I_SCREEN_END_COLUMN            = 0
      I_SCREEN_END_LINE              = 0
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER        =
      ES_EXIT_CAUSED_BY_USER         =
    TABLES
       T_OUTTAB                       = IT_FINAL
    EXCEPTIONS
      PROGRAM_ERROR                  = 1
      OTHERS                         = 2
    *IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    *ENDIF.
    *ENDFORM.                    " list_display
    Edited by: Craig Cmehil on Jul 18, 2008 10:01 AM

    The problem is with this...
    types: begin of ty_final , "occurs 0,
    equnr like itob-equnr,
    anln1 like anla-anln1,
    anln2 like anla-anln2,
    bukrs like anla-bukrs,
    ernam
    erdat
    kostl like itob-kostl,
    end of ty_final.
    DATA: wa_final TYPE ty_final.
    DATA: it_final TYPE TABLE OF ty_final with header line.
    when you are using Fieldcatalog merge you have to avoid using the TYPES Declaration of the internal table.
    Instead of that you can do this
    data: begin of it_final occurs 0,
    equnr like itob-equnr,
    anln1 like anla-anln1,
    anln2 like anla-anln2,
    bukrs like anla-bukrs,
    ernam
    erdat
    kostl like itob-kostl,
            end of it_final.

  • Interactive ALV list Report Using OOPS

    Hi Experts!!
    I would like create secondary list using ABAP OPPS (Events).
    Anybody can give me idea how to do that .
    On clicking of perticurar row + column. Secondary list should be displayed.
    Please do not suggest ALV Grid.
    I know how to do it with ALV Grid using Events.
    Thanks
    Anee

    Hi
    *"Table declarations...................................................
    TABLES:
    EKKO, " Purchasing Document Header
    CDHDR, " Change document header
    SSCRFIELDS. " Fields on selection screens
    *"Selection screen elements............................................
    SELECT-OPTIONS:
    S_EBELN FOR EKKO-EBELN, " Purchasing Document Number
    S_LIFNR FOR EKKO-LIFNR, " Vendor's account number
    S_EKGRP FOR EKKO-EKGRP, " Purchasing group
    S_BEDAT FOR EKKO-BEDAT, " Purchasing Document Date
    S_UDATE FOR CDHDR-UDATE. " Creation date of the change
    " document
    *" Data declarations...................................................
    Field String to hold Purchase Document Number *
    DATA:
    BEGIN OF FS_EBELN,
    EBELN(90) TYPE C, " Purchase Document Number
    ERNAM TYPE EKKO-ERNAM, " Name of Person who Created
    " the Object
    LIFNR TYPE EKKO-LIFNR, " Vendor's account number
    EKGRP TYPE EKKO-EKGRP, " Purchasing group
    BEDAT TYPE EKKO-BEDAT, " Purchasing Document Date
    END OF FS_EBELN,
    Field String to hold Purchase Document Header *
    BEGIN OF FS_EKKO,
    EBELN TYPE EKKO-EBELN, " Purchasing Document Number
    ERNAM TYPE EKKO-ERNAM, " Name of Person who Created the
    " Object
    LIFNR TYPE EKKO-LIFNR, " Vendor's account number
    EKGRP TYPE EKKO-EKGRP, " Purchasing group
    BEDAT TYPE EKKO-BEDAT, " Purchasing Document Date
    END OF FS_EKKO,
    Field String to hold Account Number and name of the Vendor *
    BEGIN OF FS_LFA1,
    LIFNR TYPE LFA1-LIFNR, " Account Number of Vendor
    NAME1 TYPE LFA1-NAME1, " Name1
    END OF FS_LFA1,
    Field String to hold Change date and the name of the user *
    BEGIN OF FS_CDHDR,
    OBJECTCLAS TYPE CDHDR-OBJECTCLAS, " Object Class
    OBJECTID TYPE CDHDR-OBJECTID, " Object value
    CHANGENR TYPE CDHDR-CHANGENR, " Document change number
    USERNAME TYPE CDHDR-USERNAME, " User name
    UDATE TYPE CDHDR-UDATE, " Creation date of the change
    " document
    END OF FS_CDHDR,
    Field String to hold Change document items *
    BEGIN OF FS_CDPOS,
    OBJECTCLAS TYPE CDPOS-OBJECTCLAS," Object class
    OBJECTID(10) TYPE C, " Object Value
    CHANGENR TYPE CDPOS-CHANGENR, " Document change number
    TABNAME TYPE CDPOS-TABNAME, " Table Name
    FNAME TYPE CDPOS-FNAME, " Field Name
    VALUE_NEW TYPE CDPOS-VALUE_NEW, " New contents of changed field
    VALUE_OLD TYPE CDPOS-VALUE_OLD, " Old contents of changed field
    END OF FS_CDPOS,
    Field String to hold Date Element Name *
    BEGIN OF FS_DATAELE,
    TABNAME TYPE DD03L-TABNAME, " Table Name
    FIELDNAME TYPE DD03L-FIELDNAME, " Field Name
    ROLLNAME TYPE DD03L-ROLLNAME, " Data element (semantic domain)
    END OF FS_DATAELE,
    Field String to hold Short Text of the Date Element *
    BEGIN OF FS_TEXT,
    ROLLNAME TYPE DD04T-ROLLNAME, " Data element (semantic domain)
    DDTEXT TYPE DD04T-DDTEXT, " Short Text Describing R/3
    " Repository Objects
    END OF FS_TEXT,
    Field String to hold data to be displayed on the ALV grid *
    BEGIN OF FS_OUTTAB,
    EBELN TYPE EKKO-EBELN, " Purchasing Document Number
    ERNAM TYPE EKKO-ERNAM, " Name of Person who Created the
    " Object
    LIFNR TYPE EKKO-LIFNR, " Vendor's account number
    EKGRP TYPE EKKO-EKGRP, " Purchasing group
    BEDAT TYPE EKKO-BEDAT, " Purchasing Document Date
    WERKS TYPE LFA1-WERKS, " Plant
    NAME1 TYPE LFA1-NAME1, " Name1
    USERNAME TYPE CDHDR-USERNAME, " User name
    UDATE TYPE CDHDR-UDATE, " Creation date of the change
    " document
    DDTEXT TYPE DD04T-DDTEXT, " Short Text Describing R/3
    " Repository Objects
    VALUE_NEW TYPE CDPOS-VALUE_NEW, " New contents of changed field
    VALUE_OLD TYPE CDPOS-VALUE_OLD, " Old contents of changed field
    END OF FS_OUTTAB,
    Internal table to hold Purchase Document Number *
    T_EBELN LIKE STANDARD TABLE
    OF FS_EBELN,
    Internal table to hold Purchase Document Header *
    T_EKKO LIKE STANDARD TABLE
    OF FS_EKKO,
    Temp Internal table to hold Purchase Document Header *
    T_EKKO_TEMP LIKE STANDARD TABLE
    OF FS_EKKO,
    Internal table to hold Account number and Name of the Vendor *
    T_LFA1 LIKE STANDARD TABLE
    OF FS_LFA1,
    Internal Table to hold Change date and the name of the user *
    T_CDHDR LIKE STANDARD TABLE
    OF FS_CDHDR,
    Internal Table to hold Change document items *
    T_CDPOS LIKE STANDARD TABLE
    OF FS_CDPOS,
    Temp. Internal Table to hold Change document items *
    T_CDPOS_TEMP LIKE STANDARD TABLE
    OF FS_CDPOS,
    Internal Table to hold Data Element Name *
    T_DATAELE LIKE STANDARD TABLE
    OF FS_DATAELE,
    Temp. Internal Table to hold Data Element Name *
    T_DATAELE_TEMP LIKE STANDARD TABLE
    OF FS_DATAELE,
    Internal Table to hold Short Text of the Date Element *
    T_TEXT LIKE STANDARD TABLE
    OF FS_TEXT,
    Internal Table to hold data to be displayed on the ALV grid *
    T_OUTTAB LIKE STANDARD TABLE
    OF FS_OUTTAB.
    C L A S S D E F I N I T I O N *
    CLASS LCL_EVENT_HANDLER DEFINITION DEFERRED.
    *" Data declarations...................................................
    Work variables *
    DATA:
    W_EBELN TYPE EKKO-EBELN, " Purchasing Document Number
    W_LIFNR TYPE EKKO-LIFNR, " Vendor's account number
    W_EKGRP TYPE EKKO-EKGRP, " Purchasing group
    W_VALUE TYPE EKKO-EBELN, " Reflected Value
    W_SPACE VALUE ' ', " Space
    W_FLAG TYPE I, " Flag Variable
    W_VARIANT TYPE DISVARIANT, " Variant
    *--- ALV Grid
    W_GRID TYPE REF TO CL_GUI_ALV_GRID,
    *--- Event Handler
    W_EVENT_CLICK TYPE REF TO LCL_EVENT_HANDLER,
    *--- Field catalog table
    T_FIELDCAT TYPE LVC_T_FCAT.
    AT SELECTION-SCREEN EVENT *
    AT SELECTION-SCREEN ON S_EBELN.
    Subroutine to validate Purchase Document Number.
    PERFORM VALIDATE_PD_NUM.
    AT SELECTION-SCREEN ON S_LIFNR.
    Subroutine to validate Vendor Number.
    PERFORM VALIDATE_VEN_NUM.
    AT SELECTION-SCREEN ON S_EKGRP.
    Subroutine to validate Purchase Group.
    PERFORM VALIDATE_PUR_GRP.
    START-OF-SELECTION EVENT *
    START-OF-SELECTION.
    Subroutine to select all Purchase orders.
    PERFORM SELECT_PO.
    CHECK W_FLAG EQ 0.
    Subroutine to select Object values.
    PERFORM SELECT_OBJ_ID.
    CHECK W_FLAG EQ 0.
    Subroutine to select Changed values.
    PERFORM SELECT_CHANGED_VALUE.
    CHECK W_FLAG EQ 0.
    Subroutine to Select Purchase Orders.
    PERFORM SELECT_PUR_DOC.
    Subroutine to select Vendor Details.
    PERFORM SELECT_VENDOR.
    Subroutine to select Text for the Changed values.
    PERFORM DESCRIPTION.
    END-OF-SELECTION EVENT *
    END-OF-SELECTION.
    IF NOT T_EKKO IS INITIAL.
    Subroutine to populate the Output Table.
    PERFORM FILL_OUTTAB.
    Subroutine to build Field Catalog.
    PERFORM PREPARE_FIELD_CATALOG CHANGING T_FIELDCAT.
    CALL SCREEN 100.
    ENDIF. " IF NOT T_EKKO...
    CLASS LCL_EVENT_HANDLER DEFINITION
    Defining Class which handles events
    CLASS LCL_EVENT_HANDLER DEFINITION .
    PUBLIC SECTION .
    METHODS:
    HANDLE_HOTSPOT_CLICK
    FOR EVENT HOTSPOT_CLICK OF CL_GUI_ALV_GRID
    IMPORTING E_ROW_ID E_COLUMN_ID.
    ENDCLASS. " LCL_EVENT_HANDLER DEFINITION
    CLASS LCL_EVENT_HANDLER IMPLEMENTATION
    Implementing the Class which can handle events
    CLASS LCL_EVENT_HANDLER IMPLEMENTATION .
    *---Handle Double Click
    METHOD HANDLE_HOTSPOT_CLICK .
    Subroutine to get the HotSpot Cell information.
    PERFORM GET_CELL_INFO.
    SET PARAMETER ID 'BES' FIELD W_VALUE.
    CALL TRANSACTION 'ME23N'.
    ENDMETHOD. " HANDLE_HOTSPOT_CLICK
    ENDCLASS. " LCL_EVENT_HANDLER
    *& Module STATUS_0100 OUTPUT
    PBO Event
    MODULE STATUS_0100 OUTPUT.
    SET PF-STATUS 'OOPS'.
    SET TITLEBAR 'TIT'.
    Subroutine to fill the Variant Structure
    PERFORM FILL_VARIANT.
    IF W_GRID IS INITIAL.
    CREATE OBJECT W_GRID
    EXPORTING
    I_SHELLSTYLE = 0
    I_LIFETIME =
    I_PARENT = CL_GUI_CONTAINER=>SCREEN0
    I_APPL_EVENTS =
    I_PARENTDBG =
    I_APPLOGPARENT =
    I_GRAPHICSPARENT =
    I_NAME =
    I_FCAT_COMPLETE = SPACE
    EXCEPTIONS
    ERROR_CNTL_CREATE = 1
    ERROR_CNTL_INIT = 2
    ERROR_CNTL_LINK = 3
    ERROR_DP_CREATE = 4
    OTHERS = 5.
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF. " IF SY-SUBRC <> 0
    CALL METHOD W_GRID->SET_TABLE_FOR_FIRST_DISPLAY
    EXPORTING
    I_BUFFER_ACTIVE =
    I_BYPASSING_BUFFER =
    I_CONSISTENCY_CHECK =
    I_STRUCTURE_NAME =
    IS_VARIANT = W_VARIANT
    I_SAVE = 'A'
    I_DEFAULT = 'X'
    IS_LAYOUT =
    IS_PRINT =
    IT_SPECIAL_GROUPS =
    IT_TOOLBAR_EXCLUDING =
    IT_HYPERLINK =
    IT_ALV_GRAPHICS =
    IT_EXCEPT_QINFO =
    IR_SALV_ADAPTER =
    CHANGING
    IT_OUTTAB = T_OUTTAB
    IT_FIELDCATALOG = T_FIELDCAT
    IT_SORT =
    IT_FILTER =
    EXCEPTIONS
    INVALID_PARAMETER_COMBINATION = 1
    PROGRAM_ERROR = 2
    TOO_MANY_LINES = 3
    OTHERS = 4
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF. " IF SY-SUBRC <> 0.
    ENDIF. " IF W_GRID IS INITIAL
    CREATE OBJECT W_EVENT_CLICK.
    SET HANDLER W_EVENT_CLICK->HANDLE_HOTSPOT_CLICK FOR W_GRID.
    ENDMODULE. " STATUS_0100 OUTPUT
    *& Module USER_COMMAND_0100 INPUT
    PAI Event
    MODULE USER_COMMAND_0100 INPUT.
    CASE SY-UCOMM.
    WHEN 'BACK'.
    LEAVE TO SCREEN 0.
    WHEN 'EXIT'.
    LEAVE PROGRAM.
    WHEN 'CANCEL'.
    LEAVE TO SCREEN 0.
    ENDCASE.
    ENDMODULE. " USER_COMMAND_0100 INPUT
    *& Form PREPARE_FIELD_CATALOG
    Subroutine to build the Field catalog
    <--P_T_FIELDCAT Field Catalog Table
    FORM PREPARE_FIELD_CATALOG CHANGING PT_FIELDCAT TYPE LVC_T_FCAT .
    DATA LS_FCAT TYPE LVC_S_FCAT.
    Purchasing group...
    LS_FCAT-FIELDNAME = 'EKGRP'.
    LS_FCAT-REF_TABLE = 'EKKO'.
    LS_FCAT-INTTYPE = 'C'.
    LS_FCAT-OUTPUTLEN = '10'.
    APPEND LS_FCAT TO PT_FIELDCAT.
    CLEAR LS_FCAT.
    Purchasing Document Number...
    LS_FCAT-FIELDNAME = 'EBELN'.
    LS_FCAT-REF_TABLE = 'EKKO' .
    LS_FCAT-EMPHASIZE = 'C411'.
    LS_FCAT-INTTYPE = 'C'.
    LS_FCAT-OUTPUTLEN = '10'.
    LS_FCAT-HOTSPOT = 'X'.
    APPEND LS_FCAT TO PT_FIELDCAT .
    CLEAR LS_FCAT .
    Name of Person who Created the Object...
    LS_FCAT-FIELDNAME = 'ERNAM'.
    LS_FCAT-REF_TABLE = 'EKKO'.
    LS_FCAT-OUTPUTLEN = '15' .
    APPEND LS_FCAT TO PT_FIELDCAT.
    CLEAR LS_FCAT.
    Purchasing Document Date...
    LS_FCAT-FIELDNAME = 'BEDAT'.
    LS_FCAT-REF_TABLE = 'EKKO'.
    LS_FCAT-INTTYPE = 'C'.
    LS_FCAT-OUTPUTLEN = '10'.
    APPEND LS_FCAT TO PT_FIELDCAT.
    CLEAR LS_FCAT.
    Vendor's account number...
    LS_FCAT-FIELDNAME = 'LIFNR'.
    LS_FCAT-REF_TABLE = 'EKKO'.
    LS_FCAT-INTTYPE = 'C'.
    LS_FCAT-OUTPUTLEN = '10'.
    APPEND LS_FCAT TO PT_FIELDCAT.
    CLEAR LS_FCAT.
    Account Number of Vendor or Creditor...
    LS_FCAT-FIELDNAME = 'NAME1'.
    LS_FCAT-REF_TABLE = 'LFA1'.
    LS_FCAT-INTTYPE = 'C'.
    LS_FCAT-OUTPUTLEN = '10'.
    LS_FCAT-COLTEXT = 'Vendor Name'(001).
    LS_FCAT-SELTEXT = 'Vendor Name'(001).
    APPEND LS_FCAT TO PT_FIELDCAT.
    CLEAR LS_FCAT.
    Creation date of the change document...
    LS_FCAT-FIELDNAME = 'UDATE'.
    LS_FCAT-REF_TABLE = 'CDHDR'.
    LS_FCAT-INTTYPE = 'C'.
    LS_FCAT-OUTPUTLEN = '10'.
    LS_FCAT-COLTEXT = 'Change Date'(002).
    LS_FCAT-SELTEXT = 'Change Date'(002).
    APPEND LS_FCAT TO PT_FIELDCAT.
    CLEAR LS_FCAT.
    User name of the person responsible in change document...
    LS_FCAT-FIELDNAME = 'USERNAME'.
    LS_FCAT-REF_TABLE = 'CDHDR'.
    LS_FCAT-INTTYPE = 'C'.
    LS_FCAT-OUTPUTLEN = '10'.
    LS_FCAT-COLTEXT = 'Modified by'(003).
    LS_FCAT-SELTEXT = 'Modified by'(003).
    APPEND LS_FCAT TO PT_FIELDCAT.
    CLEAR LS_FCAT.
    Short Text Describing R/3 Repository Objects...
    LS_FCAT-FIELDNAME = 'DDTEXT'.
    LS_FCAT-REF_TABLE = 'DD04T'.
    LS_FCAT-INTTYPE = 'C'.
    LS_FCAT-OUTPUTLEN = '15'.
    APPEND LS_FCAT TO PT_FIELDCAT.
    CLEAR LS_FCAT.
    Old contents of changed field...
    LS_FCAT-FIELDNAME = 'VALUE_OLD'.
    LS_FCAT-REF_TABLE = 'CDPOS'.
    LS_FCAT-INTTYPE = 'C'.
    LS_FCAT-OUTPUTLEN = '12'.
    APPEND LS_FCAT TO PT_FIELDCAT.
    CLEAR LS_FCAT.
    New contents of changed field...
    LS_FCAT-FIELDNAME = 'VALUE_NEW'.
    LS_FCAT-REF_TABLE = 'CDPOS'.
    LS_FCAT-INTTYPE = 'C'.
    LS_FCAT-OUTPUTLEN = '12'.
    APPEND LS_FCAT TO PT_FIELDCAT.
    CLEAR LS_FCAT.
    ENDFORM. " PREPARE_FIELD_CATALOG
    *& Form SELECT_PO
    Subroutine to select all the Purchase Orders
    There are no interface parameters to be passed to this subroutine.
    FORM SELECT_PO .
    SELECT EBELN " Purchasing Document Number
    ERNAM " Name of Person who Created
    " the Object
    LIFNR " Vendor's account number
    EKGRP " Purchasing group
    BEDAT " Purchasing Document Date
    FROM EKKO
    PACKAGE SIZE 10000
    APPENDING TABLE T_EBELN
    WHERE EBELN IN S_EBELN
    AND BEDAT IN S_BEDAT.
    ENDSELECT.
    IF SY-SUBRC NE 0.
    W_FLAG = 1.
    MESSAGE S401(M8).
    ENDIF. " IF SY-SUBRC NE 0
    ENDFORM. " SELECT_PO
    *& Form SELECT_OBJ_ID
    Subroutine to select Object ID
    There are no interface parameters to be passed to this subroutine.
    FORM SELECT_OBJ_ID .
    IF NOT T_EBELN IS INITIAL.
    SELECT OBJECTCLAS " Object Class
    OBJECTID " Object value
    CHANGENR " Document change number
    USERNAME " User name
    UDATE " Creation date
    FROM CDHDR
    INTO TABLE T_CDHDR
    FOR ALL ENTRIES IN T_EBELN
    WHERE OBJECTID EQ T_EBELN-EBELN
    AND UDATE IN S_UDATE
    AND TCODE IN ('ME21N','ME22N','ME23N').
    ENDSELECT.
    IF SY-SUBRC NE 0.
    W_FLAG = 1.
    MESSAGE S833(M8) WITH 'Header Not Found'(031).
    ENDIF. " IF SY-SUBRC NE 0.
    ENDIF. " IF NOT T_EBELN IS INITIAL
    ENDFORM. " SELECT_OBJ_ID
    *& Form SELECT_CHANGED_VALUE
    Subroutine to select Changed Values
    There are no interface parameters to be passed to this subroutine.
    FORM SELECT_CHANGED_VALUE .
    IF NOT T_CDHDR IS INITIAL.
    SELECT OBJECTCLAS " Object class
    OBJECTID " Object value
    CHANGENR " Document change number
    TABNAME " Table Name
    FNAME " Field Name
    VALUE_NEW " New contents of changed field
    VALUE_OLD " Old contents of changed field
    FROM CDPOS
    PACKAGE SIZE 10000
    APPENDING TABLE T_CDPOS
    FOR ALL ENTRIES IN T_CDHDR
    WHERE OBJECTCLAS EQ T_CDHDR-OBJECTCLAS
    AND OBJECTID EQ T_CDHDR-OBJECTID
    AND CHANGENR EQ T_CDHDR-CHANGENR.
    ENDSELECT.
    IF SY-SUBRC NE 0.
    W_FLAG = 1.
    MESSAGE S833(M8) WITH 'Item Not Found'(032).
    ENDIF. " IF SY-SUBRC NE 0.
    ENDIF. " IF NOT T_CDHDR IS INITIAL
    T_CDPOS_TEMP[] = T_CDPOS[].
    ENDFORM. " SELECT_CHANGED_VALUE
    *& Form SELECT_PUR_DOC
    Subroutine to select Purchase Order Details
    There are no interface parameters to be passed to this subroutine.
    FORM SELECT_PUR_DOC .
    IF NOT T_CDPOS IS INITIAL.
    SORT T_EBELN BY EBELN.
    LOOP AT T_CDPOS INTO FS_CDPOS.
    READ TABLE T_EBELN INTO FS_EBELN WITH KEY EBELN =
    FS_CDPOS-OBJECTID BINARY SEARCH.
    IF SY-SUBRC NE 0.
    DELETE TABLE T_EBELN FROM FS_EBELN.
    ENDIF. " IF SY-SUBRC NE 0.
    ENDLOOP. " LOOP AT T_CDPOS...
    LOOP AT T_EBELN INTO FS_EBELN.
    MOVE FS_EBELN-EBELN TO FS_EKKO-EBELN.
    MOVE FS_EBELN-ERNAM TO FS_EKKO-ERNAM.
    MOVE FS_EBELN-LIFNR TO FS_EKKO-LIFNR.
    MOVE FS_EBELN-EKGRP TO FS_EKKO-EKGRP.
    MOVE FS_EBELN-BEDAT TO FS_EKKO-BEDAT.
    APPEND FS_EKKO TO T_EKKO.
    ENDLOOP. " LOOP AT T_EBELN...
    T_EKKO_TEMP[] = T_EKKO[].
    ENDIF. " IF NOT T_CDPOS IS INITIAL
    ENDFORM. " SELECT_PUR_DOC
    *& Form SELECT_VENDOR
    Subroutine to select Vendor details
    There are no interface parameters to be passed to this subroutine.
    FORM SELECT_VENDOR .
    IF NOT T_EKKO IS INITIAL.
    SORT T_EKKO_TEMP BY LIFNR.
    DELETE ADJACENT DUPLICATES FROM T_EKKO_TEMP COMPARING LIFNR.
    SELECT LIFNR " Account Number of Vendor or
    " Creditor
    NAME1 " Name 1
    FROM LFA1
    INTO TABLE T_LFA1
    FOR ALL ENTRIES IN T_EKKO_TEMP
    WHERE LIFNR EQ T_EKKO_TEMP-LIFNR.
    IF SY-SUBRC NE 0.
    MESSAGE S002(M8) WITH 'Master Details'(033).
    ENDIF. " IF SY-SUBRC NE 0.
    ENDIF. " IF NOT T_EKKO IS INITIAL
    ENDFORM. " SELECT_VENDOR
    *& Form DESCRIPTION
    Subroutine to get the description
    There are no interface parameters to be passed to this subroutine.
    FORM DESCRIPTION .
    IF NOT T_CDPOS IS INITIAL.
    SORT T_CDPOS_TEMP BY TABNAME FNAME.
    DELETE ADJACENT DUPLICATES FROM T_CDPOS_TEMP COMPARING TABNAME FNAME
    SELECT TABNAME " Table Name
    FIELDNAME " Field Name
    ROLLNAME " Data element
    FROM DD03L
    INTO TABLE T_DATAELE
    FOR ALL ENTRIES IN T_CDPOS_TEMP
    WHERE TABNAME EQ T_CDPOS_TEMP-TABNAME
    AND FIELDNAME EQ T_CDPOS_TEMP-FNAME.
    IF NOT T_DATAELE IS INITIAL.
    T_DATAELE_TEMP[] = T_DATAELE[].
    SORT T_DATAELE_TEMP BY ROLLNAME.
    DELETE ADJACENT DUPLICATES FROM T_DATAELE_TEMP COMPARING ROLLNAME.
    SELECT ROLLNAME " Data element
    DDTEXT " Short Text Describing R/3
    " Repository Objects
    FROM DD04T
    INTO TABLE T_TEXT
    FOR ALL ENTRIES IN T_DATAELE_TEMP
    WHERE ROLLNAME EQ T_DATAELE_TEMP-ROLLNAME
    AND DDLANGUAGE EQ SY-LANGU.
    IF SY-SUBRC NE 0.
    EXIT.
    ENDIF. " IF SY-SUBRC NE 0.
    ENDIF. " IF NOT T_DATAELE IS INITIAL.
    ENDIF. " IF NOT T_CDPOS IS INITIAL.
    ENDFORM. " DESCRIPTION
    *& Form FILL_OUTTAB
    Subroutine to populate the Outtab
    There are no interface parameters to be passed to this subroutine.
    FORM FILL_OUTTAB .
    SORT T_CDHDR BY OBJECTCLAS OBJECTID CHANGENR.
    SORT T_EKKO BY EBELN.
    SORT T_LFA1 BY LIFNR.
    SORT T_DATAELE BY TABNAME FIELDNAME.
    SORT T_TEXT BY ROLLNAME.
    LOOP AT T_CDPOS INTO FS_CDPOS.
    READ TABLE T_CDHDR INTO FS_CDHDR WITH KEY
    OBJECTCLAS = FS_CDPOS-OBJECTCLAS
    OBJECTID = FS_CDPOS-OBJECTID
    CHANGENR = FS_CDPOS-CHANGENR
    BINARY SEARCH.
    IF SY-SUBRC EQ 0.
    MOVE FS_CDHDR-USERNAME TO FS_OUTTAB-USERNAME.
    MOVE FS_CDHDR-UDATE TO FS_OUTTAB-UDATE.
    READ TABLE T_EKKO INTO FS_EKKO WITH KEY
    EBELN = FS_CDHDR-OBJECTID
    BINARY SEARCH.
    IF SY-SUBRC EQ 0.
    MOVE FS_EKKO-EBELN TO FS_OUTTAB-EBELN.
    MOVE FS_EKKO-ERNAM TO FS_OUTTAB-ERNAM.
    MOVE FS_EKKO-LIFNR TO FS_OUTTAB-LIFNR.
    MOVE FS_EKKO-EKGRP TO FS_OUTTAB-EKGRP.
    MOVE FS_EKKO-BEDAT TO FS_OUTTAB-BEDAT.
    READ TABLE T_LFA1 INTO FS_LFA1 WITH KEY
    LIFNR = FS_EKKO-LIFNR
    BINARY SEARCH.
    IF SY-SUBRC EQ 0.
    MOVE FS_LFA1-NAME1 TO FS_OUTTAB-NAME1.
    ENDIF. " IF SY-SUBRC EQ 0.
    ENDIF. " IF SY-SUBRC EQ 0.
    ENDIF. " IF SY-SUBRC EQ 0.
    MOVE FS_CDPOS-VALUE_NEW TO FS_OUTTAB-VALUE_NEW.
    MOVE FS_CDPOS-VALUE_OLD TO FS_OUTTAB-VALUE_OLD.
    READ TABLE T_DATAELE INTO FS_DATAELE WITH KEY
    TABNAME = FS_CDPOS-TABNAME
    FIELDNAME = FS_CDPOS-FNAME
    BINARY SEARCH.
    IF SY-SUBRC EQ 0.
    READ TABLE T_TEXT INTO FS_TEXT WITH KEY
    ROLLNAME = FS_DATAELE-ROLLNAME
    BINARY SEARCH.
    IF SY-SUBRC EQ 0.
    MOVE FS_TEXT-DDTEXT TO FS_OUTTAB-DDTEXT.
    ENDIF. " IF SY-SUBRC EQ 0.
    ENDIF. " IF SY-SUBRC EQ 0.
    APPEND FS_OUTTAB TO T_OUTTAB.
    CLEAR FS_OUTTAB.
    ENDLOOP.
    ENDFORM. " FILL_OUTTAB
    *& Form GET_CELL_INFO
    Subroutine to get the Cell Information
    --> W_VALUE Holds the value of Hotspot clicked
    FORM GET_CELL_INFO .
    CALL METHOD W_GRID->GET_CURRENT_CELL
    IMPORTING
    E_ROW =
    E_VALUE = W_VALUE
    E_COL =
    ES_ROW_ID =
    ES_COL_ID =
    ES_ROW_NO =
    ENDFORM. " GET_CELL_INFO
    *& Form VALIDATE_PD_NUM
    Subroutine to validate Purchase Document Number
    There are no interface parameters to be passed to this subroutine.
    FORM VALIDATE_PD_NUM .
    IF NOT S_EBELN[] IS INITIAL.
    SELECT EBELN " Purchase Document Number
    FROM EKKO
    INTO W_EBELN
    UP TO 1 ROWS
    WHERE EBELN IN S_EBELN.
    ENDSELECT.
    IF SY-SUBRC NE 0.
    CLEAR SSCRFIELDS-UCOMM.
    MESSAGE E717(M8).
    ENDIF. " IF SY-SUBRC NE 0
    ENDIF. " IF NOT S_EBELN[]...
    ENDFORM. " VALIDATE_PD_NUM
    *& Form VALIDATE_VEN_NUM
    Subroutine to validate Vendor Number
    There are no interface parameters to be passed to this subroutine.
    FORM VALIDATE_VEN_NUM .
    IF NOT S_LIFNR[] IS INITIAL.
    SELECT LIFNR " Vendor Number
    FROM LFA1
    INTO W_LIFNR
    UP TO 1 ROWS
    WHERE LIFNR IN S_LIFNR.
    ENDSELECT.
    IF SY-SUBRC NE 0.
    CLEAR SSCRFIELDS-UCOMM.
    MESSAGE E002(M8) WITH W_SPACE.
    ENDIF. " IF SY-SUBRC NE 0
    ENDIF. " IF NOT S_LIFNR[]...
    ENDFORM. " VALIDATE_VEN_NUM
    *& Form VALIDATE_PUR_GRP
    Subroutine to validate the Purchase Group
    There are no interface parameters to be passed to this subroutine.
    FORM VALIDATE_PUR_GRP .
    IF NOT S_EKGRP[] IS INITIAL.
    SELECT EKGRP " Purchase Group
    FROM T024
    INTO W_EKGRP
    UP TO 1 ROWS
    WHERE EKGRP IN S_EKGRP.
    ENDSELECT.
    IF SY-SUBRC NE 0.
    CLEAR SSCRFIELDS-UCOMM.
    MESSAGE E622(M8) WITH W_SPACE.
    ENDIF. " IF SY-SUBRC NE 0
    ENDIF. " IF NOT S_EKFRP[]...
    ENDFORM. " VALIDATE_PUR_GRP
    *& Form FILL_VARIANT
    Subroutine to fill the Variant Structure
    There are no interface parameters to be passed to this subroutine
    FORM FILL_VARIANT .
    Filling the Variant structure
    W_VARIANT-REPORT = SY-REPID.
    W_VARIANT-USERNAME = SY-UNAME.
    ENDFORM. " FILL_VARIANT
    with regards,
    Hema SUndara.

  • Development of alv tree report using classes from basics

    Hi,
    Need a simple ALV tree report by showing the reason for why we are using the classse so that i can build a ALV report in the same manner.
    i have the data from MARA for given materials and their descriptions.Now in the basiv out put MARA information should come and tree out put for the material description when the user selects the maerial.
    A hot spot should come on the material and if he opts click the material then MM03 out put should come.
    Help me out in this regard
    Regards
    Naren

    Ok, but the importance of ABAP OO, should not be taken from an example ALV tree, but more in general. There are several good  articles on this on SCN. But for example in this particular case (ALV Tree), you should already see the importance as far as object instances and inheritance is concerned. Without much work, you can create an instance of an ALV tree, and all the attributes, methods etc. are there for use. Some of the methods / attributes are inherited from other superclasses.
    There are propably even more things to be mentioned here which emphasizes the importance of ABAP OO in ALV tree, but as far as I'm concerned, this is about it for me.

Maybe you are looking for

  • T.Code F.13

    Hi All What will the possible causes be when  entries per purchase order that match in value and quantity  remains in open items after F.13 (AUtomatic clearing) is executed Vishnu

  • MISSING FIREWIRE CABLE

    Was given 20 gb classic ipod second hand from family member who has lost the firewire cable. I synced ipod with my itunes (on my pc) and updated it and now it's asking me to complete the update by plugging it in via the ipod power adapter, which I ha

  • Juniper Approval Question [from a n00b]

    This is probably the wrong section, so I apologize in advance. Anyway, does anyone know if Apple would be willing to do payments or something for those who do not qualify for the Juniper card? I am homeschooled and need a new computer, our PC has ran

  • HTTP/1.1 100 Continue from PTWC 3.0

    Hi all We are getting the string "HTTP/1.1 100 Continue" appearing every so often after a PTWC 3.0 postback .. it doesn't seem to have any detrimental affect on the app but it's a little confusing to end users. Has anyone else experienced this? We'd

  • How to remove the open applications from right side of the dock?

    How do I remove the open apps from the right of the line on the dock? They are by the Trash. I will attach an image. I don't want them to show up over there when I have an app open.