Suppress cloumn in ALV

How to suppress column in ALV?

Hi,
So you want hide few fields of the Final Internal Table.
u can go using the key word and set as Invisible.
U can use the follwing Code snippet.
  IF NOT it_dispfinal IS INITIAL .
    IF NOT ob_container IS INITIAL .
      CALL METHOD ob_container->free.
    ENDIF .
    CALL METHOD cl_gui_cfw=>flush.
    IF cl_salv_table=>is_offline( ) EQ if_salv_c_bool_sap=>false.
      CREATE OBJECT ob_container
        EXPORTING
          container_name = 'CONTAINER'.
    ENDIF.
create an ALV table
    TRY.
        cl_salv_table=>factory(
          EXPORTING
            r_container    = ob_container
            container_name = 'CONTAINER'
          IMPORTING
            r_salv_table   = ob_table
          CHANGING
            t_table        = it_dispfinal ).
      CATCH cx_salv_msg.                                "#EC NO_HANDLER
    ENDTRY.
TRY.
        ob_col = ob_column->get_column( 'PERNR' ).
        ob_col->set_visible( abap_false ) .
      CATCH cx_salv_not_found .                         "#EC NO_HANDLER
    ENDTRY.
TRY.
        ob_col = ob_column->get_column( 'BTRTL' ).
        ob_col->set_visible( abap_false ) .
      CATCH cx_salv_not_found .                         "#EC NO_HANDLER
    ENDTRY.
&&&&&&&&&&&& Try this Code, it works
Please  reward if you fine the answer helpful
Regards
Rohini.

Similar Messages

  • How can i suppress columns in ALV ?? Will reward points.

    Hello Gurus, how can i suppress column in ALV when i`m using the transparent table:
    CALL METHOD grid->set_table_for_first_display
          EXPORTING
            i_structure_name = 'ZIANEXE'
            is_layout        = wa_layout
            is_variant       = wa_variant
            i_save           = 'U'
            IT_TOOLBAR_EXCLUDING = LT_EXCLUDE
          CHANGING
            it_outtab        = itab[]
            it_fieldcatalog  = fieldcat.
    Please help.

    in the fieldcatalog you are providing there is a field NO_OUT use this.
    Loop over internal table and check fieldname. If fieldname = column you want to hide, NO_OUT = 'X'.
    Edited by: Micky Oestreich on May 8, 2008 12:06 PM

  • Not able to display the 18 cloumns inthe alv output

    Hi Everybody,
    I am developing one report to the display the output in alv for the 18months report.
    basically my requirement is when ever i execute the program based on the current month it should calculate the next 18months and fetch the data and display in the alv.
    for eg: if we are executing in the month of mar 2012 then in the output it should display from march 2012 to next year aug 2013 and in the column heading also it should display from March to next year August.
    i have written the code and able to fetch tshould change he data for the 18 months and when i am sending the data into the internal table from row wise to column wise for the months the data is getting overwritten from the next year march 2013 to august 2013 and i am unable to add the new column after 12 months completed and the field catlog heading also should change based on when we are executing.
    please find the below code which i have written and please let me know how and where i can correct the code so that the 18 columns are displayed from the month of the execution and the data according to it.
    final internal table:
    TYPES : BEGIN OF ty_output,
             matnr  TYPE   matnr,       "Material
             maktx  TYPE   maktx,       "Material Description
             mjahr  TYPE   mjahr,       "Material Document Year
             jan    TYPE   menge_d,     "January Sales Qty
             mjan   TYPE   meins,       "January Unit of Measure
             feb    TYPE   menge_d,     "Febuary Sales Qty
             mfeb   TYPE   meins,       "Febuary Unit of Measure
             mar    TYPE   menge_d,     "March Sales Qty
             mmar   TYPE   meins,       "March Unit of Measure
             apr    TYPE   menge_d,     "April Sales Qty
             mapr   TYPE   meins,       "April Unit of Measure
             may    TYPE   menge_d,     "May Sales Qty
             mmay   TYPE   meins,       "May Unit of Measure
             jun    TYPE   menge_d,     "June Sales Qty
             mjun   TYPE   meins,       "June Unit of Measure
             jul    TYPE   menge_d,     "July Sales Qty
             mjul   TYPE   meins,       "July Unit of Measure
             aug    TYPE   menge_d,     "August Sales Qty
             maug   TYPE   meins,       "August Unit of Measure
             sep    TYPE   menge_d,     "September Sales Qty
             msep   TYPE   meins,       "September Unit of Measure
             oct    TYPE   menge_d,     "October Sales Qty
             moct   TYPE   meins,       "October Unit of Measure
             nov    TYPE   menge_d,     "November Sales Qty
             mnov   TYPE   meins,       "November Unit of Measure
             dec    TYPE   menge_d,     "December Sales Qty
             mdec   TYPE   meins,       "December Unit of Measure
             month  TYPE   char2,       "MONTH
             menge  TYPE   menge_d,     "Quantity
             meins  TYPE   meins,
            END OF ty_output.
    code to pass the data in the internal table:
    *Getting the Data into GT_OUTPUT Table
      LOOP AT gt_output1 INTO wa_output1.
        READ TABLE gt_output WITH KEY matnr = wa_output1-matnr ASSIGNING <out>.
        IF sy-subrc NE 0.
          APPEND INITIAL LINE TO gt_output ASSIGNING <out>.
          <out>-matnr = wa_output1-matnr.
          <out>-mjahr = wa_output1-mjahr.
        ENDIF.
        READ TABLE GT_MAKT INTO WA_MAKT WITH KEY MATNR = WA_OUTPUT1-MATNR.
        <out>-maktx = wa_makt-maktx.
        READ TABLE gt_final INTO wa_mseg WITH KEY matnr = wa_output1-matnr.
        CASE wa_output1-month.
    *    case wa_output1-mjahr.
          WHEN '01'.
            <out>-jan = wa_output1-menge.
            <out>-mjan = wa_mseg-meins.
          WHEN '02'.
            <out>-feb = wa_output1-menge.
            <out>-mfeb = wa_mseg-meins.
          WHEN '03'.
            <out>-mar = wa_output1-menge.
            <out>-mmar = wa_mseg-meins.
          WHEN '04'.
            <out>-apr = wa_output1-menge.
            <out>-mapr = wa_mseg-meins.
          WHEN '05'.
            <out>-may = wa_output1-menge.
            <out>-mmay = wa_mseg-meins.
          WHEN '06'.
            <out>-jun = wa_output1-menge.
            <out>-mjun = wa_mseg-meins.
          WHEN '07'.
            <out>-jul = wa_output1-menge.
            <out>-mjul = wa_mseg-meins.
          WHEN '08'.
            <out>-aug = wa_output1-menge.
            <out>-maug = wa_mseg-meins.
          WHEN '09'.
            <out>-sep = wa_output1-menge.
            <out>-msep = wa_mseg-meins.
          WHEN '10'.
            <out>-oct = wa_output1-menge.
            <out>-moct = wa_mseg-meins.
          WHEN '11'.
            <out>-nov = wa_output1-menge.
            <out>-mnov = wa_mseg-meins.
          WHEN '12'.
            <out>-dec = wa_output1-menge.
            <out>-mdec = wa_mseg-meins.
        ENDCASE.
    *    ENDCASE.
      ENDLOOP.
    Fieldcatalog
    FORM fieldcatlog .
      REFRESH gi_fcat.
      CLEAR gr_fcat.
      gr_fcat-fieldname     = 'MATNR'.
      gr_fcat-tabname       = 'GT_OUTPUT'.
      gr_fcat-ref_fieldname = 'MATNR'.
      gr_fcat-ref_tabname   = 'MSEG'.
      gr_fcat-outputlen     = 18.
      APPEND gr_fcat TO gi_fcat.
      CLEAR gr_fcat.
      gr_fcat-fieldname     = 'MAKTX'.
      gr_fcat-tabname       = 'GT_OUTPUT'.
      gr_fcat-ref_fieldname = 'MAKTX'.
      gr_fcat-ref_tabname   = 'MAKT'.
      gr_fcat-outputlen     = 40.
      APPEND gr_fcat TO gi_fcat.
      CLEAR gr_fcat.
      gr_fcat-fieldname     = 'MJAHR'.
      gr_fcat-tabname       = 'GT_OUTPUT'.
      gr_fcat-seltext_l     = text-mjh.
      gr_fcat-seltext_m     = text-mjh.
      gr_fcat-seltext_s     = 'Mat Doc Yr'.
      gr_fcat-outputlen     = 40.
      APPEND gr_fcat TO gi_fcat.
      CLEAR gr_fcat.
      gr_fcat-fieldname     = 'JAN'.
      gr_fcat-tabname       = 'GT_OUTPUT'.
      gr_fcat-seltext_l     = text-jan.
      gr_fcat-seltext_m     = text-jan.
      gr_fcat-seltext_s     = text-jan.
      gr_fcat-outputlen     = 17.
      APPEND gr_fcat TO gi_fcat.
      CLEAR gr_fcat.
      gr_fcat-fieldname     = 'MJAN'.
      gr_fcat-tabname       = 'GT_OUTPUT'.
      gr_fcat-seltext_l     = text-mja.
      gr_fcat-seltext_m     = text-mja.
      gr_fcat-seltext_s     = text-mja.
      gr_fcat-outputlen     = 20.
      APPEND gr_fcat TO gi_fcat.
    so on ...
      CLEAR gr_fcat.
      gr_fcat-fieldname  = 'DEC'.
      gr_fcat-tabname    = 'GT_OUTPUT'.
      gr_fcat-seltext_l  = text-dec.
      gr_fcat-seltext_m  = text-dec.
      gr_fcat-seltext_s  = text-dec.
      gr_fcat-outputlen  = 18.
      APPEND gr_fcat TO gi_fcat.
      CLEAR gr_fcat.
      gr_fcat-fieldname  = 'MDEC'.
      gr_fcat-tabname    = 'GT_OUTPUT'.
      gr_fcat-seltext_l  = text-mde.
      gr_fcat-seltext_m  = text-mde.
      gr_fcat-seltext_s  = text-mde.
      gr_fcat-outputlen  = 20.
      APPEND gr_fcat TO gi_fcat.
    can anyone help me out and recity this
    thanks in advance.....
    Moderator message : Not enough re-search before posting, post only relevant portion of source code, discussion locked.
    Message was edited by: Vinod Kumar

    Hi meer,
    I saw your code , here in type declaration ty_out it's having only 12( jan to dec ) months you need to add 6 more months at type declaration and field catalog level also.
    Thats the reason why next year's data is overwritng the prev year data.
    I think Coloumn heading  (month names)  you need to determine dynamically in field catalog beacause 18 months name will depends on current month.
    Regards,
    Rajeev Goswami

  • Suppress "Print ALV List" dialog.

    HI All,
    Is there a way of suppressing the "Print ALV List" dialog that is displayed when you print an alv using REUSE_ALV_BLOCK_LIST_DISPLAY.   The is_print parameters does not contain any option, though there is a supress_dynpro option before the dialog is called, not sure how to set this is_print parameters.
    Rgds,
    James.

    Hi,
    <li>You can not suppress print parameters popup screen using REUSE* function module. It comes thats it.  I tried for longtime to suppress, could not pass
    <li>But when you print classical reports you can suppress it.
       REPORT ZTEST_NOTEPAD.
      DATA:G_LAY     TYPE PRI_PARAMS-PAART,
           G_LINES   TYPE PRI_PARAMS-LINCT,
           G_COLS    TYPE PRI_PARAMS-LINSZ,
           G_VAL     TYPE C.
      DATA:W_PRIPAR  TYPE PRI_PARAMS,
           W_ARCPAR  TYPE ARC_PARAMS.
      PARAMETERS:
          P_DATA(10) TYPE C.
      START-OF-SELECTION.
        G_LAY   = 'X_65_132'.
        G_LINES = 65.
        G_COLS  = 132.
        "Read, determine, change spool print parameters and archive parameters
        CALL FUNCTION 'GET_PRINT_PARAMETERS'
          EXPORTING
            IN_ARCHIVE_PARAMETERS  = W_ARCPAR
            IN_PARAMETERS          = W_PRIPAR
            LAYOUT                 = G_LAY
            LINE_COUNT             = G_LINES
            LINE_SIZE              = G_COLS
            NO_DIALOG              = 'X'
          IMPORTING
            OUT_ARCHIVE_PARAMETERS = W_ARCPAR
            OUT_PARAMETERS         = W_PRIPAR
            VALID                  = G_VAL.
        IF G_VAL  NE SPACE AND SY-SUBRC = 0.
          W_PRIPAR-PRREL = SPACE.
          W_PRIPAR-PRIMM = SPACE.
          NEW-PAGE PRINT ON
            NEW-SECTION
            PARAMETERS W_PRIPAR
            ARCHIVE PARAMETERS W_ARCPAR
            NO DIALOG.
        ENDIF.
        WRITE 'Output in spool'.
        NEW-PAGE PRINT OFF.
        CALL FUNCTION 'ABAP4_COMMIT_WORK'.
        DATA:TEXT TYPE STRING.
        CONCATENATE 'Spool' SY-SPONO 'is generated' INTO TEXT SEPARATED BY SPACE.
        MESSAGE TEXT  TYPE 'S'.
    Thanks
    Venkat.O

  • ALV Output to Spread sheet.. all integer,date fields are moved to last .

    My requirement is that, Downloading the ALV displayed data into Excel.
    So, I gone Menu>List>Export-->Spreadsheet
    But, I observed that, the Currency, Date, Unit columns r coming in the last of spread sheet and with out any color(where as other columns does hv some color!)
    I am expalining with the example .
    when we take the table SFLIGHT.
    Go To SE16 and give table SFLIGHT
    and then go for it contents..
    then the sequence of cloumns in ALV o/p is as follows..
    Carrid,Connid,Fldate,Price,Currency ,PlaneType,seats Max,Setats Occ and others..
    But when I goto TableEntry>List>Export-->Spreadsheet
    ->Table->Micro soft Excel..
    we will ge the excel Carrid,Connid,Currency ,PlaneType,
    Fldate,Price,seats Max,Setats Occ and others..
    The Order is Changed.
    1 - So, its the SAP default property? OR Do I need do/code some thing, to resemble the ALV displayed data(to meet my requiremenet)?
    2- Generally, Wht is the procedure to get thru my requirement? I mean, am I doing correct?
    Your help is appreciated.
    With Regards,
    Satish.
    Edited by: satish akkina on Jan 17, 2008 7:34 PM

    Hi Satish,
    I am also facing this problem in one of my programs. Though I solved this problem temporarily by adding a new button to the Screen and have downloaded the file using GUI_DOWNLOAD function module, I would really like to know the reason for this and also the solution for this if you have known it by now.
    Regards,
    Amit.

  • ALV Output to Spreadsheet.. all integer,date fields are moved to last .

    My requirement is that, Downloading the ALV displayed data into Excel.
    So, I gone Menu>List>Export-->Spreadsheet
    But, I observed that, the Currency, Date, Unit columns r coming in the last of spread sheet and with out any color(where as other columns does hv some color!)
    I am expalining with the example .
    when we take the table SFLIGHT.
    Go To SE16 and give table SFLIGHT
    and then go for it contents..
    then the sequence of cloumns in ALV o/p is as follows..
    Carrid,Connid,Fldate,Price,Currency ,PlaneType,seats Max,Setats Occ and others..
    But when I goto  TableEntry>List>Export-->Spreadsheet
    ->Table->Micro soft Excel..
    we will ge the excel Carrid,Connid,Currency ,PlaneType,
    Fldate,Price,seats Max,Setats Occ and others..
    The Order is Changed.
    1 - So, its the SAP default property? OR Do I need do/code some thing, to resemble the ALV displayed data(to meet my requiremenet)?
    2- Generally, Wht is the procedure to get thru my requirement? I mean, am I doing correct?
    Your help is appreciated.
    With Regards,
    Satish.
    Edited by: satish akkina on Jan 17, 2008 7:23 PM

    Hi Satish,
    Ideally, the layout should strictly follow the field catalogue structure you have defined. Just because you are getting the correct layout in ALV implies that everuthing is OK with your code.
    A humble suggestion is that you cross-check this malfunction by downloading the same report on some other system (PC). May be some setting in the Excel sheet is modifying the layout.
    Do let me know if it works, else i will dig more to find out the reason and the remedy.
    Regards,
    Rumi

  • ALV display column

    Dear All,
    Can I get two sub column under one cloumn in ALV report display?
    like '30 days' is first column and under that I need 'USD' and 'EUR'
    Thanks,
    Fed

    Hi Fed,
         I do't think so its possible with FM of ALV's, this can be done using Write statements.
    Regards,
    Suneel Kumar G

  • ALV: How do I suppress repeating values and page breaks on printed output?

    Good day, everyone!
    First, I've done a LOT of searching trying to find the answer to my question, but I'm not finding an answer.  If this has already been answered and you can point me to a URL, I would appreciate it.
    Here's my issue:  I have a rather simple ALV report.  It has the columns of Person ID, Personnel Number, For Period, In Period, and Amount.  I sort by Person ID and Personnel Number, and if the value repeats on the next line of the report, I want to suppress it (make it blank).
    I thought the answer was in the following code, where I set the GROUP attribute to asterisk:
      CLEAR sortcat_ln.
      sortcat_ln-spos      = '1'.
      sortcat_ln-fieldname = 'PERSONID_EXT'.
      sortcat_ln-up        = c_true.
      sortcat_ln-group     = '*'.
      APPEND sortcat_ln TO sortcat.
      CLEAR sortcat_ln.
      sortcat_ln-spos      = '2'.
      sortcat_ln-fieldname = 'PERNR'.
      sortcat_ln-up        = c_true.
      sortcat_ln-group     = '*'.
      APPEND sortcat_ln TO sortcat.
    It looks PERFECT on the screen -- the values are suppressed if they repeat, and everything appears together on one screen.  However, when I print the report, two things happen:  1) The values repeat on each row, even if they are the same, and 2) I get a page break after each Person ID / Personnel Number combination.
    I now realize that I can't use the GROUP attribute.  Is there some other way in ALV to blank these repeating values and keep all the rows together on one page, rather than page breaking after each value change?
    Thanks!
    Dave

    Hi
    Same requirement i had before, when i try to print preview. the output of the grid display is in grouping is ok, but when i print preview or print it doesnt cater the grouping and page breaks, so what i did i modify the internal table use in alv , after hitting the print preview/print with the format desired by the user. you can do that in user-command. see code below
    FORM user_command USING r_ucomm TYPE syucomm
                            rs_selfield TYPE slis_selfield.
      DATA lt_sort TYPE lvc_t_sort.
      CASE r_ucomm.
        WHEN '&RNT_PREV' OR '&RNT'.
          t_final_x[] = t_final[].
          PERFORM clear_redundant.
          PERFORM set_sort_criteria USING lt_sort.
        WHEN '&F03' OR '&PRINT_BACK_PREVIEW'.
          t_final[] = t_final_x[].
        WHEN OTHERS.
      ENDCASE.
    ENDFORM.                    "user_command
    hope it helps

  • Printing ALV report by suppressing print dialog box

    Hi,
      I want to print a alv report by passing value in IS_PRINT export parameter which is working prefectly. But I want to suppress the dialog box which is appearing while printing and printing should go to spool directly is it possible.

    Hi,
    You could try something like:
      CALL FUNCTION 'GET_PRINT_PARAMETERS'
        EXPORTING
          no_dialog      = 'X'
        IMPORTING
          out_parameters = ls_params
          valid          = lv_valid
        EXCEPTIONS
          OTHERS         = 1.
      NEW-PAGE PRINT ON PARAMETERS ls_params NO DIALOG.
    * Display Table
      lr_table->display( ).
    hope it helps,
    Kr,
    m.

  • How to suppress the protocol dialog screen in ALV grid ?

    To check the values in the ALV grid we make use of the method add_protocol_entry from the class interface CL_ALV_CHANGED_DATA_PROTOCOL. The coloring of the wrong cells in the ALV grid is a nice feature but the popup screen that appears on every entry that is incorrect is not so nice. Is there a possibility to suppress this dialog screen without stopping the coloring feature? Or is there an other way to get this coloring feature in the specific cells of the ALV grid. We have already tried the emphasize option in the field catalog but in this case the coloring of a cell disappears when the cursor is set on the colored field in the ALV grid.
    I hope somebody can help us.
    Thanks and greetings,
    Ad Pegels
    Suiker Unie
    Netherlands

    As I understand by adding the PROTOCOL you are trying to validate some fields and display those with a different color.
    Instead, if you can validate and can change the color manually I think the pop ups can be avoided. All you have to  do is to add a nested internal table to the main internal table that has the display data. This nested table will be of type LVC_T_STYLE. You can add rows, one for each field that you want to display in a different color and also spcify the style in which you want to display.
    Once you do that those fields should be displayed with different colors.
    Regards,
    Ravi
    Note : Please allocate points if you find this useful.

  • How to suppress automatic keyfigure conversion in WD ALV?

    Dear experts,
    I am having a problem with automatic input conversion in WD ALV.
    I have a key-figures (type P length 9, decimals 2)in my ALV which has reference field of type if_salv_wd_c_field_settings=>reffieldtype_curr.
    I process the changes by event ON_DATA_CHANGE which passes this change object:
    r_param->t_modified_cells
    r_param->t_inserted_rows
    r_param->t_deleted_rows
    r_param->t_error_cells
    The thing is that the changes in table r_param->t_modified_cells are already converted into internal format. When user enters "1", I get here in this table value "1.00". But this internal value is not always correct because corresponding reference field with currency key may not be known yet (it is calculated later on background from other fields).
    Therefore, for example for currency JPY which has no decimal places external value "1" is converted into wrong internal value "1.00" (the correct internal value is "0.01").
    Therefore, I need to suppress the conversion by the ALV and do it myself once the currency key is known.
    How can I suppress the automatic input conversion which is done by ALV?
    There is no such problem in SAP GUI ALV! There is event DATA_CHANGE with similar change object:
    io_data_change->mt_good_cells
    io_data_change->mt_mod_cells
    io_data_change->mt_inserted_rows
    io_data_change->mt_deleted_rows
    But all the changes in table io_data_change->mt_mod_cells are in an external format (exactly the way user entered them on the screen)!
    Any idea?
    Thank you in advance for your help.
    Tomas
    Edited by: Tomas Havlik on Oct 5, 2010 10:24 AM

    I have contacted the Web Dynpro ALV support directly to find out the answer.
    There is no solution!
    The WD ALV always convert the key figure into internal format. It is not possible to get the raw user input in WD as it is in SAP GUI.
    Therefore, I use a workaround in my application - I remeber the number of decimal places of the old currency key and if the new currency key has different number of decimal places, then I shift the decimal point to the right or left correspondingly.

  • Suppress ALV statistics in background

    Hi,
    When I execute an ALV report in background, it is displaying the sort options and report statistics. However, it does not happen in foreground. Is there any way to suppress this?
    Thanks.

    Hi Janice,
    <li>Declate print structure
    Data : wa_print type slis_print_alv.
    <li>Set these parameters in the structure defined.
    wa_print-no_print_selinfos = 'X'. " It does not show list statistics
    wa_print-no_print_listinfos = 'X'. " It does not show sort info
    <li>Pass the structure through ALV function call
    REUSE_ALV_GRID_DISPLAY
        is_print                = wa_print.
    I hope that it solves your problem.
    Thanks
    Venkat.O

  • Changing a cloumn value in run time in ALV

    Hi All,
        i have a requirement to change a value of a cloumn inside an ALV in runtime. is this possible,. if so how. thanks for help to be done.
    Thanks,
    selvakumar M.

    >
    selvakumar mohan wrote:
    > Hi,
    >    My requirement is not to change the entire node. i need to change only one field in the particular node. Thank for the help done.
    >
    > Thanks,
    > selvakumar M.
    Change at runtime, means you want one cell to be opened in edit mode or change the value of a particular element's attribute through coding?
    Abhi

  • Suppressing some subtotals in an ALV grid

    Hi,
    Does anyone know if it is possible to suppress some of the subtotals in an ALV grid? In some cases I have redundant subtotals, and I would like to suppress one of them. I am using the event SUBTOTAL_TEXT, and this is not something I can control with the sort order.
    Thanks,
    Margaret Brooker.

    Hi Margaret,
    You might want to take a look at the Development Class (Package) in the Object Navigator (SE80) called SLIS.
    There you will find excellent ALV demo programs that illustrate many possible customizations to the Alv grid.
    Although there is not an exact supress subtotal example, you could probably create your own pushbuttons or events to embed your own logic.
    It is possible to create a local class and implement a double click event, which could delete a duplicate line or any other preferred logic that you code.
    cheers,
    Marilyn

  • Reg: Suppress Print popup while printing ALV

    Hi Experts,
    I am using FM REUSE_ALV_LIST_DISPLAY to print the report and convert the spool to PDF and email it as attachment.
    When iam calling the FM for printing by passing parameter IS_PRINT, it is asking me to enter printer details as popup. I need to suppress this popup. I tried passing the default print parameters to this IS_PRINT, but still no result.
    Can anyone help me on this.
    Thanks
    Naveen

    Hi
    You need to pass first ALV data to spool and a PDF doc as email and then again call the FM grid display .
    Clear Spool Number
      CLEAR: gv_spool.
    Check for presence of any recipients
      IF s_reclst[] IS NOT INITIAL.
        sy-batch = 'X'.                                       "#EC WRITE_OK
        gs_alv_print-print =  'X'.
        gs_alv_print-prnt_info = ' '.
        gs_alv_print-no_print_selinfos = 'X'.
        gs_alv_print-no_print_listinfos = 'X'.
        gs_alv_print-no_coverpage = 'X'.
        gs_alv_print-reserve_lines = 1.
        gs_alv_print-print_ctrl-pri_params-pdest = 'PRINTER'.
        gs_alv_print-print_ctrl-pri_params-primm = 'X'.
        CALL FUNCTION 'REUSE_ALV_list_DISPLAY'
          EXPORTING
            i_callback_program = gv_repid
            is_layout          = gs_alv_layout
            is_variant         = gs_alv_variant
            it_fieldcat        = gt_alv_fieldcat
            it_sort            = gt_alv_sort
            it_events          = gt_alv_events
            is_print           = gs_alv_print
          TABLES
            t_outtab           = gt_final[]
          EXCEPTIONS
            program_error      = 1
            OTHERS             = 2.
        IF sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                  WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
    Get the Spoolnumber
        gv_spool = sy-spono.
        CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
          EXPORTING
            src_spoolid              = gv_spool
          TABLES
            pdf                      = gt_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.
        IF sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                  WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ELSE.
    Transfer the 132-long strings to 255-long strings
          LOOP AT gt_pdf_output INTO gs_pdf_output.
            TRANSLATE gs_pdf_output USING ' ~'.
            CONCATENATE gt_buffer gs_pdf_output INTO gt_buffer.
          ENDLOOP.
          TRANSLATE gt_buffer USING '~ '.
          DO.
            gs_objtxt = gt_buffer.
            APPEND gs_objtxt TO gt_objtxt.
            SHIFT gt_buffer LEFT BY 255 PLACES.
            IF gt_buffer IS INITIAL.
              EXIT.
            ENDIF.
          ENDDO.
        ENDIF.
      ENDIF.
    the above code will help you.
    Thanks
    kishore

Maybe you are looking for