Application Development and Automation 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: 
Read only

Header in EXCEL Sheet

Former Member
0 Likes
2,055

Hi all,

I'm trying to download the file into excel sheet getting data into excel but header is missing in SAP4.7 version , when i check my code in ECC6.0 then the header is coming. Below is my code.

TYPES: BEGIN OF it_int,

sales(3) TYPE n,

name(30) TYPE c,

END OF it_int.

DATA: t_int TYPE STANDARD TABLE OF it_int,

fs_int TYPE it_int.

DATA:

BEGIN OF t_header OCCURS 0,

header(50) TYPE c,

END OF t_header.

fs_int-sales = 001.

fs_int-name = 'Urea'.

APPEND fs_int TO t_int.

CLEAR fs_int.

fs_int-sales = 002.

fs_int-name = 'Ammonia'.

APPEND fs_int TO t_int.

CLEAR fs_int.

t_header-header = 'Sales'.

APPEND t_header.

t_header-header = 'ItemName'.

APPEND t_header.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

filename =

'C:\SAELS.xls'

filetype= 'ASC'

append = 'X'

write_field_separator = 'X'

TABLES

data_tab = t_int

fieldnames = t_header.

What needs to be done to get header in SAP4.7 version ?

Thanks in Advance.

Regards

VENk@

Hi all,

I'm trying to download the file into excel sheet getting data into excel but header is missing in SAP4.7 version , when i check my code in ECC6.0 then the header is coming. Below is my code.

TYPES: BEGIN OF it_int,

sales(3) TYPE n,

name(30) TYPE c,

END OF it_int.

DATA: t_int TYPE STANDARD TABLE OF it_int,

fs_int TYPE it_int.

DATA:

BEGIN OF t_header OCCURS 0,

header(50) TYPE c,

END OF t_header.

fs_int-sales = 001.

fs_int-name = 'Urea'.

APPEND fs_int TO t_int.

CLEAR fs_int.

fs_int-sales = 002.

fs_int-name = 'Ammonia'.

APPEND fs_int TO t_int.

CLEAR fs_int.

t_header-header = 'Sales'.

APPEND t_header.

t_header-header = 'ItemName'.

APPEND t_header.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

filename =

'C:\SAELS.xls'

filetype= 'ASC'

append = 'X'

write_field_separator = 'X'

TABLES

data_tab = t_int

fieldnames = t_header.

What needs to be done to get header in SAP4.7 version ?

Thanks in Advance.

Regards

VENk@

15 REPLIES 15
Read only

Former Member
0 Likes
2,024

This message was moderated.

Read only

Former Member
0 Likes
2,024

This message was moderated.

Read only

0 Likes
2,024

HI I have already gone through the given sites but no use.

Regards

VEnk@

Read only

0 Likes
2,024

Check if you were able to download the same to a txt file in 4.7 version.

I don't have the 4.7 version now to check it.

Read only

0 Likes
2,024

HI,

I have tried this to download in text file but didnt worked.

Regards

VEnk@

Read only

venkat_o
Active Contributor
0 Likes
2,024

Hi Venkat reddy, <li>Try this way .I tried to change your program. it works


REPORT ztest.
TYPES: BEGIN OF it_int,
        sales(3) TYPE n,
        name(30) TYPE c,
       END OF it_int.

DATA: t_int TYPE STANDARD TABLE OF it_int,
      fs_int TYPE it_int.

DATA:BEGIN OF t_header OCCURS 0,
        field1(50) TYPE c,
        field2(50) TYPE c,
     END OF t_header.

fs_int-sales = 001.
fs_int-name = 'Urea'.
APPEND fs_int TO t_int.
CLEAR fs_int.
fs_int-sales = 002.
fs_int-name = 'Ammonia'.
APPEND fs_int TO t_int.
CLEAR fs_int.

t_header-field1 = 'Sales'.
t_header-field2 = 'ItemName'.
APPEND t_header.

CALL FUNCTION 'GUI_DOWNLOAD'
  EXPORTING
    filename              = 'C:\SAELS.xls'
    filetype              = 'ASC'
*    append                = 'X'
    write_field_separator = 'X'
  TABLES
    data_tab              = t_header.

CALL FUNCTION 'GUI_DOWNLOAD'
  EXPORTING
    filename              = 'C:\SAELS.xls'
    filetype              = 'ASC'
    append                = 'X'
    write_field_separator = 'X'
  TABLES
    data_tab              = t_int.
Thanks Venkat.O

Read only

Former Member
0 Likes
2,024

HI Venkat,

Its almost reached but not correctly, I'm Getting SALES and ITEMNAME in the same line i need to be in 2 different columns.

Any suggestions.

REgards

VEnk@

Read only

venkat_o
Active Contributor
0 Likes
2,024

Hi Venkat, <li>I dont know whether you copied portion of code or executed the code i pasted. But try to copy the code I changed and paste it. Its absolutely working. Thanks Venkat.

Read only

Former Member
0 Likes
2,024

HI Venkat,

Its working fine thks for a good concept. When i'm trying to assign marks to you its getting error as "An error has occured while assigning makrs. Please refresh the thread view and try again.

". Also one more question from me can we use this GUI_DOWNLOAD to schedule in background and generate excel sheet in the back ground.

Regards

VEnk@

Read only

GauthamV
Active Contributor
0 Likes
2,024

You cannot use GUI function modules in background.

Read only

venkat_o
Active Contributor
0 Likes
2,024

Hi Venkat, <li>We can not use any GUI* Function in background processing. Thanks Venkat.O

Read only

Former Member
0 Likes
2,024

Ok VEnk@ and Gautham can u suggest me which F.M shall i use to generate a EXCEL sheets in the background.

Regards

VEnk@

Read only

0 Likes
2,024

In background you cant save any file on local pc. You need to create the file in application server.

Using data sets, from there onwards, you can download anything to your local machine.

Read only

GauthamV
Active Contributor
0 Likes
2,024

[Download excel in background|http://www.sap-img.com/abap/download-in-background-in-excel-format.htm]

This is one approach which you can try.

Read only

Former Member
0 Likes
2,024

Answered