cancel
Showing results for 
Search instead for 
Did you mean: 

Calling a file channel from the mapping program

Former Member
0 Kudos

Hello everyone,

I have scenario in which i need to call the file channel from my userdefined function. Is it possible?

Please give ur suggestions

Thanks and Regards

Rahul Nawale

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

You can directly write a file in server accessible location using Java code.

Regards,

Uma

Former Member
0 Kudos

Thanks Uma,

Can i write the file to a FTP server?

Can you please provide me the java code.

Thanks and Regards

Rahul Nawale

Former Member
0 Kudos

Hi Rahul,

Code:

URL url = new URL("ftp://user-name:password@server/Test.txt;type=o");

URLConnection con = url.openConnection();

OutputStream op = con.getOutputStream();

op.write("Hello".getBytes());

op.close();

This code will create a new txt file in specified FTP server.

Regards,

Uma

prabhu_s2
Active Contributor
0 Kudos

can u make use of file adapter to write the fiel to FTP loc or it is req for using UDF?

Former Member
0 Kudos

Hi Uma,

What all packages do i have to import, since i am getting the below mentioned error

Lookup.java:42: cannot resolve symbol symbol : class URL location: class com.sap.xi.tf._File_MM_Lookup_ URL url = new URL("ftp://tele:bisleri@132.186.198.41/Test.txt;type=o"); ^ F:/usr/sap/EXI/DVEBMGS01/j2ee/cluster/server0/./temp/classpath_resolver/Map5ebd09c0b81611dbb419000d56714443/source/com/sap/xi/tf/_File_MM_Lookup_.java:42: cannot resolve symbol symbol : class URL location: class com.sap.xi.tf._File_MM_Lookup_ URL url = new URL("ftp://tele:bisleri@132.186.198.41/Test.txt;type=o"); ^ F:/usr/sap/EXI/DVEBMGS01/j2ee/cluster/server0/./temp/classpath_resolver/Map5ebd09c0b81611dbb419000d56714443/source/com/sap/xi/tf/_File_MM_Lookup_.java:43: cannot resolve symbol symbol : class URLConnection location: class com.sap.xi.tf._File_MM_Lookup_ URLConnection con = url.openConnection(); ^ 3 errors

Thanks and Regards

Rahul Nawale

Former Member
0 Kudos

Rahul,

You need to import these classes.

import java.net.URL;

import java.net.URLConnection;

import java.io.OutputStream;

Regards,

Uma

Former Member
0 Kudos

Thanks a lot Uma, my problem got solved. U r gr8 and SDN rocks ))

Answers (0)