Create alv report

hi friends,
i have urgent reqirement pls help on this topic
·     Created an ALV report that displays Purchase document details in hierarchical manner using predefined function modules.
thanks
ravi

Hi Ravi,
Check this example.
*& Report  ZDEMO_ALVTREE                                               *
*& Example of a simple ALV Grid Report                                 *
*& The basic requirement for this demo is to display a number of       *
*& fields from the EKPO and EKKO table in a tree structure.            *
                         Amendment History                           *
REPORT  zdemo_alvgrid                 .
*Data Declaration
TABLES:     ekko.
TYPE-POOLS: slis.                                 "ALV Declarations
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,
      it_ekpo     TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
      it_emptytab TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
      wa_ekko     TYPE t_ekko,
      wa_ekpo     TYPE t_ekko.
DATA: ok_code like sy-ucomm,           "OK-Code
      save_ok like sy-ucomm.
*ALV data declarations
DATA: fieldcatalog  TYPE lvc_t_fcat WITH HEADER LINE.
DATA: gd_fieldcat   TYPE lvc_t_fcat,
      gd_tab_group  TYPE slis_t_sp_group_alv,
      gd_layout     TYPE slis_layout_alv.
*ALVtree data declarations
CLASS cl_gui_column_tree DEFINITION LOAD.
CLASS cl_gui_cfw DEFINITION LOAD.
DATA: gd_tree             TYPE REF TO cl_gui_alv_tree,
      gd_hierarchy_header TYPE treev_hhdr,
      gd_report_title     TYPE slis_t_listheader,
      gd_logo             TYPE sdydo_value,
      gd_variant          TYPE disvariant.
*Create container for alv-tree
DATA: l_tree_container_name(30) TYPE c,
      l_custom_container        TYPE REF TO cl_gui_custom_container.
*Includes
*INCLUDE ZDEMO_ALVTREEO01. "Screen PBO Modules
*INCLUDE ZDEMO_ALVTREEI01. "Screen PAI Modules
*INCLUDE ZDEMO_ALVTREEF01. "ABAP Subroutines(FORMS)
*Start-of-selection.
START-OF-SELECTION.
ALVtree setup data
    PERFORM data_retrieval.
    PERFORM build_fieldcatalog.
    PERFORM build_layout.
    PERFORM build_hierarchy_header CHANGING gd_hierarchy_header.
    PERFORM build_report_title USING gd_report_title gd_logo.
    PERFORM build_variant.
Display ALVtree report
  call screen 100.
*&      Form  DATA_RETRIEVAL
      Retrieve data into Internal tables
FORM data_retrieval.
  SELECT ebeln
   UP TO 10 ROWS
    FROM ekko
    INTO corresponding fields of TABLE it_ekko.
  loop at it_ekko into wa_ekko.
    SELECT ebeln ebelp statu aedat matnr menge meins netpr peinh
      FROM ekpo
      appending TABLE it_ekpo
     where ebeln eq wa_ekko-ebeln.
  endloop.
ENDFORM.                    " DATA_RETRIEVAL
*&      Form  BUILD_FIELDCATALOG
      Build Fieldcatalog for ALV Report
FORM build_fieldcatalog.
Please not there are a number of differences between the structure of
ALVtree fieldcatalogs and ALVgrid fieldcatalogs.
For example the field seltext_m is replace by scrtext_m in ALVtree.
  fieldcatalog-fieldname   = 'EBELN'.           "Field name in itab
  fieldcatalog-scrtext_m   = 'Purchase Order'.  "Column text
  fieldcatalog-col_pos     = 0.                 "Column position
  fieldcatalog-outputlen   = 15.                "Column width
  fieldcatalog-emphasize   = 'X'.               "Emphasize  (X or SPACE)
  fieldcatalog-key         = 'X'.               "Key Field? (X or SPACE)
fieldcatalog-do_sum      = 'X'.              "Sum Column?
fieldcatalog-no_zero     = 'X'.              "Don't display if zero
  APPEND fieldcatalog TO gd_fieldcat.
  CLEAR  fieldcatalog.
  fieldcatalog-fieldname   = 'EBELP'.
  fieldcatalog-scrtext_m   = 'PO Iten'.
  fieldcatalog-outputlen   = 15.
  fieldcatalog-col_pos     = 1.
  APPEND fieldcatalog TO gd_fieldcat..
  CLEAR  fieldcatalog.
  fieldcatalog-fieldname   = 'STATU'.
  fieldcatalog-scrtext_m   = 'Status'.
  fieldcatalog-outputlen   = 15.
  fieldcatalog-col_pos     = 2.
  APPEND fieldcatalog TO gd_fieldcat..
  CLEAR  fieldcatalog.
  fieldcatalog-fieldname   = 'AEDAT'.
  fieldcatalog-scrtext_m   = 'Item change date'.
  fieldcatalog-outputlen   = 15.
  fieldcatalog-col_pos     = 3.
  APPEND fieldcatalog TO gd_fieldcat..
  CLEAR  fieldcatalog.
  fieldcatalog-fieldname   = 'MATNR'.
  fieldcatalog-scrtext_m   = 'Material Number'.
  fieldcatalog-outputlen   = 15.
  fieldcatalog-col_pos     = 4.
  APPEND fieldcatalog TO gd_fieldcat..
  CLEAR  fieldcatalog.
  fieldcatalog-fieldname   = 'MENGE'.
  fieldcatalog-scrtext_m   = 'PO quantity'.
  fieldcatalog-outputlen   = 15.
  fieldcatalog-col_pos     = 5.
  APPEND fieldcatalog TO gd_fieldcat..
  CLEAR  fieldcatalog.
  fieldcatalog-fieldname   = 'MEINS'.
  fieldcatalog-scrtext_m   = 'Order Unit'.
  fieldcatalog-outputlen   = 15.
  fieldcatalog-col_pos     = 6.
  APPEND fieldcatalog TO gd_fieldcat..
  CLEAR  fieldcatalog.
  fieldcatalog-fieldname   = 'NETPR'.
  fieldcatalog-scrtext_m   = 'Net Price'.
  fieldcatalog-outputlen   = 15.
  fieldcatalog-col_pos     = 7.
  fieldcatalog-datatype     = 'CURR'.
  APPEND fieldcatalog TO gd_fieldcat..
  CLEAR  fieldcatalog.
  fieldcatalog-fieldname   = 'PEINH'.
  fieldcatalog-scrtext_m   = 'Price Unit'.
  fieldcatalog-outputlen   = 15.
  fieldcatalog-col_pos     = 8.
  APPEND fieldcatalog TO gd_fieldcat..
  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  build_hierarchy_header
      build hierarchy-header-information
     -->P_L_HIERARCHY_HEADER  structure for hierarchy-header
FORM build_hierarchy_header CHANGING
                               p_hierarchy_header TYPE treev_hhdr.
  p_hierarchy_header-heading = 'Hierarchy Header'(013).
  p_hierarchy_header-tooltip = 'This is the Hierarchy Header !'(014).
  p_hierarchy_header-width = 30.
  p_hierarchy_header-width_pix = ''.
ENDFORM.                               " build_hierarchy_header
*&      Form  BUILD_REPORT_TITLE
      Build table for ALVtree header
<->  p1        Header details
<->  p2        Logo value
FORM build_report_title CHANGING
      pt_report_title  TYPE slis_t_listheader
      pa_logo             TYPE sdydo_value.
  DATA: ls_line TYPE slis_listheader,
        ld_date(10) TYPE c.
List Heading Line(TYPE H)
  CLEAR ls_line.
  ls_line-typ  = 'H'.
ls_line-key     "Not Used For This Type(H)
  ls_line-info = 'PO ALVTree Display'.
  APPEND ls_line TO pt_report_title.
Status Line(TYPE S)
  ld_date(2) = sy-datum+6(2).
  ld_date+2(1) = '/'.
  ld_date3(2) = sy-datum4(2).
  ld_date+5(1) = '/'.
  ld_date+6(4) = sy-datum(4).
  ls_line-typ  = 'S'.
  ls_line-key  = 'Date'.
  ls_line-info = ld_date.
  APPEND ls_line TO pt_report_title.
Action Line(TYPE A)
  CLEAR ls_line.
  ls_line-typ  = 'A'.
  CONCATENATE 'Report: ' sy-repid INTO ls_line-info  SEPARATED BY space.
  APPEND ls_line TO pt_report_title.
ENDFORM.
*&      Form  BUILD_VARIANT
      Build variant
form build_variant.
Set repid for storing variants
  gd_variant-report = sy-repid.
endform.                    " BUILD_VARIANT
*Includes
*include zdemo_alvtreeo01. "Screen PBO Modules
*include zdemo_alvtreei01. "Screen PAI Modules
*include zdemo_alvtreef01. "ABAP Subroutines(FORMS)
*Start-of-selection.
start-of-selection.
Screen flow logic code
PROCESS BEFORE OUTPUT.
MODULE STATUS_0100.
PROCESS AFTER INPUT.
MODULE USER_COMMAND_0100.
***INCLUDE Z......O01 .
*&      Module  STATUS_0100  OUTPUT
      PBO Module
module status_0100 output.
SET PF-STATUS 'xxxxxxxx'.
SET TITLEBAR 'xxx'.
endmodule.                 " STATUS_0100  OUTPUT
***INCLUDE Z......I01 .
*&      Module  USER_COMMAND_0100  INPUT
      PAI Module
module user_command_0100 input.
endmodule.                 " USER_COMMAND_0100  INPUT
   INCLUDE Z......I01                                                *
*&      Module  USER_COMMAND_0100  INPUT
      text
module user_command_0100 input.
  DATA return TYPE REF TO cl_gui_event.
  save_ok = ok_code.
  case ok_code.
    when 'BACK' or '%EX' or 'RW'.
    Exit program
      leave to screen 0.
  Process ALVtree user actions     
    when others.
      call method cl_gui_cfw=>get_current_event_object
              receiving
                 event_object = return.
      call method cl_gui_cfw=>dispatch.
  endcase.
endmodule.                 " USER_COMMAND_0100  INPUT
Add following code to 'STATUS_0100'(PBO module)
  Create container for alv-tree
    PERFORM create_alvtree_container.
Add following code to 'Z......F01' INCLUDE
*&      Form  CREATE_ALVTREE_CONTAINER
      Create container for alv-tree
FORM create_alvtree_container.
  gd_tree_container_name = 'SCREEN_CONTAINER'.
  create object gd_custom_container
      exporting
            container_name = gd_tree_container_name
      exceptions
            cntl_error                  = 1
            cntl_system_error           = 2
            create_error                = 3
            lifetime_error              = 4
            lifetime_dynpro_dynpro_link = 5.
  if sy-subrc <> 0.
    message x208(00) with 'ERROR'.                        
  endif.
ENDFORM.
Add following code to 'STATUS_0100'(PBO module)
Create tree control
PERFORM create_object_in_container.
Add following code to 'Z......F01' INCLUDE
*&      Form  CREATE_OBJECT_IN_CONTAINER
      Create ALVtree control
FORM create_object_in_container.
  create object gd_tree
    exporting
        parent              = gd_custom_container
        node_selection_mode = cl_gui_column_tree=>node_sel_mode_single
        item_selection      = 'X'
        no_html_header      = ''
        no_toolbar          = ''
    exceptions
        cntl_error                   = 1
        cntl_system_error            = 2
        create_error                 = 3
        lifetime_error               = 4
        illegal_node_selection_mode  = 5
        failed                       = 6
        illegal_column_name          = 7.
  if sy-subrc <> 0.
    message x208(00) with 'ERROR'.                        
  endif.
ENDFORM.
Add following code to 'STATUS_0100'(PBO module)
Create empty ALVtree control ready for first display
  PERFORM create_empty_alvtree_control.
Add following code to 'Z......F01' INCLUDE
*&      Form  CREATE_EMPTY_ALVTREE_CONTROL
      Create empty tree control
FORM create_empty_alvtree_control.
Create emty tree-control
  CLEAR: it_emptytab.
  REFRESH: it_emptytab.
  CALL METHOD gd_tree->set_table_for_first_display
     EXPORTING
               is_hierarchy_header  = gd_hierarchy_header
               it_list_commentary   = gd_report_title
               i_logo               = gd_logo
              i_background_id      = 'ALV_BACKGROUND'
               i_save               = 'A'
               is_variant            = gd_variant
     CHANGING
               it_outtab            =  it_emptytab      "Must be empty
               it_fieldcatalog      =  gd_fieldcat.
ENDFORM.                    " CREATE_EMPTY_ALVTREE_CONTROL
Add following code to 'STATUS_0100'(PBO module)
Create ALVtree Hierarchy
  PERFORM create_alvtree_hierarchy.
Add following code to 'Z......F01' INCLUDE
*&      Form  CREATE_ALVTREE_HIERARCHY
      text
      Builds ALV tree display, (inserts nodes, subnodes etc)
form create_alvtree_hierarchy.
  data: ls_sflight type sflight,
        lt_sflight type sflight occurs 0.
  data: ld_ebeln_key type lvc_nkey,
        ld_ebelp_key type lvc_nkey.
  loop at it_ekko into wa_ekko.
    perform add_ekko_node using      wa_ekko
                            changing ld_ebeln_key.
    loop at it_ekpo into wa_ekpo where ebeln eq wa_ekko-ebeln.
      perform add_ekpo_line using      wa_ekpo
                                       ld_ebeln_key
                              changing ld_ebelp_key.
    endloop.
  endloop.
calculate totals
  call method gd_tree->update_calculations.
this method must be called to send the data to the frontend
  call method gd_tree->frontend_update.
endform.                    " CREATE_ALVTREE_HIERARCHY
*&      Form  ADD_EKKO_NODE
      text
     -->P_WA_EKPO  text
     -->P_0553   text
     <--P_EBELN_KEY  text
form add_ekko_node using    ps_ekko like wa_ekko
                            value(p_relate_key)
                   changing p_node_key.
data: ld_node_text type lvc_value,
       ls_sflight type sflight.
Set item-layout
  data: lt_item_layout type lvc_t_layi,
        ls_item_layout type lvc_s_layi.
  ls_item_layout-t_image   = '@3P@'.
  ls_item_layout-fieldname = gd_tree->c_hierarchy_column_name.
  ls_item_layout-style     = cl_gui_column_tree=>style_default.
  ld_node_text             = ps_ekko-ebeln.
  append ls_item_layout to lt_item_layout.
Add node
  call method gd_tree->add_node
    exporting
          i_relat_node_key = p_relate_key
          i_relationship   = cl_gui_column_tree=>relat_last_child
          i_node_text      = ld_node_text
          is_outtab_line   = ps_ekko
          it_item_layout   = lt_item_layout
       importing
          e_new_node_key = p_node_key.
endform.                    " ADD_EKKO_NODE
*&      Form  ADD_EKPO_LINE
      text
     -->P_WA_EKPO  text
     -->P_LD_EBELN_KEY  text
     <--P_LD_EBELP_KEY  text
form add_ekpo_line using    ps_ekpo like wa_ekpo
                            value(p_relate_key)
                   changing p_node_key.
data: ld_node_text type lvc_value,
       ls_sflight type sflight.
Set item-layout
  data: lt_item_layout type lvc_t_layi,
        ls_item_layout type lvc_s_layi.
  ls_item_layout-t_image   = '@3P@'.
  ls_item_layout-fieldname = gd_tree->c_hierarchy_column_name.
  ls_item_layout-style     = cl_gui_column_tree=>style_default.
  ld_node_text             = ps_ekpo-ebelp.
  append ls_item_layout to lt_item_layout.
Add node
  call method gd_tree->add_node
    exporting
          i_relat_node_key = p_relate_key
          i_relationship   = cl_gui_column_tree=>relat_last_child
          i_node_text      = ld_node_text
          is_outtab_line   = ps_ekpo
          it_item_layout   = lt_item_layout
       importing
          e_new_node_key = p_node_key.
endform.                    " ADD_EKPO_LINE
***INCLUDE ZDEMO_ALVTREEO01 .
*&      Module  STATUS_0100  OUTPUT
      text
MODULE status_0100 OUTPUT.
  SET PF-STATUS 'STATUS1'.
SET TITLEBAR 'xxx'.
If ALVtree already exists then it  mush not be re-created as this
will cause a runtime error.
  IF gd_tree IS INITIAL.
  Create ALVtree (must be performed within screen PBO module)
    PERFORM create_alvtree_container.
    PERFORM create_object_in_container.
    PERFORM create_empty_alvtree_control.
    PERFORM create_alvtree_hierarchy.
  ENDIF.
  CALL METHOD cl_gui_cfw=>flush.
ENDMODULE.                 " STATUS_0100  OUTPUT
***INCLUDE ZDEMO_ALVTREEO01 .
*&      Module  STATUS_0100  OUTPUT
      text
MODULE status_0100 OUTPUT.
  SET PF-STATUS 'STATUS1'.
SET TITLEBAR 'xxx'.
If ALVtree already exists then it  mush not be re-created as this
will cause a runtime error.
  IF gd_tree IS INITIAL.
Create ALVtree (must be performed within screen PBO module)
    PERFORM create_alvtree_container.
    PERFORM create_object_in_container.
    PERFORM create_empty_alvtree_control.
    PERFORM create_alvtree_hierarchy.
  ENDIF.
  CALL METHOD cl_gui_cfw=>flush.
ENDMODULE.                 " STATUS_0100  OUTPUT
or
The following code allows the easy creation of the example ALVtree report. Simply copy and past it into
the appropriate includes(PBO and FORM).
  INCLUDE ZDEMO_ALVTREEF01                                           *
*&      Form  CREATE_ALVTREE_CONTAINER
      Create container for ALVtree report
form create_alvtree_container.
Create container for alv-tree
  gd_tree_container_name = 'SCREEN_CONTAINER'.
  create object gd_custom_container
      exporting
            container_name = gd_tree_container_name
      exceptions
            cntl_error                  = 1
            cntl_system_error           = 2
            create_error                = 3
            lifetime_error              = 4
            lifetime_dynpro_dynpro_link = 5.
  if sy-subrc <> 0.
    message x208(00) with 'ERROR'.
  endif.
endform.                    " CREATE_ALVTREE_CONTAINER
*&      Form  CREATE_OBJECT_IN_CONTAINER
      Create ALVtree object in container
form create_object_in_container.
Create tree control
  create object gd_tree
    exporting
        parent              = gd_custom_container
        node_selection_mode = cl_gui_column_tree=>node_sel_mode_single
        item_selection      = 'X'
        no_html_header      = ''
        no_toolbar          = ''
    exceptions
        cntl_error                   = 1
        cntl_system_error            = 2
        create_error                 = 3
        lifetime_error               = 4
        illegal_node_selection_mode  = 5
        failed                       = 6
        illegal_column_name          = 7.
  if sy-subrc <> 0.
    message x208(00) with 'ERROR'.
  endif.
endform.                    " CREATE_OBJECT_IN_CONTAINER
*&      Form  BUILD_REPORT_TITLE
      Build table for ALVtree header
<->  p1        Header details
<->  p2        Logo value
FORM build_report_title CHANGING
      pt_report_title  TYPE slis_t_listheader
      pa_logo             TYPE sdydo_value.
  DATA: ls_line TYPE slis_listheader,
        ld_date(10) TYPE c.
List Heading Line(TYPE H)
  CLEAR ls_line.
  ls_line-typ  = 'H'.
ls_line-key     "Not Used For This Type(H)
  ls_line-info = 'PO ALVTree Display'.
  APPEND ls_line TO pt_report_title.
Status Line(TYPE S)
  ld_date(2) = sy-datum+6(2).
  ld_date+2(1) = '/'.
  ld_date3(2) = sy-datum4(2).
  ld_date+5(1) = '/'.
  ld_date+6(4) = sy-datum(4).
  ls_line-typ  = 'S'.
  ls_line-key  = 'Date'.
  ls_line-info = ld_date.
  APPEND ls_line TO pt_report_title.
Action Line(TYPE A)
  CLEAR ls_line.
  ls_line-typ  = 'A'.
  CONCATENATE 'Report: ' sy-repid INTO ls_line-info  SEPARATED BY space.
  APPEND ls_line TO pt_report_title.
ENDFORM.                    " BUILD_REPORT_TITLE
*&      Form  CREATE_EMPTY_ALVTREE_CONTROL
      Create empty tree control
FORM create_empty_alvtree_control.
Create emty tree-control
  CLEAR: it_emptytab.
  REFRESH: it_emptytab.
  CALL METHOD gd_tree->set_table_for_first_display
     EXPORTING
               is_hierarchy_header  = gd_hierarchy_header
               it_list_commentary   = gd_report_title
               i_logo               = gd_logo
              i_background_id      = 'ALV_BACKGROUND'
               i_save               = 'A'
               is_variant            = gd_variant
     CHANGING
               it_outtab            =  it_emptytab      "Must be empty
               it_fieldcatalog      =  gd_fieldcat.
ENDFORM.                    " CREATE_EMPTY_ALVTREE_CONTROL
*&      Form  CREATE_ALVTREE_HIERARCHY
      text
      Builds ALV tree display, (inserts nodes, subnodes etc)
form create_alvtree_hierarchy.
  data: ls_sflight type sflight,
        lt_sflight type sflight occurs 0.
  data: ld_ebeln_key type lvc_nkey,
        ld_ebelp_key type lvc_nkey.
  loop at it_ekko into wa_ekko.
    perform add_ekko_node using      wa_ekko
                            changing ld_ebeln_key.
    loop at it_ekpo into wa_ekpo where ebeln eq wa_ekko-ebeln.
      perform add_ekpo_line using      wa_ekpo
                                       ld_ebeln_key
                              changing ld_ebelp_key.
    endloop.
  endloop.
calculate totals
  call method gd_tree->update_calculations.
this method must be called to send the data to the frontend
  call method gd_tree->frontend_update.
endform.                    " CREATE_ALVTREE_HIERARCHY
*&      Form  ADD_EKKO_NODE
      text
     -->P_WA_EKPO  text
     -->P_0553   text
     <--P_EBELN_KEY  text
form add_ekko_node using    ps_ekko like wa_ekko
                            value(p_relate_key)
                   changing p_node_key.
data: ld_node_text type lvc_value,
       ls_sflight type sflight.
Set item-layout
  data: lt_item_layout type lvc_t_layi,
        ls_item_layout type lvc_s_layi.
  ls_item_layout-t_image   = '@3P@'.
  ls_item_layout-fieldname = gd_tree->c_hierarchy_column_name.
  ls_item_layout-style     = cl_gui_column_tree=>style_default.
  ld_node_text             = ps_ekko-ebeln.
  append ls_item_layout to lt_item_layout.
Add node
  call method gd_tree->add_node
    exporting
          i_relat_node_key = p_relate_key
          i_relationship   = cl_gui_column_tree=>relat_last_child
          i_node_text      = ld_node_text
          is_outtab_line   = ps_ekko
          it_item_layout   = lt_item_layout
       importing
          e_new_node_key = p_node_key.
endform.                    " ADD_EKKO_NODE
*&      Form  ADD_EKPO_LINE
      text
     -->P_WA_EKPO  text
     -->P_LD_EBELN_KEY  text
     <--P_LD_EBELP_KEY  text
form add_ekpo_line using    ps_ekpo like wa_ekpo
                            value(p_relate_key)
                   changing p_node_key.
data: ld_node_text type lvc_value,
       ls_sflight type sflight.
Set item-layout
  data: lt_item_layout type lvc_t_layi,
        ls_item_layout type lvc_s_layi.
  ls_item_layout-t_image   = '@3P@'.
  ls_item_layout-fieldname = gd_tree->c_hierarchy_column_name.
  ls_item_layout-style     = cl_gui_column_tree=>style_default.
  ld_node_text             = ps_ekpo-ebelp.
  append ls_item_layout to lt_item_layout.
Add node
  call method gd_tree->add_node
    exporting
          i_relat_node_key = p_relate_key
          i_relationship   = cl_gui_column_tree=>relat_last_child
          i_node_text      = ld_node_text
          is_outtab_line   = ps_ekpo
          it_item_layout   = lt_item_layout
       importing
          e_new_node_key = p_node_key.
endform.                    " ADD_EKPO_LINE
Reward if useful.
Regards,
Chitra

Similar Messages

  • Need to create alv report to show pan card number.

    Hi,
    I need to create alv report to show employee and vendor  name , number ,  Pan card number .This is for hr module.
    could any one tell me table and fields for this and how I can relate them with foriegn and primary key.
    Regards,
    Moderator Message: Do your own work
    Edited by: kishan P on Oct 5, 2010 10:38 AM

    Yes, but it only has one generic Date column, no start date and end date. I can't use that twice in the prompt. Although I can specify it to be 'between', but I'm not sure I can pass values to both variables like that.
    Currently I have used Campaign Start Date and Campaign End Date to enter values in calender format to the variables.

  • Can we create ALV report in CO module

    Hi All,
    Can we create ALV reports in CO( controlling area ) module like MM and SD.
    i m new to CO module, pls suggest me in this case.
    my requirement is to generate a report on ' estate general charges by company'
    Thanks
    Mona

    Hi,
    look whatever the module may be , if you store your result in an internal table , you can display it with ALV.
    ALV is, as you know, nothing but a way to display list in better way. SO get your data and design a field catalog according and use any ALV disply function to display it.
    Regards,
    Anirban

  • Creating ALV reports using OOP concept

    After creating many reports i found out that 90% of the coding in a report is copy paste i.e. only 10% of coding effort is required which includes
        creating the custom data types and internal table variables  ...
        populating the data
        creating screen,GUI status and GUI title
    Just copy paste the below code and do as stated  :
    *ALV TEMPLATE
    *create screen no. 2000
    *change flow logic in screen if necessary
    *create GUI status and GUI title
    *change selection texts and text symbols*
    REPORT  Y_TEMPLATE_ALV.
    TABLES : ."use if range of values required on selection screen.
    DATA: zcl_alvgrid        TYPE REF TO cl_gui_alv_grid,
           zcl_ccontainer     TYPE REF TO cl_gui_docking_container,
           wa_layout    TYPE lvc_s_layo,
           it_fieldcat  TYPE STANDARD TABLE OF lvc_s_fcat,
           wa_fieldcat  TYPE lvc_s_fcat,
           z_document         TYPE REF TO cl_dd_document,
           o_docking TYPE REF TO cl_gui_docking_container,"Docking Container
           o_split TYPE REF TO cl_gui_easy_splitter_container, "Splitter
           o_top_container TYPE REF TO cl_gui_container,   "Top Container
           o_bottom_container TYPE REF TO cl_gui_container."Bottom Container
    TYPES : BEGIN OF TY_FINAL,
    "All columns which are to be displayed in the report should be included here
    END OF TY_FINAL.
    *Add additional Internal Tables's if data is to be extracted from multiple tables
    *Then loop at main table and Read the other tables
    DATA :IT_DATA TYPE STANDARD TABLE OF , "data extracted from tables can be stored in this internal table variable ..
           WA_DATA TYPE ,
           iT_alv      TYPE STANDARD TABLE OF TY_FINAL, " pass to  the method SET_TABLE_FOR_FIRST_DISPLAY of class
    ZCL_ALVGRID [Already done ; its  just fyi]
           WA_alv      TYPE                   TY_FINAL.
    DATA :V_CLN(255) TYPE C, " For no. of records
           V_LINE TYPE I. " for conversion of integer to character
    *                 Selection Screen                                     *
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
    PARAMETERS:
    SELECT-OPTIONS: " PARAMETERS and Range on selection screen
    SELECTION-SCREEN END OF BLOCK B1.
    AT SELECTION-SCREEN OUTPUT.
    *                        START  OF  SELECTION                          *
    START-OF-SELECTION.
    *  SELECT * FROM INTO CORRESPONDING FIELDS OF TABLE IT_DATA WHERE ....in ....
       IF SY-SUBRC = 0.
         LOOP AT IT_DATA INTO WA_DATA.
           MOVE-CORRESPONDING WA_DATA TO wa_alv. " if data is fetched from only one table
           APPEND wa_alv TO it_alv.
           CLEAR : wa_alv,WA_DATA.
         ENDLOOP.
         DESCRIBE TABLE it_alv LINES V_LINE.
         V_CLN = V_LINE.
       ENDIF.
    END-OF-SELECTION.
       PERFORM DISPLAY_ALV.
    *&      Module  STATUS  OUTPUT
    *       text
    MODULE STATUS_2000 OUTPUT.
       SET PF-STATUS 'STATUS'.
       SET TITLEBAR 'ALV'.
    *  ** Creating Docking Container
       CREATE OBJECT o_docking
       EXPORTING
    *    side = cl_gui_docking_container=>dock_at_right
         ratio = '95'.
       IF sy-subrc EQ 0.
    * Splitting the Docking container
         CREATE OBJECT o_split
         EXPORTING
           parent        = o_docking
           sash_position = 05 "Position of Splitter Bar (in Percent)
           with_border   = 0. "With Border = 1 Without Border = 0
    *   Placing the containers in the splitter
         o_top_container = o_split->top_left_container .
         o_bottom_container = o_split->bottom_right_container .
    *   Creating the document
         CREATE OBJECT z_document
         EXPORTING
           style = 'ALV_GRID'.
       ENDIF.
    * Calling the methods for dynamic text
       CALL METHOD z_document->add_text
       EXPORTING
         TEXT         = 'No. of Records:'
         sap_emphasis = cl_dd_area=>strong. " For bold
    * Adding GAP
       CALL METHOD z_document->add_gap
       EXPORTING
         width = 10.
    * Adding Text
       CALL METHOD z_document->add_text
       EXPORTING
         TEXT = v_cln.
    * Adding Line
       CALL METHOD z_document->new_line.
    * Display the data
       CALL METHOD z_document->display_document
       EXPORTING
         parent = o_top_container.
       IF zcl_alvgrid IS INITIAL .
    *----Creating ALV Grid instance
         CREATE OBJECT zcl_alvgrid
         EXPORTING
           i_parent          = o_bottom_container
         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.
    * Calling the method of ALV to process top of page
         CALL METHOD zcl_alvgrid->list_processing_events
         EXPORTING
           i_event_name = 'TOP_OF_PAGE'
           i_dyndoc_id  = z_document.
    * Preparing field catalog.
         PERFORM T_FIELDCAT USING:
                    '1'        'BRNCD'      'BRAND'.
    *          'Column no' 'FIELDNAME' 'Column Heading' 
         WA_LAYOUT-CWIDTH_OPT = 'X'.
         WA_LAYOUT-ZEBRA = 'X'.
         WA_LAYOUT-SEL_MODE =  'A'.
    * Setting table for first display
         CALL METHOD ZCL_ALVGRID->SET_TABLE_FOR_FIRST_DISPLAY
         EXPORTING
           IS_LAYOUT                     = WA_LAYOUT
         CHANGING
           IT_OUTTAB                     = it_alv
           IT_FIELDCATALOG               = IT_FIELDCAT
         EXCEPTIONS
           INVALID_PARAMETER_COMBINATION = 1
           PROGRAM_ERROR                 = 2
           TOO_MANY_LINES                = 3
           OTHERS                        = 4.
         IF SY-SUBRC <> 0.
           MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
           WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
         ENDIF.
       ELSE.
         CALL METHOD ZCL_ALVGRID->REFRESH_TABLE_DISPLAY
         EXCEPTIONS
           FINISHED = 1
           OTHERS   = 2.
         IF SY-SUBRC <> 0.
           MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
           WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
         ENDIF.
       ENDIF.
    ENDMODULE.                 " STATUS  OUTPUT
    MODULE USER_COMMAND_2000 INPUT.
       DATA: V_OK_CODE TYPE SY-UCOMM,
             V_SAVE_OK TYPE SY-UCOMM.
       V_OK_CODE = SY-UCOMM.
       V_SAVE_OK = V_OK_CODE.
       CASE SY-UCOMM.
         WHEN 'BACK'.
           SET SCREEN 1000.
         WHEN 'EXIT'.
           LEAVE program.
         WHEN OTHERS.
           SET SCREEN 1000.
       ENDCASE.
       CLEAR V_SAVE_OK.
       SET SCREEN 0.
       LEAVE SCREEN.
    ENDMODULE.                 " USER_COMMAND_2000  INPUT
    *&      Form  T_FIELDCAT
    *       text
    *      -->x   text
    *      -->y   text
    *      -->z   text
    FORM T_FIELDCAT  USING VALUE(X) TYPE ANY
           VALUE(Y) TYPE ANY
           VALUE(Z) TYPE ANY.
       WA_FIELDCAT-COL_POS = X.
       WA_FIELDCAT-FIELDNAME = Y.
       WA_FIELDCAT-COLTEXT  = Z.
       APPEND WA_FIELDCAT TO IT_FIELDCAT.
       CLEAR WA_FIELDCAT.
    ENDFORM.                      " T_FIELDCAT
    *&      Form  DISPLAY_ALV
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM DISPLAY_ALV .
       IF NOT it_alv[] IS INITIAL.
         CALL SCREEN 2000.
       ELSE.
         MESSAGE 'No data for Display' TYPE 'I'.
       ENDIF.
    ENDFORM.                    " DISPLAY_ALV

    Hello Jay,
    Calling methods, creating instances, casting etc are not OOP. When you say you've developed an OO-report you think OO, refer to this blog to see what i mean - Global Data in ABAP OO Programs
    BR,
    Suhas

  • In ALV Report Que.

    Hi expart.
    Pls tell me I am create Alv report so i m using fun module
    resue_alv_grid_display . so the report o/p is comming in grid format but i m using end-of-page .but footer line n't showing the write statement . In grid o/p is possible to display footer if it is possible then tell me .
    Its urgents sir...
    Regards
    Bhabani

    hi check this..here i am able to display the footer..
    *& Report  ZVG_ALV_SLIST2                                              *
    report  zvg_alv_slist2                          .
    ALV
    type-pools: slis.
    G L O B A L   I N T E R N  A L   T A B L E S
    data: gt_fieldcat type slis_t_fieldcat_alv,
          gs_layout   type slis_layout_alv,
          gt_events   type slis_t_event.
    data: it_sort type slis_t_sortinfo_alv ,
          wa_sort type slis_sortinfo_alv .
    data: gs_print type slis_print_alv.
    data: begin of it_sflight occurs 0,
            carrid     like sflight-carrid,
            connid     like sflight-connid,
            fldate     like sflight-fldate,
            price      like sflight-price,
            planetype  like sflight-planetype,
            seatsmax   like sflight-seatsmax,
            seatsocc   like sflight-seatsocc,
            paymentsum like sflight-paymentsum,
         end of it_sflight.
    *DATA: GI_SFLIGHT LIKE STANDARD TABLE OF ST_SFLIGHT.
    data: g_repid like sy-repid.
    data: gt_list_top_of_page type slis_t_listheader.
    data: v_total(5).
    start-of-selection.
      g_repid = sy-repid.
      perform init_fieldcat  using gt_fieldcat[].
      perform build_eventtab using gt_events[].
      perform build_comment  using gt_list_top_of_page[].
      perform get_data.
      perform set_layout using gs_layout.
    SORTING
      clear wa_sort.
      wa_sort-fieldname = 'CARRID'.
      wa_sort-up = 'X'.
      wa_sort-group = '*'.
      wa_sort-subtot = 'X'.
      append wa_sort to it_sort.
      clear wa_sort.
      wa_sort-fieldname = 'CONNID'.
      wa_sort-up = 'X'.
      wa_sort-group = 'UL'.
      wa_sort-subtot = 'X'.
      append wa_sort to it_sort.
    DISPLAY LIST
      call function 'REUSE_ALV_LIST_DISPLAY'
        exporting
          i_interface_check       = ' '
          i_callback_program      = g_repid
          i_callback_user_command = 'USER_COMMAND'
          is_layout               = gs_layout
          it_fieldcat             = gt_fieldcat[]
          it_sort                 = it_sort[]
          it_events               = gt_events
          is_print                = gs_print
        tables
          t_outtab                = it_sflight
        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.
    *&      Form  INIT_FIELDCAT
    form init_fieldcat using    p_gt_fieldcat type slis_t_fieldcat_alv.
      data: ls_fieldcat type slis_fieldcat_alv,
            l_index type sy-tabix.
      data :rep like sy-repid.
      rep = sy-repid.
      call function 'REUSE_ALV_FIELDCATALOG_MERGE'
        exporting
          i_program_name         = rep
          i_internal_tabname     = 'IT_SFLIGHT'
          i_inclname             = rep
        changing
          ct_fieldcat            = gt_fieldcat
        exceptions
          inconsistent_interface = 1
          program_error          = 2
          others                 = 3.
      if sy-subrc <> 0.
        message id sy-msgid type 'S' number sy-msgno
             with sy-msgv1 sy-msgv2 sy-msgv3 sy-subrc.
      endif.
      sort gt_fieldcat by col_pos.
      loop at gt_fieldcat into ls_fieldcat.
        l_index = sy-tabix.
        if ls_fieldcat-fieldname = 'PRICE'.
          ls_fieldcat-do_sum = 'X'.
          ls_fieldcat-sp_group = 'X'.
          modify gt_fieldcat from ls_fieldcat index l_index .
        endif.
      endloop.
    endform.                    " INIT_FIELDCAT
    *&      Form  BUILD_EVENTTAB
    form build_eventtab using  p_gt_events type slis_t_event.
      data: ls_event type slis_alv_event.
      clear ls_event.
      ls_event-name = slis_ev_top_of_page.
      ls_event-form = 'XTOP_OF_PAGE'.
      append ls_event to p_gt_events.
      clear ls_event.
      ls_event-name = slis_ev_top_of_list.
      ls_event-form = 'XTOP_OF_LIST'.
      append ls_event to p_gt_events.
      clear ls_event.
      clear ls_event.
      ls_event-name = slis_ev_end_of_page.
      ls_event-form = 'XEND_OF_PAGE'.
      append ls_event to p_gt_events.
      ls_event-name = slis_ev_end_of_list.
      ls_event-form = 'XEND_OF_LIST'.
      append ls_event to p_gt_events.
      clear ls_event.
    endform.                    " BUILD_EVENTTAB
    *&      Form  BUILD_COMMENT
    form build_comment using   p_gt_list_top_of_page type slis_t_listheader.
      data: ls_line type slis_listheader.
      ls_line-typ = 'H'." = Header, S = Selection, A = Action
      ls_line-key = 'KEY'.
      ls_line-info = 'INFO'.
      append ls_line to p_gt_list_top_of_page.
    endform.                    " BUILD_COMMENT
    *&      Form  SELECTION
    form get_data..
    data: l_rows type i value 3.
    Read data from table SFLIGHT
      select carrid
             connid
             fldate
             price
             planetype
             seatsmax
             seatsocc
             paymentsum
         from sflight
         into table it_sflight.
        up to l_rows rows.
      sort it_sflight.
    endform.                    " SELECTION
    *&      Form  SET_LAYOUT
    form set_layout using  p_gs_layout type slis_layout_alv.
    *  P_GS_LAYOUT-F2CODE            = P_F2CODE.
      p_gs_layout-zebra          = 'X'.
      p_gs_layout-colwidth_optimize = 'X'.
      p_gs_layout-no_input          = 'X'.
      p_gs_layout-no_colhead        = space.
      p_gs_layout-totals_text       = 'Total Price'.
      p_gs_layout-subtotals_text    = 'Sub Total'.
      p_gs_layout-totals_only       = 'X'.
      p_gs_layout-key_hotspot       = 'X'.
      p_gs_layout-detail_popup      = 'X'.
      p_gs_layout-no_subtotals      = space.
      p_gs_layout-expand_all        = 'X'.
      p_gs_layout-group_buttons     = 'X'."space.
    endform.                    " SET_LAYOUT
          FORM XTOP_OF_PAGE                                             *
    form xtop_of_page.
    data : lv_page(5),
            lv_text(20).
      MOVE SY-PAGNO TO LV_PAGE.
      write:/  'X_TOP_OF_PAGE'.
    endform.                    "xtop_of_page
          FORM XTOP_OF_LIST                                             *
    form xtop_of_list.
      write:/  'X_TOP_OF_LIST'.
    endform.                    "xtop_of_list
          FORM XEND_OF_PAGE                                             *
    form xend_of_page.
      write:/  'X_END_OF_PAGE'.
    endform.                    "xend_of_page
          FORM XEND_OF_LIST                                             *
    form xend_of_list.
      write:/  'X_END_OF_LIST'.
      data : lv_page(5),
             lv_text(20).
      data : l_lines type i,
             l_line  type i.
      clear v_total.
      write sy-pagno to v_total left-justified.
    export v_total to memory id 'V_TOTAL'.
      do sy-pagno times.
        lv_page = sy-index.
        concatenate 'Page' lv_page 'of' v_total
             into lv_text separated by space.
        if sy-index = 1.
          read line 2 of page sy-index.
        else.
          read line 1 of page sy-index.
       endif.
        sy-lisel+60(20) = lv_text.
          modify current line .
      enddo.
    endform.                    "xend_of_list
          USER_COMMAND                                             *
    form user_command  using r_ucomm like sy-ucomm
                              rs_selfield type slis_selfield.
      case r_ucomm.
        when 'EXIT'.
          leave to screen 0.
        when '&IC1'.
          data: text(256),text1(6),text2(5).
          move rs_selfield-tabindex to text1.
          move rs_selfield-sumindex to text2.
          concatenate  'Double clicked on (field:'
                        rs_selfield-fieldname
                        'Value:'
                        rs_selfield-value
                        text1
                        text2
                        into text
                        separated by space.
          call function 'POPUP_TO_DISPLAY_TEXT'
            exporting
              textline1 = text.
      endcase.
    endform.                    "user_command
    regards,
    venkat .

  • Decimal point  for Price value in  ALV Report

    HI,
    I have created ALV report,
    I have 2 price fields in ALV report
    For first field i have to display  in the below format.
    If the value of the field is 3601152 then I have to display it as 36011.52 
    For second field I have to display in the below format
    if the  value is 2494 then I have to display it as 2495.00
    else if the value is 3498.73,then I need not to do anything.
    that means If there is no decimal point, then I have to keep decimal point.
    Thanks&Regards
    RamaDevi

    HI,
    you can work with search and concatenate.
    value1 = 3601152
    search value1 for '.' .
    if sy-subrc eq 0.
      concatenate value1(5) '.' value1(2)+5 into text.
    Or value1 = value1 / 100.
    endif.
    Regards
    Nicole

  • Error in alv report

    hi expert i have created alv report ... it is giving runtime error .. in   CALL FUNCTION 'REUSE_ALV_EVENTS_GET' how to solve this plz help ....
    *& Report  ZALVTRIAL                                                   *
    REPORT  ZALVTRIAL                               .
    tables : vbak,vbap.
    type-pools: slis.
    types : begin of scr1,
            vbeln type VBELN_VA,
            erdat type erdat,
            ernam type ernam,
            end of scr1.
    data : i_vbak type standard table of scr1,
           wa_vbak type scr1.
    types : begin of scr2,
            vbeln type VBELN_VA,
            matnr type matnr,
            posnr type posnr_va,
            end of scr2.
    data : i_vbap type standard table of scr2,
           wa_vbap type scr2.
    types : begin of scr_final,
            vbeln type VBELN_VA,
            erdat type erdat,
            ernam type ernam,
            matnr type matnr,
            posnr type posnr_va,
            end of scr_final.
    data : i_final type standard table of scr_final,
           wa_final type scr_final.
    **START OF DATA DECLERATION  FOR ALV
    *DATA  FOR CATLOG
    DATA: wa_fldcat  TYPE  slis_fieldcat_alv,
          i_fldcat  TYPE slis_t_fieldcat_alv  WITH HEADER LINE .
    *DATA FOR EVENT
    DATA : wa_event  TYPE slis_alv_event,
           i_event  TYPE slis_t_event  WITH HEADER LINE.
    *DATA FOR HEADER
    DATA: wa_head  TYPE slis_listheader,
          i_head TYPE slis_t_listheader WITH HEADER LINE.
    *data for layout
    DATA: wa_layout  TYPE slis_layout_alv.
    selection-screen: begin of block b1 with frame title text-001.
    select-options: s_vbeln for vbak-vbeln .
    SELECTION-SCREEN: END OF BLOCK B1.          
    start-of-selection.
    select vbeln erdat ernam
    from vbak
    into table i_vbak where vbeln in s_vbeln.
    if sy-subrc <> 0.
      leave list-processing.
    else.
      sort i_vbak by vbeln.
    endif.
    if i_vbak[] is not initial.
      select vbeln matnr posnr
      from vbap
      into table i_vbap
      for all entries in i_vbak
      where vbeln = i_vbak-vbeln.
    endif.
    loop at i_vbak into wa_vbak.
      wa_final-vbeln = wa_vbak-vbeln.
      wa_final-erdat = wa_vbak-erdat .
      wa_final-ernam = wa_vbak-ernam .
      append wa_final to i_final.
    endloop.
    if sy-subrc = 0.
      loop at i_final into wa_final.
        read table i_vbap into wa_vbap
        with key vbeln = wa_vbak-vbeln binary search.
        if sy-subrc = 0.
          wa_final-matnr = wa_vbap-matnr.
          wa_final-posnr = wa_vbap-posnr.
          modify i_final from wa_final transporting matnr posnr.
        endif.
        clear : wa_vbap , wa_final.
      endloop.
    endif.
    **WRITE:/1 sy-uline(63).
    **WRITE:/1'|', 2 'Sales Document' COLOR 4 ON ,11'|',12 'Date' COLOR 5
    **ON
    **,21'|',22 'Name' COLOR 4 ON,35'|',
          36 'Material Number' COLOR 5 ON, 55'|',56 'line no' COLOR 4 ON
    **63'|'.
    **WRITE:/1 sy-uline(63).
    **LOOP AT  i_final INTO wa_final.
    WRITE:/1'|', 2 wa_final-vbeln,11'|',12  wa_final-erdat,21'|',22
    wa_final-ernam,35'|',
           36 wa_final-matnr, 55'|',56 wa_final-posnr,63'|'.
    **endloop.
    perform builtcatalog.
    perform event.
    perform listheader.
    perform layout.
    perform display.
    *&      Form  builtcatalog
          text
    form builtcatalog.
      wa_fldcat-col_pos = '1'.
      wa_fldcat-fieldname = 'vbeln'.
      wa_fldcat-tabname = 'I_FINAL'.
      wa_fldcat-reptext_ddic = 'Sales Document'.
      APPEND wa_fldcat  TO i_fldcat.
      CLEAR wa_fldcat.
      wa_fldcat-col_pos = '2'.
      wa_fldcat-fieldname = 'erdat'.
      wa_fldcat-tabname = 'I_FINAL'.
      wa_fldcat-reptext_ddic = 'Date'.
      APPEND wa_fldcat  TO i_fldcat.
      CLEAR wa_fldcat.
      wa_fldcat-col_pos = '3'.
      wa_fldcat-fieldname = 'ernam'.
      wa_fldcat-tabname = 'I_FINAL'.
      wa_fldcat-reptext_ddic = 'Name'.
      APPEND wa_fldcat  TO i_fldcat.
      CLEAR wa_fldcat.
      wa_fldcat-col_pos = '4'.
      wa_fldcat-fieldname = 'matnr'.
      wa_fldcat-tabname = 'I_FINAL'.
      wa_fldcat-reptext_ddic = 'Material Number'.
      APPEND wa_fldcat  TO i_fldcat.
      CLEAR wa_fldcat.
      wa_fldcat-col_pos = '5'.
      wa_fldcat-fieldname = 'posnr'.
      wa_fldcat-tabname = 'I_FINAL'.
      wa_fldcat-reptext_ddic = 'Sales Document Item'.
      APPEND wa_fldcat  TO i_fldcat.
      CLEAR wa_fldcat.
    endform.                    "builtcatalog
    *&      Form  event
          text
    form event.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
       EXPORTING
         I_LIST_TYPE = 0
        IMPORTING
          ET_EVENTS   = i_final[].
    EXCEPTIONS
       LIST_TYPE_WRONG       = 1
       OTHERS                = 2
      IF sy-subrc = 0.
        READ TABLE i_event INTO wa_event
        WITH KEY name  = slis_ev_top_of_page.
        IF sy-subrc = 0.
          wa_event-form = slis_ev_top_of_page.
          MODIFY i_event FROM wa_event  INDEX sy-tabix TRANSPORTING form.
        ENDIF.
        READ TABLE i_event INTO wa_event
         WITH KEY name  = slis_ev_pf_status_set .
        IF sy-subrc = 0.
          wa_event-form = slis_ev_pf_status_set .
          MODIFY i_event FROM wa_event  INDEX sy-tabix TRANSPORTING form.
        ENDIF.
        READ TABLE i_event INTO wa_event
         WITH KEY name  = slis_ev_user_command.
        IF sy-subrc = 0.
          wa_event-form = slis_ev_user_command .
          MODIFY i_event FROM wa_event  INDEX sy-tabix TRANSPORTING form.
        ENDIF.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    endform.                    "event
    *&      Form
          text
    form listheader.
      wa_head-typ = 'H'.
      wa_head-info = 'ALV PROGRAM                             AUTHOR jessy'
      APPEND wa_head  TO i_head.
    endform.                    "listheader
    *&      Form  layout
          text
    form layout.
      wa_layout-zebra = 'X'.
      wa_layout-f2code =  'DUB'.
    endform.                    "layout
    *&      Form  display
          text
    form display.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
      I_INTERFACE_CHECK                 = ' '
      I_BYPASSING_BUFFER                = ' '
      I_BUFFER_ACTIVE                   = ' '
         I_CALLBACK_PROGRAM                = ' sy-repid '
      I_CALLBACK_PF_STATUS_SET          = ' '
      I_CALLBACK_USER_COMMAND           = ' '
      I_CALLBACK_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_GRID_SETTINGS                   =
       IS_LAYOUT                         = wa_layout
       IT_FIELDCAT                       = i_fldcat[]
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
      IT_SORT                           =
      IT_FILTER                         =
      IS_SEL_HIDE                       =
      I_DEFAULT                         = 'X'
      I_SAVE                            = ' '
      IS_VARIANT                        =
      IT_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_HYPERLINK                      =
      IT_ADD_FIELDCAT                   =
      IT_EXCEPT_QINFO                   =
      I_HTML_HEIGHT_TOP                 =
      I_HTML_HEIGHT_END                 =
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER           =
      ES_EXIT_CAUSED_BY_USER            =
        TABLES
          T_OUTTAB                          = i_event[]
    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

    Hi,
    The error has been corrected.
    Copy the following code and execute. You won't get any runtime errors.
    *& Report ZALVTRIAL *
    REPORT ZALVTRIAL .
    tables : vbak,vbap.
    type-pools: slis.
    types : begin of scr1,
    vbeln type VBELN_VA,
    erdat type erdat,
    ernam type ernam,
    end of scr1.
    data : i_vbak type standard table of scr1,
    wa_vbak type scr1.
    types : begin of scr2,
    vbeln type VBELN_VA,
    matnr type matnr,
    posnr type posnr_va,
    end of scr2.
    data : i_vbap type standard table of scr2,
    wa_vbap type scr2.
    types : begin of scr_final,
    vbeln type VBELN_VA,
    erdat type erdat,
    ernam type ernam,
    matnr type matnr,
    posnr type posnr_va,
    end of scr_final.
    data : i_final type standard table of scr_final,
    wa_final type scr_final.
    **START OF DATA DECLERATION FOR ALV
    *DATA FOR CATLOG
    DATA: wa_fldcat TYPE slis_fieldcat_alv,
    i_fldcat TYPE slis_t_fieldcat_alv WITH HEADER LINE .
    *DATA FOR EVENT
    DATA : wa_event TYPE slis_alv_event,
    i_event TYPE SLIS_T_EVENT." WITH HEADER LINE.   "-----> correction done here
    *DATA FOR HEADER
    DATA: wa_head TYPE slis_listheader,
    i_head TYPE slis_t_listheader WITH HEADER LINE.
    *data for layout
    DATA: wa_layout TYPE slis_layout_alv.
    selection-screen: begin of block b1 with frame title text-001.
    select-options: s_vbeln for vbak-vbeln .
    SELECTION-SCREEN: END OF BLOCK B1.
    start-of-selection.
    select vbeln erdat ernam
    from vbak
    into table i_vbak where vbeln in s_vbeln.
    if sy-subrc = 0.
    leave list-processing.
    else.
    sort i_vbak by vbeln.
    endif.
    if i_vbak[] is not initial.
    select vbeln matnr posnr
    from vbap
    into table i_vbap
    for all entries in i_vbak
    where vbeln = i_vbak-vbeln.
    endif.
    loop at i_vbak into wa_vbak.
    wa_final-vbeln = wa_vbak-vbeln.
    wa_final-erdat = wa_vbak-erdat .
    wa_final-ernam = wa_vbak-ernam .
    append wa_final to i_final.
    endloop.
    if sy-subrc = 0.
    loop at i_final into wa_final.
    read table i_vbap into wa_vbap
    with key vbeln = wa_vbak-vbeln binary search.
    if sy-subrc = 0.
    wa_final-matnr = wa_vbap-matnr.
    wa_final-posnr = wa_vbap-posnr.
    modify i_final from wa_final transporting matnr posnr.
    endif.
    clear : wa_vbap , wa_final.
    endloop.
    endif.
    **WRITE:/1 sy-uline(63).
    **WRITE:/1'|', 2 'Sales Document' COLOR 4 ON ,11'|',12 'Date' COLOR 5
    **ON
    **,21'|',22 'Name' COLOR 4 ON,35'|',
    *36 'Material Number' COLOR 5 ON, 55'|',56 'line no' COLOR 4 ON
    **63'|'.
    **WRITE:/1 sy-uline(63).
    **LOOP AT i_final INTO wa_final.
    WRITE:/1'|', 2 wa_final-vbeln,11'|',12 wa_final-erdat,21'|',22
    wa_final-ernam,35'|',
    36 wa_final-matnr, 55'|',56 wa_final-posnr,63'|'.
    **endloop.
    perform builtcatalog.
    perform event.
    perform listheader.
    perform layout.
    perform display.
    **& Form builtcatalog
    *text
    form builtcatalog.
    wa_fldcat-col_pos = '1'.
    wa_fldcat-fieldname = 'vbeln'.
    wa_fldcat-tabname = 'I_FINAL'.
    wa_fldcat-reptext_ddic = 'Sales Document'.
    APPEND wa_fldcat TO i_fldcat.
    CLEAR wa_fldcat.
    wa_fldcat-col_pos = '2'.
    wa_fldcat-fieldname = 'erdat'.
    wa_fldcat-tabname = 'I_FINAL'.
    wa_fldcat-reptext_ddic = 'Date'.
    APPEND wa_fldcat TO i_fldcat.
    CLEAR wa_fldcat.
    wa_fldcat-col_pos = '3'.
    wa_fldcat-fieldname = 'ernam'.
    wa_fldcat-tabname = 'I_FINAL'.
    wa_fldcat-reptext_ddic = 'Name'.
    APPEND wa_fldcat TO i_fldcat.
    CLEAR wa_fldcat.
    wa_fldcat-col_pos = '4'.
    wa_fldcat-fieldname = 'matnr'.
    wa_fldcat-tabname = 'I_FINAL'.
    wa_fldcat-reptext_ddic = 'Material Number'.
    APPEND wa_fldcat TO i_fldcat.
    CLEAR wa_fldcat.
    wa_fldcat-col_pos = '5'.
    wa_fldcat-fieldname = 'posnr'.
    wa_fldcat-tabname = 'I_FINAL'.
    wa_fldcat-reptext_ddic = 'Sales Document Item'.
    APPEND wa_fldcat TO i_fldcat.
    CLEAR wa_fldcat.
    endform. "builtcatalog
    **& Form event
    *text
    form event.
    CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
    EXPORTING
    I_LIST_TYPE = 0
    IMPORTING
    ET_EVENTS = i_event                                         "-----> correction done here
    EXCEPTIONS
    LIST_TYPE_WRONG = 1
    OTHERS = 2
    IF sy-subrc = 0.
    READ TABLE i_event INTO wa_event
    WITH KEY name = slis_ev_top_of_page.
    IF sy-subrc = 0.
    wa_event-form = slis_ev_top_of_page.
    MODIFY i_event FROM wa_event INDEX sy-tabix TRANSPORTING form.
    ENDIF.
    READ TABLE i_event INTO wa_event
    WITH KEY name = slis_ev_pf_status_set .
    IF sy-subrc = 0.
    wa_event-form = slis_ev_pf_status_set .
    MODIFY i_event FROM wa_event INDEX sy-tabix TRANSPORTING form.
    ENDIF.
    READ TABLE i_event INTO wa_event
    WITH KEY name = slis_ev_user_command.
    IF sy-subrc = 0.
    wa_event-form = slis_ev_user_command .
    MODIFY i_event FROM wa_event INDEX sy-tabix TRANSPORTING form.
    ENDIF.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    endform. "event
    **& Form
    *text
    form listheader.
    wa_head-typ = 'H'.
    wa_head-info = 'ALV PROGRAM AUTHOR jessy'
    APPEND wa_head TO i_head.
    endform. "listheader
    **& Form layout
    *text
    form layout.
    wa_layout-zebra = 'X'.
    wa_layout-f2code = 'DUB'.
    endform. "layout
    **& Form display
    *text
    form display.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    *I_INTERFACE_CHECK = ' '
    *I_BYPASSING_BUFFER = ' '
    *I_BUFFER_ACTIVE = ' '
    I_CALLBACK_PROGRAM = ' sy-repid '
    *I_CALLBACK_PF_STATUS_SET = ' '
    *I_CALLBACK_USER_COMMAND = ' '
    *I_CALLBACK_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_GRID_SETTINGS =
    IS_LAYOUT = wa_layout
    IT_FIELDCAT = i_fldcat[]
    *IT_EXCLUDING =
    *IT_SPECIAL_GROUPS =
    *IT_SORT =
    *IT_FILTER =
    *IS_SEL_HIDE =
    *I_DEFAULT = 'X'
    *I_SAVE = ' '
    *IS_VARIANT =
    IT_EVENTS = i_event[]                                                 "-----> correction done here
    *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_HYPERLINK =
    *IT_ADD_FIELDCAT =
    *IT_EXCEPT_QINFO =
    *I_HTML_HEIGHT_TOP =
    *I_HTML_HEIGHT_END =
    *IMPORTING
    *E_EXIT_CAUSED_BY_CALLER =
    *ES_EXIT_CAUSED_BY_USER =
    TABLES
    T_OUTTAB = i_final                                                        "-----> correction done here
    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
    You need to check the TYPE before passing the internal tables or workareas to the PARAMETERS of a Function Module.
    Regards,
    Ravi Kiran..

  • Problem in alv report output

    Hi friends,
    i have created alv report .no problem of getting output . but i m getting question mark in the standard menu. it is displaying 10 question mark (sub menu has print preview etc), edit ,question marks(ABC Analysis) ,question marks (abap list viewer etc ), settings ,system , help.
    i don't want these question marks. how to candle this.i haven't moved to test or production , but iwant  to know  in development  why it is coming..
    if any one knows please let me know.
    thanks and regards,
    kani.

    The Problem is with some GUI inconsistency.
    to overcome there are 2 solutions.
    1. You need to run a program Which i don't remember exactly.
    2. Using the Status event.
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
      EXPORTING
        i_callback_program = sy-repid
        it_fieldcat        = it_fieldcat
    I_CALLBACK_PF_STATUS_SET = 'STATUS'  "important
        it_sort            = it_sort
      TABLES
        t_outtab           = it_data
      EXCEPTIONS
        program_error      = 1.
    form status using extab tyoe slis_t_extab.
    "This status you can set using the program SAPLKKBL
    " go to se41 transaction, enter the program name SAPLKKBL
    "status as STANDARD , and click the Button Copy status
    "Now in the popup for Option to enter your program name and
    "press ok, then save and activate the status
    "now come here and activate the code and test now..
    set pf-status 'STANDARD' excluding extab.
    endform.

  • Alv report on material document

    hi to all thankds in advancee
    can u pls give coding for the report following
    created alv report to display materila document list per given receiving plant , receving storage location , and supplying plant , receving supplying storage location movemnt type and document date .
    thanks

    Hi,
    Use another internal table to display output.
    make changes in new table from previous table.
    loop at itab.
    at new <matnr>.
    jtab = itab.  " Copy all the fields from itab to jtab and append
    append jtab.
    continue.
    endat.
    ord_quan = ord_quan + count1.
    ship_quan = ship_quan + count2.
    at end of <matnr>.
    itab-ord-quan = ord-quan.
    itab-ship_quan = ship_quan.
    itab-balance = itab-ord_quan - itab-ship_quan.
    jtab = itab.
    append jtab.
    endat.
    clear itab.
    endloop.
    Use this JTAB to print the output.
    Regards,
    Bhanu

  • Alv report in dynamic

    hi friends,
    how to create alv report in dynamically.
    regards,
    jai

    Hi,
    Declare this in TOP:
    *   Declaration For ALV Used
    *-- Global data definitions for ALV
    *--- ALV Grid instance reference
    DATA:v_alvgrid TYPE REF TO cl_gui_alv_grid,
         v_alvgrid1 TYPE REF TO cl_gui_alv_grid.
    *--- Name of the custom control added on the screen
    DATA v_custom_control_name TYPE scrfname VALUE 'CONTAINER_100'.
    *--- Custom container instance reference
    DATA: v_container_100 TYPE REF TO cl_gui_custom_container,
          v_container_200 TYPE REF TO cl_gui_custom_container.
    *--- Field catalog table
    DATA it_fieldcat TYPE lvc_t_fcat.
    *---Layout Structure
    DATA : wa_layout TYPE lvc_s_layo.
    CONSTANTS: c_container_name_100(13) TYPE c VALUE 'CONTAINER_100',
               c_container_name_200(13) TYPE c VALUE 'CONTAINER_200'.
    *In PAI*
      CALL METHOD v_alvgrid->check_changed_data.
    <write code here>
      CALL METHOD v_alvgrid->refresh_table_display.
    HOPE THIS HELPS
    Code Formatted by: Alvaro Tejada Galindo on Jan 1, 2008 10:16 AM

  • Download the alv report in excel

    dear experts
    I am creating ALV report and working fine, i want the report sould be viewed in excel format when i click the icon on AlV display
    with regards.
    Ajay Kumar.

    Hi Ajay,
    SAP has provided the user interface for downloading the data into an excel file in the tool bar there is an option for downloading into excel.
    Another way is to write a code using the function module alsm_excel and then downloading into the excel,
    please tell me whether this reply was useful or for further clarification revert back
    Thanks in advance
    Srikanth

  • ALV Report in Purchae Order

    Hello Experts,
    Please help me, i am beginner in abap, i want to create ALV Report of Purchase Order, kindly explain me, how to create the same and if it is possible kindly send me the screenshort and oblige,
    thanks
    sujatha

    hello
    This program checks the paths, installation, and Registry keys of the desktop office applications and OCX files used in SAP Desktop Office Integration. Its results are useful to SAP if you report problems using Desktop Office Integration.
    "C:\Archivos de programa\SAP\FrontEnd\SapGui\Testtools\Check_DOI.exe"
    Hernando

  • ALV REPORTS

    could anybody explain me the procedure to create ALV  reports?in detail?

    hi
    You just have to code.. can take help from the following...
    *& Report  ZDEMO_ALVGRID                                               *
    *& Example of a simple ALV Grid Report                                 *
    *& The basic ALV grid, Enhanced to display each row in a different     *
    *& colour                                                              *
    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,
      line_color(4) type c,     "Used to store row color attributes
    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-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).
    Set layout field for row attributes(i.e. color)
      gd_layout-info_fieldname =      'LINE_COLOR'.
    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.
    data: ld_color(1) type c.
    select ebeln ebelp statu aedat matnr menge meins netpr peinh
    up to 10 rows
      from ekpo
      into table it_ekko.
    *Populate field with color attributes
    loop at it_ekko into wa_ekko.
    Populate color variable with colour properties
    Char 1 = C (This is a color property)
    Char 2 = 3 (Color codes: 1 - 7)
    Char 3 = Intensified on/off ( 1 or 0 )
    Char 4 = Inverse display on/off ( 1 or 0 )
              i.e. wa_ekko-line_color = 'C410'
      ld_color = ld_color + 1.
    Only 7 colours so need to reset color value
      if ld_color = 8.
        ld_color = 1.
      endif.
      concatenate 'C' ld_color '10' into wa_ekko-line_color.
    wa_ekko-line_color = 'C410'.
      modify it_ekko from wa_ekko.
    endloop.
    endform.                    " DATA_RETRIEVAL
    Hope this helps to solve ur problem....
    <b>do reward if useful....</b>
    regards
    dinesh

  • Is it possible to run ALV report in background if Yes how?

    is it possible to run ALV report in background if Yes how?

    Hi,
    Why not?Through se38 only you create ALV report. there you can give your report name and go to program on menu bar - click - execute buton- click-Background . You will get new screen there you can choose Execute immediate or schedule.
    <REMOVED BY MODERATOR>
    Cheers,
    Chandra Sekhar.
    Edited by: Alvaro Tejada Galindo on Mar 4, 2008 2:12 PM

  • Editable ALV Report

    Hi experts,
    Is it possible to create ALV report in editable mode.
    Regards,
    Rajneesh Gupta

    Hi there,
    Not sure if this will be of any use but here is an example of how to make specific fields editable rather than the whole table.
    http://www.sapdevelopment.co.uk/reporting/alv/alvgrid_editable.htm
    Regards
    Mart

Maybe you are looking for