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

send excel to shared folder

vallamuthu_madheswaran2
Active Contributor
0 Likes
3,141

Hi Friends,

My requirement is that just get the data from the table send the data(excel file) to the shared folder.

Kindly provide the steps. I have searched the existing threads but no fruitful result.

Thanks with Regards,

Vallamuthu M

8 REPLIES 8
Read only

former_member717457
Participant
2,589

Hello Vallamuthu Madeswaran,

Pls. find the below code, it may useful to you for this requirement.

REPORT ZFILE.
TABLES mara.
data it_mara TYPE TABLE OF mara.
data wa_mara like LINE OF it_mara.
data lv_file TYPE rlgrap-filename.
data lv_data type string.

START-OF-SELECTION.
SELECT * FROM mara INTO TABLE it_mara UP TO 10 ROWS.

lv_file = 'sample.xls'.
OPEN DATASET lv_file FOR OUTPUT In TEXT MODE ENCODING DEFAULT.
loop AT it_mara INTO wa_mara.
CONCATENATE wa_mara-matnr
wa_mara-mtart
wa_mara-mbrsh
wa_mara-meins
wa_mara-ernam
wa_mara-ersda
INTO lv_data SEPARATED BY ','.
TRANSFER lv_data to lv_file.
clear: wa_mara.
ENDLOOP.
if sy-subrc IS INITIAL.
MESSAGE 'File stored to FTP path Successfully' TYPE 'I'.
ENDIF.
CLOSE DATASET lv_file.

Thanks

Sathish Kumar Sidhaiyan

Read only

2,589

That's a CSV, not an Excel file

It's not going to a shared folder.

Read only

former_member717457
Participant
0 Likes
2,589

After executing the code the excel file will store into shared file folder and you can check this in Home directory using Transaction AL11.

Thanks

Sathish Kumar Sidhaiyan

Read only

vallamuthu_madheswaran2
Active Contributor
0 Likes
2,589

Hi Sathish,

Thanks for your update.

We'll not stored in AL11. Shared folder is not in SAP system. it's separate storage path, which was provided by our company.

Thanks with Regards,

Vallamuthu M.

Read only

2,589

Then you need to ask your Basis consultants to map the directory, otherwise you won't be able to write to it.

Read only

2,589

In addition to c5e08e0478aa4727abc4482f5be390b2 's words, if the shared folder is mapped on users' PC, you can use the download on local file (but you cannot run the report in background, of course)

Read only

former_member717457
Participant
0 Likes
2,589

Hello Vallamuthu,

Try the below FM to download your Internal table records as excel file (Any file path).

FM: MS_EXCEL_OLE_STANDARD_DAT

Also go-through the link.

Internal Table to Excel http://abaplovers.blogspot.com/2008/05/abap-internal-table-to-excel-sheet.html

Thanks

Sathish Kumar Sidhaiyan

Read only

0 Likes
2,589

Hi Sathish,

Thanks for your update.

But it'll not download the file in the background.

Thanks with Regards,

Vallamuthu M