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: 

ALV to Excel problems

Former Member
0 Kudos
163

HI

I have created an ALV report with 87 fields in it. Whenever I am trying to download that report into excel the number of column breaks into 2 rows. In this case, The downloaded file contains 57 Columns in 1 row and remaining 29 Columns in second row. Can anyone please help me in understanding why this is happening while downloading this report into excel file and what will be the solution to correct it.

Thanks,

Sreekanth.G

6 REPLIES 6

former_member536879
Active Contributor
0 Kudos
130

Hi,

Dont Post the Same thread of yours for different Times. By doing this you are violating the SCN Rules.Please refer the SCN Rules before Posting.

With Regards,

Sumodh.P

Former Member
0 Kudos
130

Hi,

why don't you use excel-inplace?

Regards, Dieter

Former Member
0 Kudos
130

Hi,

Excel will support you till 256 columns..

May i know how you are downloading the data using sap to excel if any function module please try to check the interface of the function module any parameter will help you or let me know the function module name.

Regards

Satish Boguda

0 Kudos
130

HI friend,

I have not used any function module but i directly used the tool bar icon of ALV which are inbuilt.

thanks,

Sreekanth.G

Former Member
0 Kudos
130

it was unfortunatly clicked.that is the reason i am trying mark it as unansered.

0 Kudos
130

Try this,

    • HEADING FOR EXCEL SHEET

DATA: BEGIN OF IT_EXCEL1 OCCURS 0,

SAPID LIKE PERNR-PERNR,

UNAME LIKE SY-UNAME,

END OF IT_EXCEL1.

  • assigning column names in excel sheet

IT_EXCEL1-SAPID = 'Personnel number'.

IT_EXCEL1-UNAME = 'User Name'.

APPEND IT_EXCEL1.

  • to get desktop path

DATA : DESKTOP TYPE STRING.

CALL METHOD CL_GUI_FRONTEND_SERVICES=>GET_DESKTOP_DIRECTORY

CHANGING

DESKTOP_DIRECTORY = DESKTOP

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.

CALL METHOD CL_GUI_CFW=>FLUSH

EXCEPTIONS

CNTL_SYSTEM_ERROR = 1

CNTL_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.

CONCATENATE DESKTOP '\filename.xls' INTO DESKTOP.

  • to download into excel sheet

    • FOR TITLES

CALL FUNCTION 'GUI_DOWNLOAD' " for titles

EXPORTING

  • BIN_FILESIZE =

FILENAME = DESKTOP

FILETYPE = 'ASC'

WRITE_FIELD_SEPARATOR = 'X'

TABLES

DATA_TAB = IT_EXCEL1.

    • FOR DATA

CALL FUNCTION 'GUI_DOWNLOAD' " for data

EXPORTING

FILENAME = DESKTOP

FILETYPE = 'ASC'

APPEND = 'X'

WRITE_FIELD_SEPARATOR = 'X'

TABLES

DATA_TAB = IT_DOWNLOAD.

CALL METHOD CL_GUI_FRONTEND_SERVICES=>EXECUTE

EXPORTING

DOCUMENT = DESKTOP

  • APPLICATION =

  • PARAMETER =

  • DEFAULT_DIRECTORY =

  • MAXIMIZED =

  • MINIMIZED =

  • SYNCHRONOUS =

OPERATION = 'OPEN'

  • EXCEPTIONS

  • CNTL_ERROR = 1

  • ERROR_NO_GUI = 2

  • BAD_PARAMETER = 3

  • FILE_NOT_FOUND = 4

  • PATH_NOT_FOUND = 5

  • FILE_EXTENSION_UNKNOWN = 6

  • ERROR_EXECUTE_FAILED = 7

  • SYNCHRONOUS_FAILED = 8

  • NOT_SUPPORTED_BY_GUI = 9

  • OTHERS = 10

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.