Populating data in AVL

Advertisement

Populating data in AVL
Hi Friends,
I am having data in the final internal table and displaying in the table control, user wants to print the data available in the table control, I tried for the print option cannot get it. I am planning to use the ALV for printing purpose. when I am trying to send my final internal table data to the function
'REUSE_ALV_FIELDCATALOG_MERGE' it is not populating can any one send me the sample code for this function module. I am using table types in declaration.
Thanx in advance,
Line
Repaly
Refer the following code:
report  z_test_palv                             .
tables : mara.
select-options: s_matnr for mara-matnr.
type-pools: slis.
data: begin of itab occurs 0,
      matnr like mara-matnr,
      ernam like mara-ernam,
      ersda like mara-ersda,
      labor like mara-labor,
      end of itab.
data: i_fieldcat type slis_t_fieldcat_alv,
      xevents    type slis_t_event,
      ls_event    type slis_alv_event,
      slis_ev_top type slis_formname value 'TOP_OF_PAGE'.
data: v_repid like sy-repid.
start-of-selection.
  v_repid = sy-repid.
  select matnr ernam ersda labor
    into table itab
    from mara
    where matnr in s_matnr.
  call function 'REUSE_ALV_EVENTS_GET'
    exporting
      i_list_type     = 0
    importing
      et_events       = xevents
    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.
  read table xevents with key name = slis_ev_top
                           into ls_event.
  if sy-subrc = 0.
    move slis_ev_top to ls_event-form.
    append ls_event to xevents.
  endif.
  call function 'REUSE_ALV_FIELDCATALOG_MERGE'
    exporting
      i_program_name               =  v_repid
      i_internal_tabname           = 'ITAB'
*     I_STRUCTURE_NAME             =
*     I_CLIENT_NEVER_DISPLAY       = 'X'
      i_inclname                   = v_repid
      i_bypassing_buffer           = 'X'
      i_buffer_active              = ' '
    changing
      ct_fieldcat                  = i_fieldcat
    exceptions
      inconsistent_interface       = 1
      program_error                = 2
      others                       = 3
  if sy-subrc <> 0.
    message id sy-msgid type sy-msgty number sy-msgno
            with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  endif.
  call function 'REUSE_ALV_LIST_DISPLAY'
    exporting
*     I_INTERFACE_CHECK              = ' '
      i_bypassing_buffer             = 'X'
      i_buffer_active                = ' '
      i_callback_program             = v_repid
*     I_CALLBACK_PF_STATUS_SET       = ' '
*     I_CALLBACK_USER_COMMAND        = ' '
*     I_STRUCTURE_NAME               =
*     IS_LAYOUT                      =
      it_fieldcat                    = i_fieldcat
*     IT_EXCLUDING                   =
*     IT_SPECIAL_GROUPS              =
*     IT_SORT                        =
*     IT_FILTER                      =
*     IS_SEL_HIDE                    =
*     I_DEFAULT                      = 'X'
      i_save                         = 'A'
*     IS_VARIANT                     =
      it_events                      = xevents
*     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                       = 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.
*&      Form  top_of_page
*       text
form top_of_page.
  write:/ 'Top of page event triggeredÂ’.
  WRITE:/ ‘This report gives the material details'.
endform.                    "top_of_page
Read More: The other 5 answers