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

Renaming a file

Former Member
0 Likes
1,013

Hi Experts,

I have an .xls file with me. I need to rename it to .csv file. A program returns me the .xls file and so i need to handle the conversion internally and pass it to another SAP standard program. only a small rename and we need not do anything else. Is there any function module available for this?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
856

Hi All,

Thanks for your suggestions but... i have the file in program, like... i am calling two SAP standard programs. The first one returns me an .xls file. The second one takes the .csv file as input. I need to rename the file <b>internally in the program</b>. Can this be done via any function modules?

Hi All,

Thanks for your suggestions but... i have the file in program, like... i am calling two SAP standard programs. The first one returns me an .xls file. The second one takes the .csv file as input. I need to rename the file <b>internally in the program</b>. Can this be done via any function modules?

5 REPLIES 5
Read only

Former Member
0 Likes
856

Try this FM - KCD_CSV_FILE_TO_INTERN_CONVERT

Read only

Former Member
0 Likes
856

hi,

u can save the file in CSV format itself..open the existing Excel file and then give save as then while saving it u give in CSV format..once u give that one popup window will come.saying that u want to save as comma delimted file.tthengive yes to that...I thik this should solve ur problem.

Reward with points if helpful.

Read only

Former Member
0 Likes
856

Some more description -

call function 'SAP_CONVERT_TO_TEX_FORMAT'

exporting

i_field_seperator = ','

tables

i_tab_sap_data = itab

changing

i_tab_converted_data = itab1.

search path for '.CSV'.

if sy-subrc eq 0.

call function 'WS_DOWNLOAD'

exporting

filename = path

tables

data_tab = itab1.

else.

message e016(z4).

endif.

Read only

Former Member
0 Likes
857

Hi All,

Thanks for your suggestions but... i have the file in program, like... i am calling two SAP standard programs. The first one returns me an .xls file. The second one takes the .csv file as input. I need to rename the file <b>internally in the program</b>. Can this be done via any function modules?

Read only

0 Likes
856

Just follow below logic in your custom report ;

1. Call SAP standard Report which return .xls file,

2. Download it on local presentation server internally (ws_download) on fix file path,

3. Call SAP std FM - 'SAP_CONVERT_TO_TEX_FORMAT' as describe and download it on fixed path on presentation server,

4. Upload file for second report from step no. 3.