Skip to Content
0
Former Member
Jan 13, 2006 at 01:54 PM

ALV to Excel problem.

29 Views

Hi all,

Iam displaying 4 reports in 1 report using REUSE_ALV_BLOCK_LIST_APPEND.

the problem is when i download data from the ALV iam getting gaps between columns only for fields value2 and value.

For ally my 4 reports structure is same just values different.

I have the following code.


FORM list_append TABLES ut_table
                 USING  u_tabname TYPE slis_tabname
                        u_events  TYPE slis_t_event.

  DEFINE m_sort.
    ls_sort-fieldname = &1.
    ls_sort-up        = &2.
    ls_sort-subtot    = &3.
    append ls_sort to lt_sort.
  END-OF-DEFINITION.

  DATA :
    ls_fieldcat TYPE slis_fieldcat_alv,
    lt_fieldcat TYPE slis_t_fieldcat_alv, " Field catalog
    ls_sort     TYPE slis_sortinfo_alv,
    lt_sort     TYPE slis_t_sortinfo_alv. " Sort table

  DATA:
*    lt_events TYPE slis_t_event,
*    ls_event  TYPE slis_alv_event,
    ls_layout TYPE slis_layout_alv.

  ls_layout-group_change_edit = 'X'.
  ls_layout-colwidth_optimize = 'X'.
  ls_layout-zebra             = 'X'.
  ls_layout-cell_merge        = 'X'.
  ls_layout-detail_popup      = 'X'.
  ls_layout-get_selinfos      = 'X'.
  ls_layout-max_linesize      = '200'.

  CASE u_tabname.
    WHEN 'ETAB'.
      CLEAR : ls_fieldcat, lt_fieldcat[].
* Build field catalog and sort table
      CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
           EXPORTING
                i_program_name         = repid
                i_internal_tabname     = 'ETAB'
                i_inclname             = repid
           CHANGING
                ct_fieldcat            = lt_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 lt_fieldcat INTO ls_fieldcat.
        CASE : ls_fieldcat-fieldname.

          WHEN 'DRCRK'.
            ls_fieldcat-fix_column    = 'X'.
            ls_fieldcat-col_pos       = 1.
            MODIFY lt_fieldcat FROM ls_fieldcat.
          WHEN 'HERKUNFT'.
            ls_fieldcat-reptext_ddic = 'Herkunft'.
            ls_fieldcat-col_pos       = 2.
            ls_fieldcat-seltext_l  = 'Herkunft'.
            ls_fieldcat-seltext_m  = 'Herkunft'.
            ls_fieldcat-seltext_s  = 'Herkunft'.
            ls_fieldcat-ddic_outputlen = 8.
            ls_fieldcat-fix_column    = 'X'.
            MODIFY lt_fieldcat FROM ls_fieldcat.
             WHEN 'RYEAR'.
            ls_fieldcat-fix_column    = 'X'.
            ls_fieldcat-col_pos       = 3.
            MODIFY lt_fieldcat FROM ls_fieldcat.
          WHEN 'MONAT'.
            ls_fieldcat-reptext_ddic = 'Periode(n)'.
            ls_fieldcat-col_pos       = 4.
            ls_fieldcat-seltext_l  = 'Periode(n)'.
            ls_fieldcat-seltext_m  = 'Periode(n)'.
            ls_fieldcat-seltext_s  = 'Periode(n)'.
            ls_fieldcat-ddic_outputlen = 9.
            ls_fieldcat-fix_column    = 'X'.
            MODIFY lt_fieldcat FROM ls_fieldcat.
          WHEN  'VALUE2'.
            ls_fieldcat-reptext_ddic = 'IST Monat'.
            ls_fieldcat-col_pos       = 5.
            ls_fieldcat-seltext_l  = 'IST Monat'.
            ls_fieldcat-seltext_m  = 'IST Monat'.
            ls_fieldcat-seltext_s  = 'IST Monat'.
            ls_fieldcat-ddic_outputlen = 25.
            ls_fieldcat-do_sum = 'X'.
            ls_fieldcat-fix_column    = 'X'.
            MODIFY lt_fieldcat FROM ls_fieldcat.
          WHEN  'VALUE'.
            ls_fieldcat-reptext_ddic = 'IST GJ kum.'.
            ls_fieldcat-seltext_l  = 'IST GJ kum.'.
            ls_fieldcat-col_pos       = 6.
            ls_fieldcat-seltext_m  = 'IST GJ kum.'.
            ls_fieldcat-seltext_s  = 'IST GJ kum.'.
            ls_fieldcat-ddic_outputlen = 25.
            ls_fieldcat-do_sum = 'X'.
            ls_fieldcat-fix_column    = 'X'.
            MODIFY lt_fieldcat FROM ls_fieldcat.

        ENDCASE.
      ENDLOOP.

Please kindly help me regarding the problem.

thanks and regards.

chandu