ALV Grid - Alignment Issues in TOP OF PAGE.

Hi,
We have a requirement to right align text in the report header.
We are using REUSE ALV GRID DISPLAY, but using TOP-OF-PAGE event - the whole text is left aligned.
I tried using Class CL_DD_DOCUMENT which solved the alignment issue, but I am not able to see the header while printing/downloading to excel.
I want the header to be available while downloading/printing the list. Any suggestions?
Thanks in advance,
Harveen.

Hi
The ALV download only the grid into the file, so not the data you're writing in TOP_OF_PAGE event.
If you need to do that, you should create an your own buttom to download the file.
Max

Similar Messages

  • ALV print issue in top-of-page

    Hi,
    I have developed a alv report using REUSE_ALV_GRID_DISPLAY function module. I am using top-of-page event in events table to output top-of-page details. It is showing output correctly on screen but when I do a print preview, it is showing only the grid details and no header info from top-of-page. Please advise what can be the issue? I might be missing some parameter somewhere..I am creating my field catalog manually w/o reference to a structure or internal table..can this be a issue..
    Thanks in advance

    Have you passed the program name in parameter I_CALLBACK_PROGRAM
    DATA:f_repid TYPE sy-repid.
    f_repid = sy-repid.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
         i_callback_program      = f_repid  "  Program name

  • Issue with top of page event

    Hi All,
         In my Report i am printing both interactive and alv grid display in same report.means i have one check box it is then report print as a alv format otherwise classical format.
        But here i have small problem  i am trying  print in alv format its automatically trigger the top of page event thatsway a blank screen is generated so please tell how to skip the Top of page event.
    Regards,
    Venkatesh

    END-OF-SELECTION.
      SORT tab1 BY ebeln ebelp.
      DESCRIBE TABLE tab1 LINES tabln.
      IF tabln = 0.
        MESSAGE ID 'ME' TYPE 'I' NUMBER '260'.
        EXIT.
      ENDIF.
      SORT tab1 BY sortkey knttp ebeln ebelp.
    if P_ALV = 'X'.
      LOOP AT tab1.
        IF tab1-knttp = '1'.
              gs_final-str = text-k01.
              gs_final-kont1 = tab1-kont1.
              gs_final-kont2 = tab1-kont2.
          ELSEIF tab1-knttp = '2'.
              gs_final-str = text-k02.
              gs_final-kont1 = tab1-kont1.
              gs_final-kont2 = tab1-kont2.
          ELSEIF tab1-knttp = '3'.
           gs_final-str = text-k03.
              gs_final-kont1 = tab1-kont1.
              gs_final-kont2 = tab1-kont2.
          ELSEIF tab1-knttp = '4'.
              gs_final-str = text-k04.
              gs_final-kont1 = tab1-kont1.
              gs_final-kont2 = tab1-kont2.
          ELSEIF tab1-knttp = '5'.
              gs_final-str = text-k05.
              gs_final-kont1 = tab1-kont1.
              gs_final-kont2 = tab1-kont2.
          ELSEIF tab1-knttp = '6'.
              gs_final-str = text-k04.
              gs_final-kont1 = tab1-kont1.
          ELSEIF tab1-knttp IS INITIAL.
            gs_final-str = 'Stock without Account Assignment'.
          ENDIF.
           gs_final-ebeln = tab1-ebeln.
           gs_final-lifnr = tab1-lifnr.
           gs_final-name1 = tab1-name1.
           gs_final-aedat = tab1-aedat.
           gs_final-udate = tab1-udate.
           gs_final-inco1 = tab1-inco1.
           gs_final-inco2 = tab1-inco2.
           gs_final-ebelp = tab1-ebelp.
           gs_final-matnr = tab1-matnr.
           gs_final-txz01 = tab1-txz01.
           gs_final-paedt = tab1-paedt.
           gs_final-eindt = tab1-eindt.
           gs_final-eindt1 = tab1-eindt1.
           gs_final-labnr = tab1-labnr.                  "NWC-29042005
           gs_final-budat = tab1-budat.
           gs_final-menge = tab1-menge.
           gs_final-wemng = tab1-wemng.
           gs_final-meins = tab1-meins.
           gs_final-vbeln = tab1-vbeln.
           gs_final-tddat = tab1-tddat.
         IF NOT tab1-vbeln IS INITIAL.
          FORMAT COLOR 4 INTENSIFIED OFF.
          WRITE:/3 wa_tab1-vbeln.
          READ TABLE lines INDEX 1.
          MOVE lines-tdline TO l_text.
          CLEAR lines.
          READ TABLE lines INDEX 2.
          CONCATENATE l_text lines-tdline INTO l_text SEPARATED BY ' '.
          FORMAT COLOR 5 INTENSIFIED OFF.
          gs_final-l_text = l_text.
          SKIP.                                  "NWC-16092003
        ENDAT.
        APPEND gs_final to gt_final.
      ENDLOOP.
      PERFORM maintain_fieldcatlog.
      PERFORM Display_data.
    ELSE.
      LOOP AT tab1.
        MOVE tab1 TO wa_tab1.
        AT NEW kont1.
          RESERVE 5 LINES.
          FORMAT COLOR 3 INTENSIFIED.
          IF tab1-knttp = '1'.
            WRITE:/(20) text-k01, 20 ':  ', 22(30) tab1-kont1 NO-ZERO,
                                            60(74) tab1-kont2.
          ELSEIF tab1-knttp = '2'.
            WRITE:/(20) text-k02, 20 ':  ', 22(30) tab1-kont1 NO-ZERO,
                                            60(74) tab1-kont2.
          ELSEIF tab1-knttp = '3'.
            WRITE:/(20) text-k03, 20 ':  ', 22(30) tab1-kont1 NO-ZERO,
                                            60(74) tab1-kont2.
          ELSEIF tab1-knttp = '4'.
            WRITE:/(20) text-k04, 20 ':  ', 22(30) tab1-kont1 NO-ZERO,
                                            60(74) tab1-kont2.
          ELSEIF tab1-knttp = '5'.
            WRITE:/(20) text-k05, 20 ':  ', 22(30) tab1-kont1 NO-ZERO,
                                            60(74) tab1-kont2.
          ELSEIF tab1-knttp = '6'.
            WRITE:/(20) text-k04, 20 ':  ', 22(30) wa_tab1-kont1 NO-ZERO,
                    60  text-k02, 75 ':  ', 77(57) wa_tab1-kont2 NO-ZERO.
          ELSEIF tab1-knttp IS INITIAL.
            WRITE:/ 'Stock without Account Assignment'.
          ENDIF.
          WRITE 170 ' '.
          FORMAT COLOR INTENSIFIED OFF.
        ENDAT.
        AT NEW ebeln.
          RESERVE 4 LINES.
          FORMAT COLOR 1 INTENSIFIED OFF.
          WRITE:/ wa_tab1-ebeln,
                11 '  ',
                13 wa_tab1-lifnr,
                23 wa_tab1-name1,
                60 wa_tab1-aedat NO-ZERO,
                73 wa_tab1-udate NO-ZERO,
                86 wa_tab1-inco1,
                91(37) wa_tab1-inco2,
               170 ' '.
        ENDAT.
        AT NEW ebelp.
          RESERVE 3 LINES.
          FORMAT COLOR 2 INTENSIFIED OFF.
          WRITE:/2 wa_tab1-ebelp,
                 9 wa_tab1-matnr,
                30(40) wa_tab1-txz01,
                73(10) wa_tab1-paedt,
                84(10) wa_tab1-eindt,
                95(10) wa_tab1-eindt1 NO-ZERO,
                106(15) wa_tab1-labnr,                  "NWC-29042005
                122(10) wa_tab1-budat NO-ZERO,
                133(16) wa_tab1-menge NO-ZERO,
                150(16) wa_tab1-wemng NO-ZERO,
                167(3)  wa_tab1-meins,
                170 ' '.
        ENDAT.
        HIDE: tab1-ebeln, tab1-ebelp.
        I
          READ TABLE lines INDEX 1.
          MOVE lines-tdline TO l_text.
          CLEAR lines.
          READ TABLE lines INDEX 2.
          CONCATENATE l_text lines-tdline INTO l_text SEPARATED BY ' '.
          FORMAT COLOR 5 INTENSIFIED OFF.
          WRITE: /3(132) l_text,
                  170 ' '.
          SKIP.                                  "NWC-16092003
        ENDAT.
      ENDLOOP.
    ENDIF.
    AT LINE-SELECTION.
      CHECK NOT tab1-ebeln IS INITIAL.
      SET PARAMETER ID 'BES' FIELD tab1-ebeln.
      CALL TRANSACTION 'ME23N' AND SKIP FIRST SCREEN.
      CLEAR tab1.
    TOP-OF-PAGE.
    if P_ALV ne 'X'.
      IF sy-pagno = 1.
        DETAIL.
        WRITE: /2 text-a01.
        RESERVE 1 LINES.
        SUMMARY.
        IF lifnr IS INITIAL.
          WRITE: /4 text-a02, 26 'All'.
        ELSE.
          LOOP AT lifnr WHERE sign = 'I'.
            IF lifnr-option = 'EQ'.
              WRITE : /4 text-a02, 26 lifnr-low.
            ELSE.
              WRITE: /4 text-a02, 26 'From', 32 lifnr-low,
                                   44 'to', 48 lifnr-high.
            ENDIF.
          ENDLOOP.
        ENDIF.
        IF matnr IS INITIAL.
          WRITE: /4 text-a14, 26 'All'.
        ELSE.
          LOOP AT matnr WHERE sign = 'I'.
            IF matnr-option = 'EQ'.
              WRITE : /4 text-a14, 26 matnr-low.
            ELSE.
              WRITE: /4 text-a14, 26 'From', 32 matnr-low,
                                   44 'to', 48 matnr-high.
            ENDIF.
          ENDLOOP.
        ENDIF.
        IF ebeln IS INITIAL.
          WRITE: /4 text-a03, 26 'All'.
        ELSE.
          LOOP AT ebeln WHERE sign = 'I'.
            IF ebeln-option = 'EQ'.
              WRITE : /4 text-a03, 26 ebeln-low.
            ELSE.
              WRITE: /4 text-a03, 26 'From', 32 ebeln-low,
                                   44 'to', 48 ebeln-high.
            ENDIF.
          ENDLOOP.
        ENDIF.
        IF aedat IS INITIAL.
          WRITE: /4 text-a04, 26 'All'.
        ELSE.
          LOOP AT aedat WHERE sign = 'I'.
            IF aedat-option = 'EQ'.
              WRITE : /4 text-a04, 26 aedat-low.
            ELSE.
              WRITE: /4 text-a04, 26 'From', 32 aedat-low,
                                   44 'to', 48 aedat-high.
            ENDIF.
          ENDLOOP.
        ENDIF.
        IF eindt IS INITIAL.
          WRITE: /4 text-a13, 26 'All'.
        ELSE.
          LOOP AT eindt WHERE sign = 'I'.
            IF eindt-option = 'EQ'.
              WRITE : /4 text-a13, 26 eindt-low.
            ELSE.
              WRITE: /4 text-a13, 26 'From', 32 eindt-low,
                                   44 'to', 48 eindt-high.
            ENDIF.
          ENDLOOP.
        ENDIF.
        IF bednr IS INITIAL.
          WRITE: /4 text-a15, 26 'All'.
        ELSE.
          LOOP AT bednr WHERE sign = 'I'.
            IF bednr-option = 'EQ'.
              WRITE : /4 text-a15, 26 bednr-low.
            ELSE.
              WRITE: /4 text-a15, 26 'From', 32 bednr-low,
                                   44 'to', 48 bednr-high.
            ENDIF.
          ENDLOOP.
        ENDIF.
        linno = sy-linno + 1.
        BACK.
        IF ekorg IS INITIAL.
          WRITE: /70 text-a11, 92 'All'.
        ELSE.
          LOOP AT ekorg WHERE sign = 'I'.
            IF ekorg-option = 'EQ'.
              WRITE : /70 text-a11, 92 ekorg-low.
            ELSE.
              WRITE: /70 text-a11, 92 'From', 98 ekorg-low,
                                   104 'to', 108 ekorg-high.
            ENDIF.
          ENDLOOP.
        ENDIF.
        IF ekgrp IS INITIAL.
          WRITE: /70 text-a12, 92 'All'.
        ELSE.
          LOOP AT ekgrp WHERE sign = 'I'.
            IF ekgrp-option = 'EQ'.
              WRITE : /70 text-a12, 92 ekgrp-low.
            ELSE.
              WRITE: /70 text-a12, 92 'From', 98 ekgrp-low,
                                   104 'to', 108 ekgrp-high.
            ENDIF.
          ENDLOOP.
        ENDIF.
        IF werks IS INITIAL.
          WRITE: /70 text-a05, 92 'All'.
        ELSE.
          LOOP AT werks WHERE sign = 'I'.
            IF werks-option = 'EQ'.
              WRITE : /70 text-a05, 92 werks-low.
            ELSE.
              WRITE: /70 text-a05, 92 'From', 98 werks-low,
                                   104 'to', 108 werks-high.
            ENDIF.
          ENDLOOP.
        ENDIF.
        IF pspid IS INITIAL.
          WRITE: /70 text-a06, 92 'All'.
        ELSE.
          LOOP AT pspid WHERE sign = 'I'.
            WRITE:/70 text-a06, 92 pspid-low.
          ENDLOOP.
        ENDIF.
        IF pspnr1 IS INITIAL.
          WRITE: /70 text-a07, 92 'All'.
        ELSE.
          LOOP AT pspnr1 WHERE sign = 'I'.
            WRITE:/70 text-a07, 92 pspnr1-low.
          ENDLOOP.
        ENDIF.
        IF elikz EQ 'X'.
          WRITE: /70 text-a08, 92 'Open PO only'.
        ELSEIF elikz IS INITIAL.
          WRITE: /70 text-a08, 92 'All PO'.
        ENDIF.
        IF stock EQ 'X'.
          WRITE: ', Common Stock Items'.
        ELSEIF pspnr IS INITIAL.
          WRITE: ', All Stock'.
        ENDIF.
        IF sy-linno >= linno.
          linno = sy-linno + 1.
        ENDIF.
        SKIP TO LINE linno.
        ULINE.
    ENDIF.
      FORMAT COLOR 1 INTENSIFIED OFF.
      WRITE:/ 'PO',
            12 'Vendor no.',
            25 'Company',
            60 'PO Crt dt',
            73 'Approved dt',
            86 'Incoterm',
           170 ' '.
      FORMAT COLOR 2 INTENSIFIED OFF.
      WRITE:/2 'Item',
             9 'Material',
            30 'Description',
            73 'Chged date',
            84 'Delv date',
            95 'OA date',
           106 'OA Number',                              "NWC-29042005
           122 'GR date',
           138 'Order Qty',
           158 'GR Qty',
           167 'UoM',
           170 ' '.
      FORMAT COLOR 4 INTENSIFIED OFF.
      WRITE:/2 'Ship notf #',
             15 'ETD.',
             26 'ETA',
             44 'Shipped Qty',
             57 'UoM',
            170 ' '.
      FORMAT COLOR 5 INTENSIFIED OFF.
      WRITE:/2 'Remarks',
           170 ' '.
      ULINE.
    ENDIF.
    form MAINTAIN_FIELDCATLOG .
    REFRESH gt_fieldcat.
    CLEAR gs_fieldcat.
    PERFORM fill_fieldcatlog USING:
            '01' '01' 'STR' 'GT_FINAL' 'Account Assignment',
            '01' '02' 'KONT1' 'GT_FINAL' 'Kont1',
            '01' '03' 'KONT2' 'GT_FINAL' 'Kont2',
            '01' '04' 'EBELN' 'GT_FINAL' 'PO',
            '01' '05' 'LIFNR' 'GT_FINAL' 'Vendor no',
            '01' '06' 'NAME1' 'GT_FINAL' 'Company',
            '01' '07' 'AEDAT' 'GT_FINAL' 'PO Crt dt',
            '01' '08' 'UDATE' 'GT_FINAL' 'Approved dt' ,
            '01' '09' 'INCO1' 'GT_FINAL' 'Incoterm Code',
            '01' '10' 'INCO2' 'GT_FINAL' 'Incoterm Text',
            '01' '11' 'EBELP' 'GT_FINAL' 'Item',
            '01' '12' 'MATNR' 'GT_FINAL' 'Material',
            '01' '13' 'TXZ01' 'GT_FINAL' 'Description',
            '01' '14' 'PAEDT' 'GT_FINAL' 'Chged date',
            '01' '15' 'EINDT' 'GT_FINAL' 'Delv date',
            '01' '16' 'EINDT1' 'GT_FINAL' 'OA date',
            '01' '17' 'LABNR' 'GT_FINAL' 'OA Number',
            '01' '18' 'BUDAT' 'GT_FINAL' 'GR date',
            '01' '19' 'MENGE' 'GT_FINAL' 'Order Qty',
            '01' '20' 'WEMNG' 'GT_FINAL' 'GR Qty',
            '01' '21' 'MEINS' 'GT_FINAL' 'UoM',
            '01' '22' 'VBELN' 'GT_FINAL' 'Ship notf #',
            '01' '23' 'TDDAT' 'GT_FINAL' 'ETD',
            '01' '24' 'LFDAT' 'GT_FINAL' 'ETA',
            '01' '25' 'LFIMG' 'GT_FINAL' 'Shipped Qty',
            '01' '26' 'VRKME' 'GT_FINAL' 'UoM',
            '01' '27' 'L_TEXT' 'GT_FINAL' 'Remarks'.
    endform.                    " MAINTAIN_FIELDCATLOG
    form FILL_FIELDCATLOG  using   lv_rowpos    TYPE sycurow
                                   lv_colpos    TYPE sycucol
                                   lv_fldnam    TYPE fieldname
                                   lv_tabnam    TYPE tabname
                                   lv_seltext   TYPE dd03p-scrtext_l.
      gs_fieldcat-row_pos   = lv_rowpos.
      gs_fieldcat-col_pos   = lv_colpos.
      gs_fieldcat-fieldname = lv_fldnam.
      gs_fieldcat-tabname   = lv_tabnam.
      gs_fieldcat-seltext_l = lv_seltext.
      APPEND gs_fieldcat TO gt_fieldcat.
      CLEAR gs_fieldcat.
    endform.                    " FILL_FIELDCATLOG
    form DISPLAY_DATA .
    DATA : lv_repid TYPE syrepid.
      lv_repid = sy-repid.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
         i_callback_program                = lv_repid
         it_fieldcat                       = gt_fieldcat
        TABLES
         t_outtab                          = gt_final
       EXCEPTIONS
         program_error                     = 1
         OTHERS                            = 2.
      IF sy-subrc <> 0.                              "#EC NEEDED
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    endform.                    " DISPLAY_DATA

  • ALV Grid -- Heading in each and every page while printing

    Hello!!!!
    How to display heading in ALV Grid in each and every page while printing?
    Thanks in Advance!!!!!!

    Hi nitesh,
    <b>data: lt_list_commentary type slis_t_listheader.
    perform build_comment using
    lt_list_commentary.
    form build_comment using
    pt_list_commentary type slis_t_listheader.
    data: ls_line type slis_listheader.
    clear ls_line.
    ls_line-typ = 'H'.
    ls_line-info = 'SREEKANTH REDDY'.
    append ls_line to pt_list_commentary.
    clear ls_line.
    ls_line-typ = 'H'.
    ls_line-info = 'HEADER1'.
    append ls_line to pt_list_commentary.
    clear ls_line.
    ls_line-typ = 'H'.
    ls_line-info = 'HEADER2TEXT'.
    append ls_line to pt_list_commentary.
    clear ls_line.
    endform.
    </b>In Function module REUSE_ALV_COMMENTARY_WRITE , give the parameter as
    <b>it_list_commentary = lt_list_commentary </b>
    Here ls_line-typ = 'H'. you can use options like 'H' , 'A' , 'S'.

  • Two  ALV Grid Display  format on the Single page

    Hi guru's
    I have two plant details. I want to be  display these two plant details in the single page with ALV Grid display format.. like
    plant no 1(Details):
    xxxx  xxxx xxxx xxxx with ALV Grid Display format
    plant no 2 (Details):
    xxx  xxxx xxxx xxxx ALV Grid Display format
    Can any body help on the .. if you have sample code pls paste.
    Thanks in Advance
    Surendra

    hi,
    Grid display is not possible but u can display two list on same page by Block ALV....
    TYPE-POOLS : slis.
    TABLES : mara,
             makt.
    SELECT-OPTIONS : mat FOR mara-matnr.
    DATA : BEGIN OF itab OCCURS 0,
            matnr LIKE mara-matnr,
            maktx LIKE makt-maktx,
            matkl LIKE mara-matkl,
            mtart LIKE mara-mtart,
           END OF itab.
    DATA : BEGIN OF itab1 OCCURS 0,
            mtart LIKE mara-mtart,
            count TYPE i,
           END OF itab1.
    DATA : BEGIN OF itab1_col OCCURS 0,
            mtart LIKE mara-mtart,
            count TYPE i,
           END OF itab1_col.
    DATA : t_fcat1 TYPE slis_t_fieldcat_alv,
           t_fcat2 TYPE slis_t_fieldcat_alv,
           wa_fcat TYPE slis_fieldcat_alv,
           t_eve TYPE slis_t_event,
           wa_eve TYPE slis_alv_event,
           t_layout TYPE slis_layout_alv.
    DATA : v_repid LIKE sy-repid,
           t_mat LIKE mara-matnr.
    DEFINE create_fcat.
      clear wa_fcat.
      wa_fcat-fieldname = &1.
      wa_fcat-seltext_l = &2.
      wa_fcat-outputlen = &3.
      append wa_fcat to t_fcat1.
    END-OF-DEFINITION.
    START-OF-SELECTION.
      PERFORM get_data.
      PERFORM dis_data.
    *&      Form  get_data
          text
    FORM get_data.
      SELECT amatnr bmaktx amtart amatkl INTO CORRESPONDING FIELDS OF TABLE itab
      FROM mara AS a INNER JOIN makt AS b ON
      amatnr = bmatnr
      WHERE a~matnr IN mat.
      LOOP AT itab.
        itab1-mtart = itab-mtart.
        itab1-count = 1.
        APPEND itab1.
      ENDLOOP.
      SORT itab1 BY mtart.
      LOOP AT itab1.
        MOVE-CORRESPONDING itab1 TO itab1_col.
        COLLECT itab1_col.
      ENDLOOP.
    ENDFORM.                    "get_data
    *&      Form  dis_data
          text
    FORM dis_data.
      v_repid = sy-repid.
      CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
        EXPORTING
          i_callback_program      = v_repid.
      REFRESH t_fcat1.
      CLEAR t_fcat1.
      REFRESH t_eve.
      wa_eve-name = 'TOP_OF_PAGE'.
      wa_eve-form = 'TOP_OF_PAGE1'.
      APPEND wa_eve TO t_eve.
      create_fcat:
      'MATNR' 'Material' '10',
      'MAKTX' 'Material Description' '40',
      'MTART' 'Type' '10',
      'MATKL' 'Group' '10'.
      CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
        EXPORTING
          is_layout   = t_layout
          it_fieldcat = t_fcat1
          i_tabname   = 'ITAB'
          it_events   = t_eve
        TABLES
          t_outtab    = itab.
      REFRESH t_fcat1.
      CLEAR t_fcat1.
      REFRESH t_eve.
      wa_eve-name = 'TOP_OF_PAGE'.
      wa_eve-form = 'TOP_OF_PAGE2'.
      APPEND wa_eve TO t_eve.
      create_fcat:
      'MTART' 'Type' '10',
      'COUNT' 'Total' '5'.
      CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
        EXPORTING
          is_layout   = t_layout
          it_fieldcat = t_fcat1
          i_tabname   = 'ITAB1_COL'
          it_events   = t_eve
        TABLES
          t_outtab    = itab1_col.
      CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'.
    ENDFORM.                    "dis_data
    *&      Form  top_of_page1
          text
    FORM top_of_page1.
      FORMAT COLOR COL_POSITIVE.
      WRITE:/ 'First Block'.
      FORMAT COLOR OFF.
    ENDFORM.                    "top_of_page
    *&      Form  top_of_page2
          text
    FORM top_of_page2.
      FORMAT COLOR COL_NEGATIVE.
      WRITE /5 'Second Block'.
      FORMAT COLOR OFF.
    ENDFORM.                    "top_of_page
    reward if usefull....

  • ALV Grid alignment

    Hi,
    I have an alv grid , which gives the output in an aligned format on execution .
    If the same program is executed in background and printed on spool , the columns get misaligned . How can i align them with their columne headings ?
    Thanks

    Check these thread -
    ALV Grid At Background
    ALV GRID CONTROL + BACKGROUND JOB
    Also, check the forum there is a blog also on displaying the ALV Grid in background with lots of good information on it.
    Regards,
    Amit

  • ALV grid display issue from radio buttons

    Hello,
    I have a radio button group in a selection screen. On select of the first radio button, I display an ALV grid below the radio button group.
    On selecting the next one, I want the grid to disappear which isn't happening currently.
    Please help.
    Thanks and Regards,
    Abhijnan

    Please check if this is what you needed or something else
    DATA: obj TYPE REF TO cl_gui_alv_grid,
          repid TYPE sy-repid,
          entered TYPE c,
          lv_structure TYPE tabname,
          dock TYPE REF TO cl_gui_docking_container,
          i_mara TYPE TABLE OF mara,
          i_marc TYPE TABLE OF marc.
    FIELD-SYMBOLS:<fs_tab> TYPE table.
    PARAMETERS: p_matnr TYPE matnr.
    PARAMETERS: p_mara RADIOBUTTON GROUP a USER-COMMAND abc.
    PARAMETERS: p_marc RADIOBUTTON GROUP a.
    AT SELECTION-SCREEN OUTPUT.
      CHECK NOT p_matnr IS INITIAL.
      IMPORT entered from memory id 'E'.
      CHECK NOT entered IS INITIAL.
      CHECK dock IS INITIAL.
      repid = sy-repid.
      CREATE OBJECT dock
           EXPORTING
             repid = repid
             dynnr = sy-dynnr
             ratio = 80
             side  = cl_gui_docking_container=>dock_at_bottom
             name  = 'DOCK_CONT'.
      CHECK  obj IS INITIAL.
      CREATE OBJECT obj
      EXPORTING
      i_parent          =  dock.
      IF p_mara = 'X'.
        IMPORT i_mara FROM MEMORY ID 'IMARA'.
        FREE MEMORY ID 'IMARA'.
        lv_structure = 'MARA'.
        ASSIGN i_mara TO <fs_tab>.
      ELSE.
        IMPORT i_marc FROM MEMORY ID 'IMARC'.
        FREE MEMORY ID 'IMARC'.
        lv_structure = 'MARC'.
        ASSIGN i_marc TO <fs_tab>.
      ENDIF.
      CALL METHOD obj->set_table_for_first_display
      EXPORTING
      i_structure_name = lv_structure
      CHANGING
      it_outtab = <fs_tab>.
    START-OF-SELECTION.
      entered = 'X'.
      EXPORT entered TO memory ID 'E'.
      IF p_mara = 'X'.
        SELECT * FROM mara UP TO 100 ROWS INTO TABLE i_mara
                 WHERE matnr = p_matnr.
        EXPORT i_mara TO MEMORY ID 'IMARA'.
      ELSE.
        SELECT * FROM marc UP TO 100 ROWS INTO TABLE i_marc
               WHERE matnr = p_matnr.
        EXPORT i_marc TO MEMORY ID 'IMARC'.
      ENDIF.

  • ALV Grid - Resource Issue?

    Morning All
    I have a situation where I have a standard selection screen displaying an ALV grid.  The user can then double click a line to see a drill down ALV.  My error occurs if the user executes the program multiple times i.e. displaying the grid time and time again.  Eventually the session does not display the grid and on a subsequent attempt the session either crashes or locks.
    I am currently destroying the 2 containers used every time the user exits the relevant screens using call method gr_alvgrid-> free but to no avail.
    Has anyone else had similar problems?  I am on a 46B machine running on NT4 (yes I know I'm in the dark ages!)
    Cheers
    Ian

    Hi,
    Have you did something like that before creating event receiver?
    IF cl_gui_alv_grid=>offline( ) IS INITIAL.
    * Create the event reciever
        IF o_eventreceiver IS INITIAL.
          CREATE OBJECT o_eventreceiver.
        ENDIF.
      ENDIF.
    In PAI of the screen,just try this.
    module USER_COMMAND_9001 input.
      CASE sy-ucomm.
        WHEN 'EXIT' or  'CANC'.
          perform f9600_free_objects:
                   using o_Alvgrid 'ALV' text-E02,
                   using o_Dockingcontainer 'DOCKING'
                           TEXT-E01.
    * leave program.
          LEAVE PROGRAM.
        when 'BACK'.
          perform f9600_free_objects:
                   using o_Alvgrid 'ALV' text-E02,
                   using o_Dockingcontainer 'DOCKING'
                           TEXT-E01.
          set screen '0'.
          leave screen.
    * This leaves the program but you may need to re-call the
    * transaction to go back to the original screen
        when others.
      ENDCASE.
    endmodule.                 " USER_COMMAND_9001  INPUT
    FORM f9600_free_objects USING pobject
                        value(ptype)
                        value(ptext).
      DATA: l_objectalv TYPE REF TO cl_gui_alv_grid.
    * Need to type the field symbol or it does not work
      CASE ptype.
        WHEN 'ALV'.
          l_objectalv = pobject.
          IF NOT ( l_objectalv IS INITIAL ).
            CALL METHOD l_objectalv->free
              EXCEPTIONS
                cntl_error        = 1
               cntl_system_error = 2
                OTHERS            = 3.
            CLEAR: pobject, l_objectalv.
            PERFORM f9700_error_handle USING ptext.
          ENDIF.
        WHEN 'DOCKING'.
          DATA: lobjectdock TYPE REF TO cl_gui_docking_container.
          lobjectdock = pobject.
          IF NOT ( lobjectdock IS INITIAL ).
            CALL METHOD lobjectdock->free
              EXCEPTIONS
                cntl_error        = 1
               cntl_system_error = 2
                OTHERS            = 3.
            CLEAR: pobject, lobjectdock.
            PERFORM f9700_error_handle USING ptext.
          ENDIF.
        WHEN 'CONTAINER'.
          DATA: lobjectcontainer TYPE REF TO cl_gui_container.
          lobjectcontainer = pobject.
          IF NOT ( lobjectcontainer IS INITIAL ).
            CALL METHOD lobjectcontainer->free
              EXCEPTIONS
                cntl_error        = 1
               cntl_system_error = 2
                OTHERS            = 3.
            CLEAR: pobject, lobjectcontainer.
            PERFORM f9700_error_handle USING ptext.
          ENDIF.
        WHEN OTHERS.
          sy-subrc = 1.
          PERFORM f9700_error_handle USING
                                    text-e04.
      ENDCASE.
    ENDFORM.                    " f9600_free_objects
    FORM f9700_error_handle USING    value(ptext).
      IF sy-subrc NE 0.
    * add your handling, for example
        CALL FUNCTION 'POPUP_TO_INFORM'
             EXPORTING
                  titel = text-e03
                  txt2  = sy-subrc
                  txt1  = ptext.
      ENDIF.
    ENDFORM.                    " f9700_error_handle
    Message was edited by: Jayanthi Jayaraman

  • ALV grid output issue to excel

    Hi Experts
    I have an ALV report which I want to Download to Excel( I am using excel 2003).
    When I veiw the report it apperars ok. Their are around 90 columns in the Report
    But when I  export the alv I found that some columns  are on the next line.  Is there any way to resolve this issue
    I want to  export in excel without creating  new rows of columns .
    Thanks
    Vikrant

    Hi,
    please tell your abaper to move  90 fields to intenal table & have a look below code.
    Here my internal table is i_downfinal.
    DATA: FULLPATH      TYPE STRING,
           FILENAME         TYPE STRING,
           PATH             TYPE STRING,
            USER_ACTION      TYPE I.
       encoding         TYPE ABAP_ENCODING.
        CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_SAVE_DIALOG
          EXPORTING
            WINDOW_TITLE         = 'File Download'
            DEFAULT_FILE_NAME    = 'C:\TEMP\zpmcs.xls'
            WITH_ENCODING        = 'X'
          CHANGING
            FILENAME             = FILENAME
            PATH                 = PATH
            FULLPATH             = FULLPATH
            USER_ACTION          = USER_ACTION
         FILE_ENCODING        = encoding
          EXCEPTIONS
            CNTL_ERROR           = 1
            ERROR_NO_GUI         = 2
            NOT_SUPPORTED_BY_GUI = 3
            OTHERS               = 4.
        IF SY-SUBRC <> 0.
          EXIT.
        ENDIF.
        IF USER_ACTION <> CL_GUI_FRONTEND_SERVICES=>ACTION_OK.
          EXIT.
        ENDIF.
        CALL FUNCTION 'GUI_DOWNLOAD'
          EXPORTING
            FILENAME                = FULLPATH
            FILETYPE                = 'DAT'
          TABLES
            DATA_TAB                = I_DOWNFINAL
          EXCEPTIONS
            FILE_WRITE_ERROR        = 1
            NO_BATCH                = 2
            GUI_REFUSE_FILETRANSFER = 3
            INVALID_TYPE            = 4
            NO_AUTHORITY            = 5
            UNKNOWN_ERROR           = 6
            HEADER_NOT_ALLOWED      = 7
            SEPARATOR_NOT_ALLOWED   = 8
            FILESIZE_NOT_ALLOWED    = 9
            HEADER_TOO_LONG         = 10
            DP_ERROR_CREATE         = 11
            DP_ERROR_SEND           = 12
            DP_ERROR_WRITE          = 13
            UNKNOWN_DP_ERROR        = 14
            ACCESS_DENIED           = 15
            DP_OUT_OF_MEMORY        = 16
            DISK_FULL               = 17
            DP_TIMEOUT              = 18
            FILE_NOT_FOUND          = 19
            DATAPROVIDER_EXCEPTION  = 20
            CONTROL_FLUSH_ERROR     = 21
            OTHERS                  = 22.
        IF SY-SUBRC <> 0.
          MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                  WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.

  • ALV grid color issue

    Hi,
    I've to display a list in a Grid using FM'S, So that it should fullfill 3 requirements given below.
    1)Positive values should be in green color and negative values should be in red color. Similarly how to maintain various columns in various colors.
    2)For the first 2 values in the grid scroll bar shouldn't be enabled. That means we con't scroll through those 2 values.
    3)How to calculate subtotals.
    Thanks,
    G Sandeep

    example:
    REPORT  Z_ALV_CELL_COLOR.
    Macro definition
    DEFINE m_fieldcat.
      add 1 to ls_fieldcat-col_pos.
      ls_fieldcat-fieldname   = &1.
      ls_fieldcat-ref_tabname = &2.
      append ls_fieldcat to lt_fieldcat.
    END-OF-DEFINITION.
    TYPE-POOLS: slis.                      " ALV Global types
    SELECTION-SCREEN :
      SKIP, BEGIN OF LINE,COMMENT 5(27) v_1 FOR FIELD p_max.    "#EC NEEDED
    PARAMETERS p_max(2) TYPE n DEFAULT '30' OBLIGATORY.         "#EC *
    SELECTION-SCREEN END OF LINE.
    TYPES :
      BEGIN OF ty_data,
        vkorg TYPE vbak-vkorg,             " Sales organization
        kunnr TYPE vbak-kunnr,             " Sold-to party
        vbeln TYPE vbak-vbeln,             " Sales document
        netwr TYPE vbak-netwr,             " Net Value of the Sales Order
      END OF ty_data,
    Data displayed
      BEGIN OF ty_vbak,
        vkorg TYPE vbak-vkorg,             " Sales organization
        kunnr TYPE vbak-kunnr,             " Sold-to party
        vbeln TYPE vbak-vbeln,             " Sales document
        netwr TYPE vbak-netwr,             " Net Value of the Sales Order
        tabcolor TYPE lvc_t_scol,          " Cell Color
      END OF ty_vbak.
    DATA:
      gt_data TYPE TABLE OF ty_data,
    Data displayed
      gt_vbak TYPE TABLE OF ty_vbak.
    INITIALIZATION.
      v_1 = 'Maximum of records to read'.                       "#EC NOTEXT
    START-OF-SELECTION.
      PERFORM f_read_data.
      PERFORM f_fill_color.
      PERFORM f_display_data.
         Form  f_read_data_vbak
    FORM f_read_data.
      SELECT * INTO CORRESPONDING FIELDS OF TABLE gt_data
               FROM vbak UP TO p_max ROWS.
    ENDFORM.                               " F_READ_DATA
         Form  f_fill_color
    FORM f_fill_color.
      DATA :
        ls_data TYPE ty_data,
        ls_vbak TYPE ty_vbak.
      LOOP AT gt_data INTO ls_data.
        CLEAR ls_vbak.
        MOVE-CORRESPONDING ls_data TO ls_vbak.
        PERFORM f_modify_color USING 'NETWR' CHANGING ls_vbak.
        PERFORM f_modify_color USING 'VBELN' CHANGING ls_vbak.
      Fill gt_vbak
        APPEND ls_vbak TO gt_vbak.
      ENDLOOP.
    ENDFORM.                               " F_FILL_COLOR
         Form  F_modify_color
    FORM f_modify_color USING u_fieldname TYPE lvc_fname
                     CHANGING us_vbak     TYPE ty_vbak.
      DATA :
        l_rnd_value TYPE integer2,
        ls_tabcolor TYPE lvc_s_scol.
    Random value
      CALL FUNCTION 'RANDOM_I2'
           EXPORTING
                rnd_min   = 0
                rnd_max   = 3
           IMPORTING
                rnd_value = l_rnd_value.
      CLEAR ls_tabcolor.
      ls_tabcolor-fname = u_fieldname.
      CASE l_rnd_value.
        WHEN 0.
          ls_tabcolor-color-col = 1.       " Blue.
          ls_tabcolor-color-int = 0.
          ls_tabcolor-color-inv = 0.
        WHEN 1.
          ls_tabcolor-color-col = 3.       " Yellow.
          ls_tabcolor-color-int = 0.
          ls_tabcolor-color-inv = 0.
        WHEN 2.
          ls_tabcolor-color-col = 5.       " Green.
          ls_tabcolor-color-int = 0.
          ls_tabcolor-color-inv = 0.
        WHEN 3.
          ls_tabcolor-color-col = 6.       " Red.
          ls_tabcolor-color-int = 0.
          ls_tabcolor-color-inv = 0.
      ENDCASE.
      INSERT ls_tabcolor INTO TABLE us_vbak-tabcolor.
    ENDFORM.                               " F_MODIFY_COLOR
         Form  f_display_data
    FORM f_display_data.
      DATA:
        ls_layout   TYPE slis_layout_alv,
        ls_fieldcat TYPE slis_fieldcat_alv,
        lt_fieldcat TYPE slis_t_fieldcat_alv.
    Build the field catalog
      m_fieldcat 'VKORG' 'VBAK'.
      m_fieldcat 'KUNNR' 'VBAK'.
      m_fieldcat 'VBELN' 'VBAK'.
      m_fieldcat 'NETWR' 'VBAK'.
    Fill Layout
      ls_layout-coltab_fieldname  = 'TABCOLOR'.
    Display the list
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
           EXPORTING
                is_layout   = ls_layout
                it_fieldcat = lt_fieldcat
           TABLES
                t_outtab    = gt_vbak.
    ENDFORM.                               " F_DISPLAY_DATA

  • ALV Grid Totals Issue

    Hi,
    We are using REUSE_ALV_GRID_DISPLAY for diaplying grid . we want the totals to be displayed for some fields.
    but for percentage fields we want to calculate the values. How do we do this?

    Hi Asharaghu,
    FOR TOTAL:
    there is a property of fieldcatalog, that is do_sum.
    USE COED LIKE:
    PERFORM fieldcat USING:
    '1' 'KUNNR' 'I_MARD' 'CUSTOMER NO' ,
    '2' 'DMBTR' 'I_MARD' 'CURRENCY' ,
    FORM fieldcat USING value(p_0029)
    value(p_0030)
    value(p_0031)
    value(p_0032)
    wa_fieldcat-col_pos = p_0029.
    wa_fieldcat-fieldname = p_0030.
    wa_fieldcat-tabname = p_0031.
    wa_fieldcat-reptext = p_0032.
    wa_fieldcat-do_sum = 'X'.
    APPEND wa_fieldcat TO i_fieldcat.
    ENDFORM. " FIELDCAT
    Then pass i_fieldcat through REUSE_ALV_GRID_DISPLAY.
    in final output you will get the total of currency field.
    Hope this can solve your problems.
    Regards,
    Tutun

  • ALV Grid Column Issue

    Hellow Experts,
    i got the some code to genrate auto genrated column based on date my out put is as follow
    StudentID        Day00  Day01  Day02 ......Day31
       178           20     30      40          50     
    My Code  for genrate day is
    LOOP AT gt_cols INTO gs_col.
    TRY.
            CONCATENATE 'DATE' gs_col-date INTO g_col.      "Define Column name
            gr_column ?= gr_columns->get_column( g_col ).   "Get column
            CONCATENATE 'Day' gs_col-date+6(2) INTO g_txt.  "Define new label (Day01, .., Day31)
    gr_column->set_long_text( g_txt ).              "Set label long text
          CATCH cx_salv_not_found.                          "#EC NO_HANDLER
        ENDTRY.
    *      CATCH cx_salv_not_found.                          "#EC NO_HANDLER
    *    ENDTRY.
      ENDLOOP.
    My requirment is i dont need 'Day00' like follow
    StudentID         Day01  Day02 ......Day31
       178              30      40          50     
    PLz help me and Ammend my above code to remove Day00.Thanks

    LOOP AT gt_cols INTO gs_col.
    TRY.
         IF gs_col-date+6(2) NE '00'.      "Add this IF statement and see if it solves the problem
              CONCATENATE 'DATE' gs_col-date INTO g_col.      "Define Column name
              gr_column ?= gr_columns->get_column( g_col ).     "Get column
              CONCATENATE 'Day' gs_col-date+6(2) INTO g_txt.  "Define new label (Day01, .., Day31)
           gr_column->set_long_text( g_txt ).                           "Set label long text
         ENDIF.
          CATCH cx_salv_not_found.                          "#EC NO_HANDLER
        ENDTRY.
    *      CATCH cx_salv_not_found.                          "#EC NO_HANDLER
    *    ENDTRY.
      ENDLOOP.
    -- Aniruddha

  • ALV Grid Refresh Issue

    Hello!
        I am using the FM 'REUSE_ALV_GRID_DISPLAY' to display a report we have written. The report displays sales orders and when the user double-clicks on a line they are taken in VA02. I put in a change to have the report refresh after the user came back from VA02. I put in the code p_selfield-refresh = 'X' in the user_command section. This was working before and now it is not refreshing. I'm wondering if this has to do with a default layout we added after these changes were put in. I've done some google searches and I can find object-oriented code but my report is not setup that way so hopefully there is a solution for me!
    Thanks,
    Wendy

    If you set refresh subfield (and row/col_stable subfields if sort fields are not changed), then you should update the internal table record in your user_command form. You need to reload the data from database, but there may be a delay between leaving VA02 and actual update of database, you may try to lock the sales order to insure update task release the lock. (DO/ENQUEUE_EVVBAKE with WAIT/ENDDO and when/if successful DEQUEUE_EVVBAKE, if not successful after some tries, put a warning/status message)
    * init data
    CLEAR: lv_error,
    refresh lt_bdcmsg.
    * Read record
    READ TABLE gt_data INTO old_data
      INDEX rs_selfield-tabindex.
    CHECK sy-subrc EQ 0.
    * Call VA02
    SET PARAMETER ID 'AUN' FIELD old_data-vbeln.
    CALL transaction 'VA02' AND SKIP FIRST SCREEN
      MESSAGES into lt_bdcmsg.
    * Call successful ?
    LOOP AT lt_bdcmsgcoll INTO ls_bdcmsg WHERE msgtyp = 'E' OR msgtyp = 'S'.
      MESSAGE message ID ls_bdcmsg-msgid TYPE ls_bdcmsg-msgtyp
        NUMBER ls_bdcmsg-msgnr WITH ls_bdcmsg-msgv1. " 2 3 4
      IF ls_bdcmsg-msgtyp EQ 'E'.
        lv_error = 'X'.
        EXIT.
      ENDIF.
    ENDLOOP.
    CHECK lv_error IS INITIAL.
    * Is update ended
    DO 10 TIMES.
      CALL FUNCTION 'ENQUEUE_EVVBAKE'
           EXPORTING
                vbeln          = old_data-vbeln
                _wait          = 'X'
           EXCEPTIONS
                foreign_lock   = 1
                system_failure = 1
                OTHERS         = 1.
      IF sy-subrc EQ 0.
        CALL FUNCTION 'DEQUEUE_EVVBAKE'
             EXPORTING
                  vbeln  = old_data-vbeln
             EXCEPTIONS
                  OTHERS = 0.
        EXIT.
      ENDIF.
    ENDDO.
    * Reload
    new_data = old_data.
    SELECT SINGLE * FROM vbak INTO CORRESPONDING FIELDS OF new_data
      WHERE vbeln = l_sdata-vbeln. " more coding for other fields
    * Update internal table
    IF new_data NE old_data.
      MODIFY gt_data FROM new_data.
      rs_selfield-refresh = 'X'.
    ENDIF.
    Regards,
    Raymond

  • Error in top-of-page in ALV GRID

    Friwnds  i am trying out a simple alv grid display program with
    top of page .
    But the top-of-page is coming blank with no logo and text.
    Please help me .
    Below is the full program.
    REPORT  zalv_griddisplaypic.
    TYPE-POOLS : slis.
    DATA : itab TYPE STANDARD TABLE OF spfli,
           it_fcat TYPE slis_t_fieldcat_alv,
           wa_fcat TYPE slis_fieldcat_alv,
            drepid LIKE sy-repid.
    START-OF-SELECTION.
      SELECT carrid
             connid FROM spfli INTO corresponding fields of TABLE itab UP TO 10 ROWS.
    END-OF-SELECTION.
      wa_fcat-fieldname = 'CARRID'.
      wa_fcat-row_pos   = '1'.
      wa_fcat-col_pos = 1 .
      wa_fcat-emphasize = 'X'.
      wa_fcat-just = 'C'.
      wa_fcat-outputlen = 15.
      wa_fcat-seltext_m = 'CARRIER NO'.
      APPEND wa_fcat TO it_fcat.
      CLEAR wa_fcat.
      wa_fcat-fieldname = 'CONNID'.
      wa_fcat-row_pos   = '1'.
      wa_fcat-col_pos = 2 .
      wa_fcat-emphasize = 'X'.
      wa_fcat-just = 'C'.
      wa_fcat-outputlen = 20.
      wa_fcat-seltext_m = 'CONNECTION NO'.
      APPEND wa_fcat TO it_fcat.
      CLEAR wa_fcat.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
      I_INTERFACE_CHECK                 = ' '
      I_BYPASSING_BUFFER                = ' '
      I_BUFFER_ACTIVE                   = ' '
         i_callback_program                = drepid
      I_CALLBACK_PF_STATUS_SET          = ' '
      I_CALLBACK_USER_COMMAND           = ' '
         i_callback_top_of_page            = 'TOP-OF-PAGE1'
      I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
      I_CALLBACK_HTML_END_OF_LIST       = ' '
      I_STRUCTURE_NAME                  =
      I_BACKGROUND_ID                   = ' '
      I_GRID_TITLE                      = 'LOKESH'
      I_GRID_SETTINGS                   =
      IS_LAYOUT                         =
         it_fieldcat                       = it_fcat
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
      IT_SORT                           =
      IT_FILTER                         =
      IS_SEL_HIDE                       =
      I_DEFAULT                         = 'X'
      I_SAVE                            = ' '
      IS_VARIANT                        =
      IT_EVENTS                         =
      IT_EVENT_EXIT                     =
      IS_PRINT                          =
      IS_REPREP_ID                      =
      I_SCREEN_START_COLUMN             = 0
      I_SCREEN_START_LINE               = 0
      I_SCREEN_END_COLUMN               = 0
      I_SCREEN_END_LINE                 = 0
      I_HTML_HEIGHT_TOP                 = 0
      I_HTML_HEIGHT_END                 = 0
      IT_ALV_GRAPHICS                   =
      IT_HYPERLINK                      =
      IT_ADD_FIELDCAT                   =
      IT_EXCEPT_QINFO                   =
      IR_SALV_FULLSCREEN_ADAPTER        =
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER           =
      ES_EXIT_CAUSED_BY_USER            =
        TABLES
          t_outtab                          = itab.
    EXCEPTIONS
      PROGRAM_ERROR                     = 1
      OTHERS                            = 2
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    *&      Form  top-of-page1
          text
    FORM TOP-OF-PAGE1.
    data: header type slis_t_listheader,
          wa     type slis_listheader,
          v1 type char10.
    TITLE AREA
    wa-typ = 'S'.
    wa-info = 'ALV GRID DISPLAY'.
    append wa to header.
    clear wa.
      WRITE sy-datum TO v1 USING EDIT MASK '__/__/_____'.
      wa-typ = 'S'.
      wa-info = v1.
      wa-key = 'DATE :'.
      APPEND wa TO header.
      CLEAR wa.
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
      EXPORTING
        it_list_commentary       = header
       I_LOGO                   = 'ENJOYSAP_LOGO'
      I_END_OF_LIST_GRID       =
      I_ALV_FORM               =
    ENDFORM.                    "top-of-page1

    try to this code.........
    REPORT zalv_griddisplaypic.
    TYPE-POOLS : slis.
    DATA : itab TYPE STANDARD TABLE OF spfli,
    DATA  GT_HEADER  TYPE SLIS_T_LISTHEADER.
    it_fcat TYPE slis_t_fieldcat_alv,
    wa_fcat TYPE slis_fieldcat_alv,
    drepid LIKE sy-repid.
    START-OF-SELECTION.
    SELECT carrid
    connid FROM spfli INTO corresponding fields of TABLE itab UP TO 10 ROWS.
    END-OF-SELECTION.
    PERFORM BUILD_HEADER USING GT_HEADER.
    wa_fcat-fieldname = 'CARRID'.
    wa_fcat-row_pos = '1'.
    wa_fcat-col_pos = 1 .
    wa_fcat-emphasize = 'X'.
    wa_fcat-just = 'C'.
    wa_fcat-outputlen = 15.
    wa_fcat-seltext_m = 'CARRIER NO'.
    APPEND wa_fcat TO it_fcat.
    CLEAR wa_fcat.
    wa_fcat-fieldname = 'CONNID'.
    wa_fcat-row_pos = '1'.
    wa_fcat-col_pos = 2 .
    wa_fcat-emphasize = 'X'.
    wa_fcat-just = 'C'.
    wa_fcat-outputlen = 20.
    wa_fcat-seltext_m = 'CONNECTION NO'.
    APPEND wa_fcat TO it_fcat.
    CLEAR wa_fcat.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    I_INTERFACE_CHECK = ' '
    I_BYPASSING_BUFFER = ' '
    I_BUFFER_ACTIVE = ' '
    i_callback_program = drepid
    I_CALLBACK_PF_STATUS_SET = ' '
    I_CALLBACK_USER_COMMAND = ' '
    i_callback_top_of_page = 'TOP-OF-PAGE1'
    I_CALLBACK_HTML_TOP_OF_PAGE = ' '
    I_CALLBACK_HTML_END_OF_LIST = ' '
    I_STRUCTURE_NAME =
    I_BACKGROUND_ID = ' '
    I_GRID_TITLE = 'LOKESH'
    I_GRID_SETTINGS =
    IS_LAYOUT =
    it_fieldcat = it_fcat
    IT_EXCLUDING =
    IT_SPECIAL_GROUPS =
    IT_SORT =
    IT_FILTER =
    IS_SEL_HIDE =
    I_DEFAULT = 'X'
    I_SAVE = ' '
    IS_VARIANT =
    IT_EVENTS =
    IT_EVENT_EXIT =
    IS_PRINT =
    IS_REPREP_ID =
    I_SCREEN_START_COLUMN = 0
    I_SCREEN_START_LINE = 0
    I_SCREEN_END_COLUMN = 0
    I_SCREEN_END_LINE = 0
    I_HTML_HEIGHT_TOP = 0
    I_HTML_HEIGHT_END = 0
    IT_ALV_GRAPHICS =
    IT_HYPERLINK =
    IT_ADD_FIELDCAT =
    IT_EXCEPT_QINFO =
    IR_SALV_FULLSCREEN_ADAPTER =
    IMPORTING
    E_EXIT_CAUSED_BY_CALLER =
    ES_EXIT_CAUSED_BY_USER =
    TABLES
    t_outtab = itab.
    EXCEPTIONS
    PROGRAM_ERROR = 1
    OTHERS = 2
    IF sy-subrc 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    *& Form top-of-page1
    text
    FORM BUILD_HEADER USING HEADER TYPE SLIS_T_LISTHEADER.
    data: header type slis_t_listheader,
    wa type slis_listheader,
    v1 type char10.
    TITLE AREA
    wa-typ = 'S'.
    wa-info = 'ALV GRID DISPLAY'.
    append wa to header.
    clear wa.
    WRITE sy-datum TO v1 USING EDIT MASK '__/__/_____'.
    wa-typ = 'S'.
    wa-info = v1.
    wa-key = 'DATE :'.
    APPEND wa TO header.
    CLEAR wa.
    endform.
    form top_of_page1.
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    EXPORTING
    it_list_commentary = gt_header
    I_LOGO = 'ENJOYSAP_LOGO'
    I_END_OF_LIST_GRID=.
    endform.

  • TOP OF PAGE in ALV Grid Display in ECC 6.0

    Hi,
    I have an issue with top of page in Alv grid display
    in ECC 6.0. I searched  the forum for this, but
    couldnt fine any solution.
    I am using Reuse_alv_commentary_write to display the header.
    It's working fine in 4.7E but the same code is not working in
    ECC 6.0. The header is shown as  empty.
    I tried to execute some other programs with same FM and
    even standard SAP Prgrms too, even they raise the same issue
    the top of page is empty.
    Please suggest any other FM or approach to use in ECC 6.0 to get the top of page.
    Thanks in advance
    Kaavya.

    hiii
    use following code
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
    *     I_INTERFACE_CHECK                 = ' '
    *     I_BYPASSING_BUFFER                = ' '
    *     I_BUFFER_ACTIVE                   = ' '
         i_callback_program                = sy-repid
    *     I_CALLBACK_PF_STATUS_SET          = ' '
    *     I_CALLBACK_USER_COMMAND           = ' '
         I_CALLBACK_TOP_OF_PAGE            = 'F0020_TOP_OF_PAGE'
    *     I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
    *     I_CALLBACK_HTML_END_OF_LIST       = ' '
         i_structure_name                  = 'I_OUTPUT'
    *     I_BACKGROUND_ID                   = ' '
    *     I_GRID_TITLE                      =
    *     I_GRID_SETTINGS                   =
    *     IS_LAYOUT                       = wa_layout
         it_fieldcat           = i_fieldcat
    *     IT_EXCLUDING                      =
    *     IT_SPECIAL_GROUPS                 =
    *     IT_SORT                           =
    *     IT_FILTER                         =
    *     IS_SEL_HIDE                       =
         i_default                         = 'X'
         i_save                            = 'X'
         is_variant                        = wa_variant
    *     IT_EVENTS                         =
    *     IT_EVENT_EXIT                     =
    *     IS_PRINT                          =
    *     IS_REPREP_ID                      =
    *     I_SCREEN_START_COLUMN             = 0
    FORM f0020_top_of_page.
      DATA: i_listheader TYPE slis_t_listheader WITH HEADER LINE,
            w_date like sy-datum.
      move:
        'H'   TO i_listheader-typ,
        '                 Corporation'   TO i_listheader-info.
    *    text-021    TO i_listheader-info.
    *write: 'Camtura Corporations'.
      APPEND i_listheader.
      WRITE sy-datum TO w_date.
      move:
        'S'   TO i_listheader-typ,
        'Execution date'   TO i_listheader-key,
        w_date     TO i_listheader-info.
      APPEND i_listheader.
    regards
    twinkal

Maybe you are looking for

  • Need a little help with a Jbutton not working out the way I planned

    The following code is to fulfill an assignment I am working on. The problem I am having is with the btnCalc. For some reason when the button is used, the results I get is from another button. I think the variables are set right for the program to fun

  • URLEncoder and URLDecoder for posting XML Strings

    Hi All I need to post an XML string to another website using POST. I have some java code that generates the XML string and sets the request object with this parameter. In my JSP I need to assign this to a hidden form element so that when a user click

  • How to turn off camera sound effects on Yoga 10+?

    I find the sound effects of the camera annoying. Turning down the volume of notifications, media, or alarms does nothing to disable them. Not even plugging a dummy headphone jack will silence them.

  • Metric for monitoring the Workload distribution in RAC.

    hello guys, i have a service running on two nodes of the RAC database. service is configured to use the service_time as the load balancing advisory and long for supporting long running connection.. I think counting the number of users connected to ea

  • Advice for wireless network

    Hi all, I have cable internet going to a non-wireless router, then from router going to an ethernet wired hub with 5 ports and am wondering can I set up wireless networking from here? the reason the router is not wireless is a long story but can I st