Problem in exporting ALV Layout to excelsheet!!!

Hi,
I am facing a problem while trying to export an ALV layout to Excel sheet. While the values appear correctly, the order of the columns gets distorted. So the table in Excel appears with correct values but with columns in disarray. I have checked the settings of Excel (SECURITY LEVEL is Medium and TRUSTED SOURCES "Trust All Installed Add-Ins and Templates" and "Trust Access to Visual Basic Project" is checked.) and its doesn’t seem to be change anything.
Any suggestions?

Hi,
Follow the below procedures to export data to excel.
Normal ALV :
Click on the local file option and select spreadsheet option from the radio button list and click on ok , file save window will open , select the correct directory path and give the file name , then ALV contents will be downloaded into Excel sheet.
In OO ALV :
click on the Export button in the ALV toolbar ->click on the spreadsheet , then information message window will open , select ok button , then you will get three options , click on the table option and press ok , data will be exported to Excel sheet , then save the excel data in specified directory.
Regards
Appana

Similar Messages

  • Problem in exporting ALV Report to excel sheet

    Hi All,
    I have developed a Report and now facing problem in exporting the same to excel sheet.
    When we click the "Locate File" icon in the report layout, the system will pop up a window with radio buttons. I have opted for 'Spreadsheet'.
    When i save the excel sheet into my desktop, the excel file has all the report headers (Title of each column). But no value is exported.
    There are around 15 columns in the report and the excel sheet shows value of last 2 columns which has some text.
    I have been into ALV report development and developed around 30+ reports in the same fashion.
    What might be the reason behind this issue?
    When i export other reports into excel sheet, everything is perfect without any flaws......
    Kindly help me out......
    Regards
    Pavan

    Hi,
    Here's my suggestion: Install OpenOffice.org and ask SAP to deliver good integration with OpenOffice.org.
    Alternative suggestion: re-install SAP Gui on the PC where the integration is not working. If that does not help, re-install Microsoft Office as well.
    Here's my comment: I think you should ask this question in a different forum, e.g. in the Duet forum. That may not be the correct forum either, but as it is a Microsoft/SAP integration technology forum, someone there may know the solution.
    Regards,
    Raj.

  • Problem: User has problems to export ALV Grid to Excel...

    Hello experts,
    I have a very strange problem with an single user: when she tries to export ALV Grid data from SAP into Excel by List/Export/Spreadsheet, she's only able to export this to an xml-based file on her local client, every other user gets the popup to choose the spreadsheet format (XXL...).
    What I did so far:
    - Look up Excel Makro Security --> the same as on other desktops
    - SAP GUI Patch Level --> the same as on other desktops
    - Test with an different user on her desktop on SAP Report S_ALR_87012284 --> it worked perfectly
    - User parameters are the same as for the test user
    - Security regarding ALV is the same (S_GUI ACTVT = 61...)
    Has there ever been a similar problem to anyone else?
    Many thanks in advance for your feedback!

    Hi ,
    This problem looks very weired. Just try running that FM from SE37 from the same system and see that what is happening there.... if the problem is similar then it is not the problem of your report and some patch may be missing in that system.

  • Problem while exporting ALV column header to excel sheet.

    Hi,
    I am able to export an ALV grid details to an excel sheet. But the ALV column headers when exported to excel sheet are getting truncated.
    For eg: if my column header in ALV grid is displayed as 'Material' then the column header in excel sheet is 'Mater' only. Remaining portion is getting truncated.
    How can I view the entire column header text?
    Kindly assist.
    Thanks.

    I have the same problem with you, when user export to excel. I fixed it by using
    w_layo-colwidth_optimize = 'X'. <<<<<<<<<<<<This
    perform generate_fcat_reftab
        using 'PRUEFLOS' 'T_INPUT' '' '' 'Inspection Lot' 0.
    form generate_fcat_reftab  using    p_fieldname
                                        p_tabname
                                        p_ref_tabname
                                        p_ref_fieldname
                                        p_output_text
                                        p_output_lenght.
      clear w_fcat.
      w_fcat-fieldname = p_fieldname.
      w_fcat-tabname   = p_tabname.
      w_fcat-ref_fieldname = p_ref_fieldname.
      w_fcat-ref_tabname = p_ref_tabname.
      w_fcat-seltext_s = p_output_text.
      w_fcat-seltext_m = p_output_text.
      w_fcat-seltext_l = p_output_text.
      w_fcat-outputlen = p_output_lenght.
      w_fcat-ddictxt = 'L'. <<<<<<<<<<<<<<<<<<This
      append w_fcat to t_fcat.
    endform.

  • Problem when export ALV.

    Hello,
    I have a problem with the function REUSE_ALV_GRID_DISPLAY.
    When click to the button Local File... (CrtlShiftF9) my report give me a run timer error.
    Runtime Errors         GETWA_NOT_ASSIGNED                                                         
    Date and Time          16.03.2009 11:43:34                                                                               
    Short text                                                                               
    Field symbol has not yet been assigned.                                                                               
    What happened?                                                                               
    Error in the ABAP Application Program                                                                               
    The current ABAP program "SAPLKKBL" had to be terminated because it has                      
         come across a statement that unfortunately cannot be executed.                                                                               
    Error analysis                                                                               
    You attempted to access an unassigned field symbol                                           
         (data segment 75).                                                                               
    This error may occur if                                                                      
         - You address a typed field symbol before it has been set with                               
           ASSIGN                                                                               
    - You address a field symbol that pointed to the line of an                                  
           internal table that was deleted                                                            
         - You address a field symbol that was previously reset using                                 
           UNASSIGN or that pointed to a local field that no                                          
           longer exists                                                                               
    - You address a global function interface, although the                                      
           respective function module is not active - that is, is                                     
           not in the list of active calls. The list of active calls                                  
           can be taken from this short dump.                                                                               
    Trigger Location of Runtime Error                                                                
         Program                                 SAPLKKBL                                             
         Include                                 LKKBLF99                                             
         Row                                     3.840                                                
         Module type                             (FORM)                                               
         Module Name                             GEN_FIELD_OUT2                                                                               
    Source Code Extract                                                                               
    Line  SourceCde                                                                               
    3810       format hotspot on.                                                                   
      3811     elseif gs_fc-hotspot = 'V'                                                             
      3812        and gs_out_flags-hotline is initial and not <field> is initial                      
      3813        and gt_stack-is_layout-no_hotspot is initial.                                       
      3814       format hotspot on.                                                                   
      3815     endif.                                                                               
    3816 *>>> new API                                                                               
    3817     perform salv_set_cell_hotspot using l_celltype.                                        
      3818 *<<< new API                                                                               
    3819     if gs_fc-input = 'X' and                                                               
      3820        gt_stack-is_layout-no_input is initial and                                          
      3821        gs_fc-checkbox is initial.                                                          
      3822       format input on.                                                                     
      3823       format intensified off.                                                              
      3824     endif.                                                                               
    3825     if not gs_fc-emphasize is initial and gs_out-info is initial.                          
      3826       perform field_color_normal using gs_fc                                               
      3827 *                                      gt_stack-is_layout                                  
      3828                                        gs_out-info.                                        
      3829     endif.                                                                               
    3830                                                                               
    3831 *   complex logic with internal table for color description                                
      3832     data: lr_tabledescr  type ref to cl_abap_tabledescr,                                   
      3833           ls_lvc_color   type lvc_s_scol,                                                  
      3834           lt_kkbl_color  type kkblo_t_specialcol,                                          
      3835           ls_kkbl_color  type kkblo_specialcol.                                            
      3836                                                                               
    3837     if gs_out_flags-mcoltab = 'X' and gs_out_flags-slave ne 'X' and                        
      3838        gs_out_flags-sum ne 'X'.                                                            
      3839       lr_tabledescr ?= cl_abap_typedescr=>describe_by_name( 'LVC_T_SCOL' ).                
    >>>>>       if lr_tabledescr->applies_to_data( <coltab_any> ) eq 'X'.                            
      3841         loop at <coltab_lvc> into ls_lvc_color.                                            
      3842           move-corresponding ls_lvc_color to ls_kkbl_color.                                
      3843           ls_kkbl_color-fieldname = ls_lvc_color-fname.                                    
      3844           append ls_kkbl_color to lt_kkbl_color.                                           
      3845         endloop.                                                                           
      3846         assign lt_kkbl_color to <coltab>.                                                  
      3847       endif.                                                                               
    3848       perform field_color_complex using <coltab>                                           
      3849                                         gs_fc                                              
      3850                                         gs_out_flags-color                                 
      3851                                         gs_out_flags-intensified                           
      3852                                         gs_out_flags-inverse.                              
      3853     elseif gs_out_flags-scoltab = 'X' and gs_out_flags-slave = 'X' and                     
      3854            gs_out_flags-sum ne 'X'.                                                        
      3855       lr_tabledescr ?= cl_abap_typedescr=>describe_by_name( 'LVC_T_SCOL' ).                
      3856       if lr_tabledescr->applies_to_data( <coltab_any_slave> ) eq 'X'.                      
      3857         loop at <coltab_lvc_slave> into ls_lvc_color.                                      
      3858           move-corresponding ls_lvc_color to ls_kkbl_color.                                
      3859           ls_kkbl_color-fieldname = ls_lvc_color-fname.                                     
    I verify the internal table it has 315 values export to excel.
    How can i solve this problem?

    I try to download the output from SYSTEM>LIST>SAVE LOCAL FILE, but it was disable.
    here is the report code:
    REPORT zfir0021.
    TABLES: bsid, yypcl_fiboleto.
    TYPE-POOLS: slis.
    TYPES: BEGIN OF tp_bsid,
    bukrs     TYPE bukrs,
    kunnr     TYPE kunnr,
    umsks     TYPE umsks,
    umskz     TYPE umskz,
    augdt     TYPE augdt,
    augbl     TYPE augbl,
    zuonr     TYPE dzuonr,
    gjahr     TYPE gjahr,
    belnr     TYPE belnr_d,
    buzei     TYPE buzei,
    END OF tp_bsid.
    TYPES: BEGIN OF tp_dd03l,
    fieldname TYPE dd03l-fieldname,
    position  TYPE dd03l-position,
    keyflag   TYPE dd03l-keyflag,
    rollname  TYPE dd03l-rollname,
    datatype  TYPE dd03l-datatype,
    END OF tp_dd03l.
    +*----
    *+
    *** Variáveis
    +*----
    *+
    DATA w_catalogo TYPE slis_fieldcat_alv.
    DATA w_layout   TYPE slis_layout_alv.
    DATA t_catalogo TYPE slis_t_fieldcat_alv.
    DATA: v_layout TYPE slis_layout_alv,
    t_dd03l TYPE STANDARD TABLE OF tp_dd03l WITH HEADER LINE.
    DATA t_bsid TYPE STANDARD TABLE OF bsid WITH HEADER LINE.
    DATA: t_bsid_aux TYPE STANDARD TABLE OF bsid WITH HEADER LINE,
    t_yypcl_fiboleto TYPE STANDARD TABLE OF yypcl_fiboleto WITH HEADER LINE,
    t_reg_ok TYPE STANDARD TABLE OF yypcl_fiboleto3 WITH HEADER LINE,
    t_reg_err TYPE STANDARD TABLE OF yypcl_fiboleto3 WITH HEADER LINE.
    +*----
    *+
    *** Parâmetros de seleção
    +*----
    *+
    SELECTION-SCREEN BEGIN OF BLOCK bl1 WITH FRAME TITLE text-s02.
    SELECT-OPTIONS: s_blart FOR bsid-blart,
    s_situa FOR yypcl_fiboleto-situacao,
    s_data  FOR bsid-budat.
    SELECTION-SCREEN END OF BLOCK bl1.
    * Execução do Programa
    START-OF-SELECTION.
    PERFORM seleciona_dados.
    PERFORM imprime_resultado.
    PERFORM catalogo.
    PERFORM gerar_alv.
    END-OF-SELECTION.
    +*&----
    *+
    *&      Form  seleciona_dados
    +*&----
    *+
    +*       text+
    +*----
    *+
    +*  -->  p1        text+
    +*  <--  p2        text+
    +*----
    *+
    +FORM seleciona_dados .+
    +*  DATA lr_situacao TYPE RANGE OF yypcl_fiboleto-situacao WITH HEADER LINE.+
    *  lr_situacao-sign = 'I'.
    *  lr_situacao-option = 'EQ'.
    *  lr_situacao-low = '1'.
    *  APPEND lr_situacao.
    *  lr_situacao-low = '4'.
    *  APPEND lr_situacao.
    SELECT * INTO TABLE t_bsid
    FROM bsid
    WHERE bukrs EQ '0050'
    AND blart IN s_blart
    AND budat IN s_data
    AND anfbn <> ''.
    SELECT *
    INTO TABLE t_yypcl_fiboleto
    FROM yypcl_fiboleto
    WHERE empresa   EQ '0050'
    AND dtemissao IN s_data
    AND situacao  IN s_situa
    AND tpdoc     IN s_blart.
    ENDFORM.                    " seleciona_dados
    +*&----
    *+
    *&      Form  imprime_resultado
    +*&----
    *+
    +*       text+
    +*----
    *+
    +*  -->  p1        text+
    +*  <--  p2        text+
    +*----
    *+
    FORM imprime_resultado.
    SORT t_bsid BY bukrs kunnr gjahr belnr buzei.
    SORT t_yypcl_fiboleto BY empresa cdcliente gjahr nudoc_cont itdoc_cont.
    LOOP AT t_bsid.
    READ TABLE t_yypcl_fiboleto WITH KEY empresa = t_bsid-bukrs
    cdcliente = t_bsid-kunnr
    gjahr = t_bsid-gjahr
    nudoc_cont = t_bsid-belnr
    itdoc_cont = t_bsid-buzei
    BINARY SEARCH.
    IF NOT sy-subrc IS INITIAL.
    t_bsid_aux = t_bsid.
    APPEND t_bsid_aux.
    ENDIF.
    ENDLOOP.
    ENDFORM.                    " imprime_resultado
    +*&----
    *+
    *&      Form  catalogo
    +*&----
    *+
    +*       text+
    +*----
    *+
    +*  -->  p1        text+
    +*  <--  p2        text+
    +*----
    *+
    FORM catalogo.
    DATA l_cont TYPE i.
    SELECT fieldname position keyflag rollname datatype
    INTO TABLE t_dd03l
    FROM dd03l
    WHERE tabname = 'BSID'
    AND rollname <> '.INCLUDE' AND
    rollname <> 'MANDT' .
    SORT t_dd03l BY position.
    LOOP AT t_dd03l.
    ADD 1 TO l_cont.
    PERFORM insert_catalogo USING:
    t_dd03l-fieldname
    t_dd03l-keyflag
    'L'
    t_dd03l-datatype
    l_cont
    'C410'.
    ENDLOOP.
    ENDFORM.                    " catalogo
    +*&----
    *+
    *& Form INSERT_CATALOGO
    +*&----
    *+
    FORM insert_catalogo USING f_campo
    f_tamanho
    f_texto
    f_alinhamento
    f_somatorio
    f_tipo
    f_decimais
    f_checkbox
    f_input
    f_hotspot
    f_no_out
    f_pos
    f_cor.
    CLEAR w_catalogo.
    w_catalogo-col_pos = f_pos.
    w_catalogo-fieldname = f_campo.
    w_catalogo-key = ' '.
    w_catalogo-outputlen = f_tamanho.
    w_catalogo-seltext_s = f_texto.      " descrição curta
    w_catalogo-seltext_m = f_texto.      " descrição média
    w_catalogo-seltext_l = f_texto.      " descrição longa
    w_catalogo-just = f_alinhamento.
    w_catalogo-do_sum = f_somatorio.     " totalizar coluna
    w_catalogo-datatype = f_tipo.
    w_catalogo-decimals_out = f_decimais.
    w_catalogo-checkbox = f_checkbox.    " exibir como checkbox
    w_catalogo-input = f_input.          " modificação permitida
    w_catalogo-hotspot = f_hotspot.      " chama form USER_COMMAND
    w_catalogo-no_out = f_no_out.        " Ocultar campo inicialmente
    IF w_catalogo-datatype <> 'CHAR'.
    w_catalogo-no_zero = 'X'.
    ENDIF.
    w_catalogo-emphasize = f_cor.
    APPEND w_catalogo TO t_catalogo.
    ENDFORM.                               " INSERT_CATALOGO
    +*&----
    *+
    *&      Form  gerar_alv
    +*&----
    *+
    +*       Gera o ALV com as informações da T_YYPCL_FIBOLETO_AUX+
    +*----
    *+
    FORM gerar_alv.
    v_layout-colwidth_optimize = 'X'.  " Largura melhor possível da coluna
    v_layout-no_input = 'X'.
    v_layout-info_fieldname = 'COLOR_LINE'.
    v_layout-coltab_fieldname = 'CELL_COLOUR'.
    v_layout-zebra = 'X'.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    i_callback_program      = sy-repid
    i_structure_name        = 'BSID'
    *      i_callback_user_command = 'Z_USER_COMMAND'
    is_layout               = v_layout
    it_fieldcat             = t_catalogo
    i_save                  = 'A'
    TABLES
    t_outtab                = t_bsid_aux
    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.                    " gerar_alv

  • Problem in exporting ALV output to a spreadsheet.

    Hi All,
    We have an existing Aging report in our project where in the output in ALV  there is a row for Header data fields and a row below for Item data fields.Now the user wants that when he export the report to a spreadsheet the headings of Header and Item data should come in a single line without changing the layout in the report.
    The report is calculating some totals which he wants to get in the same way as it is now.
    Please guide me on how to go about this.
    Thanks in Advance,
    Saket.

    Hi Saket Tiwari,
    Your existing program must be storing all the values in an internal table and then displaying it in ALV format.
    Try adding the following code to your existing code.
    data : lv_filename type string,
             lv_filepath type string,
             lv_fullpath type string.
    Add the following code to select the path where the user wants to save the excel sheet
    the following method will take the path where the excel sheet is to be saved & the name of the excel sheet.
    CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_SAVE_DIALOG
    EXPORTING
    WINDOW_TITLE         = 'Select The Path Where Error File Should Be Saved'
    DEFAULT_FILE_NAME    = 'ExcelSheetName.xls'
    CHANGING
    FILENAME             = lv_filename
    PATH                 = lv_filepath
    FULLPATH             = lv_fullpath
    EXCEPTIONS
    CNTL_ERROR           = 1
    ERROR_NO_GUI         = 2
    NOT_SUPPORTED_BY_GUI = 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.
    The following function module will take the path as its input and save the contents of internal table in the form of excel sheet at the required place.
    call function 'GUI_DOWNLOAD'
    EXPORTING
    filename  = lv_fullpath
    filetype                = 'ASC'
    append                  = 'X'
    write_field_separator   = 'X'
    TABLES
    data_tab                = itab_name
    EXCEPTIONS
    file_write_error        = 1
    no_batch                = 2
    gui_refuse_filetransfer = 3
    invalid_type            = 4
    no_authority            = 5
    unknown_error           = 6
    header_not_allowed      = 7
    separator_not_allowed   = 8
    filesize_not_allowed    = 9
    header_too_long         = 10
    dp_error_create         = 11
    dp_error_send           = 12
    dp_error_write          = 13
    unknown_dp_error        = 14
    access_denied           = 15
    dp_out_of_memory        = 16
    disk_full               = 17
    dp_timeout              = 18
    file_not_found          = 19
    dataprovider_exception  = 20
    control_flush_error = 21
    others = 22.
    if sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    endif.
    itab_name is the name of internal table where the content is saved.
    hope this piece of code helps you...add it in ur existing code after collecting all the data in an internal table.
    Regards,
    Radhika
    Edited by: RadhikaS on May 29, 2009 9:23 PM

  • Total problem in Exporting ALV GRID to Excel

    Hi all,
    I have manipulated the Total of ALV Grid by using GET_SUBTOTALS and REFRESH method of CL_GUI_ALV_GRID. The ALV Output is also correct. When i export to Excel,only the Original total is displaying not the calculated one. How to download the exact output which is displaying in the ALV Grid to Excel.
    Please help me out to solve this.
    Thanks,
    Ramesh

    DEAR,
    AS U WANT UPLOAD WITH THE SUB TOTAL YOU TRY THIS.
    FIRST to get subtotal in ALV output you select at least one column of total and then press ctrl + F6 . u will see the sub total .
    and now how to download it so press  ctrl + shift + F9 .
    now screen appears and select second option ie spreadsheet and press enter
    now a screen appear  in wich u have to give file name.
    so double click on search button of file name . click on desktop  give ur file name as u want suppose zreport u have given.
    and save type = excel file.
    now save it and then generate it your output bytes will be transmitted .
    now u can see in your desktop in your file name . ur output with subtotal.
    regards
    navin

  • Export Print layout to other SAP server

    Hi,
    I'm facing problem of export print layouts from SAP B1 2007 A to SAP B1 2007 B.
    I tried with the copy express but it comes up with an error telling that the export is fail because 2 databases are in different version.
    It is unpractical and time wasting to redesign the same print layout to the new SAP server.
    Is there any way to solve this?
    Thanks.

    It may be worth trying using copy & paste? I'm not sure how different the structures are between the two localisations, and there will need to be a lot of remapping done.
    If the layout is not too complex it is probably quicker to modify the system layout & recreate from scratch

  • Alv layout problem ?

    Hi everyone,
    I generating 2 alv reports within a program.In the selection screen there are 2 radio buttons for different alv reports. First i selected the 1st radio button and executed the prog to get a alv report.Then i went to change layout and selected the required columns from the columns set and then saved the layout as the default layout.
    Then I came back to the selection screen again.In the selection screen, in the parameter p_var there is default variant,so i cleared the parameter with no layout variant selected.then i selected the 2nd radio button and executed the program.Here the program is again taking the default layout (even though i cleared it in the selection screen )and generating the alv report according to that.But i don't want to use the default layout when i select the 2nd radio button,unless i select it from the variant list.How can i do that?
    Any suggestions please?

    Hi Hymavathi,
    Thanks for the reply.Below is my code for the layout.If u can see any problem in the code please tell me the changes.Thank you.
    PARAMETERS: P_VAR LIKE DISVARIANT-VARIANT.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_VAR.
      PERFORM GET_VARIANT CHANGING P_VAR.               " ALV Layout
    FORM GET_VARIANT CHANGING X_VAR.
      PERFORM F4_ALV_LAYOUT(PPIO_ENTRY) USING I_GRID-PROGRAM
                                     CHANGING X_VAR.
    ENDFORM.
    perform alv_display.
    FORM ALV_DISPLAY.
      DATA: I_GRID-LAYOUT TYPE SLIS_LAYOUT_ALV.
      SORT I_HEADER BY PLNBEZ AUFNR.
    Define layout.
      CLEAR I_GRID-LAYOUT.
      I_GRID-LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
    Set up Variant
      I_GRID-VARIANT-VARIANT = P_VAR.     " Variant
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
      EXPORTING
        I_CALLBACK_PROGRAM             = I_GRID-PROGRAM
        IS_LAYOUT                      = I_GRID-LAYOUT
        IT_FIELDCAT                    = I_GRID-FIELDCAT
        I_SAVE                         = 'A'
        IS_VARIANT                     = I_GRID-VARIANT
      TABLES
         T_OUTTAB                      = I_HEADER
       EXCEPTIONS
        PROGRAM_ERROR                  = 1
        OTHERS                         = 2.
    ALV Failed.
      IF SY-SUBRC <> 0.
        WRITE: / 'Failed with',SY-SUBRC.
      ENDIF.
    ENDFORM.
    PERFORM ALV_DISPLAY_2.
    FORM ALV_DISPLAY_2.
      DATA: I_GRID-LAYOUT TYPE SLIS_LAYOUT_ALV.
      SORT I_HEADER BY PLNBEZ AUFNR.
    Define layout.
      CLEAR I_GRID-LAYOUT.
      I_GRID-LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
    Set up Variant
    I_GRID-VARIANT-VARIANT = P_VAR.     " Variant
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
      EXPORTING
        I_CALLBACK_PROGRAM             = I_GRID-PROGRAM
        I_CALLBACK_PF_STATUS_SET       = I_GRID-PF_STATUS_SET
        I_CALLBACK_USER_COMMAND        = I_GRID-USER_COMMAND
        IS_LAYOUT                      = i_grid-layout
        IT_FIELDCAT                    = I_GRID-FIELDCAT
       I_SAVE                         = 'A'
       IS_VARIANT                     = I_GRID-VARIANT
       TABLES
         T_OUTTAB                      = I_HEADER
       EXCEPTIONS
        PROGRAM_ERROR                  = 1
        OTHERS                         = 2.
    ALV Failed.
      IF SY-SUBRC <> 0.
        WRITE: / 'Failed with',SY-SUBRC.
      ENDIF.
    ENDFORM.                    " ALV_DISPLAY_2

  • ALV: Problem in exporting to excel with too many columns

    Hi,
    While exporting from ALV report to excel following issue was faced:
    ALV report contains 81 columns out of which 67 columns are displayed properly but from 68th column onwards data is dispalyed on next row
    I want all columns displayed on single row..
    Any help will greatly appreciated..
    Thanks,
    Deepak

    Hi Deepak,
    I was browsing through these threads to find anwer for the same issue.
    So thought of putting my analysis which helped me resolve my problem.
    Analysis/Solution:
    When we export ALV data to excel worksheet, as sap notes say the maximum lenght allowed is 1023 charaters and the max no of columns supported is 90.
    (I never faced any issue related to no of columns as it worked fine for columns >90 too)
    Issue occured when row size of exported data gets more than 1023 character.
    Therefore the row data must not exceed 1023 character, otherwise column splits and moves to next row.
    One additional aspect generally missed is that:
    When data in any particular column changes it's length, alv header also changes its lengh (short text, medium text, long text; depending on the length of of the longest cell in the column)
    therefore even if you have total length of row less than 1023 character, there might be cases when your ALV header size exceeds this length.
    Hopefully it will be helpful for you too.
    Regards,
    Parveen

  • Problem in ALV layout ...urgent

    Hi,
    I am using transction VL06C which displays the ALV list. The strucute used by standard program for ALV is LIPOV. There is one include available for customer fields LIPOVZ.
    I have inculded my Z structure to it and new field i added is shipmet number. Now i can see the shipment number in the layout of ALV list as hidden field. So I automatically got this field in my ALV list.
    Now today I added one more filed quantity to my Z structure. But I cant see that field in my Layout of ALV.
    When I debugg I can see the field is getting populated correctly in user exit. Also in Field catalog.
    But can not see in Layout when I am trying to change the ALV layout. I can see only Ship. Number
    Please suggest.

    Hi Vinit,
    I think you may have copied the fieldcatalog structure from your previous fields.
    Check whether this line has been added for the field.
    clear wa_fieldcat.
          wa_fieldcat-fieldname     = 'MTART'(060).
          wa_fieldcat-seltext_l     = 'Mat. Type '(024).
          wa_fieldcat-ddictxt       = c_long.     
    *     Hide the column
            *wa_fieldcat-no_out      =  c_x.*    
    append wa_fieldcat to i_fieldcat.
    . Sorry if iam wrong.

  • ALV layout variant missing in background job.

    hi guys,
    Having problem on getting the default ALV layout variant when run the job in backgorund. Please advise any correction needed in the following code.
    Thanks.
    *&  Include           Z_MM_KBR_AGSUBCONINV_MOD2                        *
    MODULE status_0100 OUTPUT.
      SET PF-STATUS '100'.
      SET TITLEBAR '100'.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    *&      Module  display_data  OUTPUT
          text
    MODULE display_data OUTPUT.
    IF sy-batch IS INITIAL. "Foreground
      IF w_container IS INITIAL.
        IF cl_gui_alv_grid=>offline( ) IS INITIAL.
    *Creating the container
          CREATE OBJECT w_container
            EXPORTING
              container_name              = c_container
            EXCEPTIONS
              cntl_error                  = 1
              cntl_system_error           = 2
              create_error                = 3
              lifetime_error              = 4
              lifetime_dynpro_dynpro_link = 5
              OTHERS                      = 6.
          IF sy-subrc <> 0.
         MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
          ENDIF.
        ENDIF.
    *Creating the ALV GRID
        CREATE OBJECT w_grid
          EXPORTING
            i_parent          = w_container
            i_appl_events     = c_check
          EXCEPTIONS
            error_cntl_create = 1
            error_cntl_init   = 2
            error_cntl_link   = 3
            error_dp_create   = 4
            OTHERS            = 5.
        IF sy-subrc <> 0.
         MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
        else.
         exit.
        ENDIF.
      ELSE.
    *Creating the ALV GRID
        CREATE OBJECT w_grid
          EXPORTING
            i_parent          = go_dock_container
            i_appl_events     = c_check
          EXCEPTIONS
            error_cntl_create = 1
            error_cntl_init   = 2
            error_cntl_link   = 3
            error_dp_create   = 4
            OTHERS            = 5.
        IF sy-subrc <> 0.
          WRITE:/ 'Error in grid'.
        ENDIF.
         CREATE OBJECT w_grid
          EXPORTING  i_parent = go_dock_container.
      ENDIF.
    *getting the variant option
        wa_variant-report     = sy-repid.
        wa_variant-username   = sy-uname.
        wa_layout-grid_title  = sy-title.
        wa_layout-cwidth_opt  = c_check.
        wa_layout-zebra       = c_check.
        wa_layout-no_f4       = c_check.
        wa_layout-sel_mode    = 'D'.
    *Excluding the unwanted buttons
         PERFORM exclude_toolbar_buttons.
    build field catalog.
        CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
          EXPORTING
            i_buffer_active        = c_check
            i_structure_name       = c_fcat_str
            i_bypassing_buffer     = c_check
          CHANGING
            ct_fieldcat            = t_fieldcat
          EXCEPTIONS
            inconsistent_interface = 1
            program_error          = 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.
        loop at t_fieldcat into w_fieldcat.
         if w_fieldcat-FIELDNAME = 'AGING1'.
          W_FIELDCAT-NO_ZERO = 'X'.
          MODIFY t_fieldcat FROM W_FIELDCAT INDEX SY-TABIX.
         ENDIF.
        endloop.
    Generate sort critria
        PERFORM generate_sort.
    Create object of class lcl_event_receiver.
        CREATE OBJECT w_event.
    Handler for events.
       SET HANDLER w_event->handle_top_of_page       FOR w_grid.
       SET HANDLER w_event->handle_print_top_of_page FOR w_grid.
       SET HANDLER w_event->handle_print_end_of_list FOR w_grid.
        SET HANDLER w_event->handle_hotspot_click     FOR w_grid.
    *Displaying the alv
       IF NOT sy-batch IS INITIAL.
         PERFORM create_snp.
       ENDIF.
    t_data = i_final.
        CALL METHOD w_grid->set_table_for_first_display
          EXPORTING
            i_save                        = 'A'
            is_layout                     = wa_layout
            is_variant                    = wa_variant
          CHANGING
            it_outtab                     = t_data
            it_fieldcatalog               = t_fieldcat
          EXCEPTIONS
            invalid_parameter_combination = 1
            program_error                 = 2
            too_many_lines                = 3
            OTHERS                        = 4.
        IF sy-subrc <> 0.
        ENDIF.
    ENDIF.
    ENDIF.
    ENDMODULE.                 " display_data  OUTPUT
    *&      Module  user_command_0100  INPUT
          text
    MODULE user_command_0100 INPUT.
      DATA: lt_rows TYPE lvc_t_row,
             w_rows TYPE lvc_s_row.
      CASE sy-ucomm.
        WHEN c_back.
          LEAVE TO SCREEN 0.
        WHEN c_exit.
          LEAVE TO SCREEN 0.
        WHEN c_cancel.
          LEAVE TO SCREEN 0.
       WHEN 'BILDET'.
         CALL METHOD w_grid->get_selected_rows
           IMPORTING
             et_index_rows = lt_rows.
         CALL METHOD cl_gui_cfw=>flush.
         IF sy-subrc EQ 0.
           READ TABLE lt_rows INTO w_rows INDEX 1.
           READ TABLE i_vbfa INTO w_vbfa INDEX w_rows-index.
           IF sy-subrc EQ 0.
             CLEAR i_zbw_br_nf4.
             LOOP AT i_zbw_br_nf3 INTO w_zbw_br_nf3 WHERE
                         refkey = w_vbfa-v_vbeln.
               APPEND w_zbw_br_nf3 TO i_zbw_br_nf4.
             ENDLOOP.
    call dialog screen and display new alv control
             CALL SCREEN 101 STARTING AT 10 5.
           ENDIF.
         ENDIF.
         WHEN 'NOTAF'.
         CALL METHOD w_grid->get_selected_rows
           IMPORTING
             et_index_rows = lt_rows.
         CALL METHOD cl_gui_cfw=>flush.
         IF sy-subrc EQ 0.
           READ TABLE lt_rows INTO w_rows INDEX 1.
           READ TABLE i_zbw_br_nf3 INTO w_zbw_br_nf3 INDEX w_rows-index.
           DATA docnum LIKE j_1bdydoc-docnum.
           docnum = w_zbw_br_nf3-docnum.
           SET PARAMETER ID 'JEF' FIELD docnum.
           CALL TRANSACTION 'J1B3N' AND SKIP FIRST SCREEN.
         ENDIF.
      ENDCASE.
      ENDMODULE.                 " user_command_0100  INPUT
    *&      Form  modify_col_name
          text
         -->P_<FCAT>  text
         -->P_TEXT_H01  text
    FORM modify_col_name  USING  pwa_fcat TYPE lvc_s_fcat
                                 value(pw_text) TYPE any.
      pwa_fcat-coltext   = pw_text.
      pwa_fcat-scrtext_l = pw_text.
      pwa_fcat-scrtext_m = pw_text.
      pwa_fcat-scrtext_s = pw_text.
    ENDFORM.                    " modify_col_name
          FORM display_hotspot                                          *
    FORM display_hotspot USING pw_row_id    TYPE lvc_s_row
                               pw_column_id TYPE lvc_s_col.
      FIELD-SYMBOLS <l_data> TYPE zbrforecast.
    READ TABLE t_br_nf_acum ASSIGNING <l_data> INDEX pw_row_id-index.
    CHECK sy-subrc = 0.
    IF pw_column_id = ' '.
    ENDIF.
    ENDFORM.                    "display_hotspot
    *&      Form  generate_sort
          Genereate Sort criteria
    FORM generate_sort.
    Local variables
    DATA: wal_sort TYPE lvc_s_sort,
           wl_pos   TYPE numc2.
    wl_pos = 01.
    sort ORDER
    wal_sort-spos      = wl_pos.
    wal_sort-fieldname = c_aufnr.
    wal_sort-up        = c_check.
    APPEND wal_sort TO t_sort.
    ENDFORM.                    "generate_sort
    *&      Form  f4_variant
          text
         <--PW_VARI  text
    FORM f4_variant CHANGING pw_vari TYPE disvariant-variant.
    wa_variant-report = sy-cprog.
      CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
        EXPORTING
          is_variant    = wa_variant
          i_save        = c_u
        IMPORTING
          es_variant    = wa_variant
        EXCEPTIONS
          not_found     = 1
          program_error = 2
          OTHERS        = 3.
      IF sy-subrc IS INITIAL.
        pw_vari = wa_variant-variant.
      ELSE.
        MESSAGE s208(00) WITH text-t04.
      ENDIF.
    ENDFORM.                    " f4_variant
    *&      Form  validate_layout
    *This subroutine is to validate the layout
    No parameters are passed to this subroutine
    FORM validate_layout.
    IF NOT p_layout IS INITIAL.
      Check Layout
       wa_variant-report   = sy-repid.
       wa_variant-username = sy-uname.
       wa_variant-variant  = p_layout.
       CALL FUNCTION 'LVC_VARIANT_EXISTENCE_CHECK'
         EXPORTING
           i_save     = c_u
         CHANGING
           cs_variant = wa_variant
         EXCEPTIONS
           OTHERS     = 01.
       IF NOT sy-subrc IS INITIAL.
         SET CURSOR FIELD 'P_LAYOUT'.
         MESSAGE s001(00) WITH text-t06 p_layout.
         STOP.
       ENDIF.
    ELSE.
      clear wa_variant.
    ENDIF.
    ENDFORM.                    " validate_layout
    *&      Form  validate_data
          text
    FORM validate_data .
    PERFORM validate_layout.
    ENDFORM.                    " validate_data

    Hi,
    Before the call to method set_table_for_first_display, populate
    wa_variant-report = sy-repid.
    Best regards,
    Prashant

  • Problem in Blocked ALv's

    Hi,
    I have a requirement where i am supposed to display the employee details( Personal details, Education details and corporate details) in different blocks. I am using Blocked ALV for displaying the same, and displaying .
    But the problem is that i have to display the information in page by page - that is for every employee i have to display 3 blocks, and so on for all the employees given in the selection criteria. I am not able to do so.
    For a single employee i am using the following -
    1. 'REUSE_ALV_BLOCK_LIST_INIT'
    2. 'REUSE_ALV_BLOCK_LIST_APPEND' - 3 times for three blocks
    3. 'REUSE_ALV_BLOCK_LIST_DISPLAY' - for displaying the info.
    Regrds,
    Srini

    Hi this can help u,
    BLOCKED ALV REPORT.
    REPORT  ZCS_PRG21.
    TABLES: LFA1,EKKO.
    DATA:  BEGIN OF ITAB OCCURS 0,
           LIFNR LIKE LFA1-LIFNR,
           NAME1 LIKE LFA1-NAME1,
           ORT01 LIKE LFA1-ORT01,
           LAND1 LIKE LFA1-LAND1,
           REGIO LIKE LFA1-REGIO,
           END OF ITAB.
    DATA:  BEGIN OF JTAB OCCURS 0,
           LIFNR LIKE EKKO-LIFNR,
           EBELN LIKE EKKO-EBELN,
           BUKRS LIKE EKKO-BUKRS,
           BSTYP LIKE EKKO-BSTYP,
           EKORG LIKE EKKO-EKORG,
           BSART LIKE EKKO-BSART,
           END OF JTAB.
    SELECT * FROM LFA1 INTO CORRESPONDING FIELDS OF TABLE ITAB UP TO 5 ROWS.
    SELECT * FROM EKKO INTO CORRESPONDING FIELDS OF TABLE JTAB UP TO 5 ROWS.
    TYPE-POOLS: SLIS.
    DATA:  LAYOUT TYPE SLIS_LAYOUT_ALV,
           HEADER TYPE SLIS_T_LISTHEADER WITH HEADER LINE,
           FLDCAT1 TYPE SLIS_T_FIELDCAT_ALV,
           FLDCAT2 TYPE SLIS_T_FIELDCAT_ALV,
           EVE1 TYPE SLIS_T_EVENT WITH HEADER LINE,
           EVE2 TYPE SLIS_T_EVENT WITH HEADER LINE.
    LAYOUT-ZEBRA = 'X'.
    LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
    LAYOUT-WINDOW_TITLEBAR = 'BLOCKED ALV'.
    EVE2-NAME = 'TOP_OF_PAGE'.
    EVE2-FORM = 'TOP_OF_PAGE1'.
    APPEND EVE2.
    CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
    EXPORTING
       I_LIST_TYPE           = 0
    IMPORTING
       ET_EVENTS             = EVE1[]
    EXCEPTIONS
      LIST_TYPE_WRONG       = 1
      OTHERS                = 2
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    READ TABLE EVE1 WITH KEY NAME = 'TOP_OF_PAGE'.
    EVE1-FORM = 'TOP_OF_PAGE'.
    MODIFY EVE1 TRANSPORTING FORM WHERE NAME = 'TOP_OF_PAGE'.
    CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
      EXPORTING
        I_CALLBACK_PROGRAM             = SY-REPID
      I_CALLBACK_PF_STATUS_SET       = ' '
      I_CALLBACK_USER_COMMAND        = ' '
      IT_EXCLUDING                   =
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
       I_PROGRAM_NAME               = SY-REPID
       I_INTERNAL_TABNAME           = 'ITAB' “it must be in capital letters, otherwise gives “no-fieldcatalog” is found
      I_STRUCTURE_NAME             =
      I_CLIENT_NEVER_DISPLAY       = 'X'
       I_INCLNAME                   = SY-REPID
      I_BYPASSING_BUFFER           =
      I_BUFFER_ACTIVE              =
      CHANGING
        CT_FIELDCAT                  = FLDCAT1
    EXCEPTIONS
      INCONSISTENT_INTERFACE       = 1
      PROGRAM_ERROR                = 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.
    CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
      EXPORTING
        IS_LAYOUT                        = LAYOUT
        IT_FIELDCAT                      = FLDCAT1
        I_TABNAME                        = 'ITAB'
        IT_EVENTS                        = EVE1[]
      IT_SORT                          =
      I_TEXT                           = ' '
      TABLES
        T_OUTTAB                         = ITAB
    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.
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
       I_PROGRAM_NAME               = SY-REPID
       I_INTERNAL_TABNAME           = 'JTAB'
      I_STRUCTURE_NAME             =
      I_CLIENT_NEVER_DISPLAY       = 'X'
       I_INCLNAME                   = SY-REPID
      I_BYPASSING_BUFFER           =
      I_BUFFER_ACTIVE              =
      CHANGING
        CT_FIELDCAT                  = FLDCAT2
    EXCEPTIONS
      INCONSISTENT_INTERFACE       = 1
      PROGRAM_ERROR                = 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.
    CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
      EXPORTING
        IS_LAYOUT                        = LAYOUT
        IT_FIELDCAT                      = FLDCAT2
        I_TABNAME                        = 'JTAB'
        IT_EVENTS                        = EVE2[]
      IT_SORT                          =
      I_TEXT                           = ' '
      TABLES
        T_OUTTAB                         = JTAB
    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.
    CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'
    EXPORTING
      I_INTERFACE_CHECK             = ' '
      IS_PRINT                      =
      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        =
    EXCEPTIONS
      PROGRAM_ERROR                 = 1
      OTHERS                        = 2
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    FORM TOP_OF_PAGE.
    REFRESH HEADER.
    HEADER-TYP = 'H'.
    HEADER-INFO = 'VENDOR DETAILS'.
    APPEND HEADER.
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
      EXPORTING
        IT_LIST_COMMENTARY       = HEADER[]
      I_LOGO                   =
      I_END_OF_LIST_GRID       =
      I_ALV_FORM               =
    ENDFORM.
    FORM TOP_OF_PAGE1.
    REFRESH HEADER.
    HEADER-TYP = 'H'.
    HEADER-INFO = 'PURCHASE DOCUMENTS DETAILS'.
    APPEND HEADER.
    CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
      EXPORTING
        IT_LIST_COMMENTARY       = HEADER[]
      I_LOGO                   =
      I_END_OF_LIST_GRID       =
      I_ALV_FORM               =
    ENDFORM.
    if u want more then try by adding the function modules
    'REUSE_ALV_BLOCK_LIST_APPEND' and 'REUSE_ALV_FIELDCATALOG_MERGE'
    reward points,if it is useful.
    thank you,
    chandu.

  • Doubt in alv layout variant.

    hi experts,
    I have a requirement that my selection screen should have 'ALV LAYOUT' as one of my parameter. I am using PNPCE LDB , now my issue is I can get the layout option when f4 is press on the alv layout parameter but the respective layout is not displaying in my output.
    ex: I have  layout A and  B .
    A have only pernr and name
    b have only pernr and address
    my normal alv layout is  pernr name and address. if i choose A in my ALV LAYOUT parameter also its displaying in default layout alv same is happening for while am choosing B. I  not getting the alv output for respective layout I chosen.
    {code}
    FORM GET_VARIANT .
    DATA: lw_variant TYPE disvariant,
       l_exit     TYPE char1.
       lw_variant-report = sy-repid.
       CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
         EXPORTING
           is_variant = lw_variant
           i_save     = 'A'
         IMPORTING
           e_exit     = l_exit
           es_variant = lw_variant
         EXCEPTIONS
           not_found  = 2.
       IF sy-subrc = 2.
         MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno
         WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
       ELSE.
         IF l_exit EQ space.
           p_layout = lw_variant-variant.
           IF NOT p_layout IS INITIAL.
             PERFORM get_w_variant.
           ENDIF.
         ENDIF.
       ENDIF.
    ENDFORM.                    " GET_VARIANT
    *&      Form  GET_W_VARIANT
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM GET_W_VARIANT .
       DATA: lw_variant TYPE disvariant.
       lw_variant-report      = sy-repid.
       lw_variant-handle      = space.
       lw_variant-log_group   = space.
       lw_variant-username    = space.
       lw_variant-variant     = p_layout.
       lw_variant-text        = space.
       lw_variant-dependvars  = space.
    ENDFORM.                    " GET_W_VARIANT
    *&      Form  ALV_DISPLAY
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM ALV_DISPLAY .
    *  DATA: l_table      TYPE REF TO cl_salv_table.
    *  TRY.
    *  CALL METHOD CL_SALV_TABLE=>FACTORY
    **    EXPORTING
    **      LIST_DISPLAY   = IF_SALV_C_BOOL_SAP=>FALSE
    **      R_CONTAINER    =
    **      CONTAINER_NAME =
    *    IMPORTING
    *      R_SALV_TABLE   =  L_TABLE
    *    CHANGING
    *      T_TABLE        = GT_ALV
    *   CATCH CX_SALV_MSG .
    *  ENDTRY.
    *   l_table->display( ).
       DATA: lw_variant TYPE disvariant.
    DATA:I_FIELD TYPE SLIS_T_FIELDCAT_ALV,
          iWA  TYPE SLIS_FIELDCAT_ALV.
       IWA-FIELDNAME = 'PERNR'.
       IWA-SELTEXT_L = 'EMPLOYEE ID'.
       APPEND IWA TO i_FIELD.
       IWA-FIELDNAME = 'NAME'.
       IWA-SELTEXT_L = 'NAME'.
       APPEND IWA TO I_FIELD.
       IWA-FIELDNAME = 'DEPT'.
       IWA-SELTEXT_L = 'DEPT'.
       APPEND IWA TO I_FIELD.
       IWA-FIELDNAME = 'UNION'.
       IWA-SELTEXT_L = 'UNION'.
       APPEND IWA TO I_FIELD.
    CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
       EXPORTING
         i_callback_program      = 'ZTESTPRGFOR20' "Program name
         i_callback_user_command = 'USER_COMMAND'
         it_fieldcat             = i_field
    *    it_sort                 = i_sort
         i_save                  = 'X'
         is_variant              = Lw_variant
       TABLES
         t_outtab                 = GT_ALV                       
       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.                    " ALV_DISPLAY
    {code}

    hi Mohammed Quddus,
    thanks for your reply . but if you look at my code the concept are same as same as that link code.
    am getting all the things right.
    i Can able to change the layout by the button on alv and
    able to save that new layout
    the saved layout are displaying in the my parameter if I press f4. the problem is if I choose the saved layout that layout is not coming in my alv output always its showing default layout.
    if anything you find wrong in my code please let me know.

  • ME57 transaction with possibility to show in ALV layout

    Hi experts,
    I need change the alv grid in  the transaction ME57. To this, I copied the program RM06BZ00 (scree, includes... )
    When I try execute the program with ALV layout the message ''Scope of list ALV not defined (please correct)" shows.
    To resolve this problem I change the parameter im_service in the ME_REP_GET_TABLE_MANAGER function (Way to function: program ZSAPFM06B / include ZFM06BF04 / Include ZFM06BF04_PRUEFEN_LSTUB)
    When I change this parameter on Debug (manual change) the ALV shows correctly, but when I change in program code the message remains.
    How the way to copy the Me57 transaction with possibility to show in ALV layout?
    Follows the code change:
        CALL FUNCTION 'ME_REP_GET_TABLE_MANAGER'
          EXPORTING
            im_service = 'RM06BZ00'
            im_scope   = l_scope
          IMPORTING
            ex_manager = gf_factory.
    Thank you!
    Edited by: Andréa Molina on Aug 4, 2011 5:12 PM
    Edited by: Rob Burbank on Aug 5, 2011 9:22 AM

    I solved my own problem...
    The change in im_service was right.
    The problem is that:
    The gf_factory back empty in some places and in standrad transaction back with values. The memory clean the gf_factory result.
    So... the only way to show ALV is fill the gf_factory in anywhere the gf_factory is check.
    The places are:
    1. sapfm06b - fm06bf04 - fm06bf04_pruefen_lstub
         Call in RM06BZ00 - perform pruefen_lstub(sapfm06b) using p_lstub.
    2. sapfm06b - fm06bfsl - fm06bfsl_ban_aufbauen
        Call in RM06BZ00 - ban_aufbauen(sapfm06b).
    3. sapfm06b - fm06bf01- fm06bf01_submit
       Call in RM06BZ00 - perform   perform submit(zgb_sapfm06b) using sucomm.
    If the gf_factory is filled in this places... The ALV will show!

Maybe you are looking for

  • Hooking iPod to aux outlet in Honda Ridgeline

    I have the 5th gen iPod (60 gig). My Honda truck came with an aux audio jack in the glovebox area. Is there an Apple/3rd party cable available or do I have to pay Honda $214 for their install? Thanks.

  • Query Creation

    Dear All , This is regarding Query Creation. I want to create Query by Joinging Two tables. I have created User Group, Created Infoset, Now am creating Query by SQ01. Going Step by step correctly. I have Tick mark on Field group and selected . Then B

  • URGENT : Converting Smartform  into different languages

    HI ALL, Any one has idea about how to convert the smartform to required language,I am trying to convert smartform language Engilsh to Sweden. When i logon to Swden language and converting the EN smartform to SV,its not changed ,how to solve this issu

  • HT1688 I can't set up my iphone 3GS correctly

    I had to restore my iphone last night and when it was done restoring i could not set it up.

  • Trouble with the cursor precision.

    Coming from CS2 on Leopard to CS4 on new MacBook Pro with Snow Leopard.  I have tried everything in PS Preferences to get the cursor to represent what the brush is painting.  For example,  when I am masking with the brush tool selected, the masked ar