Junk values in Excel for ALV output

Hello
I have developed a FM based (not OOPS) ALV and its giving output/report, fine.
But, when user want to get it into excel, then,
1) If user selects the CntrlShiftF7 - Microsoft Excle icon - I am getting just blank excel opened on my SAP GUI, i did not see any data on the excel, its just blank excel
2) If user selects the Local file - CntrlShiftF9 - and then selects the Spreadsheet radio button (selected the encoding as 000000): Then, user getting some junk (########) values in the saved excel, like for Invoice number, Date fields/columns.
We are on ECC 6.0 with windows 7
Thank you

Hi,
I tried the same code page which is used in the example... but no luck.
Regards,
Vinay

Similar Messages

  • Subtotal problem in Export Excel from ALV Output

    Subtotal displays correct in alv output, but if i do the export excel , that subtotal value is changed in excel sheet.
    is it possible to solve this problem.

      DATA: lo_grid TYPE REF TO cl_gui_alv_grid.
    ** get the global reference 
    CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
        IMPORTING    
        e_grid = lo_grid.
    ** get the subtotal
    DATA: it_01 TYPE REF TO data.
    *  CALL METHOD lo_grid->get_subtotals 
      IMPORTING    
      ep_collect01 = it_01.
    ** change the data 
    FIELD-SYMBOLS: <ft_tab> TYPE ANY TABLE, 
                   <fs_tab> TYPE ANY,   
                 <ff_field> TYPE ANY.
    ASSIGN it_01->* TO <ft_tab>.
    LOOP AT <ft_tab> ASSIGNING <fs_tab>. 
      ASSIGN COMPONENT 'PER' OF STRUCTURE <fs_tab> TO <ff_field>. 
      <ff_field> = '100'.
    ENDLOOP.
    ** Refresh the table display 
    CALL METHOD lo_grid->refresh_table_display  
    EXPORTING         
    i_soft_refresh = 'X'.

  • Page-break in alv background job for alv output variant not coming correctl

    Hi,
    I have created an ALV grid report. When i run the report in background i get the output with correct page-break on FIELD1. Now when i run the report in background with an "ALV output variant" (its the ALV variant that controls the fields display in the output; this is not the program variant), i do not get the page-break on FIELD1.  I have already build the sort criteria and using:
    gs_sort-group = '* '.     "New-Page
    Please let me know what could be reason for not getting the page-break in background when i am using the alv output variant and how do i correct this problem.
    Regards,
    Rakesh

    Hello Everyone,
    I have solved the problem. While running the program in background, we get the page-breaks when we use the below part of code in the sort catalogue with the condition that the program variant should not use any ALV layout variant.
    gs_sort-group = '* '.     "New-Page
    If you are using the ALV layout variant in the program variant then we can check the ROWPOS, COLPOS, and NO_OUT for that ALV layout variant and pass them along in the fieldcatalog table. You should be careful with not to pass the layout variant in the DISVARIANT. You can notice that i have cleared it and simply passing the program name into that.
    *C-- Process separately for jobs running in Background. Actually
    *C-- sortcat-group solves the problem only in Foreground. In background
    *C-- when ALV layout variant is not selected then it works otherwise it
    *C-- fails. So for background jobs we are reading the fieldcat and then
    *C-- passing the same in the display FM.
      IF sy-batch = 'X'.
        CALL FUNCTION 'REUSE_ALV_VARIANT_SELECT'
          EXPORTING
           i_dialog                  = ' '
           i_user_specific           = ' '
           i_default                 = ' '
    *   I_TABNAME_HEADER          =
    *   I_TABNAME_ITEM            =
            it_default_fieldcat       = gt_fieldcat
            i_layout                  = gs_layout
    *   I_BYPASSING_BUFFER        =
    *   I_BUFFER_ACTIVE           =
         IMPORTING
    *   E_EXIT                    =
           et_fieldcat               = lt_fieldcat
    *     et_sort                   = gt_sort[]
    *   ET_FILTER                 =
    *     es_layout                 = gs_layout
         CHANGING
           cs_variant                = gs_disvariant
         EXCEPTIONS
           wrong_input               = 1
           fc_not_complete           = 2
           not_found                 = 3
           program_error             = 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.
        CLEAR gs_fieldcat.
        LOOP AT gt_fieldcat INTO gs_fieldcat.
    *C-- Transfer all position changes to gt_fieldcat from lt_fieldcat
          CLEAR ls_fieldcat.
          READ TABLE lt_fieldcat
                INTO ls_fieldcat
                WITH KEY fieldname = gs_fieldcat-fieldname.
          IF sy-subrc = 0.
            gs_fieldcat-row_pos = ls_fieldcat-row_pos.
            gs_fieldcat-col_pos = ls_fieldcat-col_pos.
            gs_fieldcat-no_out = ls_fieldcat-no_out.
            MODIFY gt_fieldcat FROM gs_fieldcat INDEX sy-tabix.
            CLEAR gs_fieldcat.
          ENDIF.
        ENDLOOP.
    *C-- Clear the disvariant for the background job as it contains the ALV
    *C-- layout varinat
        CLEAR gs_disvariant.
        gs_disvariant-report = 'ZGPPMP0001'.
    Then pass gt_fieldcat to 'REUSE_ALV_GRID_DISPLAY'.
    The reason i'm doing it this way is that when we pass the layout variant name, the contents in gt_fieldcat were getting modified.
    One more thing i'd like to point out is that that, i tried to delete the fields with no_out = 'x'. Now when i ran the program in background with all the fields in sort catalog (suppose there are 2 fields field1 and field2) also in fieldcatalog it ran fine. In the next run in background i removed one of the fields in sort catalog from the fieldcatalog (delete the fields with no_out = 'x') and i got dump. Basically i had hidden field1 and so the code which was deleting fields with no_out = 'x' deleted this field from gt_fieldcat. So basically we should not delete fields with no_out = 'x'.
    I was getting ABAP runtime errors    MESSAGE_TYPE_X in the following part of the standard code.
    000310     LOOP AT CT_SORT INTO LS_SORT.
    000320
    000330       READ TABLE IT_FIELDCAT ASSIGNING <LS_FIELDCAT>
    000340            WITH KEY FIELDNAME = LS_SORT-FIELDNAME BINARY SEARCH.
    000350       IF SY-SUBRC NE 0.
         >         MESSAGE X000(0K).
    000370       ENDIF.
    000380
    000390       LS_SORT-SELTEXT = <LS_FIELDCAT>-SELTEXT.
    i have just mentioned this part because when i checked the forum many people were getting such errors "MESSAGE_TYPE_X". This could also be one of the reasons.

  • EHP6 to EHP7 Upgrade Issue: Junk Values are showing for BW data source

    Hi,
      We are upgrading ECC from EHP6 to EHP7. We have custom data source which is build on custom Info set and Info set is built on Pooled table ZXXX. Datasource is showing the junk values in RSA3 after upgrade. I have re-generated the Info set and tested but no use. Below is the RSA3 data screen shot. Can anyone suggest me to oversome this?
    Thanks,
    Prasad

    Hi Prasad,
    Few things to check:
    1. Pooled table data for which the datasource is created.
    2. Reactivate the extract structure - check the dataelement also for date.
    3. Is there any custom code present in Infoset? - if yes then it may be possible that dates are being calculated in that custom code and wrong format is being used there.
    Thanks
    Amit

  • Regarding downloading data into excel from alv output

    hi experts,
    i have developed a customized report(ALV) in which the employee number and all details are coming but when i press
    download to excel button and get downloaded it to the excel sheet the employee number is only not coming but all details are coming in the excel sheet.please help me to short out this problem.
    Also what i found that when i press print preview button then employee number here is also not coming but rest
      of the details are coming.

    Hi Ravi,
               For downloading the data from ALV to Excel use the following FM's
    SAP_CONVERT_TO_XLS_FORMAT
    GUI_DOWNLOAD.
    In the function GUI_DOWNLOAD use the filetype as "DBF" due to which all the data gets downloaded perfectly.
    CALL FUNCTION 'GUI_DOWNLOAD'
        EXPORTING
          filename                        = fname
          FILETYPE                        = 'DBF'
        APPEND                          = ' '
        WRITE_FIELD_SEPARATOR           = ' '
        HEADER                          = '00'
        TRUNC_TRAILING_BLANKS           = ' '
        WRITE_LF                        = 'X'
        COL_SELECT                      = ' '
        COL_SELECT_MASK                 = ' '
        DAT_MODE                        = ' '
        CONFIRM_OVERWRITE               = ' '
        NO_AUTH_CHECK                   = ' '
        CODEPAGE                        = ' '
        IGNORE_CERR                     = ABAP_TRUE
        REPLACEMENT                     = '#'
        WRITE_BOM                       = ' '
        TRUNC_TRAILING_BLANKS_EOL       = 'X'
        WK1_N_FORMAT                    = ' '
        WK1_N_SIZE                      = ' '
        WK1_T_FORMAT                    = ' '
        WK1_T_SIZE                      = ' '
        WRITE_LF_AFTER_LAST_LINE        = ABAP_TRUE
      IMPORTING
        FILELENGTH                      =
        tables
          data_tab                        =  itab
        FIELDNAMES                      =
      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.
    Pls reward if useful.
    Thanks,
    Sirisha.

  • Tranlation of text 'Export nach Excel' for ALV in WD ABAP

    Hi,
    I've created a WD that uses an ALV component. The problem I have is related to standar ALV texts. There are several buttons in the ALV header but just one is important in this case. The one is 'Export nach Excel'.
    I execute the WD for Spanish language but this text always appears in German. The funny thing is that if I execute in English the text appears translated in English. Spanish language is loaded in the system so this is not the problem.
    I've tried to find this 'Expot nach Excel' text in Se63 but without success. Also I had a look to table LTDXT with no luck.
    Any ideas where I can find this text and translate it into Spanish?
    Thanks.

    Hi,
    there might be incomplete language transports in your system or other things. But first you could position the cursor on the button in the application and then press F1. Then the help information is displayed together with the technical information where you should see the technical info about the object.
    Regards, Heidi

  • Dynamic internal table for ALV output

    Hi,
    I am looking for a simple & efficient sample code for an ALV report output with dynamic columns. Can someone please help!
    Thanks,
    JS

    Here is a small example. This is pretty old code, and it uses the FM approach.
    report zrich_0001.
    type-pools: slis.
    field-symbols: <dyn_table> type standard table,
                   <dyn_wa>.
    data: it_alvfc type slis_t_fieldcat_alv,
          wa_alvfc type slis_fieldcat_alv,
          it_fldcat type lvc_t_fcat,
          wa_fldcat type lvc_s_fcat.
    selection-screen begin of block b1 with frame title text-001.
    parameters: p_flds(5) type c.
    selection-screen end of block b1.
    start-of-selection.
    * build the dynamic internal table
      perform build_dyn_itab.
    * write 5 records to the alv grid
      do 5 times.
        perform build_report.
      enddo.
    * call the alv grid.
      perform call_alv.
    *  Build_dyn_itab
    form build_dyn_itab.
    * Create the dynamic internal table
      data: new_table type ref to data,
            new_line  type ref to data.
    * Create fields .
      do p_flds times.
        clear wa_fldcat.
        wa_fldcat-fieldname = sy-index.
        wa_fldcat-datatype  = 'CHAR'.
        wa_fldcat-intlen    = 5.
        append wa_fldcat to it_fldcat .
      enddo.
    * Create dynamic internal table and assign to FS
      call method cl_alv_table_create=>create_dynamic_table
                   exporting
                      it_fieldcatalog = it_fldcat
                   importing
                      ep_table        = new_table.
      assign new_table->* to <dyn_table>.
    * Create dynamic work area and assign to FS
      create data new_line like line of <dyn_table>.
      assign new_line->* to <dyn_wa>.
    endform.
    Have to split this code into two postings to keep formatting.
    Regards,
    Rich Heilman
    Edited by: Rich Heilman on Jun 23, 2009 11:59 AM

  • PS report S_ALR_87013558 - add layout for alv output

    Hi Friends
    In Standard report of PS S_ALR_87013558 I hav to add a selection screen field for selecting layout and accordingly the ALV layout will be displayed. Can it be achieved by enhancing, or we need to copy the report and modify and configure or is there any other way to do it.
    Thanks
    Moumita

    Hi,
    I think that can be achived through the dynamic selections to add fields to the dynamic selector you check the transaction CATS_SELVIEW press f4 on name of view and select standard then display you can see all functional groups, tables, table fields. Assign the respective according to your critaria.

  • Reg. ALV output transported into Excel

    Dear All,
                   when i transported my ALV report output to excel file , amount column is suppressed from decimal places .
    i.e. in excel file ,  decimal values of amount column is not shown in some amounts.
    Please provide some inputs
    Thanks & Regards
    shailesh

    Hi ,
    Check this [LINK|ALV List output to Excel file; for  ALV output transported into Excel.
    hope it will help you .
    Regards,
    Saravana.S

  • Transpose ALV output format in Vertical

    Hi ,
      I want to transpose the ALV output. For this i have coded like below, but there is no output displaying.Please check the below code & advise me where to write our own fielcatalog & how to write the fieldcatogue.
    TABLES:EKKO,EKPO.
    TYPE-POOLS: SLIS.
    TYPES:BEGIN OF PH_TY,
    PH_EBELN LIKE EKKO-EBELN,
    PH_AEDAT LIKE EKKO-AEDAT,
    PH_LIFNR LIKE EKKO-LIFNR,
    PH_SUBMI LIKE EKKO-SUBMI,
    PH_EKORG LIKE EKKO-EKORG,
    END OF PH_TY.
    DATA: PH_ITAB TYPE STANDARD TABLE OF PH_TY.
    DATA: L_COL TYPE SY-TABIX,
          L_STRUCTURE TYPE REF TO DATA,
          L_DYNTABLE TYPE REF TO DATA,
          WA_LVC_CAT TYPE LVC_S_FCAT,
          LT_LVC_CAT TYPE LVC_T_FCAT,
          LT_FIELDCATALOGUE TYPE SLIS_T_FIELDCAT_ALV,
          WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV,
          LT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
          LT_LAYOUT TYPE SLIS_LAYOUT_ALV.
    FIELD-SYMBOLS : <HEADER> TYPE ANY,
                    <DYNHEADER> TYPE ANY,
                    <DYNDATA> TYPE ANY,
                    <LS_TABLE> TYPE ANY,
                    <DYNAMICTABLE> TYPE STANDARD TABLE,
                    <IT_TABLE> TYPE STANDARD TABLE.
    SELECTION-SCREEN:BEGIN OF BLOCK B1.
    SELECT-OPTIONS:P_EBELN FOR EKKO-EBELN,
                   P_LIFNR FOR EKKO-LIFNR,
                   P_MATNR FOR EKPO-MATNR.
    SELECTION-SCREEN END OF BLOCK B1.
    INITIALIZATION.
    START-OF-SELECTION.
      CREATE DATA L_DYNTABLE TYPE STANDARD TABLE OF PH_TY WITH NON-UNIQUE DEFAULT KEY.
      ASSIGN L_DYNTABLE->* TO <IT_TABLE>.
      SELECT EBELN AEDAT LIFNR SUBMI EKORG FROM EKKO
                      INTO TABLE <IT_TABLE> WHERE EBELN IN P_EBELN
                      AND LIFNR IN P_LIFNR.
      WA_LVC_CAT-FIELDNAME = 'COLUMNTEXT'.
      WA_LVC_CAT-REF_TABLE = 'LVC_S_DETA'.
      APPEND WA_LVC_CAT TO LT_LVC_CAT.
      WA_FIELDCAT-FIELDNAME = 'COLUMNTEXT'.
      WA_FIELDCAT-REF_TABNAME = 'LVC_S_DETA'.
      WA_FIELDCAT-KEY = 'X'.
      APPEND WA_FIELDCAT TO LT_FIELDCAT.
    *  WA_FIELDCAT-TABNAME = 'IT_TABLE'.
    *  WA_FIELDCAT-FIELDNAME = 'PH_EBELN'.
    *  WA_FIELDCAT-SELTEXT_M = 'PO'.
    *  APPEND WA_FIELDCAT TO LT_FIELDCAT.
    *  CLEAR WA_FIELDCAT.
      DESCRIBE TABLE <IT_TABLE>.
      DO
      SY-TFILL TIMES.
        WRITE SY-INDEX TO WA_LVC_CAT-FIELDNAME LEFT-JUSTIFIED.
        CONCATENATE 'VALUE' WA_LVC_CAT-FIELDNAME INTO WA_LVC_CAT-FIELDNAME.
        WA_LVC_CAT-REF_FIELD = 'VALUE'.
        WA_LVC_CAT-REF_TABLE = 'LVC_S_DETA'.
        APPEND WA_LVC_CAT TO LT_LVC_CAT.
        CLEAR WA_FIELDCAT.
        WA_FIELDCAT-FIELDNAME = WA_LVC_CAT-FIELDNAME.
        WA_FIELDCAT-REF_FIELDNAME = 'VALUE'.
        WA_FIELDCAT-REF_TABNAME = 'LVC_S_DETA'.
        APPEND WA_FIELDCAT TO LT_FIELDCAT.
      ENDDO.
      CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
        EXPORTING
          IT_FIELDCATALOG = LT_LVC_CAT
        IMPORTING
          EP_TABLE        = L_DYNTABLE.
      ASSIGN L_DYNTABLE->* TO <DYNAMICTABLE>.
      CREATE DATA L_STRUCTURE LIKE LINE OF <DYNAMICTABLE>.
      ASSIGN L_STRUCTURE->* TO <HEADER>.
      CREATE DATA L_STRUCTURE LIKE LINE OF <IT_TABLE>.
      ASSIGN L_STRUCTURE->* TO <LS_TABLE>.
      DESCRIBE TABLE LT_FIELDCATALOGUE.
      DO SY-TFILL TIMES.
        IF SY-INDEX = 1.
        READ TABLE LT_FIELDCATALOGUE INTO WA_FIELDCAT INDEX 1.
        ENDIF.
        ASSIGN COMPONENT 1 OF STRUCTURE <HEADER> TO <DYNHEADER>.
        IF SY-SUBRC NE 0. EXIT .ENDIF.
        READ TABLE LT_FIELDCATALOGUE INTO WA_FIELDCAT INDEX SY-INDEX.
        <DYNHEADER> = WA_FIELDCAT-SELTEXT_M.
        IF <DYNHEADER> IS INITIAL.
        <DYNHEADER> = WA_FIELDCAT-FIELDNAME.
        ENDIF.
        LOOP AT <IT_TABLE> INTO <LS_TABLE>.
          L_COL = SY-TABIX + 1.
          ASSIGN COMPONENT SY-INDEX OF STRUCTURE <LS_TABLE> TO <DYNDATA>.
          IF SY-SUBRC NE 0. EXIT .
          ENDIF.
          ASSIGN COMPONENT L_COL OF STRUCTURE <HEADER> TO <DYNHEADER>.
          IF SY-SUBRC NE 0.
          EXIT .
          ENDIF.
          WRITE <DYNDATA> TO <DYNHEADER> LEFT-JUSTIFIED.
        ENDLOOP.
        APPEND <HEADER> TO <DYNAMICTABLE>.
      ENDDO.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          IS_LAYOUT   = LT_LAYOUT
          IT_FIELDCAT = LT_FIELDCAT
        TABLES
          T_OUTTAB    = <DYNAMICTABLE>.

    Hi,
    Please go thorugh the below sample code , Commenting is done for your easy understanding.
    TYPE-POOLS: slis."*Declarations for ALV, dynamic table and col no for transpose
    DATA:    l_col    TYPE sy-tabix,
             l_structure   TYPE REF TO data,
             l_dyntable    TYPE REF TO data,
             wa_lvc_cat  TYPE lvc_s_fcat,
             lt_lvc_cat  TYPE lvc_t_fcat,
             lt_fieldcatalogue     TYPE slis_t_fieldcat_alv,
             wa_fieldcat TYPE slis_fieldcat_alv,
             lt_fieldcat TYPE slis_t_fieldcat_alv,
             lt_layout   TYPE slis_layout_alv."*Field symbols declarations
    FIELD-SYMBOLS :
      <header>    TYPE ANY,
      <dynheader> TYPE ANY,
      <dyndata>   TYPE ANY,
      <ls_table>      TYPE ANY,
      <dynamictable>      TYPE STANDARD TABLE,
      <it_table> TYPE STANDARD TABLE."*Input the name of the table
    PARAMETERS p_table TYPE dd02l-tabname OBLIGATORY."*Initialization event
    INITIALIZATION."*Start of selection event
    START-OF-SELECTION."* Create internal table of dynamic type
      CREATE DATA l_dyntable TYPE STANDARD TABLE OF (p_table)
                           WITH NON-UNIQUE DEFAULT KEY.
      ASSIGN l_dyntable->* TO <it_table>."*select statement to select data from the table as input into
    *our dynamic internal table.
    *Here i have restricted only till 5 rows.
    *You can set a variable and give no of rows to be fetched
    *The variable can be set in your select statement  SELECT * INTO CORRESPONDING FIELDS OF TABLE <it_table>
                   FROM (p_table) up to 5 rows."*Fieldcatalogue definitions
      wa_lvc_cat-fieldname = 'COLUMNTEXT'.
      wa_lvc_cat-ref_table = 'LVC_S_DETA'.
      APPEND wa_lvc_cat TO lt_lvc_cat.  wa_fieldcat-fieldname = 'COLUMNTEXT'.
      wa_fieldcat-ref_tabname = 'LVC_S_DETA'.
      wa_fieldcat-key  = 'X'..
      APPEND wa_fieldcat TO lt_fieldcat.  DESCRIBE TABLE <it_table>.  DO sy-tfill TIMES.
      For each line, a column 'VALUEx' is created in the fieldcatalog
      Build Fieldcatalog
        WRITE sy-index TO wa_lvc_cat-fieldname LEFT-JUSTIFIED.
        CONCATENATE 'VALUE' wa_lvc_cat-fieldname
               INTO wa_lvc_cat-fieldname.
        wa_lvc_cat-ref_field = 'VALUE'.
        wa_lvc_cat-ref_table = 'LVC_S_DETA'.
        APPEND wa_lvc_cat TO lt_lvc_cat.
      Build Fieldcatalog
        CLEAR wa_fieldcat.
        wa_fieldcat-fieldname = wa_lvc_cat-fieldname.
        wa_fieldcat-ref_fieldname = 'VALUE'.
        wa_fieldcat-ref_tabname = 'LVC_S_DETA'.
        APPEND wa_fieldcat TO lt_fieldcat.
      ENDDO."* Create dynamic internal table
      CALL METHOD cl_alv_table_create=>create_dynamic_table
        EXPORTING
          it_fieldcatalog = lt_lvc_cat
        IMPORTING
          ep_table        = l_dyntable.  ASSIGN l_dyntable->* TO <dynamictable>."* Create structure as structure of the internal table
      CREATE DATA l_structure LIKE LINE OF <dynamictable>.
      ASSIGN l_structure->* TO <header>."* Create structure = structure of the internal table
      CREATE DATA l_structure LIKE LINE OF <it_table>.
      ASSIGN l_structure->* TO <ls_table>."* Create field catalog from our table structure
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
        EXPORTING
          i_structure_name       = p_table
        CHANGING
          ct_fieldcat            = lt_fieldcatalogue
        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.  DESCRIBE TABLE lt_fieldcatalogue."* Fill the internal to display <dynamictable>
      DO sy-tfill TIMES.
        IF sy-index = 1.
          READ TABLE lt_fieldcatalogue INTO wa_fieldcat INDEX 1.
        ENDIF.
      For each field of it_table
        ASSIGN COMPONENT 1 OF STRUCTURE <header> TO <dynheader>.
        IF sy-subrc NE 0. EXIT .ENDIF.
        READ TABLE lt_fieldcatalogue INTO wa_fieldcat INDEX sy-index.
      Fill 1st column
        <dynheader> = wa_fieldcat-seltext_m.
        IF <dynheader> IS INITIAL.
          <dynheader> = wa_fieldcat-fieldname.
        ENDIF."*Filling the other columns
        LOOP AT <it_table> INTO <ls_table>.
          l_col = sy-tabix + 1.
          ASSIGN COMPONENT sy-index OF STRUCTURE <ls_table> TO <dyndata>.
          IF sy-subrc NE 0. EXIT .ENDIF.
          ASSIGN COMPONENT l_col OF STRUCTURE <header> TO
    <dynheader>.
          IF sy-subrc NE 0. EXIT .ENDIF.
          WRITE <dyndata> TO <dynheader> LEFT-JUSTIFIED.
        ENDLOOP.
        APPEND <header> TO <dynamictable>.
      ENDDO."*Layout for ALV output
      lt_layout-zebra = 'X'.
      lt_layout-no_colhead = 'X'..
      lt_layout-colwidth_optimize ='X'.
      lt_layout-window_titlebar = 'ALV GRID TRANSPOSED'."*ALV Grid output for display
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          is_layout   = lt_layout
          it_fieldcat = lt_fieldcat
        TABLES
          t_outtab    = <dynamictable>.
    Regards,
    Arun

  • Newly added field not getting displayed in ALV output

    Hi All,
       I'm adding one more field/column to be displayed in an old existing program that uses REUSE_ALV_FIELDCATALOG_MERGE to generate the ALV fieldcat.
    DATA: BEGIN OF it_salary OCCURS 0,
            pernr LIKE pa0000-pernr,
            ename LIKE pa0001-ename,
            rtext like lv_rtext, -
    added field
            waers LIKE pa0008-waers
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
        EXPORTING
          i_program_name         = driver
          i_internal_tabname     = 'IT_SALARY'
          i_client_never_display = 'X'
          i_inclname             = driver
        CHANGING
          ct_fieldcat            = lv_fieldcat[]
        EXCEPTIONS
          inconsistent_interface = 1
          program_error          = 2
          OTHERS                 = 3.
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
        EXPORTING
          i_callback_program      = driver
          it_fieldcat             = lv_fieldcat[]
          i_default               = 'X'
          i_save                  = 'A'
          is_variant              = lv_tmplt
          is_layout               = lv_ls_layout
         i_callback_user_command = 'USER_COMMAND'
        TABLES
          t_outtab                = it_salary
        EXCEPTIONS
          program_error           = 1
          OTHERS                  = 2.
    The newly added field is not getting populated in the lv_fieldcat table. Tried running programs BALVBUFDEL,
    BCALV_BUFFER_DEL_SHARED then logging off and logging in but of no help.
    Please provide suggestion for this issue.
    Regards,
    Sridevi S

    Hi,
    Fieldcat is buffered - so use
    I_BYPASSING_BUFFER = 'X'
    Since a while CL_GUI_ALV_GRID is available which does NOT need any fieldcat (is determined internally using RTTI). It is worth playing around whith this class if you have some time. This class is recommended for ALV Output by SAP (but no edit is possible - was never supported officially).
    A simple use would be:
    data: gt_output type standard table of (adjust!).
    *simple ALV output
    data go_alv type ref to cl_salv_table.
    data go_functions type ref to cl_salv_functions_list.
    data go_columns type ref to cl_salv_columns_table.
    data go_column type ref to cl_salv_column_table.
    *Exceprion handlig
    data: go_exception  type ref to cx_root,
          gv_errortext   type string.
    ** fill table gt_output ...
    ** ALV output
    if not gt_output is initial.
        try.
            call method cl_salv_table=>factory
              importing
                r_salv_table = go_alv
              changing
                t_table      = gt_output.
          catch cx_salv_msg into go_exception.
            gv_errortext = go_exception->get_text( ).
            message gv_errortext type 'A'.
        endtry.
    * enable all standard ALV functions
        go_functions =  go_alv->get_functions( ).
        go_functions->set_all( ).
    * hide MANDT
        go_columns = go_alv->get_columns( ).
        go_column ?=  go_columns->get_column( columnname = 'MANDT' ).
        go_column->set_technical( ).
        go_alv->display( ).
    Kind regards,
    Holger

  • How to display Long text in alv output

    Hi,
    I have developed an ALV report.It is displaying the output.
    There is another requirment for alv output text field as below
    From the long text fields show only the first 20 characters and afterwards the long text icon. If the icon is clicked open the long text display screen.
    Please give your suggestion how to work on this requirement.
    Thanks in advance

    Hi,
    Create a hotspot for the long text column of ALV.
    When user clicks on the hotspot, handle the event to display long text screen.
    You may refer sample program of hotspot ALV :
    Goto SE38
    Type BCALV*
    Click F4
    search for HOTSPOT or EVENTS & you will get a sample program.
    Best regards,
    Prashant

  • How to use variant for diffrent output?

    Hi,
    I have created one report with ALV_grid_display.
    when i execute this report it would show output with less detail.
    I have a one checkbox at selection-screen also. My requirement is when i select this checkbox then report should show output with more detail i.e different output.
    I have heared we can create variant for this.
    Pls tell me how can i do this.
    Correct answear will be rewarded by maximum points.
    Thanks & Regards,
    Gaurav.

    Hi Gaurav,
    leave ur id i will send u the screen shot how to create the variant after getting the output list.
    This is the sample programe
    just go through the bold one in the coding and do modifications in ur programe,
    REPORT ZVRI4E04 LINE-SIZE 250 NO STANDARD PAGE HEADING
                                                  MESSAGE-ID MSG.
    TYPE-POOLS : SLIS.
                           TABLES DECLARATION                            *
    TABLES: VBRK, VBRP, VBKD, KONV, KNA1.
                           V A R I A B L E S                             *
    DATA : W_FIELD TYPE SLIS_FIELDCAT_ALV.
    DATA : F_FIELD TYPE SLIS_T_FIELDCAT_ALV.
    DATA : WA_LAYOUT TYPE SLIS_LAYOUT_ALV.
    DATA : V_POS TYPE I,
           LS_SORT TYPE SLIS_T_SORTINFO_ALV,
           W_SORT TYPE SLIS_SORTINFO_ALV.
    <b>DATA : IS_VARIANT LIKE DISVARIANT.</b>
    <b>IS_VARIANT-REPORT = SY-CPROG.</b>
    DATA : BEGIN OF T_VBRK OCCURS 0,
           VBELN LIKE VBRK-VBELN,
           FKDAT LIKE VBRK-FKDAT,
           KNUMV LIKE VBRK-KNUMV,
           KUNAG LIKE VBRK-KUNAG,
           VKORG LIKE VBRK-VKORG,
           VTWEG LIKE VBRK-VTWEG,
           SPART LIKE VBRK-SPART,
          END OF T_VBRK.
    DATA : BEGIN OF T_VBRP OCCURS 0,
           VBELN LIKE VBRP-VBELN,
           POSNR LIKE VBRP-POSNR,
           FKIMG LIKE VBRP-FKIMG,
           NTGEW LIKE VBRP-NTGEW,
           BRGEW LIKE VBRP-BRGEW,
           VOLUM LIKE VBRP-VOLUM,
           AUBEL LIKE VBRP-AUBEL,
          END OF T_VBRP.
    DATA : BEGIN OF T_VBKD OCCURS 0,
           VBELN LIKE VBKD-VBELN,
           BSTKD LIKE VBKD-BSTKD,
          END OF T_VBKD.
    DATA : BEGIN OF T_KONV OCCURS 0,
           KNUMV LIKE KONV-KNUMV,
           KPOSN LIKE KONV-KPOSN,
           STUNR LIKE KONV-STUNR,
           KSCHL LIKE KONV-KSCHL,
           KBETR LIKE KONV-KBETR,
           KWERT LIKE KONV-KWERT,
          END OF T_KONV.
    DATA : BEGIN OF T_KNA1 OCCURS 0,
           KUNNR LIKE KNA1-KUNNR,
           NAME1 LIKE KNA1-NAME1,
          END OF T_KNA1.
    DATA : BEGIN OF T_FINAL OCCURS 0,
           VKORG LIKE VBRK-VKORG,
           VTWEG LIKE VBRK-VTWEG,
           SPART LIKE VBRK-SPART,
           FKDAT LIKE VBRK-FKDAT,
           VBELN LIKE VBRK-VBELN,
           POSNR LIKE VBRP-POSNR,
           NAME1 LIKE KNA1-NAME1,
           BSTKD LIKE VBKD-BSTKD,
           FKIMG LIKE VBRP-FKIMG,
           NTGEW LIKE VBRP-NTGEW,
           BRGEW LIKE VBRP-BRGEW,
           VOLUM LIKE VBRP-VOLUM,
           BASIC LIKE KONV-KWERT,
           EXDUTY LIKE KONV-KWERT,
           ED LIKE KONV-KWERT,
           CST LIKE KONV-KWERT,
           VAT LIKE KONV-KWERT,
           SALTAX LIKE KONV-KWERT,
           FREIGHT LIKE KONV-KWERT,
           TCS LIKE KONV-KWERT,
           SRG LIKE KONV-KWERT,
           RATE LIKE KONV-KBETR,
          END OF T_FINAL.
                        S E L E C T I O N - S C R E E N                  *
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-000.
    SELECT-OPTIONS: S_KUNAG FOR T_VBRK-KUNAG,
                    S_FKDAT FOR T_VBRK-FKDAT,
                    S_VKORG FOR T_VBRK-VKORG,
                    S_VTWEG FOR T_VBRK-VTWEG,
                    S_SPART FOR T_VBRK-SPART.
    SELECTION-SCREEN END OF BLOCK B1.
    AT SELECTION-SCREEN .
      SELECT SINGLE KUNAG FKDAT VKORG VTWEG SPART FROM VBRK INTO T_VBRK
                                            WHERE KUNAG IN S_KUNAG
                                              AND FKDAT IN S_FKDAT
                                              AND VKORG IN S_VKORG
                                              AND VTWEG IN S_VTWEG
                                              AND SPART IN S_SPART.
      IF SY-SUBRC <> 0.
        MESSAGE E000 WITH 'THERE IS NO RECORDS FOR THIS SELECTION CRITERIA'.
      ENDIF.
    START-OF-SELECTION.
      SELECT VBELN FKDAT KNUMV KUNAG VKORG VTWEG SPART
                      FROM VBRK INTO TABLE T_VBRK
                      WHERE KUNAG IN S_KUNAG
                      AND FKDAT IN S_FKDAT
                      AND VKORG IN S_VKORG
                      AND VTWEG IN S_VTWEG
                      AND SPART IN S_SPART.
      IF NOT T_VBRK[] IS INITIAL.
        SELECT VBELN POSNR FKIMG NTGEW BRGEW VOLUM AUBEL
                                      FROM VBRP INTO TABLE T_VBRP
                                      FOR ALL ENTRIES IN T_VBRK
                                      WHERE VBELN = T_VBRK-VBELN.
      ENDIF.
      IF NOT T_VBRP[] IS INITIAL .
        SELECT VBELN BSTKD FROM VBKD
                          INTO TABLE T_VBKD
                          FOR ALL ENTRIES IN T_VBRP
                          WHERE VBELN = T_VBRP-AUBEL.
      ENDIF.
      IF NOT T_VBRK[] IS INITIAL.
        SELECT KNUMV KPOSN STUNR KSCHL KBETR KWERT
                                              FROM KONV
                                              INTO TABLE T_KONV
                                              FOR ALL ENTRIES IN T_VBRK
                                              WHERE KNUMV = T_VBRK-KNUMV.
      ENDIF.
      IF NOT T_VBRK[] IS INITIAL.
        SELECT KUNNR NAME1 FROM KNA1 INTO TABLE T_KNA1
                                          FOR ALL ENTRIES IN T_VBRK
                                          WHERE KUNNR = T_VBRK-KUNAG.
      ENDIF.
                        Populating the final data                        *
      LOOP AT T_VBRP.
        READ TABLE T_VBRK WITH KEY VBELN = T_VBRP-VBELN.
        READ TABLE T_VBKD WITH KEY VBELN = T_VBRP-AUBEL.
        READ TABLE T_KNA1 WITH KEY KUNNR = T_VBRK-KUNAG.
        T_FINAL-VKORG = T_VBRK-VKORG.
        T_FINAL-VTWEG = T_VBRK-VTWEG.
        T_FINAL-SPART = T_VBRK-SPART.
        T_FINAL-FKDAT = T_VBRK-FKDAT.
        T_FINAL-VBELN = T_VBRK-VBELN.
        T_FINAL-POSNR = T_VBRP-POSNR.
        T_FINAL-NAME1 = T_KNA1-NAME1.
        T_FINAL-BSTKD = T_VBKD-BSTKD.
        T_FINAL-FKIMG = T_VBRP-FKIMG.
        T_FINAL-NTGEW = T_VBRP-NTGEW.
        T_FINAL-BRGEW = T_VBRP-BRGEW.
        T_FINAL-VOLUM = T_VBRP-VOLUM.
        LOOP AT T_KONV WHERE KNUMV = T_VBRK-KNUMV AND
        KPOSN = T_VBRP-POSNR.
          IF T_KONV-KSCHL = 'ZIBP' OR T_KONV-KSCHL = 'ZIPR'.
            T_FINAL-BASIC = T_FINAL-BASIC + T_KONV-KWERT.
            IF NOT T_KONV-KBETR IS INITIAL.
              T_FINAL-RATE =  T_KONV-KBETR.
            ENDIF.
          ENDIF.
          IF T_KONV-KSCHL = 'ZIED'.
            T_FINAL-EXDUTY = T_FINAL-EXDUTY + T_KONV-KWERT.
          ENDIF.
          IF T_KONV-KSCHL = 'ZIEC'.
            T_FINAL-ED = T_FINAL-ED + T_KONV-KWERT.
          ENDIF.
          IF T_KONV-KSCHL = 'ZIVA'.
            T_FINAL-SALTAX = T_FINAL-SALTAX + T_KONV-KWERT.
          ENDIF.
          IF T_KONV-KSCHL = 'ZIFD' OR T_KONV-KSCHL = 'ZID0'.
            T_FINAL-FREIGHT = T_FINAL-FREIGHT + T_KONV-KWERT.
          ENDIF.
          IF T_KONV-KSCHL = 'ZITC'.
            T_FINAL-TCS = T_FINAL-TCS + T_KONV-KWERT.
          ENDIF.
          IF T_KONV-KSCHL = 'ZITS'.
            T_FINAL-SRG = T_FINAL-SRG + T_KONV-KWERT.
          ENDIF.
          IF T_KONV-KSCHL = 'ZICS'.
            T_FINAL-CST = T_FINAL-CST + T_KONV-KWERT.
          ENDIF.
          IF T_KONV-KSCHL = 'ZIVA'.
            T_FINAL-VAT = T_FINAL-VAT + T_KONV-KWERT.
          ENDIF.
        ENDLOOP.
        APPEND T_FINAL.
        CLEAR T_FINAL.
        CLEAR T_KONV.
        CLEAR : T_VBRK, T_VBRP, T_VBKD, T_KNA1.
      ENDLOOP.
                        POSITION DECLARATION FOR ALV OUTPUT              *
      V_POS = 0.
      V_POS = V_POS + 1.
      W_FIELD-COL_POS = V_POS.
      W_FIELD-FIELDNAME = 'VKORG' .
      W_FIELD-TABNAME = 'T_FINAL'.
      W_FIELD-SELTEXT_M = 'SORG'.
      APPEND W_FIELD TO F_FIELD.
      CLEAR W_FIELD.
      V_POS = V_POS + 1.
      W_FIELD-COL_POS = V_POS.
      W_FIELD-FIELDNAME = 'VTWEG' .
      W_FIELD-TABNAME = 'T_FINAL'.
      W_FIELD-SELTEXT_M = 'DCHL'.
      APPEND W_FIELD TO F_FIELD.
      CLEAR W_FIELD.
      V_POS = V_POS + 1.
      W_FIELD-COL_POS = V_POS.
      W_FIELD-FIELDNAME = 'SPART' .
      W_FIELD-TABNAME = 'T_FINAL'.
      W_FIELD-SELTEXT_M = 'DVS'.
      APPEND W_FIELD TO F_FIELD.
      CLEAR W_FIELD.
      V_POS = V_POS + 1.
      W_FIELD-COL_POS = V_POS.
      W_FIELD-FIELDNAME = 'FKDAT' .
      W_FIELD-TABNAME = 'T_FINAL'.
      W_FIELD-SELTEXT_M = 'Date'.
      APPEND W_FIELD TO F_FIELD.
      CLEAR W_FIELD.
      V_POS = V_POS + 1.
      W_FIELD-COL_POS = V_POS.
      W_FIELD-FIELDNAME = 'VBELN' .
      W_FIELD-TABNAME = 'T_FINAL'.
      W_FIELD-SELTEXT_M = 'Inv No'.
      APPEND W_FIELD TO F_FIELD.
      CLEAR W_FIELD.
      V_POS = V_POS + 1.
      W_FIELD-COL_POS = V_POS.
      W_FIELD-FIELDNAME = 'POSNR' .
      W_FIELD-TABNAME = 'T_FINAL'.
      W_FIELD-SELTEXT_M = 'Item No'.
      APPEND W_FIELD TO F_FIELD.
      CLEAR W_FIELD.
      V_POS = V_POS + 1.
      W_FIELD-COL_POS = V_POS.
      W_FIELD-FIELDNAME = 'NAME1' .
      W_FIELD-TABNAME = 'T_FINAL'.
      W_FIELD-SELTEXT_M = 'Name'.
      APPEND W_FIELD TO F_FIELD.
      CLEAR W_FIELD.
      V_POS = V_POS + 1.
      W_FIELD-COL_POS = V_POS.
      W_FIELD-FIELDNAME = 'BSTKD' .
      W_FIELD-TABNAME = 'T_FINAL'.
      W_FIELD-SELTEXT_M = 'PO No'.
      APPEND W_FIELD TO F_FIELD.
      CLEAR W_FIELD.
      V_POS = V_POS + 1.
      W_FIELD-COL_POS = V_POS.
      W_FIELD-FIELDNAME = 'FKIMG' .
      W_FIELD-TABNAME = 'T_FINAL'.
      W_FIELD-DO_SUM = 'X'.
      W_FIELD-SELTEXT_M = 'Quantity'.
      APPEND W_FIELD TO F_FIELD.
      CLEAR W_FIELD.
      V_POS = V_POS + 1.
      W_FIELD-COL_POS = V_POS.
      W_FIELD-FIELDNAME = 'NTGEW' .
      W_FIELD-TABNAME = 'T_FINAL'.
      W_FIELD-DO_SUM = 'X'.
      W_FIELD-SELTEXT_M = 'NT WG'.
      APPEND W_FIELD TO F_FIELD.
      CLEAR W_FIELD.
      V_POS = V_POS + 1.
      W_FIELD-COL_POS = V_POS.
      W_FIELD-FIELDNAME = 'BRGEW' .
      W_FIELD-TABNAME = 'T_FINAL'.
      W_FIELD-DO_SUM = 'X'.
      W_FIELD-SELTEXT_M = 'GR WG'.
      APPEND W_FIELD TO F_FIELD.
      CLEAR W_FIELD.
      V_POS = V_POS + 1.
      W_FIELD-COL_POS = V_POS.
      W_FIELD-FIELDNAME = 'VOLUM' .
      W_FIELD-TABNAME = 'T_FINAL'.
      W_FIELD-DO_SUM = 'X'.
      W_FIELD-SELTEXT_M = 'Volume'.
      APPEND W_FIELD TO F_FIELD.
      CLEAR W_FIELD.
      V_POS = V_POS + 1.
      W_FIELD-COL_POS = V_POS.
      W_FIELD-FIELDNAME = 'RATE'.
      W_FIELD-TABNAME = 'T_FINAL'.
      W_FIELD-DO_SUM = 'X'.
      W_FIELD-SELTEXT_M = 'Rate'.
      APPEND W_FIELD TO F_FIELD.
      CLEAR W_FIELD.
      V_POS = V_POS + 1.
      W_FIELD-COL_POS = V_POS.
      W_FIELD-FIELDNAME = 'BASIC'.
      W_FIELD-TABNAME = 'T_FINAL'.
      W_FIELD-DO_SUM = 'X'.
      W_FIELD-SELTEXT_M = 'BASIC'.
      APPEND W_FIELD TO F_FIELD.
      CLEAR W_FIELD.
      V_POS = V_POS + 1.
      W_FIELD-COL_POS = V_POS.
      W_FIELD-FIELDNAME = 'EXDUTY'.
      W_FIELD-TABNAME = 'T_FINAL'.
      W_FIELD-DO_SUM = 'X'.
      W_FIELD-SELTEXT_M = 'EX Duty'.
      APPEND W_FIELD TO F_FIELD.
      CLEAR W_FIELD.
      V_POS = V_POS + 1.
      W_FIELD-COL_POS = V_POS.
      W_FIELD-FIELDNAME = 'ED' .
      W_FIELD-TABNAME = 'T_FINAL'.
      W_FIELD-DO_SUM = 'X'.
      W_FIELD-SELTEXT_M = 'EDUCATION'.
      APPEND W_FIELD TO F_FIELD.
      CLEAR W_FIELD.
      V_POS = V_POS + 1.
      W_FIELD-COL_POS = V_POS.
      W_FIELD-FIELDNAME = 'SALTAX'.
      W_FIELD-TABNAME = 'T_FINAL'.
      W_FIELD-DO_SUM = 'X'.
      W_FIELD-SELTEXT_M = 'SALTAX'.
      APPEND W_FIELD TO F_FIELD.
      CLEAR W_FIELD.
      V_POS = V_POS + 1.
      W_FIELD-COL_POS = V_POS.
      W_FIELD-FIELDNAME = 'CST'.
      W_FIELD-TABNAME = 'T_FINAL'.
      W_FIELD-DO_SUM = 'X'.
      W_FIELD-SELTEXT_M = 'CST'.
      APPEND W_FIELD TO F_FIELD.
      CLEAR W_FIELD.
      V_POS = V_POS + 1.
      W_FIELD-COL_POS = V_POS.
      W_FIELD-FIELDNAME = 'VAT'.
      W_FIELD-TABNAME = 'T_FINAL'.
      W_FIELD-DO_SUM = 'X'.
      W_FIELD-SELTEXT_M = 'VAT'.
      APPEND W_FIELD TO F_FIELD.
      CLEAR W_FIELD.
      V_POS = V_POS + 1.
      W_FIELD-COL_POS = V_POS.
      W_FIELD-FIELDNAME = 'FREIGHT' .
      W_FIELD-TABNAME = 'T_FINAL'.
      W_FIELD-DO_SUM = 'X'.
      W_FIELD-SELTEXT_M = 'FREIGHT'.
      APPEND W_FIELD TO F_FIELD.
      CLEAR W_FIELD.
      V_POS = V_POS + 1.
      W_FIELD-COL_POS = V_POS.
      W_FIELD-FIELDNAME = 'TCS' .
      W_FIELD-TABNAME = 'T_FINAL'.
      W_FIELD-DO_SUM = 'X'.
      W_FIELD-SELTEXT_M = 'TCS'.
      APPEND W_FIELD TO F_FIELD.
      CLEAR W_FIELD.
      V_POS = V_POS + 1.
      W_FIELD-COL_POS = V_POS.
      W_FIELD-FIELDNAME = 'SRG' .
      W_FIELD-TABNAME = 'T_FINAL'.
      W_FIELD-DO_SUM = 'X'.
      W_FIELD-SELTEXT_M = 'SRG'.
      APPEND W_FIELD TO F_FIELD.
      CLEAR W_FIELD.
      WA_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
           EXPORTING
             <b>   I_CALLBACK_PROGRAM = SY-CPROG</b>
               I_STRUCTURE_NAME
                IS_LAYOUT     = WA_LAYOUT
                IT_FIELDCAT   = F_FIELD
          <b>      IS_VARIANT = IS_VARIANT</b>
              <b>  I_SAVE = 'X'</b>
               IT_SORT       = LS_SORT
           TABLES
                T_OUTTAB      = T_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.
    Reward points if helpful
    Thanks
    Message was edited by:
            Pattan Naveen

  • Column headings are missing in the output for ALV?

    Hi all,
    i have coded a small report in ALV mode. i am getting the data but the column headings are missing.
    iam not getting the column headings in the output. it is coming as blank. Could you all please help me out in this?
    below is the code of my program:
                     Includes                                            *
    *---Standard header and footer routines
    INCLUDE zsrepthd.
    *--- ALV Routines
    INCLUDE zvsdi_alv_routines_ver3.
    *--- Authorization Check
    INCLUDE z_selection_auth_check.
                     Types Declarations                                  *
    tables : ekpo.
                     Types Declarations                                  *
    TYPES: BEGIN OF ty_ekpo,
            EBELN(18) TYPE C,
            EBELP(20) TYPE C,
            MATNR(18) TYPE C,
            WERKS(11) TYPE C,
          END OF ty_ekpo.
    *-Output field name
    TYPES: BEGIN OF ty_output,
            EBELN(18) TYPE C,
            EBELP(20) TYPE C,
            MATNR(18) TYPE C,
            WERKS(11) TYPE C,
          END OF ty_output.
    *-Output field name
    TYPES: BEGIN OF ty_fields,
            fname(60) TYPE c,
           END OF ty_fields.
                     Internal Table Declarations                         *
    DATA:it_ekpo TYPE STANDARD TABLE OF ty_ekpo,
    *--- Alv parameters
        it_out_alvp TYPE typ_alv_form_params, "for alv parameters
    *-Field catalog  for ALV display
        it_fcat TYPE slis_t_fieldcat_alv WITH HEADER LINE,
    *-Field names for Excel column headings
    it_ekpo_fields TYPE STANDARD TABLE OF ty_fields WITH HEADER LINE.
    **--To store output for Principial Pegging data
    DATA: BEGIN OF it_output occurs 0,
            EBELN(18) TYPE C,
            EBELP(20) TYPE C,
            MATNR(18) TYPE C,
            WERKS(11) TYPE C,
          END OF it_output.
    **--To store output for 2nd
    DATA: BEGIN OF it_output1 occurs 0,
            text(2000),
           END OF it_output1.
                     Data Declarations                                   *
    data: v_ebeln TYPE ekpo-ebeln,
          v_ebelp TYPE ekpo-ebelp,
          v_matnr TYPE ekpo-matnr,
          v_werks TYPE ekpo-werks.
                     Constants Declarations                              *
    CONSTANTS:
         c_0    TYPE i     VALUE  0,
         c_x    TYPE char1 VALUE  'X',
         c_i    TYPE char1 VALUE  'I',
         c_eq   TYPE char2 VALUE  'EQ',
         c_ekpo  TYPE char4 VALUE 'EKPO',
         c_hyfn  TYPE char1 VALUE '-'.
                     Work Area Declarations                              *
    DATA: x_output_ekpo type ty_output,
          x_ekpo type ty_ekpo.
                     Selection Screen                                    *
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-f01.
    SELECT-OPTIONS:
          s_ebeln FOR v_ebeln OBLIGATORY,
          s_ebelp FOR v_ebelp,
          s_matnr FOR v_matnr,
          s_werks FOR v_werks.
    SELECTION-SCREEN END OF BLOCK b1.
                     At Selection Screen                                 *
    AT SELECTION-SCREEN.
                     Start-of-Selection                                  *
    START-OF-SELECTION.
    *--- Check Authorizations for Selection-screen
      PERFORM  z_selection_auth_check.
    *--- Fetch Purchasing Document Item data
      PERFORM  fetch_status_pp.
                     End-of-Selection                                    *
    END-OF-SELECTION.
    **-- Download data to final internal table.
      PERFORM data_output.
      IF NOT it_output[] IS INITIAL.
    *--- Fill the structure for calling the ALV form
        PERFORM initialize_alv_params.
    **-- Display ALV Report
        PERFORM setup_and_display_alv_ver2
           USING
         it_out_alvp        "Parameter structure
         it_output[]        "Internal Data table(header table)
         it_output[].       "Dummy table for Hierarchical ALV!!(item table)
        ENDIF.
      IF it_output[] IS INITIAL.
        MESSAGE i999(zi) WITH 'No data found for selection'(i02).
      ENDIF.
    *&      Form  FETCH_STATUS_PP
    Get data from ekpo table
    FORM FETCH_STATUS_PP .
    *-Fetch PP Data from ekpo table
      REFRESH it_ekpo.
      SELECT EBELN
             EBELP
             MATNR
             WERKS
             FROM ekpo
             INTO TABLE it_ekpo
             WHERE ebeln IN s_ebeln
               AND ebelp IN s_ebelp.
      IF sy-subrc = c_0.
        SORT it_ekpo BY ebeln ebelp.
      ENDIF.
    ENDFORM.                    " FETCH_STATUS_PP
    *&      Form  f_top_of_page
    *This is to write the top of page
    FORM top_of_page.
      DATA:  lt_list TYPE slis_t_listheader,
             lx_list TYPE slis_listheader.
    *--- Title name
      CLEAR lx_list.
      lx_list-typ  = 'S'.
      lx_list-key  = 'Title name'(t13).
      lx_list-info = sy-title.
      APPEND lx_list TO lt_list.
      IF NOT lt_list IS INITIAL.
        CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
          EXPORTING
            it_list_commentary = lt_list.
      ENDIF.
    ENDFORM.                    "top_of_page
    *&      Form  init_page_head
    Description : This subroutine initializes the fields in table BHDGD  *
                  for printing the report heading.                       *
    FORM init_page_head.
      bhdgd-line1  = 'SLA Status Report'(h04).
      bhdgd-line2  = sy-title.
      bhdgd-lines  = sy-linsz.
      bhdgd-fcpyrt = sy-uline.
      bhdgd-inifl  = '0'.
    ENDFORM.                    "init_page_head
    *&      Form  initialize_alv_params
    Description : Form to initialize ALV Params
    FORM initialize_alv_params.
      CONSTANTS: lc_alv_grid  TYPE char1 VALUE 'G',  "Grid
                 lc_u         TYPE char1 VALUE 'U'.
      MOVE 'IT_OUTPUT' TO   it_out_alvp-tablname.   "final table
      MOVE sy-repid    TO   it_out_alvp-repid.
      MOVE lc_alv_grid TO   it_out_alvp-alvtype.
      MOVE c_x         TO   it_out_alvp-bringdefaultvar.
      MOVE lc_u        TO   it_out_alvp-variantsavetype.
    ENDFORM.                    " initialize_alv_params
          FORM it_out_init_events                                       *
    -->this is form is to modify the events
    FORM it_out_init_events
          CHANGING
           alevnts TYPE slis_t_event.
      FIELD-SYMBOLS <alevnt> TYPE slis_alv_event.
      LOOP AT alevnts ASSIGNING <alevnt>.
        CASE <alevnt>-name.
          WHEN  slis_ev_top_of_page.
            MOVE 'TOP_OF_PAGE'  TO <alevnt>-form.
        ENDCASE.
      ENDLOOP.
    ENDFORM.                    "it_out_init_events
    *&      Form  DATA_OUTPUT
    Download data to final internal table
    FORM DATA_OUTPUT .
      loop at it_ekpo into x_ekpo.
        x_output_ekpo-ebeln = x_ekpo-ebeln.
        x_output_ekpo-ebelp = x_ekpo-ebelp.
        x_output_ekpo-matnr = x_ekpo-matnr.
        x_output_ekpo-werks = x_ekpo-werks.
        append x_output_ekpo to it_output.
      endloop.
    ENDFORM.                    " DATA_OUTPUT
          FORM it_out_alv_fieldcat_before                               *
    -->  PT_FCAT                                                       *
    -->  ALVP                                                          *
    FORM it_out_alv_fieldcat_before  CHANGING
        pt_fcat TYPE slis_t_fieldcat_alv
        alvp TYPE typ_alv_form_params.
      DATA: lx_fcat TYPE slis_fieldcat_alv.
      CLEAR lx_fcat.
      lx_fcat-tabname        = 'IT_OUTPUT'.
      lx_fcat-fieldname      = 'EBELN'.
      lx_fcat-col_pos        = '1'.
      lx_fcat-ddictxt        = 'M'.
      lx_fcat-seltext_l      = 'Purchasing Doc No'(018).
      lx_fcat-seltext_m      = 'Purchasing Doc No'(018).
      lx_fcat-seltext_s      = 'Purchasing Doc No'(018).
      lx_fcat-reptext_ddic   = 'Purchasing Doc No'(018).
      APPEND lx_fcat TO pt_fcat.
      CLEAR lx_fcat.
      lx_fcat-tabname        = 'IT_OUTPUT'.
      lx_fcat-fieldname      = 'EBELP'.
      lx_fcat-col_pos        = '1'.
      lx_fcat-ddictxt        = 'M'.
      lx_fcat-seltext_l      = 'Item No Purchasing Doc'(020).
      lx_fcat-seltext_m      = 'Item No Purchasing Doc'(020).
      lx_fcat-seltext_s      = 'Item No Purchasing Doc'(020).
      lx_fcat-reptext_ddic   = 'Item No Purchasing Doc'(020).
      APPEND lx_fcat TO pt_fcat.
      CLEAR lx_fcat.
      lx_fcat-tabname        = 'IT_OUTPUT'.
      lx_fcat-fieldname      = 'MATNR'.
      lx_fcat-col_pos        = '1'.
      lx_fcat-ddictxt        = 'M'.
      lx_fcat-seltext_l      = 'Material'(010).
      lx_fcat-seltext_m      = 'Material'(010).
      lx_fcat-seltext_s      = 'Material'(010).
      lx_fcat-reptext_ddic   = 'Material'(010).
      APPEND lx_fcat TO pt_fcat.
      CLEAR lx_fcat.
      lx_fcat-tabname        = 'IT_OUTPUT'.
      lx_fcat-fieldname      = 'WERKS'.
      lx_fcat-col_pos        = '1'.
      lx_fcat-ddictxt        = 'M'.
      lx_fcat-seltext_l      = 'Supply plant'(013).
      lx_fcat-seltext_m      = 'Supply plant'(013).
      lx_fcat-seltext_s      = 'Supply plant'(013).
      lx_fcat-reptext_ddic   = 'Supply plant'(013).
      APPEND lx_fcat TO pt_fcat.
    ENDFORM.                    " it_out_alv_fieldcat_before.
    Regards,
    Shalini
    Edited by: shalini reddy on Oct 7, 2008 5:08 PM

    Hi,
    The heading are in the table pt_fcat - you don't seem to be passing that in form....
    PERFORM setup_and_display_alv_ver2
    USING
    it_out_alvp "Parameter structure
    it_output[] "Internal Data table(header table)
    it_output[]. "Dummy table for Hierarchical ALV!!(item table)
    which I guessing in in one of the includes?
    Saying that the extract pof code does not show where you are calling form it_out_alv_fieldcat_before ...which populates the headings...
    Regards
    Stu

  • ALV Output to Excel file

    Hi All,
    I am downloading the ALV output to Excel file.I am making use of  LIST--->EXPORT--->SPREADSHEET option.
    My list is having Header, Footer, sub totals and totals.When i transfer the list i am facing following problems
    1.Even i am getting the empty columns betweeen my output.
    2.In the Place of sub totals i am getting astericks
    3.On the top of the records downloaded,"DYNAMIC LIST DISPLAY" is found.I want to avoid this text on the top
    Thanks,
    Ravee...

    Hello Vinod,
    1.I am getting the empty columns betweeen my output.
    I am having 16 columns in the ALV output,but i got 19 columns in my excel file.
    2.In the Place of sub totals i am getting astericks.
    Generally there is no possibility to download the sub totals.i am using LIST->EXPORT->SPREADSHEET.
                     I am having the sub totals in my output.
    *You would have noticed the' * ' for sub total and ' ** ' for grand totals values.*These sub total & total values are not downloaded but these asterisks are carried to excel file.
    3.On the top of the records downloaded,"DYNAMIC LIST DISPLAY" is found.I want to avoid this text on the top.
    I am using the application tool bar icon only.Still i am getting the same.
    Thanks,
    Ravee...

Maybe you are looking for

  • OBIEE 11g : Unable to see any images while customizing styles and skins

    Hi, I am trying to customize OBIEE 11g style and skin. I followed the steps mentioned at http://www.rittmanmead.com/2010/12/oracle-bi-ee-11g-styles-skins-custom-xml-messages/ and also in oracle white paper http://www.oracle.com/technetwork/middleware

  • Unable to migrate table, character set from WE8MSWIN1252 to AL32UTF8

    Hi, On our source db the character set is AL32UTF8 On our own db, we used the default character set of WE8MSWIN1252 . When migrating one of the table, we get an error of this: ORA-29275: partial multibyte character So in to alter our character set fr

  • Animating .gif on .gif background

    hi, i am making a little fish game where you can click directional buttons to move fish .gifs around a fish tank. i am trying to display .gif pictures of fish on top of my background, im struggling with paint and update and layeredpanes and whether t

  • Date format used in the datepicker

    Hi, I have a problem with date format when I open the pop up calendar: w=open("wwv_flow_utilities.show_as_popup_calendar" +..... "&p_date_format=" + escape('MM/DD/YYYY HH:MI ' )... I have the popUp window with message instead of calendar: " NOT FOUND

  • Unable to reach Target Service issues after receiving message

    Hello everyone, I am working on a demo for my devs/dba at work regarding the use of service broker, why we should start using it, and other fun facts that just go above initial implementation.  Part of this demo includes the routing capabilities for