REUSE_ALV_POPUP_TO_SELECT

Hi ,
I am using "REUSE_ALV_POPUP_TO_SELECT" in an interactive ALV report.
when the popup is displayed , it is not getting any value. it shows "list contains no data".
this is my code::
FORM USERCOMMAND USING R_UCOMM LIKE SY-UCOMM
                       FIELDS TYPE SLIS_SELFIELD.
  DATA : CURSOR1(25) TYPE C.
  CASE R_UCOMM.
    WHEN '&IC1'.
      IF FIELDS-FIELDNAME = 'KKBER'.
        READ TABLE TB_FINAL INDEX FIELDS-TABINDEX.
        GET CURSOR FIELD CURSOR1.
        SET PARAMETER ID 'KUN' FIELD TB_FINAL-KUNNR.
        SET PARAMETER ID 'KKB' FIELD TB_FINAL-KKBER.
        CALL TRANSACTION 'FD32' AND SKIP FIRST SCREEN.
      ENDIF.
      IF FIELDS-FIELDNAME = 'KUNNR'.
        READ TABLE TB_FINAL INDEX FIELDS-TABINDEX.
        PERFORM GET_TB_SEL.
        PERFORM FDCAT.
        DATA : VA_PRG3 LIKE SY-REPID.
        VA_PRG3 = SY-REPID.
        CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'
          EXPORTING
           I_TITLE                       = 'SELECT'
          I_SELECTION                   = 'X'
        I_ALLOW_NO_SELECTION          =
          I_ZEBRA                       = 'X'
        I_SCREEN_START_COLUMN         = 1
        I_SCREEN_START_LINE           = 1
        I_SCREEN_END_COLUMN           = 3
        I_SCREEN_END_LINE             = 3
        I_CHECKBOX_FIELDNAME          =
        I_LINEMARK_FIELDNAME          =
        I_SCROLL_TO_SEL_LINE          = 'X'
            I_TABNAME                     = TB_SEL
        I_STRUCTURE_NAME              =
           IT_FIELDCAT                   = IT_FIELDCAT1[]
        IT_EXCLUDING                  =
           I_CALLBACK_PROGRAM            =  VA_PRG3
           I_CALLBACK_USER_COMMAND       = 'USERCOMMAND1'
        IS_PRIVATE                    =
      IMPORTING
        ES_SELFIELD                   =
        E_EXIT                        =
          TABLES
            T_OUTTAB                      = TB_SEL1
      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.
      ENDIF.
  ENDCASE.
ENDFORM.                 "USERCOMMAND
FORM FDCAT .
  WA_FIELDCAT1-COL_POS = 1.
  WA_FIELDCAT1-REF_FIELDNAME = 'T_NAME'.
  WA_FIELDCAT1-SELTEXT_L = 'TRANSACTION'.
WA_FIELDCAT-OUTPUTLEN = 10.
  WA_FIELDCAT1-REF_TABNAME = 'TB_SEL'.
WA_FIELDCAT1-HOTSPOT = 'X'.
  APPEND WA_FIELDCAT1 TO IT_FIELDCAT1.
CLEAR WA_FIELDCAT1.
  WA_FIELDCAT1-COL_POS = 2.
  WA_FIELDCAT1-REF_FIELDNAME = 'DESC'.
  WA_FIELDCAT1-SELTEXT_L = 'DESCRIPTION'.
WA_FIELDCAT-OUTPUTLEN = 10.
  WA_FIELDCAT1-REF_TABNAME = 'TB_SEL'.
WA_FIELDCAT1-HOTSPOT = 'X'.
  APPEND WA_FIELDCAT1 TO IT_FIELDCAT1.
CLEAR WA_FIELDCAT1.
  WA_FIELDCAT1-COL_POS = 3.
  WA_FIELDCAT1-REF_FIELDNAME = 'FDNAME'.
  WA_FIELDCAT1-SELTEXT_L = 'CUSTOMER NUMBER SELECTED'.
WA_FIELDCAT-OUTPUTLEN = 10.
  WA_FIELDCAT1-REF_TABNAME = 'TB_SEL'.
WA_FIELDCAT1-HOTSPOT = 'X'.
  APPEND WA_FIELDCAT1 TO IT_FIELDCAT1.
CLEAR WA_FIELDCAT1.
ENDFORM.                    " fdcat
*&      Form  get_tb_sel
      text
-->  p1        text
<--  p2        text
FORM GET_TB_SEL .
  TB_SEL-T_NAME = 'VD03'.
  TB_SEL-DESC   = 'CUSTOMER GENERAL DATA'.
  TB_SEL-FDNAME = TB_FINAL-KUNNR.
  APPEND TB_SEL.
  TB_SEL-T_NAME = 'FBL5N'.
  TB_SEL-DESC   = 'CUSTOMER LINE ITEM DISPLAY'.
  TB_SEL-FDNAME = TB_FINAL-KUNNR.
  APPEND TB_SEL.
  TB_SEL-T_NAME = 'VA05'.
  TB_SEL-DESC   = 'LIST OF SALES ORDERS'.
  TB_SEL-FDNAME = TB_FINAL-KUNNR.
  APPEND TB_SEL.
ENDFORM.                    " get_tb_sel
kindly help me in solving this problem.
thanks in advance.
suki.

Please try and put quotes around the I_TABNAME parameter.
CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'
EXPORTING
I_TITLE = 'SELECT'
* I_SELECTION = 'X'
* I_ALLOW_NO_SELECTION =
* I_ZEBRA = 'X'
* I_SCREEN_START_COLUMN = 1
* I_SCREEN_START_LINE = 1
* I_SCREEN_END_COLUMN = 3
* I_SCREEN_END_LINE = 3
* I_CHECKBOX_FIELDNAME =
* I_LINEMARK_FIELDNAME =
* I_SCROLL_TO_SEL_LINE = 'X'
I_TABNAME = 'TB_SEL'     "<-   RIGHT HERE
* I_STRUCTURE_NAME =
IT_FIELDCAT = IT_FIELDCAT1[]
Regards,
RIch Heilman

Similar Messages

  • Data in itab does not show when using FM REUSE_ALV_POPUP_TO_SELECT

    Hello Experts,
    I am using the said FM to display some data when the user clicks on a
    custom button I made. But no data is displayed in the popup window. I
    debugged it and the itab I am passing has a value in it. Below is my code:
    WRITE icon_green_light AS ICON TO wa_legend-legend.
            wa_legend-column      = text-t05.
            wa_legend-description = text-d01.
            APPEND wa_legend TO lt_legend.
            IF sy-subrc <> 0.
              MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                      WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
            ENDIF.
            DEFINE m_fill_fieldcat.
              wa_fieldcat-fieldname = &1.
              wa_fieldcat-tabname   = &2.
              wa_fieldcat-seltext_m = &3.
              wa_fieldcat-icon      = &4.
              wa_fieldcat-outputlen = &5.
              append wa_fieldcat to lt_fieldcat.
              clear wa_fieldcat.
            END-OF-DEFINITION.
            m_fill_fieldcat 'LEGEND'      'ITAB' text-t04 'X' '14'.
            m_fill_fieldcat 'COLUMN'      'ITAB' text-t11 ''  '50'.
            m_fill_fieldcat 'DESCRIPTION' 'ITAB' text-t12 ''  '50'.
            CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'
              EXPORTING
    *           I_TITLE                       =
    *           I_SELECTION                   = 'X'
    *           I_ALLOW_NO_SELECTION          =
                i_zebra                       = 'X'
    *           I_SCREEN_START_COLUMN         =
    *           I_SCREEN_START_LINE           =
    *           I_SCREEN_END_COLUMN           =
    *           I_SCREEN_END_LINE             =
    *           I_CHECKBOX_FIELDNAME          =
    *           I_LINEMARK_FIELDNAME          =
    *           I_SCROLL_TO_SEL_LINE          = 'X'
                i_tabname                     = 'LT_LEGEND'
    *           I_STRUCTURE_NAME              =
                it_fieldcat                   = lt_fieldcat[]
    *           IT_EXCLUDING                  =
    *           I_CALLBACK_PROGRAM            =
    *           I_CALLBACK_USER_COMMAND       =
    *           IS_PRIVATE                    =
    *         IMPORTING
    *           ES_SELFIELD                   =
    *           E_EXIT                        =
              TABLES
                t_outtab                      = lt_legend[]
             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.
    Hope you can help me guys. Thank you and take care!

    Hi,
    check this code and modify your FM accordingly then it'll work,
    Q. i_checkbox_fieldname = 'CHECKBOX'
    A. If the table output in the popup has checkboxes at the beginning of the rows (e.g. for multiple selection), the internal table must contain a field containing the value of the checkbox.
    Assign the name of this field to the parameter I_CHECKBOX_FIELDNAME.
    Q. i_tabname = 'TLINE'
    A. This is the name of ur input help internal table
    Q. it_fieldcat = fieldcat[]
    A The table u gonna display has to have a fieldcat.
    Q. it_excluding = extab[].
    A. In case u wanna exclude some functions.
    Below is a working example, paste it in se38 and activate.
    !!! Warning SAVE IT AS A LOCAL OBJECT !!!
    report ztests1.
    type-pools: slis.
    data: index type i.
    data: l_kunnr like kna1-kunnr.
    data: input(10) type c,
    text(4) type c,
    text1(5) type c.
    data: begin of itab occurs 10,
    kunnr like kna1-kunnr,
    name1 like kna1-name1,
    end of itab.
    data: e_exit.
    data: fieldcat TYPE slis_t_fieldcat_alv WITH HEADER LINE.
    parameter: p_kunnr(10) type c.
    at selection-screen on value-request for p_kunnr.
    select kunnr name1 up to 10 rows
    from kna1
    into table itab.
    fieldcat-tabname = 'ITAB'.
    fieldcat-fieldname = 'KUNNR'.
    fieldcat-seltext_m = 'Cust'.
    fieldcat-ddictxt = 'M'.
    fieldcat-outputlen = 10.
    APPEND fieldcat.
    CLEAR fieldcat.
    fieldcat-tabname = 'ITAB'.
    fieldcat-fieldname = 'NAME1'.
    fieldcat-seltext_m = 'Cust Name'.
    fieldcat-ddictxt = 'M'.
    fieldcat-outputlen = 30.
    APPEND fieldcat.
    CLEAR fieldcat.
    CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'
    EXPORTING
    I_TITLE = 'Customer Selection'
    I_SELECTION = 'X'
    I_ALLOW_NO_SELECTION =
    I_ZEBRA = ' '
    I_SCREEN_START_COLUMN = 0
    I_SCREEN_START_LINE = 0
    I_SCREEN_END_COLUMN = 0
    I_SCREEN_END_LINE = 0
    I_CHECKBOX_FIELDNAME =
    I_LINEMARK_FIELDNAME =
    I_SCROLL_TO_SEL_LINE = 'X'
    i_tabname = 'ITAB'
    I_STRUCTURE_NAME =
    IT_FIELDCAT = fieldcat[]
    IT_EXCLUDING =
    I_CALLBACK_PROGRAM =
    I_CALLBACK_USER_COMMAND =
    IS_PRIVATE =
    IMPORTING
    ES_SELFIELD =
    E_EXIT = e_exit
    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.
    seshu.

  • Runtime error in ALV demo

    HI,
    Runtime error in the below  report as internal table IT_FIELDCAT is empty after the execution of FM
    REUSE_ALV_FIELDCATALOG_MERGE.
    Please tell me how do i rectify this error.
    REPORT  ZMY_ALV_COLORING_CELLS.
    TYPE-POOLS SLIS.
    DATA: BEGIN OF itab OCCURS 0,
            BUKRS LIKE T001-BUKRS,
            BUTXT LIKE T001-BUTXT,
          END   OF itab.
    PARAMETERS: P_BUKRS TYPE TBUKRS.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_BUKRS.
    PERFORM F4_FOR_BUKRS.
    *&      Form  F4_FOR_BUKRS
    FORM F4_FOR_BUKRS.
      DATA: IT_FIELDCAT TYPE  SLIS_T_FIELDCAT_ALV ,
            ES_SELFIELD TYPE  SLIS_SELFIELD. " Get data
      SELECT BUKRS
             BUTXT
             FROM T001
             INTO TABLE itab
             up to 10 rows .
    Get field
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
           EXPORTING
                I_PROGRAM_NAME     = SY-REPID
                I_INTERNAL_TABNAME = 'ITAB'
           CHANGING
                CT_FIELDCAT        = IT_FIELDCAT[].
      LOOP AT IT_FIELDCAT.
        IT_FIELDCAT-KEY = SPACE.
        IF IT_FIELDCAT-FIELDNAME = 'BUTXT'.
          IT_FIELDCAT-EMPHASIZE  = 'C710'.
        ENDIF.
        IF IT_FIELDCAT-FIELDNAME = 'BUKRS'.
          IT_FIELDCAT-EMPHASIZE  = 'C610'.
        ENDIF.
        MODIFY IT_FIELDCAT.
      ENDLOOP.
      CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'
        EXPORTING
    I_TITLE                       = 'THIS IS FOR F4 IN COLOR'
          I_TABNAME                     = 'ITAB'
          IT_FIELDCAT                   = IT_FIELDCAT[]
        IMPORTING
          ES_SELFIELD                   = ES_SELFIELD
        TABLES
          T_OUTTAB                      = ITAB .
    Thanks,
    Ahmed.

    Change like this
    >
    ahmed shaik wrote:
    > HI,
    >
    > Runtime error in the below  report as internal table IT_FIELDCAT is empty after the execution of FM
    > REUSE_ALV_FIELDCATALOG_MERGE.
    >
    > Please tell me how do i rectify this error.
    >
    >
    >
    > REPORT  ZMY_ALV_COLORING_CELLS.
    > TYPE-POOLS SLIS.
    >
    > DATA: BEGIN OF itab OCCURS 0,
    >         BUKRS LIKE T001-BUKRS,
    >         BUTXT LIKE T001-BUTXT,
    >       END   OF itab.
    >
    > PARAMETERS: P_BUKRS TYPE TBUKRS.
    >
    > AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_BUKRS.
    >
    >
    >  PERFORM F4_FOR_BUKRS.
    > &----
    > *&      Form  F4_FOR_BUKRS
    > ----
    > FORM F4_FOR_BUKRS.
    >
    >   DATA: IT_FIELDCAT TYPE  SLIS_T_FIELDCAT_ALV ,
    >         ES_SELFIELD TYPE  SLIS_SELFIELD. " Get data
    >
    >   SELECT BUKRS
    >          BUTXT
    >          FROM T001
    >          INTO TABLE itab
    >          up to 10 rows .
    > * Get field
    >
    >   CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    >        EXPORTING
    >             I_PROGRAM_NAME     = SY-REPID
    >*             I_INTERNAL_TABNAME = 'ITAB'
    >           I_STRUCTURE_NAME = 'ITAB'
    >        CHANGING
    >             CT_FIELDCAT        = IT_FIELDCAT[].
    >
    >   LOOP AT IT_FIELDCAT.
    >     IT_FIELDCAT-KEY = SPACE.
    >     IF IT_FIELDCAT-FIELDNAME = 'BUTXT'.
    >       IT_FIELDCAT-EMPHASIZE  = 'C710'.
    >     ENDIF.
    >     IF IT_FIELDCAT-FIELDNAME = 'BUKRS'.
    >       IT_FIELDCAT-EMPHASIZE  = 'C610'.
    >     ENDIF.
    >
    >     MODIFY IT_FIELDCAT.
    >   ENDLOOP.
    >
    >   CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'
    >     EXPORTING
    >  I_TITLE                       = 'THIS IS FOR F4 IN COLOR'
    >       I_TABNAME                     = 'ITAB'
    >       IT_FIELDCAT                   = IT_FIELDCAT[]
    >     IMPORTING
    >       ES_SELFIELD                   = ES_SELFIELD
    >     TABLES
    >       T_OUTTAB                      = ITAB .
    >
    >
    >
    >
    >
    > Thanks,
    > Ahmed.
    Rhea

  • Battery life issue related to display/graphics?

    Hi
    I bought a refurbished macbook pro last May. And the battery didn't even last 2 hours and half, which i found it weird since the macbook pro i had before(2007 model) had battery life of 3hours and half.
    a month later i bought it, i started having issues with screen. the screen started flickering/flashing randomly. i got the display replaced last week i think, but the screen is still having issues and battery life got even worse! now it lasts 1hour 45 minutes(screen brightness set at 50%) and i'm only browsing the web...
    (i asked the apple staff about it, and they said they ran a test and my battery is normal )
    it just got me thinking, if the issue is not in the battery, there must be something else that's affecting it...and maybe somehow the screen issues i'm having are related to the battery life.
    is it possible that something else is draining the battery power somehow..
    I was just wondering what people think about this... this is frustrating and i don't kno what to do...

    Try using FM 'REUSE_ALV_POPUP_TO_SELECT'.
    Sample code:
    REPORT ZALV_POPUP_TO_SELECT.
    TYPE-POOLS: SLIS.
    DATA: GT_OUTTAB TYPE PA0008 OCCURS 0,
          GS_PRIVATE TYPE SLIS_DATA_CALLER_EXIT,
          GS_SELFIELD TYPE SLIS_SELFIELD,
          G_EXIT(1) TYPE C.
    PARAMETERS: P_TITLE TYPE SY-TITLE.
    START-OF-SELECTION.
      SELECT * FROM pa0008 INTO TABLE GT_OUTTAB UP TO 100 ROWS
               where endda = '99991231'.
      CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'
           EXPORTING
                I_TITLE                 = P_TITLE
              I_SELECTION             = 'X'
                I_ZEBRA                 = ' '
              I_SCREEN_START_COLUMN   = 0
              I_SCREEN_START_LINE     = 0
              I_SCREEN_END_COLUMN     = 0
              I_SCREEN_END_LINE       = 0
              I_CHECKBOX_FIELDNAME    =
              I_LINEMARK_FIELDNAME    =
              I_SCROLL_TO_SEL_LINE    = 'X'
                I_TABNAME               = '1'
                I_STRUCTURE_NAME        = 'PA0008'
              IT_FIELDCAT             =
              IT_EXCLUDING            =
              I_CALLBACK_PROGRAM      =
              I_CALLBACK_USER_COMMAND =
                IS_PRIVATE              = GS_PRIVATE
         IMPORTING
                ES_SELFIELD             = GS_SELFIELD
                E_EXIT                  = G_EXIT
           TABLES
                T_OUTTAB                = GT_OUTTAB
           EXCEPTIONS
                PROGRAM_ERROR           = 1
                OTHERS                  = 2.
      IF SY-SUBRC <> 0.
        MESSAGE I000(0K) WITH SY-SUBRC.
      ENDIF.
      WRITE: / G_EXIT, GS_SELFIELD.

  • FM POPUP_GET_VALUES from internal table

    Hi all,
    I need to use this function module or some else like this to show in a screen the values from an internal work area.
    The problem with this function module is when i call it referring an internal table it doesn't show anything.
    Example:
        TYPES: BEGIN OF ty,
                     line1(20)  TYPE c,
                     END OF ty.
        DATA: popup_campos   TYPE STANDARD TABLE OF sval,
                   popup_linha    LIKE LINE OF popup_campos,
                   popup_retorno  TYPE rf_kennzx,
                   itab TYPE STANDARD TABLE OF ty,
                   wa TYPE ty.
                popup_linha-tabname = 'ITAB'.
                popup_linha-fieldname = 'LINE'.
                popup_linha-field_attr = '02'.
                popup_linha-value = <col>.
                popup_linha-fieldtext = wa_componentes-name.
                APPEND popup_linha TO popup_campos.
                UNASSIGN <col>.
              READ TABLE itab INDEX 1 INTO wa.
              CALL FUNCTION 'POPUP_GET_VALUES'
                EXPORTING
                  popup_title           = 'Detalhes'
               IMPORTING
                 returncode             = popup_retorno
                TABLES
                  fields                =  popup_campos
    is there another way of doing this?
    Regards

    Hi,
    In my code below, it displays the error messages contained in the table. Check it out:
    DEFINE m_fill_fieldcat.
              wa_fieldcat-fieldname = &1.
              wa_fieldcat-tabname   = &2.
              wa_fieldcat-seltext_m = &3.
              wa_fieldcat-icon      = &4.
              wa_fieldcat-outputlen = &5.
              append wa_fieldcat to lt_fieldcat.
              clear wa_fieldcat.
            END-OF-DEFINITION.
            m_fill_fieldcat 'DOCNUM'  'LT_VIEW_ERRORS' text-h24 '' '20'.
            m_fill_fieldcat 'MESSAGE' 'LT_VIEW_ERRORS' text-h25 '' '100'.
            CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'
              EXPORTING
    *           I_TITLE                       =
               i_selection                   = gc_x
               i_allow_no_selection          = gc_x
               i_zebra                       = gc_x
    *           i_screen_start_column         =
    *           i_screen_start_line           =
    *           I_SCREEN_END_COLUMN           = 0
    *           I_SCREEN_END_LINE             = 0
    *           I_CHECKBOX_FIELDNAME          =
    *           I_LINEMARK_FIELDNAME          =
               i_scroll_to_sel_line          = gc_x
               i_tabname                     = 'LT_VIEW_ERRORS'
    *           I_STRUCTURE_NAME              =
               it_fieldcat                   = lt_fieldcat
    *           IT_EXCLUDING                  =
    *           I_CALLBACK_PROGRAM            =
    *           I_CALLBACK_USER_COMMAND       =
    *           IS_PRIVATE                    =
    *         IMPORTING
    *           ES_SELFIELD                   =
    *           E_EXIT                        =
              TABLES
                t_outtab                      = lt_view_errors
             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.

  • Interactive ALV report for vendorwise purchase order details

    Hi Experts,
    I am trying to create vendor wise purchase order interactive report, if i click any of vendor detail it has to display vendor details in a popup window or if i click any of purchase details it has to display purchase order details ina popup..
    can any body explain by using function modules REUSE_ALV_POPUP_TO_SELECT and REUSE_ALV_FIELDCATALOG_MERGE...

    Check the link below will be of some use to you.
    http://www.geocities.com/mpioud/Z_REUSE_ALV_POPUP_TO_SELECT.html
    Regards,
    Murthy

  • Field Catalogs in ALV

    Hi Friends,
    Please help me out, I am new to ABAP.
    Please anybody explain me the functionality of Field catalogs in ALVs?
    How many methods are there to pass data to ALVs, i.e., in how many ways?
    Hope u will help me.

    hi,
    this will be very helpful for ALV REPORTING.....
    Sap provides a set of ALV (ABAP LIST VIEWER) function modules which can be put into use to embellish the output of a report. This set of ALV functions is used to enhance the readability and functionality of any report output. Cases arise in sap when the output of a report contains columns extending more than 255 characters in length.  In such cases, this set of ALV functions can help choose selected columns and arrange the different columns from a report output and also save different variants for report display. This is a very efficient tool for dynamically sorting and arranging the columns from a report output. The report output can contain upto 90 columns in the display with the wide array of display options.
    The commonly used ALV functions used for this purpose are;
    1.     REUSE_ALV_VARIANT_DEFAULT_GET
    2.     REUSE_ALV_VARIANT_F4
    3.     REUSE_ALV_VARIANT_EXISTENCE
    4.     REUSE_ALV_EVENTS_GET
    5.     REUSE_ALV_COMMENTARY_WRITE
    6.   REUSE_ALV_FIELDCATALOG_MERGE
    7.   REUSE_ALV_LIST_DISPLAY
    8.     REUSE_ALV_GRID_DISPLAY
    9.     REUSE_ALV_POPUP_TO_SELECT
    The different steps used for getting the above function modules into use are:
    Step 1
    DATA DECLARATION
    Sap standard type pools:  SLIS , KKBLO .
    Sap standard tables types taken from the type pools are:  SLIS_LAYOUT_ALV ,
                                             SLIS_T_FIELDCAT_ALV,
    SLIS_T_LISTHEADER,
    SLIS_T_EVENT,
    SLIS_SELFIELD.
    Internal tables to used in the program declared based on the above table types
    DATA:  I_LAYOUT TYPE SLIS_LAYOUT_ALV,
                I_FIELDTAB TYPE SLIS_T_FIELDCAT_ALV,
               I_HEADING TYPE SLIS_T_LISTHEADER,
    I_EVENTS TYPE SLIS_T_EVENT.
    TYPES:  KKBLO_SELFIELD TYPE SLIS_SELFIELD.
    Step 2 (Optional)
    SELECTING THE VARIANTS FOR INITIAL LIST DISPLAY (DEFAULT VARIANT)
    The variants in the list display can be both user-specific and general. The user can programmatically set the initial (default) variant for list display.
    The default variant can be found using the function module 'REUSE_ALV_VARIANT_DEFAULT_GET'.
    Sample code:
    CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
           EXPORTING
                i_save     = variant save condition ( A=all, U = user-specific )
           CHANGING
                cs_variant = internal table containing the program name (and the default variant---optional )
           EXCEPTIONS
                not_found  = 2.
    The user can also choose from the list of existing variants using the function module ‘REUSE_ALV_VARIANT_F4’.
    Step 3
    DEFININING OUTPUT CHARACTERISTICS: PREPARING DISPLAY FIELDS CATALOG
    A field catalog is prepared using the internal table (I_FIELDCAT) of type SLIS_T_FIELDCAT_ALV. Field catalog containing descriptions of the list output fields (usually a subset of the internal output table fields).
    A field catalog is required for every ALV list output to add desired functionality (i.e. Key, Hotspot, Specific headings, Justify, Col. position etc) to certain fields of the output. If not mentioned specifically, then the defaults are taken. The possible values and defaults are listed below.
    The field catalog for the output table is built-up in the caller's coding. The build-up can be completely or partially automated by calling the REUSE_ALV_FIELDCATALOG_MERGE module.
    The minimal field catalog is documented below. This can be done in a routine using a local variable. The user can use the other optional parameters to assign output attributes to different fields in the output, which differ from the default.
    A field catalog need not be built-up and passed explicitly only under the following conditions:
    1.     The internal table to be output has the same structure as a Data Dictionary structure which is referred to in the internal table declaration using LIKE or INCLUDE STRUCTURE. In this case the attributes of the different fields is taken directly from the table and the attributes (key fields, length, texts etc) need to state explicitly.
    2.     all fields in this structure are to be output
    3.     The structure name is passed to ALV in the parameter I_STRUCTURE_NAME of the function module REUSE_ALV_LIST_DISPLAY.
    All the values entered in the catalog is specific to the particular field whose name is entered in the fieldname FIELDNAME of the fieldcat structure. The name of the table is also entered in the corr. Fieldname TABNAME of the structure.
    The different possible attributes are:
    •     Row_pos (row position): Only relevant if the list output is to be multi-line (two or three lines) by default. So, this attribute can be used maintain certain level of alignment in the output.
                         Value set: 0, 1 – 3
    •     Col_pos (column position): This parameter is relevant when the fields in the output are to be different from the sequence of the fields in the internal table used for display.       The parameter specifies the relative column position of the field in the list output. The column order can be changed interactively by the user. If this parameter is initial for all field catalog entries, columns appear in the internal table field sequence.
    Value set: 0, 1 – 60
    •     Fieldname (field name): This is the name of the internal table field for which the parameters are passed in the catalog.
    Value set: internal output table field name (required parameter)
    •     Tabname (internal output table): Name of the internal output table that contains the field FIELDCAT-FIELDNAME above.
                         Value set: SPACE, internal output table name.
    •     Ref_fieldname (reference field name): Name of the Data Dictionary field referred to. This parameter is only used when the internal output table field described by the current field catalog entry has a reference to the Data Dictionary (not a program field), and the field name in the internal output table is different from the name of the field in the        Data Dictionary. If the field names are identical, naming the Data Dictionary structure or table in the FIELDCAT-REF_TABNAME parameter is sufficient.
        Value set: SPACE, Data Dictionary field name.
    •     Ref_tabname (reference table/structure field name): Structure or table name of the referred Data Dictionary field.        This parameter is only used when the internal output table field described by the current field catalog entry has a Data Dictionary reference (not a program field).
    Value set: SPACE, name of a Data Dictionary structure or table
    Link to currency unit
    •     Cfieldname (currency unit field name): This is used for currency fields that have a reference to any unit field. This is only relevant for amount columns with associated unit. This parameter contains the Name of the internal output table field containing the currency unit associated with the amount field FIELDCAT-FIELDNAME. The field in FIELDCAT-CFIELDNAME must have its own field catalog entry.
    Value set: SPACE, output table field name
    •     Ctabname (internal currency unit field output table): Name of the internal output table containing the FIELDCAT-CFIELDNAME field.
    Value set: SPACE, output table field name.
            Link to measurement unit
    •     Qfieldname (measurement unit field name): Only relevant for quantity columns with unit link. Name of the internal output table field containing the measurement unit associated with the quantity field FIELDCAT-FIELDNAME. The field in FIELDCAT-QFIELDNAME must have its own field catalog entry.
    Value set: SPACE, output table field name.
    •     Qtabname (internal measurement unit field output table): Name of the internal output table containing the FIELDCAT-QFIELDNAME field.
    Value set: SPACE, output table field name.
    •     Outputlen (column width): This parameter is used if the desired output length for a field is desired to be different from the internal output table field. For fields with a Data Dictionary link this parameter can be left initial. For fields without a Data Dictionary link (program field) the parameter must be given the value of the desired field list output length (column width).
    Initial = column width is the output length of the referred Data Dictionary field (domain).
    N = column width is n characters.
          Value set: 0 (initial), n.
    •     Key (key column): By default, the system makes some fields in the output as key fields, provided the fields are key fields in their referencing table. Using this parameter, fields other than key fields of the referencing table can be made key field. This parameter is most important if the output needs to contain some field which are not scrollable or cannot be hidden.
    If the internal output table contains fields that are key fields from different tables, then all those fields in the report output becomes unscrollable and cannot be hidden. So, the fields in the output internal table should not be referenced from tables in which they are key fields. Instead, they should be referenced to the tables in which they are not key fields, incase they are not desired as key field in the output.
    'X' = key field (key field output in color) and Key fields can not be interactively hidden. Parameter FIELDCAT-NO_OUT must be left initial.
          Value set: SPACE, 'X'.
    •     Key_sel (hideable key column): This parameter is only relevant for the fields which are made key fields using FIELDCAT-KEY = 'X'. Using this parameter the Key field can be hidden interactively.
    The key column sequence cannot be changed interactively by the user. The output is controlled by the FIELDCAT-NO_OUT parameter analogously to non-key fields.
    Value set: SPACE, 'X'.
    •     No_out (field in field list): This parameter is used to remove certain fields from the output during initial display.  The user can however interactively choose the field for output from the field list in the display variant.
                'X' = field is not displayed in the current list.
            Value set: SPACE, 'X'.
    •     Tech (technical field): This parameter is used to make certain field display only in the field catalog. The fields with this parameter set cannot be output in the list nor can they be displayed interactively from the catalog.
                        'X' = technical field.
           Value set: SPACE, 'X'.
    •     Emphasize (highlight columns in color): As name suggests, this field parameter is used to highlight certain field with chosen colors.
    Value set: SPACE, 'X' or 'Cxyz' (x:'1'-'9'; y,z: '0'=off ,'1'=on).
    'X' = column is colored with the default column highlight color.
                        'Cxyz' = column is colored with a coded color:
                      -  C: Color (coding must begin with C)
                     -  X: color number
                      -  Y: bold
                       -  Z: inverse
    •     Hotspot (column as hotspot): This parameter is used to make certain field appear as hotspot i.e. a hand is displayed if the cursor is positioned on the field value. Single click on such fields cause the PICK OR F2 events to happen.
             Value set: SPACE, 'X'.
                        'X' = column cells are output as hotspots.
    •     Fix_column (fix column): This parameter is used to fix certain columns in the output. All columns to be fixed must have this flag, starting from the left. If a column without this flag is output, only the columns to the left of this column are fixed. The user can change the column fixing interactively.
                         Value set: SPACE, 'X'.
            'X' = column fixed (does not scroll horizontally).
    •     Do_sum (sum over column): the user can also call this function interactively.
                      Value set: SPACE, 'X'.
    'X' = a sum is calculated over this internal output table field.
    •     No_sum (sums forbidden): No sum can be calculated over this field, although the data type of the field would allow summing.
             Value set: SPACE, 'X'.
    •     Icon: The parameter displays certain column contents as icons. The internal output table column contents must be valid icon strings.
                        Value set: SPACE, 'X'.
                         'X' = column contents to be output as an icon.
    •     Symbol: The internal output table column must be a valid symbol character.
    Value set: SPACE, 'X'
                        'X' = column contents are to be output as a symbol.
    •     Just (justification): This parameter is used for alignment of the contents of the output table. This is only relevant for CHAR or NUMC fields in the output internal table. The justification of the column header always follows the justification of the columns. Independent justification of the column header is not possible.
    Value set: SPACE, 'R', 'L', and ‘C’.
           ' ' = Default justification for this data type
           'R' = right-justified output
           'L' = left-justified output
           'C' = centered output.
    •     Lzero (leading zeros): By default ALV outputs NUMC fields right-justified without leading zeros. Using this parameter only the NUMC fields can be displayed with leading zeroes.
                       Value set: SPACE, 'X'.
                        'X' = output with leading zeros.
    •     No_sign (no +/- sign): This parameter is used to suppress the signs of the output fields. It is only relevant for the value fields.
        Value set: SPACE, 'X'.
               'X' = value output without +/ sign.
    •     No_zero (suppress zeros): Only relevant for value fields.
                 Value set: SPACE, 'X'.
                        'X' = suppress zeros.
    •     Edit_mask (field formatting): To apply the report output formatting options same as in the WRITE statement in report writing.
               Value set: SPACE, template.
    The following parameters are used for customizing the texts in the heading of the output of the columns. The texts are taken from the Data Dictionary for fields with a Data Dictionary reference. If this is not desired, the text parameters can also be specified. The Data Dictionary texts are then ignored.
    If the user changes the column width interactively, the column header text with the appropriate length is always used.
    The interactive function 'Optimize column width' takes account of both the field contents and the column headers: if all field contents are shorter than the shortest column header, the column width depends on the column header.
         The 'long field label' is also used in display variant definition,
            Sort, etc.  Popup.
    •     seltext_l (long field label)
    •     seltext_m (medium field label)
    •     seltext_s (short field label)
    •     reptext_ddic(header) Analogous to the Data element main header
    •     Ddictxt (specify text) : You can specify with values 'L', 'M',  and 'S', the keyword that should always be used as column header. If the column width changes, no attempt is made in this case to find an appropriate header for the new output width.
    Value set: SPACE, 'L', 'M', and ‘S’.
    Sample code:
    Suppose I_PO_DETAILS is an internal table containing two fields EBELN (PO number) and EBELP (PO item no).
    DATA: L_FIELDCAT TYPE SLIS_FIELDCAT_ALV.     “Local variable to hold the parameters                                                                               
    for a particular field of the field catalog
      CLEAR L_FIELDCAT.
      L_FIELDCAT-TABNAME   = 'I_PO_DETAILS'.
      L_FIELDCAT-FIELDNAME = 'EBELN'.
      L_FIELDCAT-KEY = 'X'.         “The PO no is made the key field,
                          “Colored and non scrollable
      L_FIELDCAT-HOTSPOT = 'X'.     “The po no becomes a hotspot
      L_FIELDCAT-SELTEXT_S = ‘P.O No’.
      L_FIELDCAT-SELTEXT_M = 'P order No'.
      L_FIELDCAT-SELTEXT_L = 'Purchase order No'.
      APPEND L_FIELDCAT TO I_FIELDTAB.
      CLEAR L_FIELDCAT
      L_FIELDCAT-TABNAME   = 'I_PO_DETAILS'.
      L_FIELDCAT-FIELDNAME = 'EBELN'.
      L_FIELDCAT-KEY = 'X'.         “The po item no is made the key field,
                               “Colored and non scrollable
      L_FIELDCAT-SELTEXT_S = 'Item No'.
      L_FIELDCAT-SELTEXT_M = 'Item No`.
      L_FIELDCAT-SELTEXT_L = 'PO Item No'.
      APPEND L_FIELDCAT TO I_FIELDTAB.
      CLEAR L_FIELDCAT
    Thus the catalog for the report output is prepared.
    Step 4
    The next step is to build an event table, which are used for firing both user commands and the system dependent events i.e. top of page, end of page etc.
    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.
    Sample code :
    FORMNAME_TOP_OF_PAGE TYPE SLIS_FORMNAME VALUE 'TOP_OF_PAGE',
    FORMNAME_END_OF_PAGE TYPE SLIS_FORMNAME VALUE 'END_OF_PAGE', FORMNAME_USER_COMMAND TYPE SLIS_FORMNAME VALUE 'USER_COMMAND'.
    DATA: L_I_EVENT TYPE SLIS_ALV_EVENT.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
           EXPORTING
               I_LIST_TYPE = 0
           IMPORTING
                ET_EVENTS   = I_EVENTS.
      READ TABLE I_EVENTS WITH KEY NAME = SLIS_EV_TOP_OF_PAGE
                               INTO L_I_EVENT.
      IF SY-SUBRC = 0.
        MOVE FORMNAME_TOP_OF_PAGE TO L_I_EVENT-FORM.
        APPEND L_I_EVENT TO I_EVENTS.
      ENDIF.
      READ TABLE I_EVENTS WITH KEY NAME = SLIS_EV_END_OF_PAGE
                               INTO L_I_EVENT.
      IF SY-SUBRC = 0.
        MOVE FORMNAME_END_OF_PAGE TO L_I_EVENT-FORM.
        APPEND L_I_EVENT TO I_EVENTS.
      ENDIF.
      CLEAR L_I_EVENT.
      READ TABLE I_EVENTS WITH KEY NAME = SLIS_EV_USER_COMMAND
                               INTO L_I_EVENT.
      IF SY-SUBRC = 0.
        MOVE FORMNAME_USER_COMMAND TO L_I_EVENT-FORM.
        APPEND L_I_EVENT TO I_EVENTS.
      ENDIF.
    This will prepare the events table for the report.
    The report will contain three forms for the above events:
    1.     FORM TOP_OF_PAGE : This form will contain the top of page event for the report i.e header etc
    Using the function module ‘REUSE_ALV_COMMENTARY_WRITE’, the internal table containing the headings for top of page event can be passed to the list output. Also, any logo specific to the report can be passed to the function module.
    2.     FORM END_OF_PAGE : This form will contain the end of page event for the report i.e footer etc
    3.     FORM USER_COMMAND : This form will contain the desired user command i.e pick/line selection
    Step 5
    A layout is build for the report output list description USING the internal table declared above (I_LAYOUT).
    Output list description structure.
         The parameters are described under the following heads:
    •     Display options
    •     Exceptions
    •     Totals
    •     Interaction
    •     Detail screen
    •     Display variants (only for hierarchical-sequential lists)
    •     Color
    •     Other
    The layout table is of type slis_layout_alv_spec and has the following fields:
    Display options                                                
    1. Colwidth_optimize (1) TYPE c: This parameter optimizes the length of the different columns in the output. The width of the different col. now depends on the max. Length of the data in the column.
    Value set: SPACE, 'X'
    'X' = optimizes the column width so that all contents are displayed completely.                   
    2. No_colhead(1) TYPE c : This parameter suppresses the column headings                    
    Value set: SPACE, 'X'.
    'X' = column headers are not output
    3. No_hotspot(1) TYPE c :  The heading of the report output are not output as hotspot.       
    Value set: SPACE, 'X'.
    'X' = column headers are not output as hotspot
    4. Zebra(1) TYPE c : The report is output in the striped pattern.             
    Value set: SPACE, 'X'.
    'X' = striped pattern (e.g. for wide lists)
    5. No_vline(1) TYPE c : The report output contains columns only separated by space and no lines.  It is not relevant for: hierarchical-sequential lists and multiple-line lists.
    Value set: SPACE, 'X'.
    'X' = columns separated by SPACE
    6. No_min_linesize(1) TYPE c : The report  line size is equal to the width of the list. It is not relevant for block lists.
    Value set: SPACE, 'X’.
    'X' = line size depends on list width
    '  ' = Line size is set to 80 or MIN_LINESIZE (if > 0) .
    7. Min_linesize LIKE sy-linsz: The report output contains a minimum possible length of line. If initial min_linesize is set to 80 by default, then this parameter is used to customize it. The prerequisite for this is that the parameter no_min_linesize should be ' '.
    Value set: 0, 10 - 250
    If the list is wider, the format uses the list width (maximum 250 or MAX_LINESIZE (if > 0)).
    8. Max_linesize LIKE sy-linsz: The default max. Linesize is 250. To change this default value, this parameter can interactively-define the maximum list width setting.
    Value set: 0, 80 - 1020
    9. Window_titlebar LIKE rsmpe-tittext: To set the titlebar on the report output.                            
               10. No_uline_hs(1) TYPE c.
    Exceptions                                                 
    11. Lights_fieldname TYPE slis_fieldname: Internal output table field containing the codes of exceptions to be output.
                      Output table field code:  '1' = red traffic light
                                    '2' = yellow traffic light
                                         '3' = green traffic light Fieldname for exception 
         Value set: SPACE, internal output table field name.
    12. Lights_tabname TYPE slis_tabname: Name of the internal output table that contains the field in the parameter LIGHTS_FIELDNAME. If LIGHTS_FIELDNAME is not empty, this field must also be filled for hierarchical-sequential lists. Only relevant for hierarchical-sequential lists.
    .     Value set: SPACE, internal output table name.
    13. Lights_rollname LIKE dfies-rollname: The documentation of this data element is displayed when you call F1 help for an exception column.
    Value set: SPACE, data element name.
               14. Lights_condense(1) TYPE c : If a list record is output with 'red traffic light', each
               Subtotal that includes this record is also output with 'red traffic light'.
               Value set: SPACE, 'X'
               'X' = the 'maximum' exception of the items in the subtotal is output at subtotal level.
    Sums                                                       
    15. No_sumchoice(1) TYPE c : This parameter allows the choice for summing up
    Only by fieldcatalog.
    Value set: SPACE, 'X'
    'X' = fields which are to be summed, passed by the calling program (FIELDCAT-DO_SUM = 'X'). The user should not be able to change this value interactively.
    16. No_totalline(1) TYPE c : Removes the option of having totals after sub-totals.
    Value set: SPACE, 'X'
    'X' = no total record is to be output. Subtotals can still be calculated and output. The fields in the subtotals are flagged DO_SUM = 'X' in the field list.
    17. No_subchoice(1) TYPE c : Does not allow the user to interactively change the field chosen for subtotals.
    Value set: SPACE, 'X'
    'X' = value whose change triggers subtotals, provided by the calling program. The user should not be able to change this value interactively.
    18. No_subtotals(1) TYPE c : No subtotals possible          
    Value set: SPACE, 'X'
    'X' = no subtotals.
    19. Numc_sum(1)  TYPE c : Totals only possible for NUMC-Fields.
    20. No_unit_splitting TYPE c: No separate total lines by inh.units   
    21.totals_before_items TYPE c: Display totals before the items   
    22. Totals_only(1) TYPE c :  Show only totals      
    Value set: SPACE, 'X'
    'X' = only total records are output.
    23. Totals_text(60) TYPE c : Text for 1st col. in totals   
    Value set: SPACE, string (max.60)
    ' ' = The first column in the total record contains an appropriate number of '*'s to indicate the total by default. If the first column is wide enough, the string 'Total' is output after the asterisks.
    'String’ = The string passed is output after the total indicated by '*', if the column is wide enough.
    24. Subtotals_text(60) TYPE c : Texts for subtotals
    Value set: SPACE, string (max.60)
    ' ' = In the first column of subtotal records, the subtotal is indicated by an appropriate number of '*' by default. If the first column is not a subtotal criterion, the string 'Total' is output after the asterisks, if the column is wide enough.
    'String’ = the string passed is output after the subtotal indicated by '*', if the column is wide enough and the first column is not a subtotal criterion. If it is a subtotal criterion, its value is repeated after the total, if the column is wide enough.
    Interaction                                                      
    25. Box_fieldname TYPE slis_fieldname: Fieldname for checkbox in the report output. If the list has checkboxes at the start of records (for selecting several records), this parameter contains the internal output table field name indicated by the checkbox selection column. The field is a checkbox at the start of list records without a list header.
    Value set: SPACE, internal output table field name
    26. Box_tabname TYPE slis_tabname: Name of the internal output table that contains the field in the parameter BOX_FIELDNAME. If BOX_FIELDNAME is not empty, this field must also be filled for hierarchical-sequential lists.
    Value set: SPACE, internal output table name.
    27. Box_rollname LIKE dd03p-rollname: rollname for checkbox          
    28. Expand_fieldname TYPE slis_fieldname: fieldname flag ‘expand’. The user can show or hide the items by clicking on the folder symbol (hotspot). If the items for a header entry are only to be read by the calling program and passed to ALV when a header has been expanded interactively, this can be controlled via the CALLBACK event        'ITEM_DATA_EXPAND'.
    29. Hotspot_fieldname TYPE slis_fieldname: Used to make the fieldname flag hotspot.
    30. No_input(1) TYPE c : The fields are only display fields.
            Value set: SPACE, 'X'
    'X' = all ready-for-input fields in a list are displayed as not ready-for-input. (Record selection checkboxes and fields which can be made ready-for-input via the field list parameter FIELDCAT-INPUT = 'X')
    31. F2code LIKE sy-ucomm: To assign an ALV standard function code to double-click (F2), assign the function code to this parameter. Ex.: to assign the ALV standard function 'Detail' ('&ETA') to F2.
                      => LAYOUT-F2CODE = '&ETA'.
    Value set: SPACE, function code
    32. Confirmation_prompt: confirm. Prompt when leaving       
    Value set: SPACE, 'X'
    'X' = if one of the functions ‘Back (F03)', ‘Exit (F15)' or ‘Cancel (F12)' occurs, a confirmation prompt appears.
    33. Key_hotspot(1) TYPE c : The key fields are displayed as hotspot. The columns defined in the field catalog as key fields (FIELDCAT-KEY = 'X') are output as hotspots, i.e. clicking on a key column (highlighted in color in the list) calls the function under F2.
    Value set: SPACE, 'X'.
    34. Reprep(1) TYPE c :  report report interface active.     
    35. Group_buttons(1) TYPE c :  group-buttons for COL1 - COL5 . Group output fields via FIELDCAT-SP_GROUP in the field list, and pass the group name to the list module in the interface parameter IT_SPECIAL_GROUPS.           
    Value set: SPACE, 'X'.
    36. No_keyfix(1) TYPE c : Used to make the key fields scrollable.
    Value set: SPACE, 'X'.
    ' ' = The key columns defined in the field catalog by FIELDCAT-KEY = 'X' are fixed in the list output. These columns do not scroll horizontally. The item table key columns are fixed in hierarchical-sequential lists. The header table key fields are not considered here.
    'X' = key columns not fixed
    37. Get_selinfos(1) TYPE c : To read selection screen.
    Value set: SPACE, 'X'.
    If the calling program is a report with an ABAP/4 selection screen, setting this parameter makes ALV read the selection screen again. If the selections are read successfully, a pushbutton, via which the user can call a popup which lists the report selections in a simple form, becomes active on the results list output by ALV.
    38.     group_change_edit(1) TYPE c :  Settings by user for new group     
    Value set: SPACE, 'X'
    'X' = the user can enter a format option for each sort criterion in the sort/subtotal popup, for the list format when this value changes (e.g. new page or underline).
    39.     No_scrolling(1) TYPE c : Does not allow scrolling of the list to the right.
    Value set: SPACE, 'X'.
    40. Expand_all(1) TYPE c : Expand all positions                   
    Detailed screen                                                    
    40.     Detail_popup(1) TYPE c : show detail in popup.
    Value set: SPACE, 'X'
    '  '  = List record detail display in full-screen mode, with top-of-page.
    'X'  = list record detail display in popup (without top-of-page).
    41. Detail_initial_lines(1) TYPE c : show also initial lines   
    Value set: SPACE, 'X'
    '  ' = Only fields whose contents are not initial are output in the detail view.
    'X' = initial field contents are also output in detail.
    41.     detail_titlebar(30) type c : Titlebar for detail screen
    Value set: SPACE, string (max.30)
    ` ' = ' Detail: Display' is output as the title of the detail window.
                  'String’ = the string passed is output as the title of the detail window. 
    Display variants                                                   
    42. Header_text (20) TYPE c: Text for header button. Only relevant for hierarchical-sequential lists. You can toggle between display field and field list views via pushbuttons in the display variant definition popup for hierarchical-sequential lists. The views refer to the hierarchy level of the fields. This is technically a toggle between the header table and item table fields.   
    Value set: SPACE, CHAR (20)
    ' ' = The header table field pushbutton text is 'Header' by default.
    CHAR (20) = header table field pushbutton text.
    43.item_text(20) TYPE c : Text for item button. Only relevant for hierarchical-sequential lists. You can toggle the view between the display fields and the field list via pushbuttons in the display variant definition popup for hierarchical-sequential lists. The views refer to the hierarchy level of the fields. This is technically a toggle between the header table and item table fields.        
    Value set: SPACE, CHAR (20)
    ' ' = The pushbutton text for the item table fields is 'Item' by default.
    CHAR (20) = item table field pushbutton text.
    44.default_ item(1) TYPE c : Items as default. Only relevant for hierarchical-sequential lists.
         Value set: SPACE, 'X'
    ' ' = The header table fields are displayed by default in the display variant definition popup. The user can switch to the item table fields interactively.
    'X' = the item table fields are displayed by default in the display variant Definition Popup.    The user can switch to the header table fields interactively.
    Colour                                                       
    45. Info_fieldname TYPE slis_fieldname: infofield for listoutput. A whole list record can be colored individually using a color code in a column of the internal output table for the record. Assign the name of the field containing the color code to this parameter.
    Value set: SPACE, internal output table field name
    The internal output table field must be of type CHAR(3).
    The code must have the following syntax:  'Cxy':
            C = color (all codes must start with 'C')
            X = color number ('1'-'9')
            Y = bold ('0' = off, '1' = on)
    46. Coltab_fieldname TYPE slis_fieldname: Cells can be colored individually using a color code which is contained in a column of the internal output table for the record containing the cell. Assign the name of the field to this parameter.       
    Others                                                
    47. List_append(1) TYPE c :  no call screen. It is only useful to output block-lists without specifying the above modules if the number of list blocks exceeds, or may exceed, the maximum number specified in the block module documentation. These operations are not possible for user-defined block lists.
    Example code :
           I_LAYOUT-f2code       = ws_fcode.
           I_LAYOUT-zebra        = 'X'.
    I_LAYOUT-colwidth_optimize = 'X'.
    I_LAYOUT-no_keyfix = 'X'.
    I_LAYOUT-get_selinfos = 'X'.
    I_LAYOUT-no_hotspot = 'X'.
           I_LAYOUT-no_input = 'X'.
    I_LAYOUT-hotspot_fieldname = FIELDNAME.
    I_LAYOUT-no_input          = ‘X’.
    I_LAYOUT-no_vline          = `X’.
    I_LAYOUT-no_colhead        = ‘ ‘.
    I_LAYOUT-lights_condense   = ` `.
    I_LAYOUT-totals_text       = ` `.
    I_LAYOUT-subtotals_text    = ` `.
    I_LAYOUT-totals_only       = ` `.
    I_LAYOUT-key_hotspot       = ‘X’.
    I_LAYOUT-detail_popup      = ‘X’.
    I_LAYOUT-group_change_edit = ‘X’.
    I_LAYOUT-GROUP_BUTTONS     = ‘X’.
    Step 6
    This step is required to get the selection screen information in the report output.
    The prerequisite for this is to set the parameter LAYOUT-GET_SELINFOS of the IMPORTING structure.
    The parameters to be passed in the IS_SEL_HIDE table are:
    o mode:              'R' = only the entries passed in the internal table IS_SEL_HIDE-T_ENTRIES       
    Are output in the pop up. Selection info, which the list tool read in the selection screen (when called by a report with a selection screen), is replaced by the values passed.
    'S' = the selection info which the list tool read in the selection screen of the calling report are modified by the entries in the table IS_SEL_HIDE-T_ENTRIES.
    o t_entries:         Selection info table
    o t_entries-mode:   'A' = output the selection info for the current table record in the info popup.
    'D' = do not output select option or SELNAME parameter selection info in   the popup.
    o t_entries-selname: (only used in t_entries-mode = 'D') : Name of the select option or parameter.
    The following table fields are only used in t_entries-mode = 'A'. They contain the selection information to be added.
    •     t_entries-field:  DDIC field name of the field for which selection information is to be output.
    •     t_entries-table:  DDIC table names of t_entries-field.
    •     t_entries-stext:  Field name in info popup.
    •     If t_entries-field and t_entries-table have been entered, this text is taken from DDIC.
    •     t_entries-valuf:  Selection condition 'from' value (external format)
    •     t_entries-valut:  Selection condition 'to' value (external format)
    •     t_entries-sign0:  (I)nclusive (E)xclusive
    •     t_entries-option:  All values of the select options Option field allowed.
    Step 6
    The Table IT_SORT is populated with the sort criteria for the different fields.
    The caller specifies the sorting and/or subtotaling of the basic list in the internal table IT_SORT.
    This internal table has the following fields:
         o spos :  Sort sequence
         o fieldname :  Internal output table field name
         o tabname : Only relevant for hierarchical-sequential lists. Name of the internal output table.
         o up : 'X' = sort in ascending order
         o down : 'X' = sort in descending order
         o subtot : 'X' = subtotal at group value change
         o group : '* ' = new page at group value change ,'UL' = underline at group value change
                             Step 7
    The final step in the output of the report is the use of two ALV functions modules.
    1.     REUSE_ALV_FIELDCATALOG_MERGE
    2.     REUSE_ALV_LIST_DISPLAY
    The first function module is used to pass the field catalog to the report output and merge it with the internal output table.
    FUNCTION reuse_alv_fieldcatalog_merge.                                
    ""Lokale Schnittstelle:                                             
    *” IMPORTING                                                    
    *"             VALUE(I_PROGRAM_NAME) LIKE  SY-REPID OPTIONAL          
    *"             VALUE(I_INTERNAL_TABNAME) TYPE  SLIS_TABNAME OPTIONAL  
    *"             VALUE(I_STRUCTURE_NAME) LIKE  DD02L-TABNAME OPTIONAL   
    *"             VALUE(I_CLIENT_NEVER_DISPLAY) TYPE  SLIS_CHAR_1        
    *"                             DEFAULT 'X'                            
    *"             VALUE(I_INCLNAME) LIKE  TRDIR-NAME OPTIONAL            
    *"       CHANGING                                                     
    *"             VALUE(CT_FIELDCAT) TYPE  SLIS_T_FIELDCAT_ALV           
    *"       EXCEPTIONS                                                   
    *"              INCONSISTENT_INTERFACE                                
    *"              PROGRAM_ERROR                                         
    Import parameters 
    I_PROGRAM_NAME: Program in which the internal output table is declared and populated   
    I_INTERNAL_TABNAME: Internal output table name
    I_STRUCTURE_NAME: Structure name (structure, table, and view)
    I_CLIENT_NEVER_DISPL: Hide client fields default ‘X’
    I_INCLNAME: Data declarations include name
    CHANGING parameter
    CT_FIELDCAT: Field catalog with field descriptions
    The variant based on a program-internal table should only be used for rapid prototyping since the following restrictions apply:                                                                               
    1.   Performance is affected since the code of the table definition must always be read and interpreted at runtime.                                                                               
    2.   Dictionary reference are only considered if the keywords LIKE or  INCLUDE STRUCTURE (not TYPE) are used.
    Step 8
    The other function module is used to display the internal output table with the contents
    FUNCTION reuse_alv_list_display.                                          
    ""Lokale Schnittstelle:                                                 
    *” IMPORTING                                                        
    *"             VALUE(I_INTERFACE_CHECK) DEFAULT SPACE                     
    *"             VALUE(I_CALLBACK_PROGRAM) LIKE  SY-REPID DEFAULT SPACE     
    *"             VALUE(I_CALLBACK_PF_STATUS_SET) TYPE  SLIS_FORMNAME        
    *"                             DEFAULT SPACE                              
    *"             VALUE(I_CALLBACK_USER_COMMAND) TYPE  SLIS_FORMNAME         
    *"                             DEFAULT SPACE                              
    *"             VALUE(I_STRUCTURE_NAME) LIKE  DD02L-TABNAME OPTIONAL       
    *"             VALUE(IS_LAYOUT) TYPE  SLIS_LAYOUT_ALV OPTIONAL            
    *"             VALUE(IT_FIELDCAT) TYPE  SLIS_T_FIELDCAT_ALV OPTIONAL      
    *"             VALUE(IT_EXCLUDING) TYPE  SLIS_T_EXTAB OPTIONAL            
    *"             VALUE(IT_SPECIAL_GROUPS) TYPE  SLIS_T_SP_GROUP_ALV         
    *"                             OPTIONAL                                   
    *"             VALUE(IT_SORT) TYPE  SLIS_T_SORTINFO_ALV OPTIONAL          
    *"             VALUE(IT_FILTER) TYPE  SLIS_T_FILTER_ALV OPTIONAL          
    *"             VALUE(IS_SEL_HIDE) TYPE  SLIS_SEL_HIDE_ALV OPTIONAL        
    *"           VALUE(I_DEFAULT) DEFAULT 'X'
    "             VALUE(I_SAVE) DEFAULT SPACE                             
    "             VALUE(IS_VARIANT) LIKE  DISVARIANT                      
    "                             STRUCTURE  DISVARIANT DEFAULT SPACE     
    "             VALUE(IT_EVENTS) TYPE  SLIS_T_EVENT OPTIONAL            
    "             VALUE(IT_EVENT_EXIT) TYPE  SLIS_T_EVENT_EXIT OPTIONAL   
    "             VALUE(IS_PRINT) TYPE  SLIS_PRINT_ALV OPTIONAL           
    "             VALUE(IS_REPREP_ID) TYPE  SLIS_REPREP_ID OPTIONAL       
    "             VALUE(I_SCREEN_START_COLUMN) DEFAULT 0                  
    "             VALUE(I_SCREEN_START_LINE) DEFAULT 0                    
    "             VALUE(I_SCREEN_END_COLUMN) DEFAULT 0                    
    "             VALUE(I_SCREEN_END_LINE) DEFAULT 0                      
    "       EXPORTING                                                     
    "             VALUE(E_EXIT_CAUSED_BY_CALLER)                          
    "             VALUE(ES_EXIT_CAUSED_BY_USER) TYPE  SLIS_EXIT_BY_USER   
    "       TABLES                                                        
    "              T_OUTTAB                                               
    "       EXCEPTIONS                                                    
    "              PROGRAM_ERROR
    Import parameters
    I_INTERFACE_CHECK: Interface consistency check log output.
    I_CALLBACK_PROGRAM: Name of the calling program
    I_CALLBACK_PF_STATUS_SET: Set EXIT routine to status.   
    I_CALLBACK_USER_COMMAND: EXIT routine for command handling
    I_STRUCTURE_NAME: Internal output table structure name     
    IS_LAYOUT: List layout specifications 
    IT_FIELDCAT: Field catalog with field descriptions
    IT_EXCLUDING: Table of inactive function codes   
    IT_SPECIAL_GROUPS: Grouping fields for column selection
    IT_SORT: Sort criteria for first list display
    IT_FILTER: Filter criteria for first list output
    IS_SEL_HIDE     : Selection information modification
    I_DEFAULT:      Initial variant active/inactive logic
    I_SAVE: Variants can be saved
    IS_VARIANT     : Variant information
    IT_EVENTS: Table of events to perform  IT_EVENT_EXIT :  Standard fcode exit requests table 
    IS_PRINT: Print information
    IS_REPREP_ID: Initialization keys for Re/Re interface
    I_SCREEN_START_COLUMN: Coordinates for list in dialog box
    I_SCREEN_START_LINE: Coordinates for list in dialog box
    I_SCREEN_END_COLUMN: Coordinates for list in dialog box        
    I_SCREEN_END_LINE: Coordinates f

  • Input must bein module pool and the output should be in ALV report

    Dear Friends,
    Greetings.....................
    Please give me solution for my problem.
    Consider there is one module pool screen with the fields empno, edob, ecity.There is one search button.if the user clicks the search button.it should display the employee details based on empno and output must be in ALV reports.
    Thanks in advance
    Raj

    Hi,
    Try to use
    call function 'REUSE_ALV_POPUP_TO_SELECT'
           exporting
                i_title               = text-021
                i_zebra               = 'X'
                i_tabname             = 'P_YSIZE1'
                it_fieldcat           = p_fieldcat[]
                it_excluding          = p_excltab[]
                i_screen_start_column = 02
                i_screen_start_line   = 02
                i_screen_end_column   = 45
                i_screen_end_line     = 15
           importing
                e_exit                = p_exit
                es_selfield           = p_selfield
           tables
                t_outtab              = p_ysize1.

  • Is it Possible to display the output of the ALV list as POP-UP

    Hi Experts,
                     Is it Possible to display the output of the ALV list as POP-UP, if yes then provide some ideas on it.
    thanking in advance,
    Samad.

    Hi samad, it is possible to display alv list as pop-up by using the FM " REUSE_ALV_POPUP_TO_SELECT"
    try this sample code
    CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'
          EXPORTING
       I_TITLE                       =  P1_TITLE
           I_SELECTION                   = 'X'
           I_ZEBRA                       = 'X'
      I_CHECKBOX_FIELDNAME          =
      I_LINEMARK_FIELDNAME          =
      I_SCROLL_TO_SEL_LINE          = 'X'
            I_TABNAME                     = 'T_VBAP'
           I_STRUCTURE_NAME              =  'T_VBAP'
           IT_FIELDCAT                   =  T_FCAT2
           I_CALLBACK_PROGRAM            = 'ZTEST_ALV_POPUP'
       IMPORTING
           ES_SELFIELD                   = I_SELFIELD
           E_EXIT                        = W_EXIT
          TABLES
            T_OUTTAB                      = T_VBAP.
    i think it will solve your problem
    Regards,
    Vijay

  • Events in Alv Report

    Hi experts,
    Can anyone brief me about events which appears in an ALV report.
    I want the events only for Alv report not for any report program.
    Thanks
    Sanket sethi.

    Hi Sanket,
    <b>ALV is Application List viewer.</b>
    Sap provides a set of ALV (ABAP LIST VIEWER) function modules which can be put into use to embellish the output of a report. This set of ALV functions is used to enhance the readability and functionality of any report output. Cases arise in sap when the output of a report contains columns extending more than 255 characters in length.
    In such cases, this set of ALV functions can help choose selected columns and arrange the different columns from a report output and also save different variants for report display. This is a very efficient tool for dynamically sorting and arranging the columns from a report output.
    The report output can contain up to 90 columns in the display with the wide array of display options.
    The commonly used ALV functions used for this purpose are;
    <b>1. REUSE_ALV_VARIANT_DEFAULT_GET
    2. REUSE_ALV_VARIANT_F4
    3. REUSE_ALV_VARIANT_EXISTENCE
    4. REUSE_ALV_EVENTS_GET
    5. REUSE_ALV_COMMENTARY_WRITE
    6. REUSE_ALV_FIELDCATALOG_MERGE
    7. REUSE_ALV_LIST_DISPLAY
    8. REUSE_ALV_GRID_DISPLAY
    9. REUSE_ALV_POPUP_TO_SELECT</b>
    Purpose of the above Functions are differ not all the functions are required in all the ALV Report.
    But either no.7 or No.8 is there in the Program.
    How you call this function in your report?
    After completion of all the data fetching from the database and append this data into an Internal Table. say I_ITAB.
    Then use follwing function module.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
           EXPORTING
                I_CALLBACK_PROGRAM       = 'Prog.name'
                I_STRUCTURE_NAME         = 'I_ITAB'
                I_DEFAULT                = 'X'
                I_SAVE                   = 'A'
           TABLES
                T_OUTTAB                 = I_ITAB.
      IF SY-SUBRC <> 0.
        WRITE: 'SY-SUBRC: ', SY-SUBRC .
      ENDIF.
    ENDFORM.                    " GET_FINAL_DATA
    Sample ALV1:
    REPORT Z_ALV_SIMPLE_EXAMPLE_WITH_ITAB .
    *Simple example to use ALV and to define the ALV data in an internal
    *table
    Martin Schlegel, BearingPoint, December 2004
    Thanks to Madhusudhan Sonee and Rama Krishna Kommineni for testing
    and feedback
    *For a very long time, people gave me the feeling that ALV is a
    *complicated tool that is difficult to understand and to use.
    *Lately I had to use it and I discovered that ALV is easy to use and
    *saves a lot of work:
    *ALV will generate the column headings on its own, so one does not need
    *to work on headlines and transalation.
    *ALV allows the user to select the columns he wants to see, so the user
    *does not need to contact a developer for every change he likes to have.
    *ALV allows the user to create his own sums, so …
    *ALV has a simple way to work with internal tables.
    *If you really want to save time, use ALV instead of write!
    *Please take 30 minutes to explore the following example and see how
    *easy it is to use ALV!
    *data definition
    tables:
    marav. "Table MARA and table MAKT
    Data to be displayed in ALV
    Using the following syntax, REUSE_ALV_FIELDCATALOG_MERGE can auto-
    matically determine the fieldstructure from this source program
    Data:
    begin of imat occurs 100,
    matnr like marav-matnr, "Material number
    maktx like marav-maktx, "Material short text
    matkl like marav-matkl, "Material group (so you can test to make
                            " intermediate sums)
    ntgew like marav-ntgew, "Net weight, numeric field (so you can test to
                            "make sums)
    gewei like marav-gewei, "weight unit (just to be complete)
    end of imat.
    Other data needed
    field to store report name
    data i_repid like sy-repid.
    field to check table length
    data i_lines like sy-tabix.
    Data for ALV display
    TYPE-POOLS: SLIS.
    data int_fcat type SLIS_T_FIELDCAT_ALV.
    select-options:
    s_matnr for marav-matnr matchcode object MAT1.
    start-of-selection.
    read data into table imat
      select * from marav
      into corresponding fields of table imat
      where
      matnr in s_matnr.
    Check if material was found
      clear i_lines.
      describe table imat lines i_lines.
      if i_lines lt 1.
      Using hardcoded write here for easy upload
        write: /
        'No materials found.'.
        exit.
      endif.
    end-of-selection.
    Now, we start with ALV
    To use ALV, we need a DDIC-structure or a thing called Fieldcatalogue.
    The fieldcatalouge can be generated by FUNCTION
    'REUSE_ALV_FIELDCATALOG_MERGE' from an internal table from any
    report source, including this report.
    The only problem one might have is that the report and table names
    need to be in capital letters. (I had it )
    Store report name
      i_repid = sy-repid.
    Create Fieldcatalogue from internal table
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
           EXPORTING
                I_PROGRAM_NAME         = i_repid
                I_INTERNAL_TABNAME     = 'IMAT'  "capital letters!
                I_INCLNAME             = i_repid
           CHANGING
                CT_FIELDCAT            = int_fcat
           EXCEPTIONS
                INCONSISTENT_INTERFACE = 1
                PROGRAM_ERROR          = 2
                OTHERS                 = 3.
    *explanations:
       I_PROGRAM_NAME is the program which calls this function
       I_INTERNAL_TABNAME is the name of the internal table which you want
                          to display in ALV
       I_INCLNAME is the ABAP-source where the internal table is defined
                  (DATA....)
         CT_FIELDCAT contains the Fieldcatalouge that we need later for
         ALV display
      IF SY-SUBRC <> 0.
        write: /
        'Returncode',
        sy-subrc,
        'from FUNCTION REUSE_ALV_FIELDCATALOG_MERGE'.
      ENDIF.
    *This was the fieldcatlogue
    And now, we are ready to display our list
    Call for ALV list display
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
           EXPORTING
               I_CALLBACK_PROGRAM = 'Z_ALV_SIMPLE_EXAMPLE_WITH_ITAB'
                I_CALLBACK_PROGRAM = i_repid
                IT_FIELDCAT        = int_fcat
                I_SAVE             = 'A'
           TABLES
                T_OUTTAB           = imat
           EXCEPTIONS
                PROGRAM_ERROR      = 1
                OTHERS             = 2.
    *explanations:
       I_CALLBACK_PROGRAM is the program which calls this function
       IT_FIELDCAT (just made by REUSE_ALV_FIELDCATALOG_MERGE) contains
                    now the data definition needed for display
       I_SAVE allows the user to save his own layouts
         T_OUTTAB contains the data to be displayed in ALV
      IF SY-SUBRC <> 0.
        write: /
        'Returncode',
        sy-subrc,
        'from FUNCTION REUSE_ALV_LIST_DISPLAY'.
      ENDIF.
    Samle ALV2:
    *& Report  ZZ_22038_22098_002                                          *
    *& This is an Interactive ALV report, where on line slection we can see
    *&  the secondry list
    REPORT  ZZ_22038_22098_002 NO STANDARD PAGE HEADING LINE-SIZE 650
    MESSAGE-ID ZZ_9838                      .
    TYPE-POOLS: SLIS.
    *type declaration for values from ekko
    TYPES: BEGIN OF I_EKKO,
           EBELN LIKE EKKO-EBELN,
           AEDAT LIKE EKKO-AEDAT,
           BUKRS LIKE EKKO-BUKRS,
           BSART LIKE EKKO-BSART,
           LIFNR LIKE EKKO-LIFNR,
           END OF I_EKKO.
    DATA: IT_EKKO TYPE STANDARD TABLE OF I_EKKO INITIAL SIZE 0,
          WA_EKKO TYPE I_EKKO.
    *type declaration for values from ekpo
    TYPES: BEGIN OF I_EKPO,
           EBELN LIKE EKPO-EBELN,
           EBELP LIKE EKPO-EBELP,
           MATNR LIKE EKPO-MATNR,
           MENGE LIKE EKPO-MENGE,
           MEINS LIKE EKPO-MEINS,
           NETPR LIKE EKPO-NETPR,
           END OF I_EKPO.
    DATA: IT_EKPO TYPE STANDARD TABLE OF I_EKPO INITIAL SIZE 0,
          WA_EKPO TYPE I_EKPO .
    *variable for Report ID
    DATA: V_REPID LIKE SY-REPID .
    *declaration for fieldcatalog
    DATA: I_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
          WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
    DATA: IT_LISTHEADER TYPE SLIS_T_LISTHEADER.
    declaration for events table where user comand or set PF status will
    be defined
    DATA: V_EVENTS TYPE SLIS_T_EVENT,
          WA_EVENT TYPE SLIS_ALV_EVENT.
    declartion for layout
    DATA: ALV_LAYOUT TYPE SLIS_LAYOUT_ALV.
    declaration for variant(type of display we want)
    DATA: I_VARIANT TYPE DISVARIANT,
          I_VARIANT1 TYPE DISVARIANT,
          I_SAVE(1) TYPE C.
    *PARAMETERS : p_var TYPE disvariant-variant.
    *Title displayed when the alv list is displayed
    DATA:  I_TITLE_EKKO TYPE LVC_TITLE VALUE 'FIRST LIST DISPLAYED'.
    DATA:  I_TITLE_EKPO TYPE LVC_TITLE VALUE 'SECONDRY LIST DISPLAYED'.
    INITIALIZATION.
      V_REPID = SY-REPID.
      PERFORM BUILD_FIELDCATLOG.
      PERFORM EVENT_CALL.
      PERFORM POPULATE_EVENT.
    START-OF-SELECTION.
      PERFORM DATA_RETRIEVAL.
      PERFORM BUILD_LISTHEADER USING IT_LISTHEADER.
      PERFORM DISPLAY_ALV_REPORT.
    *&      Form  BUILD_FIELDCATLOG
          Fieldcatalog has all the field details from ekko
    FORM BUILD_FIELDCATLOG.
      WA_FIELDCAT-TABNAME = 'IT_EKKO'.
      WA_FIELDCAT-FIELDNAME = 'EBELN'.
      WA_FIELDCAT-SELTEXT_M = 'PO NO.'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-TABNAME = 'IT_EKKO'.
      WA_FIELDCAT-FIELDNAME = 'AEDAT'.
      WA_FIELDCAT-SELTEXT_M = 'DATE.'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-TABNAME = 'IT_EKKO'.
      WA_FIELDCAT-FIELDNAME = 'BUKRS'.
      WA_FIELDCAT-SELTEXT_M = 'COMPANY CODE'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'IT_EKKO'.
      WA_FIELDCAT-FIELDNAME = 'BUKRS'.
      WA_FIELDCAT-SELTEXT_M = 'DOCMENT TYPE'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'IT_EKKO'.
      WA_FIELDCAT-FIELDNAME = 'LIFNR'.
      WA_FIELDCAT-NO_OUT    = 'X'.
      WA_FIELDCAT-SELTEXT_M = 'VENDOR CODE'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
    ENDFORM.                    "BUILD_FIELDCATLOG
    *&      Form  EVENT_CALL
      we get all events - TOP OF PAGE or USER COMMAND in table v_events
    FORM EVENT_CALL.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
       EXPORTING
         I_LIST_TYPE           = 0
       IMPORTING
         ET_EVENTS             = V_EVENTS
    EXCEPTIONS
       LIST_TYPE_WRONG       = 1
       OTHERS                = 2
      IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    "EVENT_CALL
    *&      Form  POPULATE_EVENT
         Events populated for TOP OF PAGE & USER COMAND
    FORM POPULATE_EVENT.
      READ TABLE V_EVENTS INTO WA_EVENT WITH KEY NAME = 'TOP_OF_PAGE'.
      IF SY-SUBRC EQ 0.
        WA_EVENT-FORM = 'TOP_OF_PAGE'.
        MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =
    WA_EVENT-FORM.
      ENDIF.
      READ TABLE V_EVENTS INTO WA_EVENT WITH KEY NAME = 'USER_COMMAND'.
      IF SY-SUBRC EQ 0.
        WA_EVENT-FORM = 'USER_COMMAND'.
        MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =
    WA_EVENT-NAME.
      ENDIF.
    ENDFORM.                    "POPULATE_EVENT
    *&      Form  data_retrieval
      retreiving values from the database table ekko
    FORM DATA_RETRIEVAL.
      SELECT EBELN AEDAT BUKRS BSART LIFNR FROM EKKO INTO TABLE IT_EKKO.
    ENDFORM.                    "data_retrieval
    *&      Form  bUild_listheader
          text
         -->I_LISTHEADEtext
    FORM BUILD_LISTHEADER USING I_LISTHEADER TYPE SLIS_T_LISTHEADER.
      DATA HLINE TYPE SLIS_LISTHEADER.
      HLINE-INFO = 'this is my first alv pgm'.
      HLINE-TYP = 'H'.
    ENDFORM.                    "build_listheader
    *&      Form  display_alv_report
          text
    FORM DISPLAY_ALV_REPORT.
      V_REPID = SY-REPID.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
         I_CALLBACK_PROGRAM                = V_REPID
      I_CALLBACK_PF_STATUS_SET          = ' '
         I_CALLBACK_USER_COMMAND           = 'USER_COMMAND'
         I_CALLBACK_TOP_OF_PAGE            = 'TOP_OF_PAGE'
         I_GRID_TITLE                      = I_TITLE_EKKO
      I_GRID_SETTINGS                   =
      IS_LAYOUT                         = ALV_LAYOUT
         IT_FIELDCAT                       = I_FIELDCAT[]
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
      IT_SORT                           =
      IT_FILTER                         =
      IS_SEL_HIDE                       =
        i_default                         = 'ZLAY1'
         I_SAVE                            = 'A'
        is_variant                        = i_variant
         IT_EVENTS                         = V_EVENTS
        TABLES
          T_OUTTAB                          = IT_EKKO
    EXCEPTIONS
      PROGRAM_ERROR                     = 1
      OTHERS                            = 2
      IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    "display_alv_report
    *&      Form  TOP_OF_PAGE
          text
    FORM TOP_OF_PAGE.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          IT_LIST_COMMENTARY       = IT_LISTHEADER
       i_logo                   =
       I_END_OF_LIST_GRID       =
    ENDFORM.                    "TOP_OF_PAGE
    *&      Form  USER_COMMAND
          text
         -->R_UCOMM    text
         -->,          text
         -->RS_SLEFIELDtext
    FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
    RS_SELFIELD TYPE SLIS_SELFIELD.
      CASE R_UCOMM.
        WHEN '&IC1'.
          READ TABLE IT_EKKO INTO WA_EKKO INDEX RS_SELFIELD-TABINDEX.
          PERFORM BUILD_FIELDCATLOG_EKPO.
          PERFORM EVENT_CALL_EKPO.
          PERFORM POPULATE_EVENT_EKPO.
          PERFORM DATA_RETRIEVAL_EKPO.
          PERFORM BUILD_LISTHEADER_EKPO USING IT_LISTHEADER.
          PERFORM DISPLAY_ALV_EKPO.
      ENDCASE.
    ENDFORM.                    "user_command
    *&      Form  BUILD_FIELDCATLOG_EKPO
          text
    FORM BUILD_FIELDCATLOG_EKPO.
      WA_FIELDCAT-TABNAME = 'IT_EKPO'.
      WA_FIELDCAT-FIELDNAME = 'EBELN'.
      WA_FIELDCAT-SELTEXT_M = 'PO NO.'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-TABNAME = 'IT_EKPO'.
      WA_FIELDCAT-FIELDNAME = 'EBELP'.
      WA_FIELDCAT-SELTEXT_M = 'LINE NO'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
      WA_FIELDCAT-TABNAME = 'I_EKPO'.
      WA_FIELDCAT-FIELDNAME = 'MATNR'.
      WA_FIELDCAT-SELTEXT_M = 'MATERIAL NO.'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'I_EKPO'.
      WA_FIELDCAT-FIELDNAME = 'MENGE'.
      WA_FIELDCAT-SELTEXT_M = 'QUANTITY'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'I_EKPO'.
      WA_FIELDCAT-FIELDNAME = 'MEINS'.
      WA_FIELDCAT-SELTEXT_M = 'UOM'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
    WA_FIELDCAT-TABNAME = 'I_EKPO'.
      WA_FIELDCAT-FIELDNAME = 'NETPR'.
      WA_FIELDCAT-SELTEXT_M = 'PRICE'.
      APPEND WA_FIELDCAT TO I_FIELDCAT.
      CLEAR WA_FIELDCAT.
    ENDFORM.                    "BUILD_FIELDCATLOG_EKPO
    *&      Form  event_call_ekpo
      we get all events - TOP OF PAGE or USER COMMAND in table v_events
    FORM EVENT_CALL_EKPO.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
       EXPORTING
         I_LIST_TYPE           = 0
       IMPORTING
         ET_EVENTS             = V_EVENTS
    EXCEPTIONS
      LIST_TYPE_WRONG       = 1
      OTHERS                = 2
      IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    "event_call_ekpo
    *&      Form  POPULATE_EVENT
           Events populated for TOP OF PAGE & USER COMAND
    FORM POPULATE_EVENT_EKPO.
      READ TABLE V_EVENTS INTO WA_EVENT WITH KEY NAME = 'TOP_OF_PAGE'.
      IF SY-SUBRC EQ 0.
        WA_EVENT-FORM = 'TOP_OF_PAGE'.
        MODIFY V_EVENTS FROM WA_EVENT TRANSPORTING FORM WHERE NAME =
    WA_EVENT-FORM.
      ENDIF.
      ENDFORM.                    "POPULATE_EVENT
    *&      Form  TOP_OF_PAGE
          text
    FORM F_TOP_OF_PAGE.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          IT_LIST_COMMENTARY       = IT_LISTHEADER
       i_logo                   =
       I_END_OF_LIST_GRID       =
    ENDFORM.                    "TOP_OF_PAGE
    *&      Form  USER_COMMAND
          text
         -->R_UCOMM    text
         -->,          text
         -->RS_SLEFIELDtext
    *retreiving values from the database table ekko
    FORM DATA_RETRIEVAL_EKPO.
    SELECT EBELN EBELP MATNR MENGE MEINS NETPR FROM EKPO INTO TABLE IT_EKPO.
    ENDFORM.
    FORM BUILD_LISTHEADER_EKPO USING I_LISTHEADER TYPE SLIS_T_LISTHEADER.
    DATA: HLINE1 TYPE SLIS_LISTHEADER.
    HLINE1-TYP = 'H'.
    HLINE1-INFO = 'CHECKING PGM'.
    ENDFORM.
    FORM DISPLAY_ALV_EKPO.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      I_INTERFACE_CHECK                 = ' '
      I_BYPASSING_BUFFER                = ' '
      I_BUFFER_ACTIVE                   = ' '
       I_CALLBACK_PROGRAM                = V_REPID
      I_CALLBACK_PF_STATUS_SET          = ' '
      I_CALLBACK_USER_COMMAND           = 'F_USER_COMMAND'
       I_CALLBACK_TOP_OF_PAGE            = 'TOP_OF_PAGE'
      I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
      I_CALLBACK_HTML_END_OF_LIST       = ' '
      I_STRUCTURE_NAME                  =
      I_BACKGROUND_ID                   = ' '
       I_GRID_TITLE                      = I_TITLE_EKPO
      I_GRID_SETTINGS                   =
      IS_LAYOUT                         =
       IT_FIELDCAT                       = I_FIELDCAT[]
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
      IT_SORT                           =
      IT_FILTER                         =
      IS_SEL_HIDE                       =
      I_DEFAULT                         =
       I_SAVE                            = 'A'
      IS_VARIANT                        =
       IT_EVENTS                         = V_EVENTS
      TABLES
        T_OUTTAB                          = IT_EKPO
    EXCEPTIONS
       PROGRAM_ERROR                     = 1
       OTHERS                            = 2
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    ENDFORM.
    <b>Reward Points if Useful</b>
    Regards
    Gokul

  • Triggerring ALV-pop up

    Hi all,
             How to trigger a pop-up alv report upono double click  on a row  in a report developed using OO ALV.
    Do i need to trigger any method and call fm REUSE ALV POP UP? Please help!
    Helpful answers will be rewarded.
    Thanks,
    Sandeep

    Hi Sandeep,
                      This might help:
    User selects infotypes from a pop up alv .The details of
    *infotypes selected are displayed in a ALV dialog box.
    REPORT ZALV_POPDIALOG.
    *Type pools for ALV declarations
    TYPE-POOLS : slis.
    *Internal table and wa declarations for T582A.
    DATA : it_t582a TYPE STANDARD TABLE OF t582a INITIAL SIZE 0,
           wa_t582a TYPE t582a.
    *Internal table and wa declarations for T582S.
    DATA : it_text TYPE STANDARD TABLE OF t582s,
           wa_text TYPE t582s.
    *Structure declaration for output
    TYPES : BEGIN OF ty_output,
            infty TYPE infty,
            zeitb TYPE dzeitb,
            itext TYPE intxt,
            pnnnn TYPE pnnnn_d,
            dname TYPE dianm,
            namst TYPE namst,
            edynr TYPE edynp,
            ldynr TYPE ldynp,
            stypt TYPE stypt,
            sytxt TYPE sytxt,
            zbtab TYPE dzbtab,
            checkbox(1),
            END OF ty_output.
    *Internal table and work area declaration for output in pop up
    DATA : it_output TYPE STANDARD TABLE OF ty_output INITIAL SIZE 0,
           wa_output TYPE ty_output.
    *Internal table and workarea declaration for alv dialog display
    DATA : it_display TYPE STANDARD TABLE OF ty_output INITIAL SIZE 0,
           wa_display TYPE ty_output.
    *data declarations for ALV
    DATA:ls_fieldcat TYPE slis_fieldcat_alv,
        lt_fieldcat TYPE slis_t_fieldcat_alv,
        ls_fieldcatlog TYPE slis_fieldcat_alv,
        lt_fieldcatlog TYPE slis_t_fieldcat_alv,
        lt_layout TYPE slis_layout_alv.
    *Initialization event
    INITIALIZATION.
    *Start of selection event
    START-OF-SELECTION.
    *Select to fetch all the infotypes and details in sap system
      SELECT *
             FROM t582a
             INTO CORRESPONDING FIELDS OF TABLE it_t582a.
    *Select to fetch the infotypes text
      IF it_t582a[] IS NOT INITIAL.
        SELECT * FROM t582s INTO CORRESPONDING FIELDS OF TABLE it_text
        FOR ALL ENTRIES IN it_t582a WHERE infty = it_t582a-infty
        AND sprsl = 'E'.
      ENDIF.
    *Appending the selected values to the output table
      LOOP AT it_t582a INTO wa_t582a.
        wa_output-infty = wa_t582a-infty.
        wa_output-zeitb = wa_t582a-zeitb.
        wa_output-pnnnn = wa_t582a-pnnnn.
        wa_output-dname = wa_t582a-dname.
        wa_output-namst = wa_t582a-namst.
        wa_output-edynr = wa_t582a-edynr.
        wa_output-ldynr = wa_t582a-ldynr.
        wa_output-stypt = wa_t582a-stypt.
        wa_output-sytxt = wa_t582a-sytxt.
        wa_output-zbtab = wa_t582a-zbtab.
        READ TABLE it_text INTO wa_text WITH KEY infty = wa_t582a-infty.
        wa_output-itext = wa_text-itext.
        APPEND wa_output TO it_output.
        CLEAR wa_output.
      ENDLOOP.
    *Subroutine to display the pop up values.
      PERFORM popup_display.
    *Subroutine to display the ALV dialog display
      PERFORM alv_output.
         Form  popup_display
    FORM popup_display.
    *field catalogue for pop up
      CLEAR ls_fieldcat.
      ls_fieldcat-row_pos   = '1'.
      ls_fieldcat-col_pos   = '1'.
      ls_fieldcat-fieldname = 'CHECKBOX'.
      ls_fieldcat-tabname   = 'IT_OUTPUT'.
      ls_fieldcat-seltext_m = 'SELECT'.
      APPEND ls_fieldcat TO lt_fieldcat.
      CLEAR ls_fieldcat.
      ls_fieldcat-row_pos   = '1'.
      ls_fieldcat-col_pos   = '2'.
      ls_fieldcat-fieldname = 'ITEXT'.
      ls_fieldcat-tabname   = 'IT_OUTPUT'.
      ls_fieldcat-seltext_m = 'DESCRIPTION'.
      ls_fieldcat-outputlen = 50.
      APPEND ls_fieldcat TO lt_fieldcat.
    Display data in a POPUP
      CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'
        EXPORTING
          i_zebra              = 'X'
          it_fieldcat          = lt_fieldcat
          i_tabname            = 'IT_OUTPUT'
          i_checkbox_fieldname = 'CHECKBOX'
        TABLES
          t_outtab             = it_output.
    *Appending the selected infotypes only to internal table
      LOOP AT it_output INTO wa_output WHERE checkbox = 'X'.
        wa_display-itext = wa_output-itext.
        wa_display-infty = wa_output-infty.
        wa_display-zeitb = wa_output-zeitb.
        wa_display-pnnnn = wa_output-pnnnn.
        wa_display-dname = wa_output-dname.
        wa_display-namst = wa_output-namst.
        wa_display-edynr = wa_output-edynr.
        wa_display-ldynr = wa_output-ldynr.
        wa_display-sytxt = wa_output-sytxt.
        wa_display-stypt = wa_output-stypt.
        wa_display-zbtab = wa_output-zbtab.
        APPEND wa_display TO it_display.
        CLEAR wa_display.
      ENDLOOP.
    ENDFORM.                               " popup_display
    *&      Form  alv_output
    FORM alv_output .
    *fieldcatalogue for ALV dialog
      PERFORM build_fieldcat.
    *Layout for ALV dialog
      PERFORM build_layout.
    **ALV dialog output
      PERFORM alv.
    ENDFORM.                    " alv_output
    *&      Form  build_fieldcat
    FORM build_fieldcat .
    *fieldcatalogue for alv dialog
      CLEAR ls_fieldcatlog.
      ls_fieldcatlog-row_pos   = '1'.
      ls_fieldcatlog-col_pos   = '1'.
      ls_fieldcatlog-fieldname = 'INFTY'.
      ls_fieldcatlog-tabname   = 'IT_DISPLAY'.
      ls_fieldcatlog-seltext_m = 'Infotype'.
      APPEND ls_fieldcatlog TO lt_fieldcatlog.
      CLEAR ls_fieldcatlog.
      ls_fieldcatlog-row_pos   = '1'.
      ls_fieldcatlog-col_pos   = '2'.
      ls_fieldcatlog-fieldname = 'ITEXT'.
      ls_fieldcatlog-tabname   = 'IT_DISPLAY'.
      ls_fieldcatlog-seltext_m = 'Description'.
      APPEND ls_fieldcatlog TO lt_fieldcatlog.
      CLEAR ls_fieldcatlog.
      ls_fieldcatlog-row_pos   = '1'.
      ls_fieldcatlog-col_pos   = '3'.
      ls_fieldcatlog-fieldname = 'ZEITB'.
      ls_fieldcatlog-tabname   = 'IT_DISPLAY'.
      ls_fieldcatlog-seltext_m = 'TimeConstraint'.
      APPEND ls_fieldcatlog TO lt_fieldcatlog.
      CLEAR ls_fieldcatlog.
      ls_fieldcatlog-row_pos   = '1'.
      ls_fieldcatlog-col_pos   = '4'.
      ls_fieldcatlog-fieldname = 'PNNNN'.
      ls_fieldcatlog-tabname   = 'IT_DISPLAY'.
      ls_fieldcatlog-seltext_m = 'Structure'.
      APPEND ls_fieldcatlog TO lt_fieldcatlog.
      CLEAR ls_fieldcatlog.
      ls_fieldcatlog-row_pos   = '1'.
      ls_fieldcatlog-col_pos   = '5'.
      ls_fieldcatlog-fieldname = 'DNAME'.
      ls_fieldcatlog-tabname   = 'IT_DISPLAY'.
      ls_fieldcatlog-seltext_m = 'DialogModule'.
      APPEND ls_fieldcatlog TO lt_fieldcatlog.
      CLEAR ls_fieldcatlog.
      ls_fieldcatlog-row_pos   = '1'.
      ls_fieldcatlog-col_pos   = '6'.
      ls_fieldcatlog-fieldname = 'NAMST'.
      ls_fieldcatlog-tabname   = 'IT_DISPLAY'.
      ls_fieldcatlog-seltext_m = 'Subtypefield'.
      APPEND ls_fieldcatlog TO lt_fieldcatlog.
      CLEAR ls_fieldcatlog.
      ls_fieldcatlog-row_pos   = '1'.
      ls_fieldcatlog-col_pos   = '7'.
      ls_fieldcatlog-fieldname = 'EDYNR'.
      ls_fieldcatlog-tabname   = 'IT_DISPLAY'.
      ls_fieldcatlog-seltext_m = 'Singlescreenno'.
      APPEND ls_fieldcatlog TO lt_fieldcatlog.
      CLEAR ls_fieldcatlog.
      ls_fieldcatlog-row_pos   = '1'.
      ls_fieldcatlog-col_pos   = '8'.
      ls_fieldcatlog-fieldname = 'LDYNR'.
      ls_fieldcatlog-tabname   = 'IT_DISPLAY'.
      ls_fieldcatlog-seltext_m = 'Listscreenno'.
      APPEND ls_fieldcatlog TO lt_fieldcatlog.
      CLEAR ls_fieldcatlog.
      ls_fieldcatlog-row_pos   = '1'.
      ls_fieldcatlog-col_pos   = '9'.
      ls_fieldcatlog-fieldname = 'STYPT'.
      ls_fieldcatlog-tabname   = 'IT_DISPLAY'.
      ls_fieldcatlog-seltext_m = 'SubtypTable'.
      APPEND ls_fieldcatlog TO lt_fieldcatlog.
      CLEAR ls_fieldcatlog.
      ls_fieldcatlog-row_pos   = '1'.
      ls_fieldcatlog-col_pos   = '10'.
      ls_fieldcatlog-fieldname = 'SYTXT'.
      ls_fieldcatlog-tabname   = 'IT_DISPLAY'.
      ls_fieldcatlog-seltext_m = 'Subtyptexttable'.
      APPEND ls_fieldcatlog TO lt_fieldcatlog.
      CLEAR ls_fieldcatlog.
      ls_fieldcatlog-row_pos   = '1'.
      ls_fieldcatlog-col_pos   = '11'.
      ls_fieldcatlog-fieldname = 'ZBTAB'.
      ls_fieldcatlog-tabname   = 'IT_DISPLAY'.
      ls_fieldcatlog-seltext_m = 'SubtypeTCTable'.
      APPEND ls_fieldcatlog TO lt_fieldcatlog.
    ENDFORM.                    " build_fieldcat
    *&      Form  build_layout
    *Layout for ALV dialog
    FORM build_layout .
      lt_layout-zebra = 'X'.
      lt_layout-colwidth_optimize = 'X'.
    ENDFORM.                    " build_layout
    *&      Form  alv
    *Alv dialog output.
    FORM alv .
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program    = sy-repid
          i_grid_title          = 'INFOTYPE DETAILS'
          is_layout             = lt_layout
          it_fieldcat           = lt_fieldcatlog
          i_screen_start_column = 10
          i_screen_start_line   = 20
          i_screen_end_column   = 100
          i_screen_end_line     = 40
        TABLES
          t_outtab              = it_display
        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.                    " alv

  • Pop up on clicking a button

    Hi All,
    Problem : There is a custom screen in a CRM Transaction. In the screen there is a table which displays data.and there are a few buttons which provides a few functionalities like delete records, display attachments etc. The functionality is provided in a CASE statement. The problem now is I need to provide a popup as soon as the user clicks on a button. this popup will display a list from a table.
    I am not able give a popup when i click the button. this will be something like when i click a variant button on a report screen it displaying the list of variants and one of the variants being selected. How do i provide this funtionality it ?
    Thanks,
    Amit

    hi,
    chk a sample code.
    report zsha_0001.
    type-pools: slis.
    data: begin of iku occurs 0,
          check type c,
          kunnr type kna1-kunnr,
          name1 type kna1-name1,
          end of iku.
    data: ifldc type slis_t_fieldcat_alv .
    data: xfldc type slis_fieldcat_alv .
    select kunnr name1 into corresponding fields of table iku
            from kna1 up to 10 rows.
    clear xfldc.
    xfldc-reptext_ddic    = 'Customer'.
    xfldc-fieldname  = 'KUNNR'.
    xfldc-tabname   = 'IKU'.
    xfldc-outputlen  = '12'.
    append xfldc to ifldc.
    clear xfldc.
    xfldc-reptext_ddic    = 'Customer Name'.
    xfldc-fieldname  = 'NAME1'.
    xfldc-tabname   = 'IKU'.
    xfldc-outputlen  = '30'.
    append xfldc to ifldc.
    call function 'REUSE_ALV_POPUP_TO_SELECT'
         exporting
              I_TITLE  = 'This is the message here'
    *          i_checkbox_fieldname = 'CHECK'
              i_tabname            = 'IKU'
              it_fieldcat          = ifldc
         tables
              t_outtab             = iku
         exceptions
              program_error        = 1
              others               = 2.
    check sy-subrc  = 0.
    **********anothe sampel code**
    CALL FUNCTION 'POPUP_WITH_TABLE_DISPLAY'
    EXPORTING ENDPOS_COL = 41
    ENDPOS_ROW = 10
    STARTPOS_COL = 1
    STARTPOS_ROW = 1
    TITLETEXT = TEXT-202
    IMPORTING CHOISE = SEL_ROW
    TABLES VALUETAB = ITAB
    EXCEPTIONS OTHERS = 99.
    IF SY-SUBRC EQ 0 AND SEL_ROW > 0.
    READ TABLE ITAB INDEX SEL_ROW.
    REF_NAME = ITAB-TABNAME.
    ELSE.
    REF_NAME = SPACE.
    ENDIF.
    Regards,
    Anver
    <b><i>if hlped pls mark points</i></b>

  • Documentation on ALV Report

    I have made an ALV Report, i want to show some help to the User, i have created the Documentation thru SE38 but its only visible thru SE38, but my requirement is that when the Report is Displayed then the User will be able to see that Documentation. i have done by creating one button in the PF Status of ALV and then by calling the FM REUSE_ALV_POPUP_TO_SELECT, is this the only way or some else can also be done for displaying the Documentaion to the User.
    Abhishek Suppal

    Hi Abhishek,
    You can use function module DSYS_SHOW_FOR_F1HELP.
    CALL FUNCTION 'DSYS_SHOW_FOR_F1HELP'
      EXPORTING
      APPLICATION              = 'SO70'
        dokclass                 = 'RE'
      DOKLANGU                 = SY-LANGU
        dokname                  = 'SBAL_DOCUMENTATION' <b>"Fill your report name here</b>
        doktitle                 = 'Test'
      HOMETEXT                 = ' '
      OUTLINE                  = ' '
      VIEWNAME                 = 'STANDARD'
      Z_ORIGINAL_OUTLINE       = ' '
      CALLED_FROM_SO70         = ' '
       short_text               = 'X'
       appendix                 = 'X'
    IMPORTING
      APPL                     =
      PF03                     =
      PF15                     =
      PF12                     =
    EXCEPTIONS
       class_unknown            = 1
       object_not_found         = 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.
    Hope this helps..
    Sri
    Message was edited by: Srikanth Pinnamaneni
    Message was edited by: Srikanth Pinnamaneni

  • How to display check box in the search help restriction pop-up window

    Hi Experts,
    I have created one searc help with dialog value restrictions. Search help contains 4 fields.
    Out of which one field has length one character.
    As oon as user press on F4 on particular field, it will display pop-up window with restrictions and displayed 4 fields.
    I would like to show that field ( one character length field) as check box in search help restrictions pop-up window.
    Pls help me ,... How can we acheive this..
    Thanks
    Raghu

    Ur Exact Requirement,
    Types : begin of itab,
         fields type c,
         Check type c,(For Check Box)
         end of itab.
    data it_tab type standard table of itab.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_input-low.(If it is in select-options)
      CLEAR  v_input.
      GET CURSOR FIELD s_input VALUE  v_input.
      CALL FUNCTION 'AIPC_CONVERT_TO_UPPERCASE'
        EXPORTING
          i_input  = v_input
          i_langu  = sy-langu
        IMPORTING
          e_output = v_input.
      CLEAR s_input-low.
      IF v_input NE '' .
        IF v_input NE '?'..
          v_input1-sign = 'I'.
          v_input1-option = 'CP'.
          v_input1-low = v_input.
          APPEND v_input1.
        ENDIF.
      ENDIF.
    SELECT DISTINCT   Field
                      FROM Table
                      INTO TABLE it_tab
                      WHERE field IN v_input.
    CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'
              EXPORTING
                i_title                 = 'Select Colors'
               i_selection             = 'X'
                i_zebra                 = 'X'
                i_screen_start_column   = 5
                i_screen_start_line     = 5
                i_screen_end_column     = 30
                i_screen_end_line       = 12
                i_checkbox_fieldname    = 'CHECK'
                i_tabname               = 'IT_TAB'
                i_scroll_to_sel_line    = 'X'
                it_fieldcat             = it_fieldcat1
                i_callback_program      = sy-repid
                i_callback_user_command = 'USER_COMMAND1'
              IMPORTING
                es_selfield             = selfield
              TABLES
                t_outtab                = it_tab
              EXCEPTIONS
                program_error           = 1.
    Cheers,
    Naveen

  • To display the output of a FM inside a tree

    Hi all,
    'REUSE_ALV_POPUP_TO_SELECT'  is a FM for displaying or selecting table entries in internal tables in a
    popup .
    I need to display the output if this FM inside a tree.
    That is when i expand the tree ,  the output of the FM shoul be displayed .
    Can you please suggest a demo program for this, or a way in which i can do it?
    Regards,
    Harshit Rungta

    No way You can choose any other ALV.
    Kanagaraja L

Maybe you are looking for