Printing a Special Message in ALV Report

Hi,
I have a requirement to print a special message in an ALV report. Customer wants to see this single line message between Report Header and ALV grid. This is a dynamic message to be displayed based on the values in the ALV table. Please suggest me with a suitable solution.
Thanks,
Kannan

Hello Kannan,
if you are using OOPs ABAP to create this ALV then you can put a text field in your Calling screen just above the "Custom Control" Area. make the text area output only.
Now you can pass a variable data to this screen variable from your program.
change the value of this variable based on your condition on PBO part of the called screen.
OR
In case you are using REUSE_AVL then you need to pass the value at.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
  EXPORTING
    i_callback_program       = sy-repid
    it_fieldcat              = t_fieldcat
    is_layout                = x_layout
    it_sort                  = t_sort
    i_callback_pf_status_set = w_status
    i_callback_user_command  = w_comm
    i_save                   = 'X'
    it_events                = t_event
    i_grid_title             = w_title
  TABLES
    t_outtab                 = t_data
  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.
OR
* Report title
  CLEAR t_heading[].
  CLEAR x_heading.
  x_heading-typ = 'H'.
  x_heading-info = 'Reporte Prueba'(001).
  APPEND x_heading TO t_heading.
* Program name
  CLEAR x_heading.
  x_heading-typ = 'S'.
  x_heading-KEY = 'Program: '.
  x_heading-info = sy-repid.
  APPEND x_heading TO t_heading.
* User who is running the report
  CLEAR x_heading.
  x_heading-typ = 'S'.
  x_heading-KEY = 'User: '.
  x_heading-info = sy-uname.
  APPEND x_heading TO t_heading.
* Date of execution
  CLEAR x_heading.
  x_heading-typ = 'S'.
  x_heading-KEY = 'Date: '.
  WRITE sy-datum TO x_heading-info.
  APPEND x_heading TO t_heading.
* Time of execution
  CLEAR x_heading.
  x_heading-typ = 'S'.
  x_heading-KEY = 'Time: '.
  WRITE sy-uzeit TO x_heading-info.
  APPEND x_heading TO t_heading.
* Top of page event
  x_event-name = slis_ev_top_of_page.
  x_event-FORM = 'TOP_OF_PAGE'.
  APPEND x_event TO t_events.
Please pass your variable data that you need to the parameter w_status.
Please give points if you find solution helpful.
Cheers,
Suvendu

Similar Messages

  • Displaying special characters in ALV report.

    Hi Experts,
    Can we display special characters in ALV reports? Special characters such as tick mark.(Like in character map(Font Bookshelf  Symbol 7) of windows ).
    I tried with icons in ALV report, I was able to display tick icon in the ALV report, but when we export the report in to a excel, the icons comes in as Hexadecimal code.
    Can any we display special characters like tick in ALV report or display the icons in excel aswell?
    I will be gratefull for the <urgency reduced by moderator> response.
    Regards,
    Sharath.
    Edited by: Thomas Zloch on May 10, 2011 10:26 AM

    Sharath,
    I think it is possible to do so.
    Please check this link.
    http://www.sapfans.com/forums/viewtopic.php?f=13&t=322569
    Thanks,
    Guru.

  • Warning message in ALV report

    Hi Experts,
    In ALV report i am getting warning like
    " Field string LS_HEADER is not referenced statically"
    Actually i declared this field as "DATA: ls_header TYPE slis_listheader.".
    How to correct this warning message.
    Thanks in advance.
    Thanks,
    Madhu.

    Dear Madhu,
    You are not using LS_HEADER statically that you have defined in the program. You will get a warning message since you have defined a field that you have not referenced statically.
    Are you using this field dynamically? You can delete/comment the code if you are not using it statically and dynamically.
    Moved the thread ABAP forum. Post your queries in relevant forums to get efficient answers.
    Regards,
    Naveen

  • Supress Background Print parameters when user executes ALV report by F9

    Hi friends,
         How can we Supress Background Print parameters pop-up, when user executes ALV report by F9
    or by navigation from selection screen -i.e;  Program ->>Execute in Background.
    Please guide me
    Thanks in Advance,
    Ganesh

    Sorry,
    i need to supress the POP-UP which asks for background Print Parameters in the ALV report. when i press F9 in a selection - screen of a Tcode
    as we supress Pop-up for a smartform or script by passing the Print Parameters
    This 'RS_SET_SELSCREEN_STATUS' excludes the commands(say F9 function code) in report
    I think we need to set the Print paramters in the Program
    please guide me
    Thanks,
    Ganesh

  • How to print the Grid title in ALV Report?

    Hi All,
    I write ALV Report.When i am going to print this report it is not printing the Grid Header(ie.Title ).even in Print Preview Also i m not getting the title.It shows the Gird with Values.How Can i print the title Also...
    Regards,Ravi

    Hi,
      u will declare the data as below like this
    DATA: LIST_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER,
            TOP_OF_PAGE  TYPE SLIS_FORMNAME VALUE 'TOP_OF_PAGE'.
      DATA : ST_FIELDCAT TYPE SLIS_FIELDCAT_ALV,
             IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
             ST_EVENT TYPE SLIS_ALV_EVENT,
             IT_EVENT TYPE SLIS_T_EVENT.
      DATA : ST_LIST  TYPE SLIS_LISTHEADER,
             IT_LIST  TYPE SLIS_T_LISTHEADER,
             IT_LIST1 TYPE SLIS_T_LISTHEADER,
             IT_LIST2 TYPE SLIS_T_LISTHEADER.
    START-OF-SELECTION.
      IF G_FLAG = SPACE.
      W_REPID = SY-REPID.
      G_TOP_PAGE = 'TOP-PAGE'.
          ST_LIST-INFO = '  Title Name '.
          APPEND ST_LIST TO IT_LIST.
          ST_LIST-INFO = '  second Name'.
          APPEND ST_LIST TO IT_LIST.
        ELSE.
      ENDIF.
    FORM TOP-PAGE .
      DATA: V_LOGO(15).
        V_LOGO = 'LOGO'.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          IT_LIST_COMMENTARY = IT_LIST
          I_LOGO             = V_LOGO.
        I_END_OF_LIST_GRID       =
    ENDFORM.                    "TOP-PAGE

  • How to Print Selection-Screen along with ALV Report output

    Hi,
    I have a requirement wherein i need to also print the Selection Screen of a report when I print the ALV report output.
    Basically i need to print the ALV output along with selection screen.
    Could you plz suggest me the way.
    Regards,
    Nitin

    Hi,
    My selection Screen is a very big one. It contains around 30 select-options.
    So is their any standard method in which you can choose whether you want to take the output printout with or without Selection screen.
    Regards,
    Nitin

  • Print Selection Screen Parameters in ALV report only once

    Does anyone know how to print the selection screen within a ALV report.
    I've tried everything. I have the code to capture the selection parameters into a internal table. I can use top_of_page but I only want it printed once.

    Hi,
      If you have captured the selection screen entries in an internal table, then you could display it once by using the BLOCK LIST ALV.
    Check the function module.
    REUSE_ALV_BLOCK_LIST_DISPLAY
    Using this function module more than 1 alv could be display in the report.
    In our case ..there will be two alvs ...one for the selection screen n other for the main report output.
    Check the following example on the block List ALV....
    <b>BALVBT01</b>.
    Regards,
    Vara

  • Calling standard printer driver program RVADOR01 from ALV report

    I have ALV report (Sales order documents) and one of columns in report is icon type with print preview link (hotspot). When user press icon, I would like to call standard print program RVADOR01 (actually we have custom Z_RVADOR01 and custom smartform which are working fine when using Document -> Output in VA03) to display print preview. I don't know how to call (trigger) print driver routine and pass needed parameters to it (ex. SO number).
    Marko

    Actually I did that. But then you are at least three clicks away from print preview screen. For testing purpose I've created custom smartform and run it from my report. It is working like I want. Now, instead of my procedure I want to run standard printer driver program with needed parameters. I believe that all it needs is document number (vbeln) and all the rest is already there, program, smatform... I just don't know how to use it (ex. pass parameters).
    I know I maybe complicating too much but I am ABAP beginner and want to learn as much as possible. Thank you anyway!

  • Error Message in ALV Report

    Hi All,
    I have developed a report.
    After start-of-selection, i have written a perform statement, in which the data is getting retrieved for printing the same in ALV layout.
    If there is no data available in the table, the code will raise an error message stating ' No data is available". This error message statment is in this PERFORM statement....
    But this error message will be triggered in the different page which will be blank...
    Now user would like to have the message in the same page (selection screen).
    How to resolve this issue....??????
    Pelase guide me.....
    Regards
    Pavan
    Message was edited by:
            Pavan Sanganal

    Hi,
    when your internal table is empty
    give the message like
    when u r in start of selection event then
    form
    message i000( zmessage ) with ' no data found'.
    stop.
    endform.
    this provides u again the selection screen,
    regards,
    venkatesh

  • Need to print the company logo in alv report

    Hi All ,
           I am displaying an alv grid for some QM report .
           I have used top-of-page event and   'REUSE_ALV_COMMENTARY_WRITE '    FM to display the logo and header . Every thing is working fine .
      But when I am taking the print-out  the logo is not getting printed . Except logo everything is coming in the print out.
    So please help me if you have any idea ragarding how to print the logo in the report.
    regards
    Satish

    print the logo is really simple, check this little sample:
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          i_logo             = 'Z_LOGO'
          it_list_commentary = gt_list_top_of_page.
    and how to upload the logo in this link:
    uploading logo
    regards
    Edited by: Sebastian Bustamante on Sep 24, 2008 3:26 PM

  • Printing page numbers in an ALV report with multiple grids

    Hi,
    I have developed a report using OO ALV GRID. The output is having multiple grids navigated using a menu button appended to the standard tool bar
    (Ref report: BCALV_GRID_07). On navigation, we are able to display specific titles when each grid is displayed.
    When we print those individual pages (the grids), we are able to print the page numbers and the title for the first grid but when we display the next grid and print, we are unable to initialise the page number
    and print specific title. The page numbers continues from the last printing.
    I am looking at identifying the grid when the print event - PRINT_TOP_OF_PAGE is triggered so that a grid specific title can be printed and also page number initialised.
    Any suggestions is highly appreciated.
    Thanks.
    Mani.

    You cannot have one event for all the grids as you cannot identify for which grid the event has fired. You need to activate the event for each of the grid and handle the code independently.
    regards,
    Ravi
    Note - Please mark the helpful answers

  • How to print a special color in a report.

    Hello,
    I'm new with BI Publisher I'm working on some reports and the user request me to print a particular color on a cell if the cell has a special condition
    Example:
    If the cell comes with 1 print green to that particular cell
    If the cell comes with 2 print yellow to that cell
    and if comes with 3 print red to that cell
    is this possible in BI Publisher? How can I do it?
    regards,
    NA

    Hi you can try in different ways one of them is below .
    <?if@inlines:number(your_field_name)<0?><?attribute@incontext:color;'red'?><?end if?>
    or you can try for entire row like below
    <?if@row:ID='1'?><?attribute@incontext:color;'red'?><?end if?>
    Check the below link
    https://blogs.oracle.com/xmlpublisher/entry/conditional_rows_and_columns
    Edited by: varma on Apr 25, 2012 2:31 PM

  • Printing from ITS a custom ALV report

    Dear All,
    If anybody has any ideas on the following topic it would be appreciated.
    We have written a custom report that outputs in ALV, this is then rendered as service on our ITS server.
    The problem is that when you try to print the frame using standard browser printing it only prints what is on the screen.
    Are there any techniques to use to allow printing of all data that is returned to the browser?
    Thanks
    Matt

    Hi Matt,
    Printing from within the browser is always problematic. Therefore such print jobs are normally done by the SAP system and not by the browser. I would recommend to use the print button of the ALV grid for such printouts. You may either do a print out using a printer connected to the SAP system or may select a PDF printer. Using the PDF printer you can print out using your local printer connected to the PC. You may want to check note 351230 for systems with a basis up to release 6.20 and note 771683 for systems 6.40 and higher.
    Best regards,
    Klaus

  • Print an ALV report in A3/A4

    How to print the output of an ALV report in A3 and A4 size. The number of columns in the report are 49. Also the headings of the columns is too long, is there any way to word wrap these headings in to multiple lines?

    You can customize printer with this formats but you can't establish more than one header in ALV

  • Heading in ALV report is showing up blank

    Hello Friends
    First of all thanks to you all for giving so much of help. I appreciate it.
    I would appreciate if some could please let me know, why my code is not printing the header in my ALV report. It shows up as blank. I have written the Form 'TOP-OF-PAGE'.
    Thanks a lot in advance
    Ram

    This coding will give u the solution ....
    this is an interactive ALV ...
    *& Report  ZMR001_MATERIAL_STOCK_VALUE
    REPORT  zmr001_material_stock_value.
          MODULE MMxxxxxxxx.                                              *
          Objective :..........................................         *
          Program   : Updates Tables (   )    Downloads data (  )       *
                      Outputs List   (   )                              *
          Technical Spec No ...............                             *
          Date Created       07/12/2006                                 *
          Author             Jayakumar.T....                            *
          Location           April Business / Banglore                  *
          LDB                .....                                      *
          External Dependencies                                         *
    Amendment History                                                  *
    Who        Change ID    Reason                                      *
    ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯                                     *
    XXXXXXXXX  AADDMMYYYY Where XXXX = Developers Name................. *
               AA- Developers Initial ................................  *
          Includes                                                      *
    *INCLUDE   :                                                           *
          Tables                                                        *
    *TABLES   :                                                            *
    TABLES : mchb , mara  , mbew , tvkos , t001w.
          Types                    Begin with TY_                       *
    *TYPES   :                                                             *
    TYPES : BEGIN OF ty_mchb,
            matnr LIKE mchb-matnr,
            charg LIKE mchb-charg,
            clabs LIKE mchb-clabs,
            werks LIKE mchb-werks,
            spart LIKE mara-spart,
            maktx LIKE makt-maktx,
            value LIKE mchb-clabs,
            total LIKE mchb-clabs,
            END OF ty_mchb.
    TYPE-POOLS: slis.
    CONSTANTS:
    c_formname_top_of_page TYPE slis_formname VALUE 'TOP_OF_PAGE'.
    DATA  gt_list_top_of_page TYPE slis_t_listheader.
          Constants                Begin with C_                        *
    *CONSTANTS:                                                            *
          Data                     Begin with W_                        *
    *DATA     :                                                            *
          Infotypes                   ( HR Module Specific)             *
    *INFOTYPES :                                                           *
          Internal tables          Begin with IT_                       *
    *DATA    :                                                             *
    DATA : it_mchb TYPE TABLE OF ty_mchb,
            wa_mchb TYPE ty_mchb ,
            it_final TYPE TABLE OF ty_mchb,
            wa_final TYPE ty_mchb,
            it_temp TYPE TABLE OF ty_mchb,
            wa_temp TYPE ty_mchb,
            it_temp1 TYPE TABLE OF ty_mchb,
            wa_temp1 TYPE ty_mchb
    DATA: it_listheader TYPE slis_t_listheader.
          Field Symbols            Begin with FS_                       *
    *FIELD-SYMBOLS:                                                        *
          Insert                                                        *
    *INSERT   :                                                            *
          Select Options          Begin with SO_                        *
    *SELECT-OPTIONS :                                                      *
          Parameters              Begin with PR_                        *
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001 .
    PARAMETERS     : pr_vkorg LIKE tvko-vkorg OBLIGATORY .
    SELECT-OPTIONS : so_werks FOR mchb-werks.
    SELECT-OPTIONS : so_spart FOR mara-spart.
    SELECTION-SCREEN END OF BLOCK b1.
          Initialisation                                                *
    *INITIALISATION   :
    DATA:   wa_variant LIKE disvariant                ,   "Variant
            wa_fieldcat TYPE slis_fieldcat_alv        ,
            it_fieldcat TYPE slis_t_fieldcat_alv      ,
            it_fieldcat1 TYPE slis_t_fieldcat_alv      ,
            wa_layout   TYPE slis_layout_alv          ,
            wa_print    TYPE slis_print_alv           ,
            it_sort     TYPE slis_t_sortinfo_alv      ,
            it_sp_group TYPE slis_t_sp_group_alv      ,
            it_events   TYPE slis_t_event             ,
            it_list_top_of_page TYPE slis_t_listheader,
            w_title1    TYPE lvc_title,
            w_datum LIKE sy-datum.
    DATA slis_ev_top_of_page  TYPE slis_formname VALUE 'TOP_OF_PAGE'.
    DATA w_top_of_page  TYPE slis_formname VALUE 'TOP_OF_PAGE'.   " for top of page
    DATA it_event  TYPE slis_t_event.
    INITIALIZATION.
      PERFORM eventtab_build USING it_event[].
    *set pf-status '002'.
          At selection-screen                                           *
    AT SELECTION-SCREEN.
      SELECT SINGLE * FROM tvkos WHERE vkorg = pr_vkorg AND spart IN so_spart.
      IF sy-subrc NE 0 .
        MESSAGE text-008 TYPE 'E'.
      ENDIF.
      SELECT SINGLE * FROM t001w WHERE vkorg = pr_vkorg AND werks IN so_werks.
      IF sy-subrc NE 0 .
        MESSAGE text-009 TYPE 'E'.
      ENDIF.
          S T A R T   O F   S E L E C T I O N                           *
    START-OF-SELECTION.
      SELECT mc~matnr charg clabs werks spart maktx
      INTO CORRESPONDING
      FIELDS OF TABLE it_mchb FROM mchb AS mc
      INNER JOIN mara AS ma
      ON mamatnr = mcmatnr
      INNER JOIN makt AS mt
      ON mamatnr = mtmatnr
      WHERE werks IN so_werks AND
      spart IN so_spart
      AND spras = 'EN'
    it_temp[] =  it_mchb[].
    SORT it_temp BY matnr.
    DELETE ADJACENT DUPLICATES FROM it_temp COMPARING matnr.
    LOOP AT it_temp INTO wa_temp.
       it_temp1[] = it_mchb[].
       DELETE it_temp1 WHERE matnr NE wa_temp-matnr.
       LOOP AT it_temp1 INTO wa_temp1.
         SUM.
         EXIT.
       ENDLOOP.
       wa_final-matnr = wa_temp1-matnr.
       wa_final-charg = wa_temp1-charg.
       wa_final-maktx = wa_temp1-maktx.
       wa_final-clabs = wa_temp1-clabs.
       wa_final-werks = wa_temp1-werks.
       wa_final-spart = wa_temp1-spart.
       APPEND wa_final TO it_final.
    ENDLOOP.
      SORT it_mchb BY matnr.
      LOOP AT it_mchb INTO wa_mchb.
        ON CHANGE OF wa_mchb-matnr.
          IF wa_final-matnr IS NOT INITIAL.
            SELECT SINGLE * FROM mbew WHERE matnr = wa_final-matnr
            AND bwkey = wa_final-werks.
            IF mbew-vprsv =  'V'.
              wa_final-value = mbew-verpr.
            ELSEIF mbew-vprsv =  'S'.
              wa_final-value = mbew-stprs.
            ENDIF.
            wa_final-total = wa_final-value * wa_final-clabs.
            APPEND wa_final TO it_final.
            CLEAR wa_final.
          ENDIF.
        ENDON.
        wa_final-clabs = wa_mchb-clabs + wa_final-clabs .
        wa_final-matnr = wa_mchb-matnr.
        wa_final-werks = wa_mchb-werks.
        wa_final-charg = wa_mchb-charg.
        wa_final-maktx = wa_mchb-maktx.
      ENDLOOP.
      IF it_final IS INITIAL.
        MESSAGE text-010 TYPE 'I'.
      ELSE.
        PERFORM fieldcat.
        PERFORM display_data.
      ENDIF.
    LOOP AT it_mchb INTO  wa_mchb.
       WRITE : / , wa_mchb-matnr  , wa_mchb-charg , wa_mchb-maktx , wa_mchb-clabs , wa_mchb-werks , wa_mchb-spart .
    ENDLOOP.
    WRITE : / , 'Jaya'.
    LOOP AT it_final INTO  wa_final.
       WRITE : / , wa_final-matnr  , wa_final-charg , wa_final-maktx , wa_final-clabs , wa_final-werks , wa_final-spart .
    ENDLOOP.
    *GET XX.
    *END-OF-SELECTION.
          E N D       O F   S E L E C T I O N                           *
          At line selection                                             *
    *AT LINE-SELECTION.
          User Command Processing                                       *
    *AT USER-COMMAND.
          Top Of Page                                                   *
    *TOP-OF-PAGE.
          End Of Page                                                   *
    *END-OF-PAGE.
    FORM eventtab_build USING rt_events TYPE slis_t_event.
    *"Registration of events to happen during list display
      DATA: ls_event TYPE slis_alv_event.
    to get the events
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
        EXPORTING
          i_list_type = 0
        IMPORTING
          et_events   = rt_events.
      READ TABLE rt_events INTO ls_event WITH KEY name = slis_ev_top_of_page
      IF sy-subrc = 0.
        ls_event-form = slis_ev_top_of_page.
        MODIFY  rt_events FROM  ls_event TRANSPORTING form WHERE
        name = ls_event-form.
      ENDIF.
      READ TABLE rt_events INTO ls_event WITH KEY name = 'USER_COMMAND'.
      IF sy-subrc EQ 0.
        ls_event-form = 'USER_COMMAND'.
        MODIFY rt_events FROM ls_event TRANSPORTING form WHERE name = ls_event-name.
      ENDIF.
    ENDFORM.                    "eventtab_build
    *&      Form  fieldcat
    FORM fieldcat .
      CLEAR  wa_fieldcat.
      wa_fieldcat-fieldname = 'MATNR'.
      wa_fieldcat-seltext_m   = text-002 .
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR  wa_fieldcat.
      wa_fieldcat-fieldname = 'MAKTX'.
      wa_fieldcat-seltext_m   = text-003 .
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR  wa_fieldcat.
      wa_fieldcat-fieldname = 'CLABS'.
      wa_fieldcat-seltext_m   = text-004 .
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR  wa_fieldcat.
      wa_fieldcat-fieldname = 'VALUE'.
      wa_fieldcat-seltext_m   = text-006 .
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR  wa_fieldcat.
      wa_fieldcat-fieldname = 'TOTAL'.
      wa_fieldcat-seltext_m   = text-007 .
      APPEND wa_fieldcat TO it_fieldcat.
    ENDFORM.                    "fieldcat
    *&      Form  display_data
    FORM display_data .
      PERFORM comment_build USING gt_list_top_of_page[].
      wa_layout-info_fieldname = 'LINE_COLOR'. " Line Color
      wa_print-no_coverpage = 'X'.
      wa_print-no_print_listinfos = 'X'.  " Remove the default first page.
    to get thr grid display
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program      = sy-repid
         i_background_id         = 'ALV_BACKGROUND'
         i_callback_top_of_page  = 'TOP_OF_PAGE'
          i_callback_user_command = 'USER_COMMAND'
         is_layout               = wa_layout
          it_fieldcat             = it_fieldcat
         i_default               = 'X'
          i_save                  = 'A'
          it_events               = it_event[]
         is_print                = wa_print
        TABLES
          t_outtab                = it_final
        EXCEPTIONS
          program_error           = 1
          OTHERS                  = 2.
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    " eventtab_build
    *&      Form  comment_build
    FORM comment_build USING lt_top_of_page TYPE  slis_t_listheader.
      DATA: ls_line TYPE slis_listheader.
      CLEAR ls_line.
      ls_line-typ  = 'H'.
    to get the company text
      DATA w_name(50) TYPE c.
      ls_line-info = text-005 .
      APPEND ls_line TO lt_top_of_page.
      CLEAR ls_line.
      ls_line-typ  = 'S'.
      ls_line-info = ''.
      APPEND ls_line TO lt_top_of_page.
    ENDFORM.                    "comment_build
    *&      Form  top_of_page
         to print at top of page
    FORM top_of_page.
    to pass the comment bulid for the top of page into the alv
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          it_list_commentary = gt_list_top_of_page.
    ENDFORM.                    "top_of_page
    *&      Form  USER_COMMAND
          text
         -->R_UCOMM    text
         -->RS_SELFIELDtext
    FORM user_command USING r_ucomm LIKE sy-ucomm
    rs_selfield TYPE slis_selfield.
      CASE r_ucomm.
        WHEN '&IC1'.
         MESSAGE 'jj' TYPE 'I'.
          READ TABLE it_final INTO wa_final INDEX rs_selfield-tabindex.
          PERFORM build_fieldcatlog.
          PERFORM event_call USING it_event[].
         PERFORM POPULATE_EVENT_EKPO.
          PERFORM data_retrieval.
          PERFORM build_listheader USING it_listheader.
          PERFORM DISPLAY_ALV.
      ENDCASE.
    ENDFORM.                    "user_command
    *&      Form  BUILD_FIELDCATLOG
          text
    FORM build_fieldcatlog.
    clear it_fieldcat1[].
      CLEAR  wa_fieldcat.
      wa_fieldcat-fieldname = 'MATNR'.
      wa_fieldcat-seltext_m   = text-002 .
      APPEND wa_fieldcat TO it_fieldcat1.
      CLEAR  wa_fieldcat.
      wa_fieldcat-fieldname = 'MAKTX'.
      wa_fieldcat-seltext_m   = text-003 .
      APPEND wa_fieldcat TO it_fieldcat1.
      CLEAR  wa_fieldcat.
      wa_fieldcat-fieldname = 'CHARG'.
      wa_fieldcat-seltext_m   = text-003 .
      APPEND wa_fieldcat TO it_fieldcat1.
      CLEAR  wa_fieldcat.
      wa_fieldcat-fieldname = 'CLABS'.
      wa_fieldcat-seltext_m   = text-004 .
      APPEND wa_fieldcat TO it_fieldcat1.
    ENDFORM.                    "BUILD_FIELDCATLOG
    *&      Form  EVENT_CALL
          text
         -->RT_EVENTS  text
    FORM event_call USING rt_events TYPE slis_t_event.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
       EXPORTING
         i_list_type           = 0
       IMPORTING
         et_events             = rt_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  DATA_RETRIEVAL
          text
    FORM data_retrieval.
      it_temp[] = it_mchb[].
      DELETE it_temp WHERE matnr NE wa_final-matnr.
    ENDFORM.                    "DATA_RETRIEVAL
    *&      Form  BUILD_LISTHEADER
          text
         -->I_LISTHEADEtext
    FORM build_listheader USING i_listheader TYPE slis_t_listheader.
      DATA: hline1 TYPE slis_listheader.
      hline1-typ = 'H'.
      hline1-info = 'CHECKING PGM'.
    ENDFORM.                    "BUILD_LISTHEADER
    FORM DISPLAY_ALV.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      I_INTERFACE_CHECK                 = ' '
      I_BYPASSING_BUFFER                = ' '
      I_BUFFER_ACTIVE                   = ' '
      I_CALLBACK_PROGRAM                = sy-REPID
      I_CALLBACK_PF_STATUS_SET          = ' '
      I_CALLBACK_USER_COMMAND           = '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                      = TITLE_EKPO
      I_GRID_SETTINGS                   =
      IS_LAYOUT                         =
       IT_FIELDCAT                       = It_FIELDCAT1[]
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
      IT_SORT                           =
      IT_FILTER                         =
      IS_SEL_HIDE                       =
      I_DEFAULT                         =
      I_SAVE                            = 'A'
      IS_VARIANT                        =
       IT_EVENTS                         = it_EVENTS[]
      TABLES
        T_OUTTAB                          = IT_temp[]
    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.

Maybe you are looking for