How do I save ALV Grid O/P to spool

Hi All,
           I have a requirement of saving alv grid output to spool. How can this be done?
could I get any help on this?
Thanks & Regards,
Deepak Raj

DATA: BEGIN OF i_mara OCCURS 0,
  matnr LIKE mara-matnr.
  DATA: END OF i_mara.
  DATA: v_dest LIKE tsp01-rqdest,
  v_handle LIKE sy-tabix,
  v_spool_id LIKE tsp01-rqident,
  v_rc TYPE c,
  v_errmessage(100) TYPE c,
  v_text(70) TYPE c.
START-OF-SELECTION.
  SELECT matnr FROM mara INTO TABLE i_mara.
  CALL FUNCTION 'RSPO_OPEN_SPOOLREQUEST'
       EXPORTING
            dest            = 'LOCL'
           layout          =
           name            =
           suffix1         =
           suffix2         =
           copies          =
           prio            =
           immediate_print =
           auto_delete     =
           titleline       =
           receiver        =
           division        =
           authority       =
           posname         =
           acttime         =
            lifetime        = '8'
           append          =
           coverpage       =
           codepage        =
           doctype         =
       importing
            handle          = v_handle
            spoolid         = gd_spool_nr
            rc              = v_rc
            errmessage      = v_errmessage.
  LOOP AT i_mara.
    v_text = i_mara-matnr.
    CALL FUNCTION 'RSPO_WRITE_SPOOLREQUEST'
         EXPORTING
              handle           = v_handle
              text             = v_text
              length           =
              codepage         =
              truncate         =
         importing
              rc               = v_rc
              errmessage       = v_errmessage
         EXCEPTIONS
              handle_not_valid = 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.
  ENDLOOP.
  CALL FUNCTION 'RSPO_CLOSE_SPOOLREQUEST'
       EXPORTING
            handle           = v_handle
       IMPORTING
            rc               = v_rc
            errmessage       = v_errmessage
       EXCEPTIONS
            handle_not_valid = 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.
  CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
       EXPORTING
            src_spoolid              = gd_spool_nr
            no_dialog                = c_no
            dst_device               = c_device
       IMPORTING
            pdf_bytecount            = gd_bytecount
       TABLES
            pdf                      = it_pdf_output
       EXCEPTIONS
            err_no_abap_spooljob     = 1
            err_no_spooljob          = 2
            err_no_permission        = 3
            err_conv_not_possible    = 4
            err_bad_destdevice       = 5
            user_cancelled           = 6
            err_spoolerror           = 7
            err_temseerror           = 8
            err_btcjob_open_failed   = 9
            err_btcjob_submit_failed = 10
            err_btcjob_close_failed  = 11
            OTHERS                   = 12.
  CHECK sy-subrc = 0.
get the spool number
Declaration of local variables.
  DATA:
  lv_rq2name LIKE tsp01-rq2name.
  CONCATENATE sy-repid+0(8)
  sy-uname+0(3)
  INTO lv_rq2name SEPARATED BY '_'.
Get the spool number.
  SELECT * FROM tsp01 WHERE rq2name = lv_rq2name
  ORDER BY rqcretime DESCENDING.
    v_rqident = tsp01-rqident.
    EXIT.
  ENDSELECT.
  IF sy-subrc NE 0.
    CLEAR v_rqident.
  ENDIF

Similar Messages

  • 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

  • Save ALV grid to local excel-file in background

    Hi,
    i want to save a alv grid to an excel-file on a local fileshare using an background job..
    Does anybody know how this works?
    Thanks ahead

    DATA: file TYPE string VALUE `flights.dat`,
          wa   TYPE spfli.
    FIELD-SYMBOLS TYPE x.
    OPEN DATASET file FOR OUTPUT IN BINARY MODE.
    SELECT *
           FROM spfli
           INTO wa.
      ASSIGN wa TO CASTING.
      TRANSFER TO file.
    ENDSELECT.
    CLOSE DATASET file.
    <b>The binary data from database table SPFLI is transferred to a binary file flights.dat</b>

  • How to create editable ALV grid/list

    Hi,
    I want to create editable ALV grid/list so that user can modify the data in the ALV.
    And when user presses save button data will get saved in Z table.
    I dont know how to create editable ALV so could anybody please help me regarding this?
    Thanks & regards,
    Sameer Dhuke

    HI
    check the demo programs BCALV_FULLSCREEN_GRID_EDIT
    BCALV_GRID_EDIT
    BCALV_TEST_GRID_EDIT_01
    BCALV_TEST_GRID_EDITABLE
    REUSE_ALV_GRID EDITABLE
    ALV Grid editable fields
    Just to make things a bit easy
    In the layout,there is a property called edit, make it 'X' for the particular field whichever you want to make editable.
    Hope this helps,
    Suruchi
    Message was edited by:
            Suruchi Mahajan

  • How to get the alv grid report in another screen when double click on basic

    Hi.
    I have created an alv report using class cl_gui_alv_grid.I got another report in the same screen,when double clicked on basic list(using double_click event).I want to get this report in another screen.What i have to do?(In classical reports i worked with sy-lsind = 1 ,but how to do here?)
    How to set color to the selected rows in the alv grid report?I worked with change_data_from_inside method of cl_gui_alv_grid.But it didn't work out..
    With Regards,
    Ramana.

    On double click event . you will have to call another screen say 9000.
    now within screen 900 PBO.. you will have to prepare the fieldcatalog/layout.. and the table to be displayed there.
    in PAI of screen 9000, you can return to the original ALV.
    method double_click.
    call screen 9000.
    endmethod.
    " now in PBO create a module display_alv2
    module display_alv2.
    'prepare the fieldcat/layout info for new alv
    'add the data to the new ALV table
    'instantiate the grid call.. etc
    'call the ALV
    endmodule
    "in PAI
    module exit.
    case sy-ucomm.
    when 'ENT1'.
      leave to screen 0.
    endcase.
    endmodule
    while preparing the field catalog you can mention the EMPHASIZE field, whish will give color to tht column
    E.g
    *--Service Order
        ls_fieldcat-tabname   = 'IT_FINAL_VALID'.
        ls_fieldcat-fieldname = 'AUFNR'.
        ls_fieldcat-scrtext_m = 'Service Order'.
        ls_fieldcat-ref_table = 'AUFK'.
        ls_fieldcat-ref_field = 'AUFNR'.
        ls_fieldcat-col_pos   = 1.
        ls_fieldcat-outputlen = 12.
        ls_fieldcat-emphasize = 'C400'.  "This will add color to the cell
        APPEND ls_fieldcat TO fcat_valid.
    Hope this helps.

  • How to read a alv grid row data from standard program

    Hi All,
    I am working on transaction LBK1. Actually when you will open this transaction in the left hand side it will show you the data in tree. When you click on a notification node it will show the relevant data in right side. In which there is a operation tab . In this tab the data comes in alv grid. If user selects a row then I have to get that selected row value. There is also a toolbar above on the tree side. There are some buttons which execute our implementation class where I can put the code.  
    Can anyone please help me out? How I can read that selected row in our class/method?
    Thanks in advance.
    Best Regards
    Ritu

    Setting and getting selected rows (Columns) and read line contents
    You can read which rows of the grid that has been selected, and dynamic select rows of the grid using methods get_selected_rows and set_selected_rows. There are similiar methods for columns.
    Note that the grid table always has the rows in the same sequence as displayed in the grid, thus you can use the index of the selected row(s) to read the information in the rows fronm the table. In the examples below the grid table is named gi_sflight.
    Data declaratrion:
    DATA:
    Internal table for indexes of selected rows
    gi_index_rows TYPE lvc_t_row,
    Information about 1 row
    g_selected_row LIKE lvc_s_row.
    Example 1: Reading index of selected row(s) and using it to read the grid table
      CALL METHOD go_grid->get_selected_rows
        IMPORTING
          et_index_rows = gi_index_rows.
      DESCRIBE TABLE gi_index_rows LINES l_lines.
      IF l_lines = 0.
        CALL FUNCTION 'POPUP_TO_DISPLAY_TEXT'
             EXPORTING
                  textline1 = 'You must choose a valid line'.
        EXIT.
      ENDIF.
      LOOP AT gi_index_rows INTO g_selected_row.
         READ TABLE gi_sflight INDEX g_selected_row-index INTO g_wa_sflight.
        ENDIF.
      ENDLOOP.
    Example 2: Set selected row(s).
      DESCRIBE TABLE gi_index_rows LINES l_lines.
      IF l_lines > 0.
        CALL METHOD go_grid->set_selected_rows
            exporting
              it_index_rows = gi_index_rows.
      ENDIF.

  • How to use two ALV grids in a single program (pl read below for details)?

    Please read thoroughly::
    I have an ALV report using REUSE_ALV_GRID_DISPLAY.
    On the output of this report, when I click on a "change" button, a couple of columns should be made editable.
    I achieved this by modifying the fieldcatalog and triggering the output with another REUSE_ALV_GRID_DISPLAY.
    When I click on the back button of this second report, it is still taking me to the first one.
    How to over come this?
    Note:
    I used custom containers etc but the default buttons on the container are not controllable. I added custom buttons but could not suppress the default ones. So I did not pursue this much even though this is more comfortable to use.
    I am not able to get into the code in debug to see how the default buttons like COPY, INSERT ROW etc are working.
    Can any body throw some inputs into this?
    Thanks,
    Ven.

    >I achieved this by modifying the fieldcatalog and triggering the >output with another REUSE_ALV_GRID_DISPLAY.
    >When I click on the back button of this second report, it is still >taking me to the first one.
    >How to over come this?
    For this there is a solution
    i am thinking you are using user_command and calling the second time ALV Grid if so check this.
    form user_command using r_ucomm type sy-ucomm selfield type slis_selfield.
    case r_ucomm.
    when 'CHANGE'.
    selfield-exit = 'X'.   "use this , this will solve the problem
    "i hope you are calling the Function here
    endform.

  • How to kill an alv-grid object and refresh the frontend

    Hello experts,
    i have created an alv-grid display!
    now i want to hide the whole alv-table on the screen when user e.g. hits a button!
    How can i kill this object and refresh the frontend?
    Thanks a lot,
    Marcel

    Hello Marcel
    For this requirement I would use the following approach:
    (1) main screen '0100': here you display your ALV grid
    (2) Define a dummy screen '0101' the user will never see
    (3) Link the container for the ALV grid (e.g. go_docking) to the dummy screen when the user pushes the HIDE button (method LINK)
    (4) Link the container back to your main screen when the user pushes the DISPLAY button
    I never ever destroy a grid control and re-build it from scratch but always use either of its methods REFRESH_TABLE_DISPLAY or SET_TABLE_FOR_FIRST_DISPLAY.
    Regards
       Uwe

  • How to  learn about ALV Grid?

    Hi Experts,
    I dont about ALV grid and how to implement it.So can anyone let me know how to implement the simple basic ALV grid with example?
    Please explain me with set by step procedure.
    Thanks a lot in Advance,
    Regards,
    Raghu

    hi,
    Process to create ALV with OOPs:
    Step 1:
    Create a container. There are 2 type of containers: docking and custom.
    Go to SE38.Create a program. Use Pattern button to create object for docking container. Click ABAP Object Pattern radio button. Click Create object radio button. Give Instance as o_docking and class as cl_gui_docking_contianer.
    Step 2:
    Create a grid inside the container.
    Use Pattern button to create the same. Make the parent of grid as container.
    Click ABAP Object Pattern radio button. Click Create object radio button. Give Instance as o_grid and class as cl_gui_alv_grid. Create object o_grid.
    Step 3:
    Call the function lvc_fieldcatalog_merge to get the field catalog.
    Pass the structure name.
    Step 4:
    Call the method of grid set_table_for_first_display to display the output.
    Click ABAP Object Pattern radio button. Click Call Method radio button. Give Instance as o_grid and Class/Interface as cl_gui_alv_grid and Method as set_table_for_first_display.
    w_variant-report = sy-repid.
    Call method o_grid->set_table_for_first_display
    Step 5:
    Fill the internal table itab with values by using logic.
    select * from mara into table itab up to 100 rows.
    call screen 9000.
    Create a screen by double clicking 9000 in the above line. Fill the description for the screen. In the flow logic, uncomment the PBO and PAI module and create those in main program (for simplicity).
    Step 6:
    Create GUI status. Create GUI Title if required. That can be done by using display object List (CtrlShiftF5).Then in left side, right click the program and create GUI Status and Title.
    Step 7:
    Free the memory occupied once the BACK, EXIT or CANCEL button is clicked. Use Pattern button to call the method FREE of cl_gui_alv_grid and cl_gui_docking_container.
    Click ABAP Object Pattern radio button. Click Call Method radio button. Give Instance as o_grid and Class/Interface as cl_gui_alv_grid and Method as Free.
    Similarly Click Call Method radio button. Give Instance as o_docking and Class/Interface as cl_gui_docking_container and Method as Free.
    Also follow these links.
    1. Please give me general info on ALV.
    http://www.sapfans.com/forums/viewtopic.php?t=58286
    http://www.sapfans.com/forums/viewtopic.php?t=76490
    http://www.sapfans.com/forums/viewtopic.php?t=20591
    http://www.sapfans.com/forums/viewtopic.php?t=66305 - this one discusses which way should you use - ABAP Objects calls or simple function modules.
    2. How do I program double click in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=11601
    http://www.sapfans.com/forums/viewtopic.php?t=23010
    3. How do I add subtotals (I have problem to add them)...
    http://www.sapfans.com/forums/viewtopic.php?t=20386
    http://www.sapfans.com/forums/viewtopic.php?t=85191
    http://www.sapfans.com/forums/viewtopic.php?t=88401
    http://www.sapfans.com/forums/viewtopic.php?t=17335
    4. How to add list heading like top-of-page in ABAP lists?
    http://www.sapfans.com/forums/viewtopic.php?t=58775
    http://www.sapfans.com/forums/viewtopic.php?t=60550
    http://www.sapfans.com/forums/viewtopic.php?t=16629
    5. How to print page number / total number of pages X/XX in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=29597 (no direct solution)
    6. ALV printing problems. The favourite is: The first page shows the number of records selected but I don't need this.
    http://www.sapfans.com/forums/viewtopic.php?t=64320
    http://www.sapfans.com/forums/viewtopic.php?t=44477
    7. How can I set the cell color in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=52107
    8. How do I print a logo/graphics in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=81149
    http://www.sapfans.com/forums/viewtopic.php?t=35498
    http://www.sapfans.com/forums/viewtopic.php?t=5013
    9. How do I create and use input-enabled fields in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=84933
    http://www.sapfans.com/forums/viewtopic.php?t=69878
    10. How can I use ALV for reports that are going to be run in background?
    http://www.sapfans.com/forums/viewtopic.php?t=83243
    http://www.sapfans.com/forums/viewtopic.php?t=19224
    11. How can I display an icon in ALV? (Common requirement is traffic light icon).
    http://www.sapfans.com/forums/viewtopic.php?t=79424
    http://www.sapfans.com/forums/viewtopic.php?t=24512
    12. How can I display a checkbox in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=88376
    http://www.sapfans.com/forums/viewtopic.php?t=40968
    http://www.sapfans.com/forums/viewtopic.php?t=6919
    Hope this helps, Do reward.

  • How to increase the alv grid size dynamically

    Hi all,
    I have to develop the report with the following requirement:
    I have to take bwkey from t001k on basis of bukrs and bwkey. this bukrs and bwkey are entered in selection-screen.
    I have to select matnr, lbkum, salk3 from mbew on basis of bwkey in selection-screen.(this is select options)
    now the ouput should be as follows:
    for example :
                        ef01                efo2               ef03
    matnr     lbkum  salk3  lbkum    salk3      lbkum  salk3         total
    700001     3       4            0        0            0            0                    7
    700010     0       0            2       1             0            0                    3
    The output should be as mentioned above.
    In the above output,
    in the first record for 700001, the total of 3 and 4 is displayed as total 7 and
    for 700010 , it is displayed as 3.
    the get the output as above in the alv grid,
    I have taken bwkeys in t001k and remaining fields from mbew and joined them in final internal table.
    now in the final table ifinal, i have the following fields,
    matnr lbkum salk3 bwkey total.
    now when i want to display the output, it is displaying as normal output like
    mantr bwkey lbkum salk3 total
    700001 etap   3         4      7
    700002 etap   1        2       3
    but i want to display in the first mentioned format.
    so i tried to attach the bwkey values in it001k(this is internal table for t001k) for the final field catalog so that this bwkeys are displayed as column headings in the final output. but it is not displaying.
    Please suggest me the solution to display the output in the above first mentioned
    format as soon as possible
    points will be awarded.
    thanking u in advance.
    A.Srinivas

    hi ,
    u can set the row count to any number , here I am setting it to 5 using the method set_visible_row_count
    1 Change the visible row count to u20185u2019
      DATA lo_cmp_usage TYPE REF TO if_wd_component_usage.
      lo_cmp_usage =   wd_this->wd_cpuse_alv( ).
      IF lo_cmp_usage->has_active_component( ) IS INITIAL.
        lo_cmp_usage->create_component( ).
      ENDIF.
      DATA lo_interfacecontroller TYPE REF TO iwci_salv_wd_table .
      lo_interfacecontroller =   wd_this->wd_cpifc_alv( ).
        DATA lo_value TYPE REF TO cl_salv_wd_config_table.
        lo_value = lo_interfacecontroller->get_model(
        lo_value->if_salv_wd_table_settings~set_visible_row_count( '5' ).
    u can also go thru this useful links for CONFIGUIRING ALV :
    http://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/40794172-b95a-2910-fb98-b86d8a0918b4;jsessionid=(J2EE3417400)ID0488867050DB10849380333905377829End
    SAP List Viewer (ALV) [original link is broken]
    Configuring ALV
    http://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/1190424a-0801-0010-84b5-ef03fd2d33d9?overridelayout=true
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/db22242d-0701-0010-28a2-aeaa1fefd706;jsessionid=(J2EE3414800)ID0133346050DB00727847586176044227End?overridelayout=true&bcsi_scan_06B6B0A4B65849C2=0
    I hope it shud solve ur query.
    regards,
    amit

  • How to show an ALV grid in planning book (using macro-exit)

    Hi Expertss,
    I am using a macro-exit. Now in the execution flow of this macro-exit I am required to shaow an ALV grid. I tried calling a Zreport in which i am calling alv screen(screen type dialog box). It is giving a short-dump saying Exception condition "CNTL_ERROR" raised.
    If i comments the fieldcatlog and structure name while calling the ALV in my Zreport then the alv is coming but then planning book is not vivible.
    Kindly tell what thing I am missing and what probable thing I can do to make it work.
    Thanks a lot in advance.

    I got the solution.

  • F4 help before save - ALV Grid in Module Pool

    Hi,
       I am calling an ALV Grid using CL_GUI_A;V_GRID. When I create a new record, I need F4 help for a particular field based on the entries in 2 other fields. Thing is I can't use DATA_CHANGED event coz then I won't be able to display the F4 button. And F4 option doesn't pass the data that has been changed(ER_CHANGED_DATA table). So frustrating. Can anyone help me plz???
    Thanks in advance,
    Poornima L Nathan

    Hi ,
    i think you are missing one params while registering your F4 fields..
      ls_f4-register   = 'X'.
      ls_f4-getbefore  = 'X'.
      ls_f4-chngeafter = 'X'.
    Documentatin of SAP program *BCALV_EDIT_08*
    *   1b. If the value range in your f4 help depends on other
    *       values of cells that are input enabled, set the
    *       GETBEFORE parameter.
    now you can use row_indx no to read your internal table
    regards
    Prabhu
    Edited by: Prabhu Peram on Aug 23, 2011 2:11 PM

  • How to print an alv grid

    Hello All,
    I want to print data on an alv grid to spool according the current layout using code.
    Can anyone give me suggestion, maybe some sample code?
    Thanks in advance,
    Alex

    Hi,
    I have 2 ALV grid in the screen and pront to spool of both ALV's using OOp.
    Please find sample code. Whenever report runs in the background i simply call this print subroutine after creating fieldcatalog, layout, sorting table etc.
    FORM list_append TABLES ut_table
                     USING  u_no      TYPE char1
                            u_tabname TYPE slis_tabname.
      IF u_no CA '13'.
        MOVE        'TOP_OF_PAGE'        TO ls_event-name.
        CONCATENATE 'TOP_OF_PAGE' u_no INTO ls_event-form.
        APPEND ls_event TO lt_events.
      ELSE.
        MOVE        'TOP_OF_LIST'        TO ls_event-name.
        CONCATENATE 'TOP_OF_LIST' u_no INTO ls_event-form.
        APPEND ls_event TO lt_events.
      ENDIF.
      CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
           EXPORTING
                it_fieldcat                = lt_fieldcat
                is_layout                  = ls_layout
                i_tabname                  = u_tabname
                it_events                  = lt_events
                it_sort                    = lt_sort
    *           i_text                     =
           TABLES
                t_outtab                   = ut_table
           EXCEPTIONS
                program_error              = 1
                maximum_of_appends_reached = 2
                OTHERS                     = 3.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
               WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    ENDFORM.                               " LIST_APPEND
    *       Form  f_list_display
    FORM f_list_display.
      DATA ls_print TYPE slis_print_alv.
      ls_print-no_print_selinfos  = 'X'.   " Display no selection infos
      ls_print-no_print_listinfos = 'X'.   " Display no listinfos
      ls_print-reserve_lines      = 2.     " Lines reserved for end of page
      CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'
           EXPORTING
                i_interface_check = ' '
                is_print          = ls_print
           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.                               " F_LIST_DISPLAY
    May this will help you.
    aRs
    Message was edited by:
            aRs

  • How to print multiple ALV Grids with only one print dialog?

    Hi,
    I have a report that has multiple ALV grids in splitter containers. The users want to be able to print those ALVs by pushing only one print button. I got it to work (parameter IS_PRINT and method SET_FRONTEND_PRINT before calling SET_TABLE_FOR_FIRST_DISPLAY) but I can't find a way to avoid that the printer dialog pops up for every grid I print.
    I tried to use the function module approach with REUSE_ALV_LIST_DISPLAY but have the same issue. Any thoughts?
    Thanks,
    Guenther

    Hi Peluka,
    Well, that's exactly what I am doing. Putting one central button in the app is not the problem; the issue is that the print dialog (to select the printer) pops up for every  individual ALV grid. E.g. if I place 4 ALV grids on my screen and trigger their print from a central button, I am getting 4 print dialogs.
    Cheers,
    Guenther

  • How to display 2  ALV grids in the output

    Hi all
    I have 2 internal tables with some data
    i want to display 1st internal table data in one grid and 2nd internal table in the second grid in the same output screen with some headings
    can anyone tell me how to do it
    or can send the sample code
    Thank you

    Hi
    see this program you can understand the flow very easily
    *& Report  ZAMIT_ALVOOPS
    REPORT  ZNNR_ALVOOPS_SCREEN.
    tables: mara,spfli.
    types: begin of ty_tab,
            matnr type mara-matnr,
            ernam type mara-ernam,
            ersda type mara-ersda,
           end of ty_tab.
    DATA ITAB1 TYPE TABLE OF SPFLI.
    DATA WA1 LIKE LINE OF ITAB1.
    DATA IO1 TYPE SPFLI-CARRID VALUE 'AA'.
    data itab type table of ty_tab.
    data wa like line of itab.
    DATA OK_CODE TYPE SY-UCOMM.
    DATA: GRID TYPE REF TO CL_GUI_ALV_GRID,
          CONT TYPE REF TO CL_GUI_CUSTOM_CONTAINER.
    DATA: GRID1 TYPE REF TO CL_GUI_ALV_GRID,
          CONTA TYPE REF TO CL_GUI_CUSTOM_CONTAINER.
    CREATE OBJECT CONT EXPORTING CONTAINER_NAME = 'CONT1' .
    CREATE OBJECT GRID EXPORTING I_PARENT = CONT .
    CREATE OBJECT CONTA EXPORTING CONTAINER_NAME = 'CONT2' .
    CREATE OBJECT GRID1 EXPORTING I_PARENT = CONTA .
    selection-screen begin of block b1 with frame title text-100.
    select-options: s_matnr for mara-matnr.
    selection-screen end of block b1.
    select matnr ernam ersda from mara into corresponding fields of table itab up to 15 rows
    where matnr in s_matnr .
    call selection-screen 100.
    *&      Module  USER_COMMAND_0100  INPUT
          text
    MODULE USER_COMMAND_0100 INPUT.
    if ok_code = 'PB1'.
    leave to screen 0.
    else.
    leave to screen 100.
    endif.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    *&      Module  STATUS_0100  OUTPUT
          text
    MODULE STATUS_0100 OUTPUT.
    SET PF-STATUS 'xxxxxxxx'.
    SET TITLEBAR 'xxx'.
    SELECT * FROM SPFLI INTO
      CORRESPONDING FIELDS OF TABLE ITAB1 WHERE CARRID = IO1.
    CALL METHOD grid->SET_TABLE_FOR_FIRST_DISPLAY
      EXPORTING
       I_BUFFER_ACTIVE               =
       I_BYPASSING_BUFFER            =
       I_CONSISTENCY_CHECK           =
        I_STRUCTURE_NAME              = 'MARA'
       IS_VARIANT                    =
       I_SAVE                        =
       I_DEFAULT                     = 'X'
       IS_LAYOUT                     =
       IS_PRINT                      =
       IT_SPECIAL_GROUPS             =
       IT_TOOLBAR_EXCLUDING          =
       IT_HYPERLINK                  =
       IT_ALV_GRAPHICS               =
       IT_EXCEPT_QINFO               =
       IR_SALV_ADAPTER               =
      CHANGING
        IT_OUTTAB                     = itab.
       IT_FIELDCATALOG               =
       IT_SORT                       =
       IT_FILTER                     =
    EXCEPTIONS
       INVALID_PARAMETER_COMBINATION = 1
       PROGRAM_ERROR                 = 2
       TOO_MANY_LINES                = 3
       others                        = 4
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
               WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
       CALL METHOD GRID1->SET_TABLE_FOR_FIRST_DISPLAY
        EXPORTING
          I_STRUCTURE_NAME = 'SPFLI'
        CHANGING
          IT_OUTTAB        = ITAB1.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    <b>Reward if usefull</b>

Maybe you are looking for