cancel
Showing results for 
Search instead for 
Did you mean: 

text Exception in UFD for remove duplicated file

former_member745782
Active Participant
0 Kudos

hello Gurus,

i have a problem.

after following the wiky "Different ways to keep your Interface from processing duplicate files " i decided to crate my UDF and put it inside my graphical mapping.

All works fine but in case of duplicate file i have a error in monitor like this:

<SAP:Stack>During the application mapping com/sap/xi/tf/_MM_RTTicket1_ a com.sap.aii.utilxi.misc.api.BaseRuntimeException was thrown: RuntimeException in Message-Mapping transformatio~</SAP:Stack>

I would like put a more exaustive text like "file duplicated!!!"

i put this code on end of module:

catch(Exception e){

+ throw new BaseRuntimeException(" file is already processed");+

}

but no result.

any suggestion??

if u want i can send u code of all module

thanks in advance

Alex

Accepted Solutions (1)

Accepted Solutions (1)

stefan_grube
Active Contributor
0 Kudos

You can see your error message only in trace.

former_member745782
Active Participant
0 Kudos

hello Stefan,

in wich trace? trace in xml monitor?

i checked but i not found my message.

this is my UDF:

String processedFileDatabase = processedFile[0];

String sourceFileName;

DynamicConfiguration attrib = (DynamicConfiguration)container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);

DynamicConfigurationKey fileKey = DynamicConfigurationKey.create("http:/""/sap.com/xi/XI/System/File","FileName");+

attrib.put(fileKey,attrib.get(fileKey));

sourceFileName = attrib.get(fileKey);

File fileDB=new File(processedFileDatabase);

try{

if (!(fileDB.exists() && fileDB.canWrite() && fileDB.canRead())){

+ fileDB.createNewFile();+

}

Vector fileNameList = new Vector();

BufferedReader br = null;

br = new BufferedReader(new FileReader(processedFileDatabase));

String name = new String();

//loop and read a line from the file as long as we dont get null

while ((name = br.readLine()) != null)

+ //add the read word to the wordList+

+ fileNameList.add(name);+

br.close();

boolean fileAlreadyProcessed = fileNameList.contains(sourceFileName);

if (!fileAlreadyProcessed) {

+ Writer output = new BufferedWriter(new FileWriter(new File(processedFileDatabase),true));+

+ output.write(sourceFileName + "\r\n");+

+ output.flush();+

+ output.close();+

}

+result.addValue("" + !fileAlreadyProcessed);+

}

catch(Exception e){

+ throw new RuntimeException(" file is already processed");+

}

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Alex,

Ref: http://wiki.sdn.sap.com/wiki/display/XI/DifferentwaystokeepyourInterfacefromprocessingduplicate+files

You would find an UDF in the link.. that might help you.

Thanks,

former_member745782
Active Participant
0 Kudos

hi Hareenkumar!

yes i know this link

I followed this one for build my interface.

I'm able to filter duplicated file but the error in monitorning is so much generic and i cannot set a custom exception with custome text.

Former Member
0 Kudos

Hi Alex,

Check the blog : /people/alessandro.guarneri/blog/2006/01/26/throwing-smart-exceptions-in-xi-graphical-mapping

This may help you...

Thanks,

former_member745782
Active Participant
0 Kudos

yes thanks! i see this blog and i tried this way but i still to see the same error and in trace i don't see anything

former_member745782
Active Participant
0 Kudos

any others helps?