cancel
Showing results for 
Search instead for 
Did you mean: 

Problem in SAP XI

Former Member
0 Kudos

Hi,

I am trying to check wether file exist in the target folder in my scenario.

I got following java code which is working fine in java environment.

boolean blnFile= false;
AbstractTrace  trace = container.getTrace();
try
     {
     try
           {
	URL url = new URL("ftp://abdur:abdur@/fin.flg;type=i");
	con = url.openConnection();
	blnFile = true;
           }
     catch(Exception e)
          {
	blnFile = false;
          }
                                                                                if(blnFile == true)
		{
			trace.addWarning("fin.flg Found !!!");
		}
		else
		{
		trace.addWarning("fin.flg NOT Found !!!");
		}
    }
catch(Exception e)
{
trace.addWarning("FTP Main Function Error.");
}

But when i wrote same code in SAP XI (message mapping under function tab in init function) it is not working . It is always giving file found.

Accepted Solutions (0)

Answers (2)

Answers (2)

udo_martens
Active Contributor
0 Kudos

Hi,

i think this behaviour is because the code is excecuted from the PI server, the ftp url is accessable from your computer but not from the server.

btw: The file adapter provides some nice settings to control the process depending from existing files. Please have a look to "Processing Tab Page" in [SAP help: Configuring the Receiver File/FTP Adapter|http://help.sap.com/saphelp_nw2004s/helpdata/en/bc/bb79d6061007419a081e58cbeaaf28/frameset.htm]

Regards,

Udo

Former Member
0 Kudos

Thanks for ur reply...

if URL is not accessible from PI Server then it should raise exception...so flag value should be false...

means trace should contain Fil.Flg file not found...

But it is always showing file found,,,

former_member200962
Active Contributor
0 Kudos

Hi,

Try including your code in the java mapping itself instead of going for message mapping. Compile your code in a java editor like NWDS and include the .class file in the Interface mapping (zip the class file and include this zip file as Imported Archives and then in the Interface mapping instead of Message Mapping option select the JAVA option and include this imported archive)....hope it helps you ....

Regards,

Abhishek.