cancel
Showing results for 
Search instead for 
Did you mean: 

How to test/debug the UDF used for storing file on Server

nitinlpatil12
Participant
0 Kudos

Hi Experts,

I had written the UDF to save the runtime created xml file on server. It was working 3-5 days back but now it is not working.

I had to store the timestamp from response and save it as a xml file to be used for next request sent to Target system.

Code for your reference,

public String StoreTimeStamp(String TimeStamp, Container container) throws StreamTransformationException{

try {

                            String FinalXML = "";

                            String FilesPath = "/usr/sap/tmp";

                String StartString = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><ns0:MT_GetPendingRequest_TimeStamp xmlns:ns0=\"urn:ariba.com:xi:AribaIntegration\"><TimeStamp>";

                String EndString = "</TimeStamp></ns0:MT_GetPendingRequest_TimeStamp>";

               

                FinalXML = FinalXML.concat(StartString);

                FinalXML = FinalXML.concat(TimeStamp);

                FinalXML = FinalXML.concat(EndString);

                             byte[] FinalBytes = FinalXML.getBytes();

                            try{

                                String FileName = "GetPendingRequestOrderConfirmation.xml";

                                File path = new File(FilesPath+FileName);

                              FileOutputStream fos = new FileOutputStream(path);    

                                fos.write(FinalBytes);

                            }

                            catch(IOException IOE)

                            {

                                StreamTransformationException STE = new StreamTransformationException(IOE.getMessage(),IOE);

                                STE.setStackTrace(IOE.getStackTrace());

                                throw STE;

                         }                 

return TimeStamp;

}

catch(Exception e){

throw new RuntimeException("Exception : "+e);

}

}

Please let me know how can I troubleshoot/test or debug the UDF or any other suggestion.

Regards,

Nitin Patil

Accepted Solutions (0)

Answers (2)

Answers (2)

markangelo_dihiansan
Active Contributor
0 Kudos

Hi Nitin,

Could be a folder permission problem, can you check this with your basis team?

Regards,

Mark

former_member183816
Active Participant
0 Kudos

Add traces in your code, wherever you think, something is going wrong, like below.

container.getTrace().addInfo("*** Debugging *** Entered UDF StoreTimeStamp to store timestamp");

Test your code either in OM or MM, using test tab to troubleshoot.