Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

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

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

Former Member
Not what you were looking for? View more on this topic or Ask a question