ALV grid Print

Hi Gurus,
         I have a problem with ALV PRINT. Here  i am printing out put directly from ALV with out display. I want the out put to be fit in A4 sheet. My out put is having 11 coloumns. PLease help me how i can do that.

Hi Ashish,
display once. Create a layout that fits on desired paper size (organize columns displayed and column width required). Save as layout, set this as default layout.
Thats it.
Regards,
Clemens

Similar Messages

  • Text above an ALV-Grid print-out

    It is possible to set a Text above an ALV-Grid print-out?

    hii
    yes you can print header in ALV & it will come in print out.use following code
    DATA: i_listheader TYPE slis_t_listheader WITH HEADER LINE,
            w_date like sy-datum.
      move:
        'H'   TO i_listheader-typ,
       TO i_listheader-info.
    *    text-021    TO i_listheader-info.
      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.
      MOVE:
      'S'   TO i_listheader-typ,
        'Execution user'   TO i_listheader-key,
        sy-uname   TO i_listheader-info.
      APPEND i_listheader.
      Move:
        'Discription' to i_listheader-key,
        'Tolling Production Variance' to i_listheader-info.
         APPEND i_listheader.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
           EXPORTING
                it_list_commentary = i_listheader[].
    <REMOVED BY MODERATOR>
    thx
    twinkal
    Edited by: twinkal patel on Jun 12, 2008 2:51 PM
    Edited by: Alvaro Tejada Galindo on Jun 12, 2008 1:33 PM

  • Issue with ALV grid print preview/spool

    Hello everyone,
    I am working on a report and I am having some issues with ALV grid. Currently in our DEV and QA environments the user can run the report, view the ALV grid, and print the grid without any issues.
    However this isn't the case in the Prod environment. The user is able to run the report and view the grid without any issues. But when they click print preview or click print, the spool is incorrect. It shows the proper values from the grid, but the first field is reduced in length. Rather than showing a numeric field of length 10 it shows 99999999# or 99999999...
    The programs are identical through every environment, including user parameters, formats, and spool settings. I have been told printing grids may have some issues, does anyone have any advice or dealt with this issue before?
    I appreciate the help.
    Thanks,
    C

    I was waiting to hear from the functional team on the matter and no one has mentioned any more issues.  I am assuming the problem is solved.  I just noticed the thread was still un-answered and wanted to give an update. 
    Thank you for you help Vijay.
    Regards
    C

  • ALV GRID print problem

    Hi guys,
    When I execute my report I can see all fields ok, but when I decide to print it the columns and fields are been displaced. I tried to fix with the fielcatalog but it isn't possible. Can anybody help me?
    Thanks a lot
    Best regards.
    Ana

    Hi  Menegazzo Marco  ,
    I call the alv :
    ***fieldcatalog***
    LS_FCAT-COL_POS = '1'.
      LS_FCAT-FIELDNAME = 'BUKRS' .
      LS_FCAT-TABNAME = 'BKPF'.
      LS_FCAT-INTTYPE = 'C' .
      LS_FCAT-OUTPUTLEN = '4' .
      LS_FCAT-COLTEXT = 'Sociedad ' .
      LS_FCAT-SELTEXT = 'Sociedad ' .
    LS_FCAT-JUST = 'X'.
      LS_FCAT-COL_OPT  = ' '.
      APPEND LS_FCAT TO PGT_FIELDCAT .
      CLEAR LS_FCAT.
      LS_FCAT-COL_POS = '2'.
      LS_FCAT-FIELDNAME = 'BELNR' .
      LS_FCAT-TABNAME = 'BKPF'.
      LS_FCAT-INTTYPE = 'C' .
      LS_FCAT-OUTPUTLEN = '10' .
      LS_FCAT-DD_OUTLEN = '10'.
      LS_FCAT-COLTEXT = 'Nº doc. Contable' .
      LS_FCAT-SELTEXT = 'Nº doc. Contable' .
      LS_FCAT-JUST = 'X'.
      LS_FCAT-COL_OPT  = ''.
      APPEND LS_FCAT TO PGT_FIELDCAT .
      CLEAR LS_FCAT.
      LS_FCAT-COL_POS = '3'.
      LS_FCAT-FIELDNAME = 'GJAHR' .
      LS_FCAT-TABNAME = 'BKPF'.
      LS_FCAT-INTTYPE = 'N' .
      LS_FCAT-OUTPUTLEN = '4' .
      LS_FCAT-COLTEXT = 'Ejercicio' .
      LS_FCAT-SELTEXT = 'Ejercicio' .
      LS_FCAT-JUST = 'X'.
      LS_FCAT-COL_OPT  = ' '.
      APPEND LS_FCAT TO PGT_FIELDCAT .
      CLEAR LS_FCAT.
    **end fieldcatalog**
    *layout**
    PGS_LAYOUT-CWIDTH_OPT = 'X'.
      PGS_LAYOUT-COL_OPT = 'X'.
    *end layout**
    *print*
    GS_PRINT-NO_COLWOPT = 'X'.
    *end print*
        CALL METHOD GR_ALVGRID->SET_TABLE_FOR_FIRST_DISPLAY
          EXPORTING
            I_STRUCTURE_NAME              = 'S_ALV'
            IS_LAYOUT                     = GS_LAYOUT
            IS_PRINT                      = GS_PRINT
          CHANGING
            IT_OUTTAB                     = LT_ALV[]
            IT_FIELDCATALOG               = GT_FIELDCAT
          EXCEPTIONS
            INVALID_PARAMETER_COMBINATION = 1
            PROGRAM_ERROR                 = 2
            TOO_MANY_LINES                = 3
            OTHERS                        = 4.
        IF SY-SUBRC <> 0.
    *--Exception handling
        ENDIF.
    Thanks a lot.

  • Change of list printing to ALV grid printing

    Hi everybody
    I have requirement to convert the following code to Grid display
    can any body help me out in this.
    NEW-PAGE PRINT ON
          NO DIALOG
          LINE-COUNT     58                                           
          LINE-SIZE      170                                                          LAYOUT  'X_58_170'                                   
          NEW LIST IDENTIFICATION 'X'
          KEEP IN SPOOL  'X'
          NEW-SECTION
          IMMEDIATELY    P_ERRLP
          DESTINATION    P_DEVICE
          SAP COVER PAGE 'X'
          LIST NAME      'ZFFR070E'.
    advance thanks

    You can do that
    See this thread
    CL_ALV_GRID  header
    Here the data is being displayed in the header, instead you can display in the bottom container rather than top container and display the grid in the top container.
    Regards,
    Ravi
    Note : Please mark all the helpful answers

  • ALV Grid Print Parameters (Select-Option Headerpage)

    Dear developers,
    I'm searching for the right method to call, parameter to
    set or whatever I may need to do in order to get my
    programm using the function REUSE_ALV_GRID_DISPLAY to
    set the option for the printout of the leading page
    with the select-options list. I want to force the output and I thought I coulde use the IS_PRINT - parameter for
    that (structure SLIS_PRINT_ALV, field no_print_selinfos),
    but that doesn't seeem to work. What am I doing wrong ?
    regards
    Andreas

    If all else fails, you can write your select-options manually in the header.  Something like this.
    report zrich_0001
           no standard page heading.
    * Global ALV Data Declarations
    type-pools slis.
    data: begin of i_alv occurs 0,
          matnr type mara-matnr,
          end of i_alv.
    * Miscellanous Data Declarations
    data: fieldcat type slis_t_fieldcat_alv,
          events   type slis_t_event,
          list_top_of_page type slis_t_listheader,
          top_of_page  type slis_formname value 'TOP_OF_PAGE'.
    select-options: s_matnr for i_alv-matnr.
    start-of-selection.
      perform initialization.
      perform get_data.
      perform call_alv.
    end-of-selection.
    *  Form  Initialization
    form initialization.
      clear i_alv.       refresh i_alv.
      perform eventtab_build using events[].
    endform.
    *  Form  Get_Data
    form  get_data.
      select matnr into table i_alv
                  from mara where matnr in s_matnr.
    endform.
    *  CALL_ALV
    form call_alv.
      data: variant type  disvariant.
      data: repid type sy-repid.
      repid = sy-repid.
      variant-report = sy-repid.
      variant-username = sy-uname.
      perform build_field_catalog.
      perform comment_build using list_top_of_page[].
    * Call ABAP List Viewer (ALV)
      call function 'REUSE_ALV_GRID_DISPLAY'
           exporting
                it_fieldcat        = fieldcat
                i_callback_program = repid
                is_variant         = variant
                it_events          = events[]
                i_save             = 'U'
           tables
                t_outtab           = i_alv.
    endform.
    * EVENTTAB_BUILD
    form eventtab_build using events type slis_t_event.
    * Registration of events to happen during list display
      data: tmp_event type slis_alv_event.
      call function 'REUSE_ALV_EVENTS_GET'
           exporting
                i_list_type = 0
           importing
                et_events   = events.
      read table events with key name = slis_ev_top_of_page
                               into tmp_event.
      if sy-subrc = 0.
        move top_of_page to tmp_event-form.
        append tmp_event to events.
      endif.
    endform.
    * BUILD_FIELD_CATALOG
    form build_field_catalog.
      clear: fieldcat. refresh: fieldcat.
      data: tmp_fc type slis_fieldcat_alv.
      tmp_fc-reptext_ddic = 'Material'.
      tmp_fc-fieldname    = 'MATNR'.
      tmp_fc-tabname      = 'I_ALV'.
      tmp_fc-outputlen    = 18.
      append tmp_fc to fieldcat.
    endform.
    * COMMENT_BUILD
    form comment_build using list_top_of_page type
                                            slis_t_listheader.
      data: tmp_line type slis_listheader.
      clear tmp_line.
      tmp_line-typ  = 'H'.
      tmp_line-info = 'Select-Options'.
      append tmp_line to list_top_of_page.
      read table s_matnr index 1.
      clear tmp_line.
      tmp_line-typ  = 'S'.
      tmp_line-key  = 'From Material'.
      tmp_line-info = s_matnr-low.
      append tmp_line to list_top_of_page.
      clear tmp_line.
      tmp_line-typ  = 'S'.
      tmp_line-key  = 'To Material'.
      tmp_line-info = s_matnr-high.
      append tmp_line to list_top_of_page.
    endform.
    * TOP_OF_PAGE
    form top_of_page.
      call function 'REUSE_ALV_COMMENTARY_WRITE'
           exporting
                i_logo             = 'ENJOYSAP_LOGO'
                it_list_commentary = list_top_of_page.
    endform.
    Regards,
    Rich Heilman

  • Taking download into excel from ALV Grid - header is printing in two lines

    Hi All,
    I have a scenario where I am taking the download from ALV grid to an excel sheet. Now the header of the ALV (column names) is appearing in two lines in the downloaded excel sheet while items (records of the ALV table) are getting displayed in a single line.
    This download is taken from the standard download to local file (spreadsheet) button provided by SAP for ALVs.
    I am using function module "Reuse_alv_grid_display" for the purpose.
    Can somebody provide an idea how I can avoid the header printing in two lines and keep the length as it is.
    Thanks in Advance,
    Chandan

    Hi..
    1. Pass header name in internal table appned first line.
    2. after that pass u r data .
    3. Use  FM. WS_DOWNLOAD 
    Salil ......
    Edited by: salil chavan on Nov 26, 2008 11:07 AM

  • Printing from ALV Grid

    Hi Friends,
    I am facing a problem while printing a report from ALV grid .. The report display is coming perfectly based on the SORT criteria .. but while trying  to print or print preview or Download to  Excel  the sorting is not working .. If any one know how to print the report as it look like the  screen display ..Please let me know..
    Thanks in advance..
    Regards.
    Elango

    Hi Vinni,
    Thanks for your repaly , I am using 4.7.
    Function module used to display grid is  REUSE_ALV_GRID_DISPLAY and for  
    build the field catlog  I am using REUSE_ALV_FIELDCATALOG_MERGE 
    function module .
    Regards,
    Elango

  • Print headings using RSBTCHH0 on ALV grids

    Most reports I have developed use the list processing event top-of-page to print headings for the report listing by calling standard SAP subroutine BATCH-HEADING in program RSBTCHH0 when structure BHDGD has been populated. Field BHDGD-LINES contains the line size used for printing the report headings. When we use ABAP objects to print data in the ALV grid we can add the same processing to print page headings to event PRINT_TOP_OF_PAGE. It appears as if the heading data is printed until the position of last column of the grid before the text is wrapped, creating a new line. Is there anyway of controlling the default line-size when doing grid printing.
    Thanks in advance
    Colin

    Hi,
    Refer to this document for all your ALV queries:
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/an easy reference for alv grid control.pdf
    regards
    Aveek

  • How to send the ALV GRID output to spool by using the print button in std t

    How to send the ALV GRID output to spool by using the print button in standard tool bar.
    We have created a button in the va02 transaction.  If user click on the button the new screen will be display on that screen we are populating the alv grid output using the oops concept.  But i am unable to send the output to spool using the print button in the standard tool bar.
    I am able to display the Print parameter dialog box but i am not able to send it to spool.
    Kindly help.
    Thanks In Advance.
    G.V.Ramana

    Hi Shaik,
    There is not properties button in my print screen.
    MODULE user_command_0900 INPUT.
        WHEN 'EXCEL'.
          PERFORM excel_download.                              
        WHEN 'PRI'.
          PERFORM print_output.
    form Print_output.
    CALL FUNCTION 'RSPO_LIST_LAYOUT_FITS'
               EXPORTING
                    columns        = 80
                    device         = 'ANY '
                    lines          = 65
                    maxpenality    = 1999
               TABLES
                    layouts        = lt_layouts1
               EXCEPTIONS
                    unknown_device = 1
                    OTHERS         = 2.
          IF sy-subrc = 0.
            LOOP AT lt_layouts1.
              IF lt_layouts1-penality < 1000        AND
                 lt_layouts1-penality < l_min_penality.
                l_layout       = lt_layouts1-layout.
                l_min_penality = lt_layouts1-penality.
              ENDIF.
            ENDLOOP.
            IF NOT l_layout IS INITIAL.
              CALL FUNCTION 'GET_PRINT_PARAMETERS'
                   EXPORTING
                        mode                   = 'CURRENT'
                        line_size              = 80             "#EC *
                new_list_id            = l_new_list_id
                        no_dialog              = l_no_dialog
                        layout                 = l_layout
                   IMPORTING
                        out_archive_parameters = rs_arc_params
                        out_parameters         = rs_pri_params
                        valid                  = l_valid
                   EXCEPTIONS
                        archive_info_not_found = 1
                        invalid_print_params   = 2
                        invalid_archive_params = 3
                        OTHERS                 = 4.
              IF sy-subrc NE 0.                                 " INS SLIN
              ENDIF.                                            " INS SLIN
              IF rs_pri_params-linsz LT 80 OR
                 rs_pri_params-linsz LT gt_stack-s_lprint-width.
                gt_stack-print_line_break = 'X'.
              ELSE.
                CLEAR gt_stack-print_line_break.
              ENDIF.
              IF l_valid NE 'X'.
                rs_pri_params = ls_pri_params_sav.
                rs_arc_params = ls_arc_params_sav.
              ENDIF.
            ENDIF.
          ENDIF.
    endform.                    " Print_output
        CALL METHOD gv_cost_tot_alv_grand->set_table_for_first_display
                EXPORTING
                   is_layout         = gs_layout_cost_tot_grand
                CHANGING
                   it_fieldcatalog   = gt_fcat_cost_tot_grand[]
                   it_outtab         = gt_cost_tot_grand[].
    Please check my code

  • HOW TO PRINT LONG TEXT OF 255 CHARACTER IN ALV GRID instead of132 Char's

    Hi sir/mam
    i'm sreekar can any one help me on this please
    "As I took a variable 'STR' with 255 length, But still ALV GRID DISPLAYS the same 132 characters, and
    When I download the report into excel it is showing the 250 charactered text"
    how can i print it in alv grid
    FORM BUID_CATALOG .
      DATA : COL_POS TYPE I.
      COL_POS = COL_POS + 1.
    *--DECLARING FIELDCATALOG FOR HEADER
      LT_FCAT-COL_POS = COL_POS.
      LT_FCAT-FIELDNAME = 'EBELN'.
      LT_FCAT-TABNAME = 'LT_FINAL'.
      LT_FCAT-SELTEXT_L = 'Purch.doc.no.'(002).
      LT_FCAT-REF_FIELDNAME = 'EBELN'.
      LT_FCAT-REF_TABNAME = 'EKKO'.
      APPEND LT_FCAT.
      CLEAR LT_FCAT.
      LT_FCAT-COL_POS = COL_POS.
      LT_FCAT-FIELDNAME = 'BEDAT'.
      LT_FCAT-TABNAME = 'LT_FINAL'.
      LT_FCAT-SELTEXT_L = 'Po Date'(003).
      LT_FCAT-REF_FIELDNAME = 'EBDAT'.
      LT_FCAT-EDIT_MASK = '__.__.____'.
      APPEND LT_FCAT.
      CLEAR LT_FCAT.
      LT_FCAT-COL_POS = COL_POS.
      LT_FCAT-FIELDNAME = 'EKGRP'.
      LT_FCAT-TABNAME = 'LT_FINAL'.
      LT_FCAT-SELTEXT_L = 'Purch.Grp'(004).
      LT_FCAT-REF_FIELDNAME = 'BKGRP'.
      APPEND LT_FCAT.
      CLEAR LT_FCAT.
      LT_FCAT-COL_POS = COL_POS.
      LT_FCAT-FIELDNAME = 'EKNAM'.
      LT_FCAT-TABNAME = 'LT_FINAL'.
      LT_FCAT-SELTEXT_L = 'Purch.Grp. Name'(005).
      LT_FCAT-REF_FIELDNAME = 'EKNAM'.
      APPEND LT_FCAT.
      CLEAR LT_FCAT.
      LT_FCAT-COL_POS = COL_POS.
      LT_FCAT-FIELDNAME = 'LIFNR'.
      LT_FCAT-TABNAME = 'LT_FINAL'.
      LT_FCAT-SELTEXT_L = 'Vendor No.'(006).
      LT_FCAT-REF_FIELDNAME = 'ELIFN'.
      APPEND LT_FCAT.
      CLEAR LT_FCAT.
      LT_FCAT-COL_POS = COL_POS.
      LT_FCAT-FIELDNAME = 'NAME1'.
      LT_FCAT-TABNAME = 'LT_FINAL'.
      LT_FCAT-SELTEXT_L = 'Vendor Name'(007).
      LT_FCAT-REF_FIELDNAME = 'NAME1_GP'.
      APPEND LT_FCAT.
      CLEAR LT_FCAT.
      LT_FCAT-COL_POS = COL_POS.
      LT_FCAT-FIELDNAME = 'ZTERM'.
      LT_FCAT-TABNAME = 'LT_FINAL'.
      LT_FCAT-SELTEXT_L = 'Pay.Code'(008).
      LT_FCAT-REF_FIELDNAME = 'ZTERM'.
      APPEND LT_FCAT.
      CLEAR LT_FCAT.
      LT_FCAT-COL_POS = COL_POS.
      LT_FCAT-FIELDNAME = 'TEXT1'.
      LT_FCAT-TABNAME = 'LT_FINAL'.
      LT_FCAT-SELTEXT_L = 'Own explanation'(009).
      LT_FCAT-REF_FIELDNAME = 'DZTERM'.
      LT_FCAT-OUTPUTLEN = '30'.
      LT_FCAT-DDICTXT = 'L'.
      APPEND LT_FCAT.
      CLEAR LT_FCAT.
      LT_FCAT-COL_POS = COL_POS.
      LT_FCAT-FIELDNAME = 'WAERS'.
      LT_FCAT-TABNAME = 'LT_FINAL'.
      LT_FCAT-SELTEXT_L = 'Curr'(010).
      LT_FCAT-REF_FIELDNAME = 'WAERS'.
      APPEND LT_FCAT.
      CLEAR LT_FCAT.
      LT_FCAT-COL_POS = COL_POS.
      LT_FCAT-FIELDNAME = 'NETWR'.
      LT_FCAT-TABNAME = 'LT_FINAL'.
      LT_FCAT-SELTEXT_L = 'Net Value'(011).
      LT_FCAT-REF_FIELDNAME = 'BWERT'.
      APPEND LT_FCAT.
      CLEAR LT_FCAT.
    ENDFORM.                    " BUID_CATALOG
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          I_BUFFER_ACTIVE         = 'X'
          I_BACKGROUND_ID         = 'ALV_BACKGROUND'
          IS_LAYOUT               = GS_LAYOUT
          IT_FIELDCAT             = LT_FCAT[]
          I_SAVE                  = G_SAVE
          IS_VARIANT              = GS_VARIANT
        IMPORTING
          E_EXIT_CAUSED_BY_CALLER = G_EXIT_CAUSED_BY_CALLER
          ES_EXIT_CAUSED_BY_USER  = GS_EXIT_CAUSED_BY_USER
        TABLES
          T_OUTTAB                = LT_FINAL[]
        EXCEPTIONS
          PROGRAM_ERROR           = 1
          OTHERS                  = 2.
      IF SY-SUBRC = 0.
        IF G_EXIT_CAUSED_BY_CALLER = 'X'.
        ELSE.
          IF GS_EXIT_CAUSED_BY_USER-BACK = 'X'.       "F3
            EXIT.
          ELSE.
            IF GS_EXIT_CAUSED_BY_USER-EXIT = 'X'.     "F15
              LEAVE TO SCREEN 1000.
            ELSE.
              IF GS_EXIT_CAUSED_BY_USER-CANCEL = 'X'. "F12
                LEAVE TO SCREEN 1000.
              ELSE.
                EXIT.
              ENDIF.
            ENDIF.
          ENDIF.
        ENDIF.
      ELSE.
      ENDIF.
    ENDFORM.                    " DISPLAY_DATA
    CALL FUNCTION 'READ_TEXT'
    EXPORTING
    CLIENT = SY-MANDT
    ID = 'F15' "ls_thead-tdid PAYMENT TERMS
    LANGUAGE = SY-LANGU "ls_thead-tdspras "CURRENT LANGUAGE 'E'
    NAME = NAME "ls_thead-tdname PO NUMBER LW_EKKO-EBELN
    OBJECT = 'EKKO' "ls_thead-tdobject TABLE NAME EKKO
    IMPORTING
    HEADER = HTEXT
    TABLES
    LINES = LTEXT
    EXCEPTIONS
    ID = 1
    LANGUAGE = 2
    NAME = 3
    NOT_FOUND = 4
    OBJECT = 5
    REFERENCE_CHECK = 6
    WRONG_ACCESS_TO_ARCHIVE = 7
    OTHERS = 8.
    IF SY-SUBRC = 0.
    LOOP AT LTEXT.
    IF LTEXT-TDLINE NE ''.
    MOVE LTEXT-TDLINE TO WA_WORD-TEXT.
    APPEND WA_WORD TO LT_SENTENCE.
    ENDIF.
    ENDLOOP.
    ENDIF.
    LOOP AT LT_SENTENCE INTO WA_WORD.
    COUNT = COUNT + 1.
    IF COUNT = 1.
    STR = WA_WORD-TEXT.
    LW_FINAL-TEXT1 = STR.
    ELSEIF COUNT = 2 OR COUNT = 3 OR COUNT = 4 OR COUNT = 5 OR COUNT = 6 OR COUNT = 7 OR COUNT = 8.
    CONCATENATE STR WA_WORD-TEXT INTO STR SEPARATED BY SPACE.
    LW_FINAL-TEXT1 = STR.
    ENDIF.
    ENDLOOP.

    can you provide an example of how to wrap the text i have like this please see the below code and correct if any errors
    FORM GET_TEXT_LINES .
      DATA :NAME TYPE THEAD-TDNAME.
      NAME = LW_EKKO-EBELN.
      V_TABIX = SY-TABIX.
    CALLING FUNCTION READ_TEXT FOR PAYMENT TEXTS
      CALL FUNCTION 'READ_TEXT'
        EXPORTING
          CLIENT                  = SY-MANDT          "CLIENT ID 200/600/400
          ID                      = 'F15' "ls_thead-tdid "PAYMENT TERMS TEXT ID 'F15'
          LANGUAGE                = SY-LANGU "ls_thead-tdspras "CURRENT LANGUAGE 'E'
          NAME                    = NAME "ls_thead-tdname "PO NUMBER LW_EKKO-EBELN
          OBJECT                  = 'EKKO' "ls_thead-tdobject "TABLE NAME EKKO
        IMPORTING
          HEADER                  = HTEXT "LS_THEAD
        TABLES
          LINES                   = LTEXT "LT_LINES[]
        EXCEPTIONS
          ID                      = 1
          LANGUAGE                = 2
          NAME                    = 3
          NOT_FOUND               = 4
          OBJECT                  = 5
          REFERENCE_CHECK         = 6
          WRONG_ACCESS_TO_ARCHIVE = 7
          OTHERS                  = 8.
      IF SY-SUBRC = 0.
        LOOP AT LTEXT.
          IF LTEXT-TDLINE NE ''.
            MOVE LTEXT-TDLINE TO WA_WORD-TEXT.
            APPEND WA_WORD TO LT_SENTENCE.
          ENDIF.
        ENDLOOP.
      ENDIF.
    Word Wrap the text in multiple lines
      LOOP AT LT_SENTENCE INTO WA_WORD.
        CALL FUNCTION 'RKD_WORD_WRAP'
          EXPORTING
            TEXTLINE            = WA_WORD-TEXT
             OUTPUTLEN           = 100
          TABLES
            OUT_LINES           = LT_SENTENCE
          EXCEPTIONS
            OUTPUTLEN_TOO_LARGE = 1
            OTHERS              = 2.
        IF SY-SUBRC EQ 0.
             IF not LT_SENTENCE IS INITIAL.
          READ TABLE LT_SENTENCE INTO WA_WORD INDEX v_tabix.
          LW_FINAL-TEXT1 = WA_WORD_TEXT.
          MODIFY LT_FINAL FROM LW_FINAL INDEX V_TABIX.
      ENDLOOP.
      CLEAR: LT_SENTENCE.
    ENDFORM.                    " GET_TEXT_LINES
    *&      Form  LAYOUT_INIT
          text
         -->P_GS_LAYOUT  text
    FORM LAYOUT_INIT  USING RS_LAYOUT TYPE SLIS_LAYOUT_ALV.
    *"Build layout for list display
      RS_LAYOUT-DETAIL_POPUP      = 'X'.
    ENDFORM.                    " LAYOUT_INIT
    *&      Form  EVENTTAB_BUILD
          text
         -->P_GT_EVENTS[]  text
    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.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
        EXPORTING
          I_LIST_TYPE = 0
        IMPORTING
          ET_EVENTS   = RT_EVENTS.
      READ TABLE RT_EVENTS WITH KEY NAME = SLIS_EV_AFTER_LINE_OUTPUT
                               INTO LS_EVENT.
      IF SY-SUBRC = 0.
        APPEND LS_EVENT TO RT_EVENTS.
      ENDIF.
    ENDFORM.                    " EVENTTAB_BUILD
    *&      Form  AFTER_LINE_OUTPUT
          text
    -->  p1        text
    <--  p2        text
    FORM AFTER_LINE_OUTPUT.
    CLEAR :COUNT,LT_SENTENCE.
    LOOP AT LT_SENTENCE INTO WA_WORD.
      READ TABLE LT_SENTENCE INTO WA_WORD INDEX V_TABIX.
      CHECK SY-SUBRC = 0.
    CALL FUNCTION 'RKD_WORD_WRAP'
        EXPORTING
          TEXTLINE  = WA_WORD-TEXT
          OUTPUTLEN = 20
        TABLES
          OUT_LINES = LT_SENTENCE.
      DESCRIBE TABLE LT_SENTENCE LINES V_TABIX.
      CHECK V_TABIX > 1.
        COUNT = COUNT + 1.                                                   
        IF COUNT = 1.                                                      
          STR = WA_WORD-TEXT.                                                         
          LW_FINAL-TEXT1 = STR.                                          
        ELSEIF COUNT = 2 OR COUNT = 3 OR COUNT = 4 OR COUNT = 5 OR COUNT = 6 OR COUNT = 7 OR COUNT = 8.
          CONCATENATE STR WA_WORD-TEXT INTO STR SEPARATED BY SPACE.
          LW_FINAL-TEXT1 = STR.
        ENDIF.
      ENDLOOP.
    ENDFORM.                    " AFTER_LINE_OUTPUT

  • Custom total/subtotal formula in an ALV Grid and printing.

    I have an ALV grid using OOPs method (Class cl_gui_alv_grid). The table that I am displaying is a dynamic table.
    call method o_grid->set_table_for_first_display
        exporting
          is_variant      = gx_variant
          i_save          = 'A'
          is_layout       = gs_layout
        changing
          it_fieldcatalog = it_fldcat
          it_outtab       = <gt_tabletotal>.
    On one of the columns in the ALV grid, instead of the regular summation, I had to do weighted averages (not avg).
    I built a logic to manipulate this total field for that column using field symbols.
    CALL METHOD o_grid->get_subtotals
        IMPORTING ep_collect00 = total
                  ep_collect01 = subto.
    ASSIGN total->* TO <ftotal>.
    ASSIGN subto->* TO <fsubto>.
    CALL METHOD o_grid->refresh_table_display
       EXPORTING I_SOFT_REFRESH = '1' .
    I manipulated <ftotal>-mycustomformulafield field there using some logic.
    In my field catalog i have the above field with wa_it_fldcat-do_sum = 'X ' .
    Now, II am able to see my custom formula on the screen. But when I print the grid using the print button or when I export to an excel sheet(I use export to local file and then select excel there) , my custom formula that i calculated above is reset to 0.000 .
    (Also when I email the grid, my custom formula is wiped). How can I avoid this ? Any useful suggestion is well appreciated.

    Hi, Shareen,
    We have the same problema here.
    Could you solve it?
    Thanks in advance

  • Printing with ALV Grid

    Hi,
    I am using ALV List and ALV grid in one of my custom reports.
    There is no issue with ALV List when I print the report after running the program.
    But when I use ALV Grid , the report runs good and when I try to print the report I get short dump "OBJECTS_NOT_CHARLIKE" in program "LKKBLF99" of the main program "SAPLKKBL".
    I am using the function module "REUSE_ALV_GRID_DISPLAY" to run the report using ALV Grid and I get the above short dump when I try to print the report.
    Can anyone help me please?
    Thanks,
    Ashok.

    Hai Ashok
    Try with the following Code
    *& Report  ZALV_GRID                                           *
    REPORT  ZALV_GRID .
    TABLES: MARA.
    TYPE-POOLS : SLIS.
    Data declaration
    DATA: BEGIN OF I_MARA OCCURS 0.
            INCLUDE STRUCTURE MARA.
    DATA: END OF I_MARA.
    DATA: V_REPID LIKE SY-REPID.
    selection-screen
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME.
      SELECT-OPTIONS : S_MATNR FOR MARA-MATNR.
      PARAMETERS: P_MTART LIKE MARA-MTART DEFAULT 'ROH'.
    SELECTION-SCREEN END OF BLOCK B1.
    initialisation
    INITIALIZATION.
    S_MATNR-LOW = '1400'.
    S_MATNR-HIGH = '1500'.
    APPEND S_MATNR.
    V_REPID = SY-REPID.
    start-of-selection
    START-OF-SELECTION.
    SELECT * FROM MARA
        INTO TABLE I_MARA
        WHERE MATNR IN S_MATNR AND
              MTART = P_MTART.
      CHECK SY-SUBRC = 0.
    end of selection
    END-OF-SELECTION.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      I_INTERFACE_CHECK              = ' '
      I_BYPASSING_BUFFER             =
      I_BUFFER_ACTIVE                = ' '
      I_CALLBACK_PROGRAM             = ' '
      I_CALLBACK_PF_STATUS_SET       = ' '
      I_CALLBACK_USER_COMMAND        = ' '
       I_STRUCTURE_NAME               = 'MARA'
      IS_LAYOUT                      =
      IT_FIELDCAT                    =
      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
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER        =
      ES_EXIT_CAUSED_BY_USER         =
      TABLES
        T_OUTTAB                       = I_MARA
    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.
    Thanks & Regards
    Sreenivasulu P

  • 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'.

  • Re: Increasing Column Header Length While Printing in ALV Grid

    Hi
    For some column headers in a report, the translations in Turkey are more than 40 characters, because of which while executing the report in TR language, the column header is getting truncated.
    So, I would like to know if we can increase the column header length while printing the ALV Grid(OO ALV) output.
    Or else, Is there any way where we can divide the column header into 2 rows.
    Please let me know.
    Thanks and Regards,
    Vishwa.

    Jose and Sivaram,
    Thanks for replying.
    The problem we have is with the column headers, there is a limit of 40 characters for the column header in ALV reports. So, increasing the outputlen also did not help.
    Regards,
    Vishwa.

Maybe you are looking for

  • PSE 7 - Pictures in wrong folders

    I just opened up my organizer in PSE 7.  While most of my pictures are in the correct folder for their date (using folder location view), the last 10-12 folders are completely screwed up.  Pictures dated 2009_05_16 (for example) are spread across fol

  • K8N Platinum Video and S-ATA issues

    hey, here is my problem: i bought some hardware 3 weeks ago, including: A64 3800+ (Venice), MSI K8N Neo4 Platinum (MS-7125), Leadtek PX6800 GT TDH (265MB), Be Quiet! 450 Watt Titanium S1.3 in exchange for my old system (2500+, Abit K7N, ATi Radeon 98

  • POWL: Hiding query from list of active queries in eRec workcenter dashboard

    Hi All, We are implementing SAP eRecruitment (EHP4) based on web dynpro ABAP. eRecruitment has work overview page (Recruiter role), which has two iviews (Search and Dashboard). Dashboard iview has two sections: Active Queries (Link Matrix) and Requis

  • JavaBeans in EJB App

    In which circumstances to use JavaBeans in Ejb application? I have created a simple e-commerce application using EJB components but without JavaBeans at all. The thing is that i have a problem with the jsp page which presents all the products under a

  • Fabridge is extremly slow and why is drawPath() missing?

    I am creating an abstract graphics Javascript library where the flex/flash is one of the options (besides vml, canvas, svg).  What I noticed is that drawing rate using Graphics.moveTo/lineTo methods is about 300 vertices per second which is about two