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

Program to download file

Former Member
0 Likes
780

Hello Expert,

i want to write a program in which if i execute program data should store in the file.

The file structure is :

PNT 01FPMGERIMSGER00000001A20091023TEAMLEADER -Header file

PNT 01FPMGERIMSGER001BFPMPOR000010 0010000 M012345678 20091025--- Records

PNT 01FPMGERIMSGER001BFPMPOR000010 0010000 M012345678 20091025----Records

PNT 01FPMGERIMSGER00000001ZOO12222888888888 - Trial file

So hw i can make this in internal table and download to file.

Thanks and regards,

Zubera

Hello Expert,

i want to write a program in which if i execute program data should store in the file.

The file structure is :

PNT 01FPMGERIMSGER00000001A20091023TEAMLEADER -Header file

PNT 01FPMGERIMSGER001BFPMPOR000010 0010000 M012345678 20091025--- Records

PNT 01FPMGERIMSGER001BFPMPOR000010 0010000 M012345678 20091025----Records

PNT 01FPMGERIMSGER00000001ZOO12222888888888 - Trial file

So hw i can make this in internal table and download to file.

Thanks and regards,

Zubera

5 REPLIES 5
Read only

rainer_hbenthal
Active Contributor
0 Likes
750

Search the forum and the wiki for download. There are tons of examples.

Read only

Former Member
0 Likes
750

hi,

Moderator message - Please respect the 2,500 character maximum when posting. Post only the relevant portions of code

Edited by: RAHUL SHARMA on Oct 23, 2009 3:46 AM

Edited by: RAHUL SHARMA on Oct 23, 2009 3:47 AM

Edited by: Rob Burbank on Oct 23, 2009 9:33 AM

Read only

Former Member
0 Likes
750

Thanks for your quick reply.

i am facing problem first i have to write header data and line item data.

first i have to populate header data to file( all the field is constant ), line item and than file trialer record.

i want to know only one internal table can i use or more than one internal table and how to populate header and item data to file.

Thanks and regards,

Zubera

Read only

0 Likes
750

Hi,

You could use both the options. You could either decalre a single internal and populate all the header, item and trailier records to it and use GUI_DOWNLOAD.

Else use a seperate internal table for header and specify it in the header import parameter of the FM gui_download with the item and trailer records in a separate internal table

Vikranth

Read only

Former Member
0 Likes
750

Best way to this is to loop at internal table.

move your data to a char variable of your desired length in which you think your whole work area can be accommodated. Then transfer this variable to the file path.

Keep your header and trailer records already written to a char type variable (as described above).

In the above loop statement use AT FIRST to write the Header and use AT LAST to write the Trailer.

For Example:

Loop at itab into wa .

at first.

transfer v_header to v_filepath(with filename).

end at.

v_char(4) = wa-1.

v_char+4(4) = wa-2.

.

.

.

transfer v_char to v_filepath(with filename).

at last.

transfer v_trailer to v_filepath(with filename).

endat.

endloop