Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

slis_selfield

Former Member
0 Likes
7,699

hi friends ,

can any one explain me the use of slis_selfield and slis_t_event

thanks

deepti

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
3,579

Hi

watch the code you will get an idea especially perform event

*&---------------------------------------------------------------------*
*& Report  ZWRVBCLAIM_REP_ALV                                          *
*&                                                                     *
*&---------------------------------------------------------------------*
*&                                                                     *
*&                                                                     *
*&---------------------------------------------------------------------*

REPORT  zwrvbclaim_rep_alv NO STANDARD PAGE HEADING .

TABLES : zwarr_crnote,bseg.
TYPE-POOLS : slis.

DATA : BEGIN OF itab OCCURS 0,
        belnr LIKE zwarr_crnote-belnr,
        gjahr LIKE zwarr_crnote-gjahr,
        sernr LIKE zwarr_crnote-sernr,
        notifno LIKE zwarr_crnote-notifno,
        claim LIKE zwarr_crnote-claim,
        budat LIKE zwarr_crnote-budat,
        lifnr LIKE zwarr_crnote-lifnr,
        adhoc LIKE bseg-pswbt,
        service LIKE  bseg-pswbt,
        fixed LIKE  bseg-pswbt,
        line_color(4),
      END OF itab.

DATA: fieldtab TYPE slis_t_fieldcat_alv,
      header TYPE slis_t_listheader,
      events TYPE slis_t_event,
      layout TYPE slis_layout_alv,
      gt_sort TYPE slis_t_sortinfo_alv,
      formname TYPE slis_formname VALUE 'TOP_OF_PAGE',
      repname LIKE sy-repid,
      mtitle(70) TYPE c,
      slno(3) TYPE n.

DATA : ls_fieldcat TYPE slis_fieldcat_alv.
DATA : hline TYPE slis_listheader.
DATA : tabix LIKE sy-tabix.

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-000.
SELECT-OPTIONS : belnr FOR bseg-belnr,
                 budat FOR zwarr_crnote-budat OBLIGATORY,
                 sernr FOR zwarr_crnote-sernr,
                 lifnr FOR bseg-lifnr.
SELECTION-SCREEN END OF BLOCK b1.

START-OF-SELECTION.
  repname = sy-repid.
  PERFORM event USING events[].
  PERFORM layout USING layout .
  SELECT sernr notifno claim belnr budat gjahr lifnr FROM zwarr_crnote INTO CORRESPONDING FIELDS OF TABLE itab
                                   WHERE belnr IN belnr AND
                                         budat IN budat AND
                                         sernr IN sernr AND
                                         lifnr IN lifnr.

  LOOP AT itab.
    tabix = sy-tabix.
    SELECT SINGLE * FROM bseg WHERE belnr = itab-belnr AND gjahr = itab-gjahr AND bschl = '31' AND
                                                           shkzg = 'H'.
    IF sy-subrc EQ 0.
      ON CHANGE OF itab-belnr.
        itab-line_color = 'C201'.
        IF itab-notifno IS  NOT INITIAL.
          MOVE bseg-wrbtr TO itab-adhoc.
        ELSEIF itab-claim = 'F1'.
          MOVE bseg-wrbtr TO itab-fixed.
        ELSEIF itab-claim NE 'F1' AND itab-claim IS NOT INITIAL.
          MOVE bseg-wrbtr TO itab-service.
        ENDIF.
      ENDON.
      MODIFY itab INDEX tabix.
    ENDIF.
  ENDLOOP.
  PERFORM structure.
  PERFORM display.



*&---------------------------------------------------------------------*
*&      Form  print_data
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM print_data .

ENDFORM.                    " print_data
*&---------------------------------------------------------------------*
*&      Form  event
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_eventS[]  text
*----------------------------------------------------------------------*
FORM event  USING    p_events TYPE slis_t_event.

  DATA: ls_event TYPE slis_alv_event.

  CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
    EXPORTING
      i_list_type = 0
    IMPORTING
      et_events   = p_events.
  READ TABLE p_events WITH KEY name = slis_ev_top_of_page INTO ls_event.

  IF sy-subrc = 0.
    MOVE formname TO ls_event-form.
    APPEND ls_event TO p_events.
  ENDIF.

ENDFORM.                    " event
*&---------------------------------------------------------------------*
*&      Form  layout
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_layout  text
*----------------------------------------------------------------------*
FORM layout USING    p_layout TYPE slis_layout_alv.

  p_layout-zebra = 'X'.
*P_LAYOUT-NO_VLINE = ''.
*P_LAYOUT-NO_HLINE = ''.
  p_layout-numc_sum = 'X'.
*P_LAYOUT-F2CODE = F2CODE.
*  layout-info_fieldname = 'LINE_COLOR'.
*layout-expand_all = 'X'.
*P_LAYOUT-ITEM_TEXT = 'X'.
*P_LAYOUT-NO_AUTHOR = 'X'.
*LAYOUT-totals_before_items = 'X'. " diplay totals before the items
*P_LAYOUT-detail_popup = ''.

ENDFORM.                    " layout
*&---------------------------------------------------------------------*
*&      Form  structure
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM structure .
  PERFORM append_fieldcat USING  'BELNR' 'Accounting Document'
                           'BSEG' 'BELNR'.
  PERFORM append_fieldcat USING  'GJAHR' 'Fiscal Year'
                           'ZWARR_CRNOTE' 'GJAHR'.
  PERFORM append_fieldcat USING  'SERNR' 'Serial No'
                             'ZWARR_CRNOTE' 'SERNR'.
  PERFORM append_fieldcat USING  'NOTIFNO' 'Notification No'
                             'ZWARR_CRNOTE' 'NOTIFNO'.
  PERFORM append_fieldcat USING  'CLAIM' 'Claim No'
                              'ZWARR_CRNOTE' 'CLAIM'.
  PERFORM append_fieldcat USING  'BUDAT' 'Posting Date'
                               'ZWARR_CRNOTE' 'BUDAT'.
  PERFORM append_fieldcat USING  'LIFNR' 'Vendor'
                               'ZWARR_CRNOTE' 'LIFNR'.
  PERFORM append_fieldcat USING  'ADHOC' 'Adhoc Amount/Claim'
                                 'BSEG' 'PSWBT'.
  PERFORM append_fieldcat USING  'SERVICE' 'Serv.Charges/Annum'
                                 'BSEG' 'PSWBT'.
  PERFORM append_fieldcat USING  'FIXED' 'Fixed Amount/Engine'
                                 'BSEG' 'PSWBT'.
ENDFORM.                    " structure
*&---------------------------------------------------------------------*
*&      Form  append_fieldcat
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_0328   text
*      -->P_0329   text
*      -->P_0330   text
*      -->P_0331   text
*----------------------------------------------------------------------*
FORM append_fieldcat  USING    fldname
                               flddesc
                               reftab
                               reffld.
*                               len.
  ADD 1 TO slno.
  ls_fieldcat-col_pos = slno.
  ls_fieldcat-fieldname = fldname.
  ls_fieldcat-tabname = 'ITAB'.
  ls_fieldcat-ref_fieldname = reffld.
  ls_fieldcat-ref_tabname = reftab.
  ls_fieldcat-reptext_ddic = flddesc.
  ls_fieldcat-seltext_m = flddesc.
  ls_fieldcat-ddictxt   = 'M'.
*  ls_fieldcat-outputlen   = len.

  APPEND ls_fieldcat TO fieldtab.

ENDFORM.                    " append_fieldcat
*&---------------------------------------------------------------------*
*&      Form  display
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM display .
  DATA : p_repid TYPE sy-repid.
  p_repid = sy-repid.

  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
 EXPORTING
*   I_INTERFACE_CHECK                 = ' '
*   I_BYPASSING_BUFFER                = ' '
*   I_BUFFER_ACTIVE                   = ' '
    i_callback_program                = p_repid
*   I_CALLBACK_PF_STATUS_SET          = ' '
*   I_CALLBACK_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_GRID_SETTINGS                   =
    is_layout                         = layout
    it_fieldcat                       = fieldtab[]
*   IT_EXCLUDING                      =
*   IT_SPECIAL_GROUPS                 =
*   IT_SORT                           =
*   IT_FILTER                         =
*   IS_SEL_HIDE                       =
*    I_DEFAULT                         = 'X'
*    i_save                            = 'X'
*   IS_VARIANT                        =
    it_events                         = 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                          = 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.

ENDFORM.                    " display
*-------------------------------------------------------------------*
* Form  TOP-OF-PAGE                                                 *
*-------------------------------------------------------------------*
* ALV Report Header                                                 *
*-------------------------------------------------------------------*
FORM top_of_page.
*ALV Header declarations
  DATA: t_header TYPE slis_t_listheader,
        wa_header TYPE slis_listheader,
        t_line LIKE wa_header-info,
        date(10) TYPE c.

* Title
  wa_header-typ  = 'H'.
  CONCATENATE 'TMTL'  'LTD' INTO   wa_header-info SEPARATED BY space.
  APPEND wa_header TO t_header.
  CLEAR wa_header.

  CONCATENATE  sy-datum+6(2) '.'
                sy-datum+4(2)'.'
                sy-datum+0(4) INTO date.

  CONCATENATE 'Run Date: ' date
                    INTO t_line SEPARATED BY space.
  wa_header-typ  = 'S'.
  wa_header-key = t_line.
  APPEND wa_header TO t_header.
  CLEAR: wa_header, t_line.

  CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
      it_list_commentary = t_header.
*            i_logo             = 'Z_LOGO'.
ENDFORM.                    "TOP_OF_PAGE

it calls the events

Regards,

V.balaji

Reward if usefull

16 REPLIES 16
Read only

Former Member
0 Likes
3,580

Hi

watch the code you will get an idea especially perform event

*&---------------------------------------------------------------------*
*& Report  ZWRVBCLAIM_REP_ALV                                          *
*&                                                                     *
*&---------------------------------------------------------------------*
*&                                                                     *
*&                                                                     *
*&---------------------------------------------------------------------*

REPORT  zwrvbclaim_rep_alv NO STANDARD PAGE HEADING .

TABLES : zwarr_crnote,bseg.
TYPE-POOLS : slis.

DATA : BEGIN OF itab OCCURS 0,
        belnr LIKE zwarr_crnote-belnr,
        gjahr LIKE zwarr_crnote-gjahr,
        sernr LIKE zwarr_crnote-sernr,
        notifno LIKE zwarr_crnote-notifno,
        claim LIKE zwarr_crnote-claim,
        budat LIKE zwarr_crnote-budat,
        lifnr LIKE zwarr_crnote-lifnr,
        adhoc LIKE bseg-pswbt,
        service LIKE  bseg-pswbt,
        fixed LIKE  bseg-pswbt,
        line_color(4),
      END OF itab.

DATA: fieldtab TYPE slis_t_fieldcat_alv,
      header TYPE slis_t_listheader,
      events TYPE slis_t_event,
      layout TYPE slis_layout_alv,
      gt_sort TYPE slis_t_sortinfo_alv,
      formname TYPE slis_formname VALUE 'TOP_OF_PAGE',
      repname LIKE sy-repid,
      mtitle(70) TYPE c,
      slno(3) TYPE n.

DATA : ls_fieldcat TYPE slis_fieldcat_alv.
DATA : hline TYPE slis_listheader.
DATA : tabix LIKE sy-tabix.

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-000.
SELECT-OPTIONS : belnr FOR bseg-belnr,
                 budat FOR zwarr_crnote-budat OBLIGATORY,
                 sernr FOR zwarr_crnote-sernr,
                 lifnr FOR bseg-lifnr.
SELECTION-SCREEN END OF BLOCK b1.

START-OF-SELECTION.
  repname = sy-repid.
  PERFORM event USING events[].
  PERFORM layout USING layout .
  SELECT sernr notifno claim belnr budat gjahr lifnr FROM zwarr_crnote INTO CORRESPONDING FIELDS OF TABLE itab
                                   WHERE belnr IN belnr AND
                                         budat IN budat AND
                                         sernr IN sernr AND
                                         lifnr IN lifnr.

  LOOP AT itab.
    tabix = sy-tabix.
    SELECT SINGLE * FROM bseg WHERE belnr = itab-belnr AND gjahr = itab-gjahr AND bschl = '31' AND
                                                           shkzg = 'H'.
    IF sy-subrc EQ 0.
      ON CHANGE OF itab-belnr.
        itab-line_color = 'C201'.
        IF itab-notifno IS  NOT INITIAL.
          MOVE bseg-wrbtr TO itab-adhoc.
        ELSEIF itab-claim = 'F1'.
          MOVE bseg-wrbtr TO itab-fixed.
        ELSEIF itab-claim NE 'F1' AND itab-claim IS NOT INITIAL.
          MOVE bseg-wrbtr TO itab-service.
        ENDIF.
      ENDON.
      MODIFY itab INDEX tabix.
    ENDIF.
  ENDLOOP.
  PERFORM structure.
  PERFORM display.



*&---------------------------------------------------------------------*
*&      Form  print_data
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM print_data .

ENDFORM.                    " print_data
*&---------------------------------------------------------------------*
*&      Form  event
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_eventS[]  text
*----------------------------------------------------------------------*
FORM event  USING    p_events TYPE slis_t_event.

  DATA: ls_event TYPE slis_alv_event.

  CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
    EXPORTING
      i_list_type = 0
    IMPORTING
      et_events   = p_events.
  READ TABLE p_events WITH KEY name = slis_ev_top_of_page INTO ls_event.

  IF sy-subrc = 0.
    MOVE formname TO ls_event-form.
    APPEND ls_event TO p_events.
  ENDIF.

ENDFORM.                    " event
*&---------------------------------------------------------------------*
*&      Form  layout
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_layout  text
*----------------------------------------------------------------------*
FORM layout USING    p_layout TYPE slis_layout_alv.

  p_layout-zebra = 'X'.
*P_LAYOUT-NO_VLINE = ''.
*P_LAYOUT-NO_HLINE = ''.
  p_layout-numc_sum = 'X'.
*P_LAYOUT-F2CODE = F2CODE.
*  layout-info_fieldname = 'LINE_COLOR'.
*layout-expand_all = 'X'.
*P_LAYOUT-ITEM_TEXT = 'X'.
*P_LAYOUT-NO_AUTHOR = 'X'.
*LAYOUT-totals_before_items = 'X'. " diplay totals before the items
*P_LAYOUT-detail_popup = ''.

ENDFORM.                    " layout
*&---------------------------------------------------------------------*
*&      Form  structure
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM structure .
  PERFORM append_fieldcat USING  'BELNR' 'Accounting Document'
                           'BSEG' 'BELNR'.
  PERFORM append_fieldcat USING  'GJAHR' 'Fiscal Year'
                           'ZWARR_CRNOTE' 'GJAHR'.
  PERFORM append_fieldcat USING  'SERNR' 'Serial No'
                             'ZWARR_CRNOTE' 'SERNR'.
  PERFORM append_fieldcat USING  'NOTIFNO' 'Notification No'
                             'ZWARR_CRNOTE' 'NOTIFNO'.
  PERFORM append_fieldcat USING  'CLAIM' 'Claim No'
                              'ZWARR_CRNOTE' 'CLAIM'.
  PERFORM append_fieldcat USING  'BUDAT' 'Posting Date'
                               'ZWARR_CRNOTE' 'BUDAT'.
  PERFORM append_fieldcat USING  'LIFNR' 'Vendor'
                               'ZWARR_CRNOTE' 'LIFNR'.
  PERFORM append_fieldcat USING  'ADHOC' 'Adhoc Amount/Claim'
                                 'BSEG' 'PSWBT'.
  PERFORM append_fieldcat USING  'SERVICE' 'Serv.Charges/Annum'
                                 'BSEG' 'PSWBT'.
  PERFORM append_fieldcat USING  'FIXED' 'Fixed Amount/Engine'
                                 'BSEG' 'PSWBT'.
ENDFORM.                    " structure
*&---------------------------------------------------------------------*
*&      Form  append_fieldcat
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_0328   text
*      -->P_0329   text
*      -->P_0330   text
*      -->P_0331   text
*----------------------------------------------------------------------*
FORM append_fieldcat  USING    fldname
                               flddesc
                               reftab
                               reffld.
*                               len.
  ADD 1 TO slno.
  ls_fieldcat-col_pos = slno.
  ls_fieldcat-fieldname = fldname.
  ls_fieldcat-tabname = 'ITAB'.
  ls_fieldcat-ref_fieldname = reffld.
  ls_fieldcat-ref_tabname = reftab.
  ls_fieldcat-reptext_ddic = flddesc.
  ls_fieldcat-seltext_m = flddesc.
  ls_fieldcat-ddictxt   = 'M'.
*  ls_fieldcat-outputlen   = len.

  APPEND ls_fieldcat TO fieldtab.

ENDFORM.                    " append_fieldcat
*&---------------------------------------------------------------------*
*&      Form  display
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM display .
  DATA : p_repid TYPE sy-repid.
  p_repid = sy-repid.

  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
 EXPORTING
*   I_INTERFACE_CHECK                 = ' '
*   I_BYPASSING_BUFFER                = ' '
*   I_BUFFER_ACTIVE                   = ' '
    i_callback_program                = p_repid
*   I_CALLBACK_PF_STATUS_SET          = ' '
*   I_CALLBACK_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_GRID_SETTINGS                   =
    is_layout                         = layout
    it_fieldcat                       = fieldtab[]
*   IT_EXCLUDING                      =
*   IT_SPECIAL_GROUPS                 =
*   IT_SORT                           =
*   IT_FILTER                         =
*   IS_SEL_HIDE                       =
*    I_DEFAULT                         = 'X'
*    i_save                            = 'X'
*   IS_VARIANT                        =
    it_events                         = 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                          = 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.

ENDFORM.                    " display
*-------------------------------------------------------------------*
* Form  TOP-OF-PAGE                                                 *
*-------------------------------------------------------------------*
* ALV Report Header                                                 *
*-------------------------------------------------------------------*
FORM top_of_page.
*ALV Header declarations
  DATA: t_header TYPE slis_t_listheader,
        wa_header TYPE slis_listheader,
        t_line LIKE wa_header-info,
        date(10) TYPE c.

* Title
  wa_header-typ  = 'H'.
  CONCATENATE 'TMTL'  'LTD' INTO   wa_header-info SEPARATED BY space.
  APPEND wa_header TO t_header.
  CLEAR wa_header.

  CONCATENATE  sy-datum+6(2) '.'
                sy-datum+4(2)'.'
                sy-datum+0(4) INTO date.

  CONCATENATE 'Run Date: ' date
                    INTO t_line SEPARATED BY space.
  wa_header-typ  = 'S'.
  wa_header-key = t_line.
  APPEND wa_header TO t_header.
  CLEAR: wa_header, t_line.

  CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
      it_list_commentary = t_header.
*            i_logo             = 'Z_LOGO'.
ENDFORM.                    "TOP_OF_PAGE

it calls the events

Regards,

V.balaji

Reward if usefull

Read only

Former Member
0 Likes
3,579

Hi

A list of possible events is populated into an event table (I_EVENTS) when this table is passed to the function module REUSE_ALV_EVENT_NAMES_GET. The return table from this function module contains all the possible events.

The function module contains following import and export parameters.

IMPORTING PARAMETERS: I_LIST_TYPE

This parameter has possible values from 0-4.

The parameter I_LIST_TYPE is of TYPE SLIS_LIST_TYPE and is DEFAULT 0 .

EXPORTING PARAMETERS: I_EVENTS table.

This table is of TYPE SLIS_T_EVENT and returns to the program the name of all the possible events.

The table structure contains the fields:

I_EVENTS-NAME: Name of the Callback event.

I_EVENTS-FORM: Name of the form routine that should be called in the calling program at the event.

Only events with a form routine name are processed.

The I_EVENTS table returns with the following possible constants:

1. Slis_ev_item_data_expand TYPE slis_formname VALUE 'ITEM_DATA_EXPAND'.

Only relevant for hierarchical-sequential lists using the layout parameter IS_LAYOUT-EXPAND_FIELDNAME of the structure IS_LAYOUT. Exit for passing item entries (ITEM table) for a header record that was expanded interactively by the user.

2. Slis_ev_reprep_sel_modify TYPE slis_formname VALUE 'REPREP_SEL_MODIFY'.

RS_SELFIELD-TABINDEX contains the header table index for which the item entries are to be put in the global item output table (T_OUTTAB_SLAVE). The Callback is only called if ALV has no items for a header that is to be expanded.

RFLG_ALL is passed with 'X' if the user shows all items. The application must ensure that entries are not repeated in the item table.

RS_SELFIELD is initial in this case.

3. Slis_ev_caller_exit_at_start TYPE slis_formname VALUE 'CALLER_EXIT'.

Is called at the beginning of the function module to make special settings. It is not usually used.

4. Slis_ev_user_command TYPE slis_formname VALUE 'USER_COMMAND'.

As this is a frequently-used Callback event, the form routine can also be passed directly in the interface by passing the user command in the IMPORTING parameter I_CALLBACK_USER_COMMAND.

5. Slis_ev_top_of_page TYPE slis_formname VALUE 'TOP_OF_PAGE'.

Equivalent to the list processing TOP-OF-PAGE event.

6. Slis_ev_top_of_coverpage TYPE slis_formname VALUE 'TOP_OF_COVERPAGE'.

The selection information and list status are output together (if they exist) on a separate page by default

7. Slis_ev_end_of_coverpage TYPE slis_formname VALUE 'END_OF_COVERPAGE'.

Analogously to TOP_OF_COVERPAGE the user can add other information

to the information output by ALV (selection information, list status) at this event.

8. Slis_ev_foreign_top_of_page TYPE slis_formname VALUE ‘FOREIGN_TOP_OF_PAGE'.

The Top-of-page event is always processed in ALV and is only passed to the caller via the Callback mechanism. This is still the case if the caller, e.g. by a user action, processes a branch list which was not formatted by ALV (e.g. a popup with additional information about the list record selected and displayed by ALV).

In this case, top-of-page cannot be formatted by ALV analogously to the basic list, it must be handled completely by the caller. The event top-of-page still occurs in ALV. When ALV notices a top-of-page which was not caused by an ALV output, the form routine in FOREIGN_TOP_OF_PAGE is called.

9. Slis_ev_foreign_end_of_page TYPE slis_formname VALUE 'FOREIGN_END_OF_PAGE'.

The event end-of-page is always processed in ALV and only passed to the caller via callback. This is still the case, e.g. when the caller processes a details list which was not formatted by ALV (e.g. a popup with further information about selected list records which were displayed by ALV).

In this case, end-of-page cannot be formatted by ALV analogously to the basic list, it must be handled completely by the caller. The event end-of-page still occurs in ALV. When ALV notices an end-of-page that was not caused by an ALV output, the form routine in FOREIGN_END_OF_PAGE is called.

10. Slis_ev_pf_status_set TYPE slis_formname VALUE 'PF_STATUS_SET'.

If a user list status is to be set, it must be done in the form routine assigned to this event. The ALV function codes, which must not be active, are in the Parameter RT_EXTAB. This table must be passed with the SET PF-STATUS command (with inactive user function codes as well, if necessary).

The STANDARD status of the function group SALV should be used as a template for a user-specific status. As this is a frequently used Callback event, its form routine can also be passed directly in the interface in the IMPORTING parameter I_CALLBACK_PF_STATUS_SET.

11. Slis_ev_list_modify TYPE slis_formname VALUE 'LIST_MODIFY'.

LIST_MODIFY USING R_TABNAME TYPE SLIS_TABNAME

R_INDEX LIKE SY-TABIX

R_INDEX_ITEM LIKE SY-TABIX

R_INDEX_SUM LIKE SY-TABIX.

12. Slis_ev_top_of_list TYPE slis_formname VALUE 'TOP_OF_LIST'.

Information output at the start of the list

13. Slis_ev_end_of_page TYPE slis_formname VALUE 'END_OF_PAGE'.

Information output at the end of a page. This is only called for printing.

14. Slis_ev_end_of_list TYPE slis_formname VALUE 'END_OF_LIST'.

Information output at the end of the list

15. Slis_ev_after_line_output TYPE slis_formname VALUE 'AFTER_LINE_OUTPUT'.

Output information after each output line. Should only be used in justified cases because it costs a lot of performance.

16. Slis_ev_before_line_output TYPE slis_formname VALUE 'BEFORE_LINE_OUTPUT'.

Output information before each output line. Should only be used in justified cases because it costs a lot of performance.

17. Slis_ev_subtotal_text TYPE slis_formname VALUE 'SUBTOTAL_TEXT'.

This event table (I_EVENTS) is now checked with the desired constants. If the desired constant is found, then the corresponding field for the FORM NAME is populated with the name of the routine containing the corresponding event.

Read only

Former Member
0 Likes
3,579

hi deepthi,

SLIS_SELFIELD: It is for cursor positioning in ALV.

SLIS_T_EVENT: This is to set the events (for display the header data).

slis_selfield

TYPE-POOLS: slis. "Global types for generic listing constituents.

DATA: itab LIKE STANDARD TABLE OF MARA WITH HEADER LINE.

DATA: gs_selfield TYPE slis_selfield "Information cursor position ALV

, w_aufnr LIKE MARA-MATNR,

U_UCOMM LIKE SY-UCOMM. "Order Number

SELECT * FROM MARA INTO TABLE itab WHERE MATNR LIKE

'000007178%'.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY' "for GRID

EXPORTING

i_structure_name = 'MARA'

i_callback_program = sy-cprog

i_callback_user_command = 'USER_COMMAND_IW33'

TABLES

t_outtab = itab

EXCEPTIONS

program_error = 1

OTHERS = 2.

IF sy-subrc <> 0.

leave program.

ENDIF.

FORM user_command_iw33 USING u_ucomm LIKE sy-ucomm

us_selfield TYPE slis_selfield. "#EC

CASE u_ucomm.

WHEN '&IC1'. "Double Click / Hot Spot

gs_selfield = us_selfield. "Line selected

IF gs_selfield-fieldname = 'MATNR'. "Field selected

w_aufnr = gs_selfield+101(13). "Order Number

  • Show the Program

  • put your code.

ELSE.

MESSAGE w208(00) WITH 'Select by Order only!'.

ENDIF.

ENDCASE.

ENDFORM.

slis_t_event

DATA: X_EVENT TYPE SLIS_T_EVENT.

DATA: WA_EVENT TYPE SLIS_ALV_EVENT.

and create one perform for getting events.

FORM BUILD_EVENT.

CALL FUNCTION 'REUSE_ALV_EVENTS_GET'

EXPORTING

I_LIST_TYPE = 0

IMPORTING

ET_EVENTS = X_EVENT

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 X_EVENT INTO WA_EVENT

WITH KEY NAME = SLIS_EV_PF_STATUS_SET.

IF SY-SUBRC = 0.

WA_EVENT-FORM = V_PF_STATUS.

MODIFY X_EVENT FROM WA_EVENT INDEX SY-TABIX.

ENDIF.

Read only

0 Likes
3,579

to the point yet descriptive explanation.. Thankyou!!

Read only

venkat_o
Active Contributor
0 Likes
3,579

Hi Deepti,

When u use ALV to display output, classical events TOP OF PAGE, AT LINE-SELECTION, AT USER-COMMAND are not triggered. To trigger such events when we use ALV, We have to define one internal table type slis_t_event and then build that Itab and should be passed through REUSE_ALV_LIST_DISPLAY function module.

Build events table like this.

w_events-name = 'TOP_OF_PAGE'.
w_events-form = 'TOP_OF_PAGE'.
append w_events to i_events.
clear w_events.

w_events-name = 'USER_COMMAND' .
w_events-form = 'USER_COMMAND' .
append w_events to i_events.
clear w_events.
 
w_events-name = 'PF_STATUS_SET' .
w_events-form = 'PF_STATUS_SET' .
append w_events to i_events.
clear w_events.

2.

When we handle USER_COMMAND event, slis_selfield structure will be seen. This structure contains information like when we double click on output, on which field double cliked and what is the value of that field.

You can check the structure below

*&---------------------------------------------------------------------*
*&      Form  user_command
*&---------------------------------------------------------------------*
form user_command using ucomm like sy-ucomm
                  selfield type slis_selfield.
  case ucomm .
    when '&IC1'. This is for double click on ALV output.
      skip 10.
      position 10.
      write 'Double click was executed'.
  endcase.
 
endform.                    "user_command

selfield structure

You can also handle Interactive ALV using this structure.

types: begin of slis_selfield,
         tabname              type slis_tabname,
         tabindex             like sy-tabix,
         sumindex             like sy-tabix,
         endsum(1)            type c,
         sel_tab_field        type slis_sel_tab_field,
         value                type slis_entry,
         before_action(1)     type c,
         after_action(1)      type c,
         refresh(1)           type c,
         col_stable(1)        type c,
         row_stable(1)        type c,
*        colwidth_optimize(1) type c,
         exit(1)              type c,
         fieldname            type slis_fieldname,
         grouplevel           type i,
         collect_from         type i,
         collect_to           type i,
       end of slis_selfield.

I Hope that it helps you.

Regards,

Venkat.O

Read only

Former Member
0 Likes
3,579

Hi deepti,

SLIS_SELFIELD: it is similar to get cursor key word, which will be used for capturing  the value of a field

SLIS_T_EVENT : this is used for capturing the events performed by user

--

Jack

Read only

Former Member
0 Likes
3,579

hi,

please check the following piece of code to under stand SLIS_SELFIELD ad slis_t_event

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

    EXPORTING

      IS_LAYOUT               = WRK_LAYOUT

      I_CALLBACK_PROGRAM      = SY-REPID

      I_CALLBACK_USER_COMMAND = 'P_CALLBACK'

      IT_FIELDCAT             = TAB_FIELDCAT

      IS_VARIANT              = WRK_VARIANT

      I_SAVE                  = ABAP_TRUE

    TABLES

      T_OUTTAB                = <FS_TABLE>

    EXCEPTIONS

      PROGRAM_ERROR           = 1

      OTHERS                  = 2.

*&---------------------------------------------------------------------*

*&      Form  P_CALLBACK

*&---------------------------------------------------------------------*

*       text

*----------------------------------------------------------------------*

*      -->UCOMM      text

*      -->SELFIELD   text

*----------------------------------------------------------------------*

FORM P_CALLBACK USING UCOMM    LIKE SY-UCOMM

                      SELFIELD TYPE SLIS_SELFIELD.

  CASE UCOMM.

    WHEN '&IC1'.

    WHEN 'REFH'.

      DELETE <FS_TABLE> INDEX 1.

      CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'

        IMPORTING

          E_GRID = WRK_GRID.

      CALL METHOD WRK_GRID->REFRESH_TABLE_DISPLAY.

    WHEN OTHERS.

  ENDCASE.

ENDFORM.                    "P_CALLBACK

hope it helps,

Mathan R.

Read only

0 Likes
3,579

to capture the cursor line ive  slis_selfield.. based on that i have filled one internal table aswell.. Now hot to display this output table into a report....

my code:

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           = '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                         =

    IT_FIELDCAT                       = GTOUTTAB

*   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                          = ITABCOMBI

* 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 user_command USING r_ucomm TYPE sy-ucomm

                         rs_selfield TYPE slis_selfield.

   CASE r_ucomm.

*User clicks a transaction code and that tcode is called from ALV

     WHEN '&IC1'.   "Double Click / Hot Spot

       gs_selfield = rs_selfield.

       IF gs_selfield-fieldname = 'EKKO-EBELN'.

         SELECT EBELN STATU

           FROM EKPO

           INTO CORRESPONDING FIELDS OF TABLE itabekpo

           WHERE EBELN = gs_selfield-value.

           ELSE.

MESSAGE w208(001) WITH 'Select by Order only!'.

ENDIF.

ENDCASE.

ENDFORM.

now how do i display or create a report for table itabekpo based on interaction with previous tabble??

Read only

0 Likes
3,579

to capture the cursor line ive  slis_selfield.. based on that i have filled one internal table aswell.. Now hot to display this output table into a report....

my code:

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           = '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                         =

    IT_FIELDCAT                       = GTOUTTAB

*   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                          = ITABCOMBI

* 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 user_command USING r_ucomm TYPE sy-ucomm

                         rs_selfield TYPE slis_selfield.

   CASE r_ucomm.

*User clicks a transaction code and that tcode is called from ALV

     WHEN '&IC1'.   "Double Click / Hot Spot

       gs_selfield = rs_selfield.

       IF gs_selfield-fieldname = 'EKKO-EBELN'.

         SELECT EBELN STATU

           FROM EKPO

           INTO CORRESPONDING FIELDS OF TABLE itabekpo

           WHERE EBELN = gs_selfield-value.

           ELSE.

MESSAGE w208(001) WITH 'Select by Order only!'.

ENDIF.

ENDCASE.

ENDFORM.

now how do i display or create a report for table itabekpo based on interaction with previous tabble??

Read only

0 Likes
3,579

hi,

After this..

     WHEN '&IC1'.   "Double Click / Hot Spot

       gs_selfield = rs_selfield.

       IF gs_selfield-fieldname = 'EKKO-EBELN'.

         SELECT EBELN STATU

           FROM EKPO

           INTO CORRESPONDING FIELDS OF TABLE itabekpo

           WHERE EBELN = gs_selfield-value.

           ELSE.

MESSAGE w208(001) WITH 'Select by Order only!'.

ENDIF.

you can create another ALV using the same FM REUSE_ALV_GRID_DISPLAY itself.

All you have to do is.. call the FM again.. Before passing the parameters, clear it and pass. thats it..

thanks,

Mathan R.

Read only

0 Likes
3,579

with the program ive posted im getting the 1st level ALV report, but when im clicking on hotspot field (ebeln), its throwing a dump: Runtime errors         LOAD_PROGRAM_NOT_FOUND

Read only

0 Likes
3,579

also, just to check if my form is working, i wrote a simple write statement in the form:

CASE r_ucomm.

*User clicks a transaction code and that tcode is called from ALV

     WHEN '&IC1'.   "Double Click / Hot Spot

       gs_selfield = rs_selfield.

       WRITE: gs_selfield-fieldname.

ENDCASE.

ENDFORM.

And even this was not executing.

Read only

0 Likes
3,579

Just for your reference: this is my program:

REPORT   ZALV_REPORT1           .

*-------Tables Used----------------------------------------------------

TABLES: SPFLI, SCARR.  "SPFLI - Flight Schedule;; SCARR - Airline Detail

*-----------------------------------------------------------------------------

*-------------------Declaring Type Pool used & Structure.--------------------------------------

TYPE-POOLS: slis.               .

TYPES: BEGIN OF ud_struct,

         EKKO LIKE EKKO,

         EKPO LIKE EKPO,

     END OF ud_struct.

TYPES: BEGIN OF ebeln,

        zebeln LIKE EKKO-EBELN,

        END OF ebeln.

*----------------------------------------------------------------------------------------------

*------------------------------Internal Tables Declaration----------------------------------------

DATA: ITABCOMBI TYPE TABLE OF ud_struct,

       GTOUTTAB TYPE SLIS_T_FIELDCAT_ALV,

       WA_OUTTAB LIKE LINE OF GTOUTTAB,

       OUTTAB TYPE SLIS_T_FIELDCAT_ALV,

       WA1_OUTTAB LIKE LINE OF GTOUTTAB,

       Doc_Nm LIKE EKKO-EBELN,   "Select Option Filed Decalarion

       itab TYPE TABLE OF ebeln,

       wa LIKE LINE OF itab.

TYPES: BEGIN OF itab_ekpo,

       EBELN TYPE EBELN,

       STATU TYPE STATU,

       END OF itab_ekpo.

DATA: itabekpo TYPE TABLE OF itab_ekpo.

DATA: gs_selfield TYPE slis_selfield. "Information cursor position ALV

SELECTION-SCREEN BEGIN OF BLOCK A1 WITH FRAME TITLE TEXT-000.

SELECT-OPTIONS: DOC_NUM for Doc_Nm.

SELECTION-SCREEN END OF BLOCK A1.

AT SELECTION-SCREEN.

   SELECT  EBELN FROM EKKO INTO TABLE itab WHERE EBELN IN DOC_NUM.

START-OF-SELECTION.

     SELECT * FROM EKKO INNER JOIN EKPO ON EKKO~EBELN = EKPO~EBELN

       INTO TABLE ITABCOMBI

       FOR ALL ENTRIES IN ITAB

       WHERE EKKO~EBELN = ITAB-ZEBELN.

WA_OUTTAB-tabname = 'ITABCOMBI'.

WA_OUTTAB-fieldname = 'EKKO-EBELN'.

WA_OUTTAB-SELTEXT_M = 'Purchasing Doc Num'.

WA_OUTTAB-COL_POS = 1.

WA_OUTTAB-OUTPUTLEN = 15.

WA_OUTTAB-HOTSPOT = 'X'.

APPEND WA_OUTTAB TO GTOUTTAB.

CLEAR WA_OUTTAB.

WA_OUTTAB-tabname = 'ITABCOMBI'.

WA_OUTTAB-fieldname = 'EKKO-BUKRS'.

WA_OUTTAB-SELTEXT_M = 'Company Code'.

WA_OUTTAB-COL_POS = 2.

WA_OUTTAB-OUTPUTLEN = 15.

APPEND WA_OUTTAB TO GTOUTTAB.

CLEAR WA_OUTTAB.

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           = '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                         =

    IT_FIELDCAT                       = GTOUTTAB

*   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                          = ITABCOMBI

* 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 user_command USING r_ucomm TYPE sy-ucomm

                         rs_selfield TYPE slis_selfield.

   CASE r_ucomm.

*User clicks a transaction code and that tcode is called from ALV

     WHEN '&IC1'.   "Double Click / Hot Spot

       gs_selfield = rs_selfield.

       WRITE: gs_selfield-fieldname.

ENDCASE.

ENDFORM.

Read only

0 Likes
3,579

Can you just tell me the MINIMUM events required for an interactive ALV report?.. I dont want all the top events and all.. just enough events so that when i click on a field of 1st level ALV, it should generate me another report based on an internal table where i have fed my data?

Read only

0 Likes
3,579

hi,

*& SETTING OUR ROUTINE NAME TO THE CORRESPONDING EVENT IN ALV GRID

*&---------------------------------------------------------------------*

   "SORTING IT FOR USING BINARY SEARCH IN READ STMT.

   SORT: LT_EVENT BY NAME.

   READ TABLE LT_EVENT BINARY SEARCH WITH KEY NAME = SLIS_EV_TOP_OF_PAGE INTO LS_EVENT.

   IF SY-SUBRC EQ 0.

     LS_EVENT-FORM = 'Z_FI_TOP'.

     APPEND LS_EVENT TO LT_EVENT.

     CLEAR LS_EVENT.

   ENDIF.

   READ TABLE LT_EVENT BINARY SEARCH WITH KEY NAME = SLIS_EV_USER_COMMAND INTO LS_EVENT.

   IF SY-SUBRC EQ 0.

     LS_EVENT-FORM = 'Z_FI_USER_COMMAND'.

     APPEND LS_EVENT TO LT_EVENT.

     CLEAR LS_EVENT.

   ENDIF.

   READ TABLE LT_EVENT BINARY SEARCH WITH KEY NAME = SLIS_EV_PF_STATUS_SET INTO LS_EVENT.

   IF SY-SUBRC EQ 0.

     LS_EVENT-FORM = 'Z_FI_MY_STATUS'.

     APPEND LS_EVENT TO LT_EVENT.

     CLEAR LS_EVENT.

   ENDIF.

"LOCAL VARIABLE DECLARATIONS USED INSIDE THE ROUTINE

   DATA: LS_EVENT TYPE SLIS_ALV_EVENT.

   "FM RESPONSIBLE TO GET AVAILABLE EVENTS IN ALV GRID

   CALL FUNCTION 'REUSE_ALV_EVENTS_GET'

     EXPORTING

       I_LIST_TYPE     = 0

     IMPORTING

       ET_EVENTS       = LT_EVENT

     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.

FORM Z_FI_USER_COMMAND USING R_UCOMM TYPE LV_UCOMM_N

                          LS_SELFIELD TYPE LS_SEL_FIELD_N.

   CASE R_UCOMM.

     WHEN 'PDF'.

       "ROUTINE RESPONSIBLE FOR DOWNLOADING REPORT IN PDF EXTENSION

       PERFORM Z_FI_PDF_DOWN.

     WHEN '&IC1'.

       IF LS_SELFIELD-FIELDNAME = 'VBELN'.

         MESSAGE S000 DISPLAY LIKE 'E'.

       ENDIF.

   ENDCASE.

ENDFORM.                  " USER_COMMAND

*&---------------------------------------------------------------------*

*&      Form  Z_FI_PDF_DOWN

*&---------------------------------------------------------------------*

* "ROUTINE RESPONSIBLE FOR DOWNLOADING REPORT IN PDF EXTENSION

*----------------------------------------------------------------------*

FORM Z_FI_PDF_DOWN .

   "LOCAL VARIABLE DECLARATIONS USED INSIDE THE ROUTINES

   DATA: LS_PRINT_PARMS TYPE PRI_PARAMS,

         LS_SPOOL       TYPE TSP01-RQIDENT,

         LV_PATH        TYPE IBIPPARMS-PATH,

         LV_FILE_PDF    TYPE STRING,

         LT_TLINE       TYPE TABLE OF TLINE.

   "FM RESPONSIBLE TO READ THE SPOOL PRINT PARAMETERS

   CALL FUNCTION 'GET_PRINT_PARAMETERS'

     EXPORTING

       COPIES                 = '1'

       NO_DIALOG              = 'X'

       USER                   = SY-UNAME

     IMPORTING

       OUT_PARAMETERS         = LS_PRINT_PARMS

     EXCEPTIONS

       ARCHIVE_INFO_NOT_FOUND = 1

       INVALID_PRINT_PARAMS   = 2

       INVALID_ARCHIVE_PARAMS = 3

       OTHERS                 = 4.

   IF SY-SUBRC EQ 0.

     "TO SPECIFY THE SPOOL PRINT PARAMETERS OF THE SPOOL REQUEST

     NEW-PAGE PRINT ON NEW-SECTION PARAMETERS LS_PRINT_PARMS NO DIALOG.

     "FM RESPONSIBLE FOR DISPLAYING THE ALV GRID REPORT

     PERFORM Z_FI_ALV_GRID.

   ELSE.

     MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

     WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

   ENDIF.

   LS_SPOOL = SY-SPONO.

   "FM RESPONSIBLE FOR CONVERTING THE REPORT INTO PDF EXTENSION

   CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'

     EXPORTING

       SRC_SPOOLID              = LS_SPOOL

       DST_DEVICE               = 'LP01'

     TABLES

       PDF                      = LT_TLINE

     EXCEPTIONS

       ERR_NO_ABAP_SPOOLJOB     = 1

       ERR_NO_SPOOLJOB          = 2

       ERR_NO_PERMISSION        = 3

       ERR_CONV_NOT_POSSIBLE    = 4

       ERR_BAD_DESTDEVICE       = 5

       USER_CANCELLED           = 6

       ERR_SPOOLERROR           = 7

       ERR_TEMSEERROR           = 8

       ERR_BTCJOB_OPEN_FAILED   = 9

       ERR_BTCJOB_SUBMIT_FAILED = 10

       ERR_BTCJOB_CLOSE_FAILED  = 11

       OTHERS                   = 12.

   IF SY-SUBRC <> 0.

     MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

     WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

   ELSE.

     "FM RESPONSIBLE FOR ACQUIRING THE FILE PATH

     CALL FUNCTION 'F4_FILENAME'

       EXPORTING

         PROGRAM_NAME  = SY-REPID

         DYNPRO_NUMBER = SY-DYNNR

       IMPORTING

         FILE_NAME     = LV_PATH.

     CONCATENATE LV_PATH '.PDF' INTO LV_FILE_PDF.

     "FM RESPONSIBLE FOR DOWNLOADING THE FILE TO THE PRESENTATION SERVER

     CALL FUNCTION 'GUI_DOWNLOAD'

       EXPORTING

         FILENAME                = LV_FILE_PDF

         FILETYPE                = 'BIN'

       TABLES

         DATA_TAB                = LT_TLINE

       EXCEPTIONS

         FILE_WRITE_ERROR        = 1

         NO_BATCH                = 2

         GUI_REFUSE_FILETRANSFER = 3

         INVALID_TYPE            = 4

         NO_AUTHORITY            = 5

         UNKNOWN_ERROR           = 6

         HEADER_NOT_ALLOWED      = 7

         SEPARATOR_NOT_ALLOWED   = 8

         FILESIZE_NOT_ALLOWED    = 9

         HEADER_TOO_LONG         = 10

         DP_ERROR_CREATE         = 11

         DP_ERROR_SEND           = 12

         DP_ERROR_WRITE          = 13

         UNKNOWN_DP_ERROR        = 14

         ACCESS_DENIED           = 15

         DP_OUT_OF_MEMORY        = 16

         DISK_FULL               = 17

         DP_TIMEOUT              = 18

         FILE_NOT_FOUND          = 19

         DATAPROVIDER_EXCEPTION  = 20

         CONTROL_FLUSH_ERROR     = 21

         OTHERS                  = 22.

     IF SY-SUBRC <> 0.

       MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

       WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

     ELSE.

       MESSAGE S003.

     ENDIF.

   ENDIF.

ENDFORM.                    " Z_FI_PDF_DOWN

*&---------------------------------------------------------------------*

*&      Form  Z_FI_ALV_GRID

*&---------------------------------------------------------------------*

* ROUTINE USE TO DISPLAY THE RESULTANT TRANSACTIONS IN THE FORM ALV

*----------------------------------------------------------------------*

FORM Z_FI_ALV_GRID .

   DATA: LV_STAT  TYPE SLIS_T_EXTAB,

         LV_UCOMM TYPE SY-UCOMM,

         LS_SEL_FIELD TYPE SLIS_SELFIELD.

*  CLEAR SY-INDEX.

*  IF SY-INDEX EQ 1.

*    PERFORM Z_FI_TOP.

*    PERFORM Z_FI_USER_COMMAND USING LV_UCOMM LS_SEL_FIELD .

*    PERFORM Z_FI_MY_STATUS USING LV_STAT.

*  ENDIF.

   "FM RESPONSIBLE FOR DISPLAYING THE ALV GRID REPORT

   CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

     EXPORTING

       I_CALLBACK_PROGRAM = SY-REPID

       I_STRUCTURE_NAME   = 'ZLY_CONS_ALV'

       IT_EVENTS          = LT_EVENTS

     TABLES

       T_OUTTAB           = LT_CONS_ALV

     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.                    " Z_FI_ALV_GRID

hope it helps.

Mathan R.

Read only

0 Likes
3,579

hi,

these are all the 17 events which we can perform in ALV.

the usage of ALV events is always depends upon the requirement..

  1. AFTER_LINE_OUTPUT
  2. BEFORE_LINE_OUTPUT
  3. CALLER_EXIT
  4. END_OF_COVERPAGE
  5. END_OF_LIST
  6. END_OF_PAGE
  7. FOREIGN_END_OF_PAGE
  8. FOREIGN_TOP_OF_PAGE
  9. GROUPLEVEL_CHANGE
  10. LIST_MODIFY
  11. PF_STATUS_SET
  12. REPREP_SEL_MODIFY
  13. SUBTOTAL_TEXT
  14. TOP_OF_COVERPAGE
  15. TOP_OF_LIST
  16. TOP_OF_PAGE
  17. USER_COMMAND

hope this helps,

Mathan R.