Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

is it possible to incorporate download to excel feature to module pool prog

Former Member
0 Kudos

hi i need to know

if is it possible to incorporate download to excel feature, to module pool prog

regards

Arora

2 REPLIES 2

Former Member
0 Kudos

wht i mean basically is that like in ALV report we have download to excel feature is it possible for module pool also...

module pool maintainence i am talking abot

created a mocule pool to maintaine a table data and displa a table data

now need wot know whethere it is possible to download the data to excel file or not.like we have foe alv report

regards

Arora

0 Kudos

the answer is <b>YES</b>.

You can refer to this piece of code for doing this -

REPORT  ZSKC_ALV_XXL.

TYPE-POOLS : KKBLO.

DATA : ITAB LIKE T100 OCCURS 0,
       T_FCAT_LVC TYPE LVC_S_FCAT OCCURS 0 WITH HEADER LINE,
       T_FCAT_KKB TYPE KKBLO_T_FIELDCAT.


START-OF-SELECTION.

* Get data.
  SELECT * UP TO 20 ROWS
  FROM   T100
  INTO   TABLE ITAB
  WHERE  SPRSL = SY-LANGU.

  CHECK SY-SUBRC EQ 0.

* Create the field catalog.
  CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
   EXPORTING
      I_STRUCTURE_NAME             = 'T100'
    CHANGING
      CT_FIELDCAT                  = T_FCAT_LVC[]
    EXCEPTIONS
      INCONSISTENT_INTERFACE       = 1
      PROGRAM_ERROR                = 2
      OTHERS                       = 3.

  CHECK SY-SUBRC EQ 0.
* make sure you pass the correct internal table name in the field catalog.
  t_fcat_lvC-tabname = 'ITAB'.
  MODIFY T_FCAT_LVC TRANSPORTING TABNAME WHERE TABNAME NE SPACE.

* Transfer to KKBLO format.
  CALL FUNCTION 'LVC_TRANSFER_TO_KKBLO'
    EXPORTING
      IT_FIELDCAT_LVC                 = T_FCAT_LVC[]
    IMPORTING
      ET_FIELDCAT_KKBLO               = T_FCAT_KKB
   EXCEPTIONS
     IT_DATA_MISSING                 = 1
     IT_FIELDCAT_LVC_MISSING         = 2
     OTHERS                          = 3.

  CHECK SY-SUBRC EQ 0.

* Call XXL.
  CALL FUNCTION 'ALV_XXL_CALL'
    EXPORTING
      I_TABNAME                    = 'ITAB'
      IT_FIELDCAT                  = T_FCAT_KKB
    TABLES
      IT_OUTTAB                    = ITAB[]
    EXCEPTIONS
      FATAL_ERROR                  = 1
      NO_DISPLAY_POSSIBLE          = 2
      OTHERS                       = 3.

  IF SY-SUBRC <> 0.
  ENDIF.

Now u can export ur data to excel very much like ALV !!