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

Heading for fields in File

Former Member
0 Likes
963

hi frenz,

I'm using gui_download to download a internal table content as a presentation server file.

Now the problem is, i'm not able to give the heading for each field names in file. File only contains the field values. So how to give column name?

I can do that with alv_download function module with fielcatalog stuffs... But it's a big coding stuff. So i want something other than that.

Prompt answers will be rewarded with points.

with regards,

praveen.

Message was edited by: Praveen Rajendran

1 ACCEPTED SOLUTION
Read only

Vinod_Chandran
Active Contributor
0 Likes
924

Hi Praveen,

Two ways you can do this.

1. Have the header as the first line of the internal table.

2. First create an internal table which only holds one record with just headings. You already have an internal table for data and download this to the same file location and name in append mode . Set the import parameter "append = 'X'".

Regards

Vinod

hi frenz,

I'm using gui_download to download a internal table content as a presentation server file.

Now the problem is, i'm not able to give the heading for each field names in file. File only contains the field values. So how to give column name?

I can do that with alv_download function module with fielcatalog stuffs... But it's a big coding stuff. So i want something other than that.

Prompt answers will be rewarded with points.

with regards,

praveen.

Message was edited by: Praveen Rajendran

6 REPLIES 6
Read only

Vinod_Chandran
Active Contributor
0 Likes
925

Hi Praveen,

Two ways you can do this.

1. Have the header as the first line of the internal table.

2. First create an internal table which only holds one record with just headings. You already have an internal table for data and download this to the same file location and name in append mode . Set the import parameter "append = 'X'".

Regards

Vinod

Read only

Former Member
0 Likes
924

Hi Praveen,

Insert the headings as first record into your internal table. and poupulate ur internal table and call the FM.

Best Regards,

Vijay

Read only

Former Member
0 Likes
924

hi vinod,

I've tried those two methods also. thats working. But i just want to know whether we got any other formal method of doing this. Otherwise it fine. So is there any other way or in-built functionality for doing it?

With regards,

praveen

Read only

0 Likes
924

Hi Praveen,

As far as I know this is the solution for your requirement. I have not seen any other solution to this for similar earlier posts.

Thanks

Vinod

Read only

0 Likes
924

Hi Praveen,

1) If you are downloading this as a txt file then there is no other alternative method to this. But here you'll have some problems. eg: if the field is a numeric field in the internal table and you try to enter the heading/title in the first line it cannot get apended. In this case you shud make all the fields as char.

2) Other alternative to this is you can download the contents in a excel sheet format using the function module MS_EXCEL_OLE_STANDARD_DAT. In the tables, you can actually pass two itabs. One for headers (Fieldnames) the contains only the field names 1 row. The actual data can be in Internal table assigned to (data_tab).

This will surely solve this issue.

Cheers,

Sam

Read only

Former Member
0 Likes
924

Hi, if you concern that the heard line content is not enough flexbile as a general solution, maybe you can get the field name by some FM, not hard code(if you current use it).

List as following:

'REUSE_ALV_FIELDCATALOG_MERGE'

'GET_COMPONENT_LIST'

CL_ABAP_STRUCTDESCR CL_ABAP_TYPEDESCR

call them, you can get any fields name of the internal table or structure, and your solution will be suitable for more general case.