cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic file Name Generation-problem

Former Member
0 Kudos

Hi Friends..

in My Idoc to File..

i want to generate Dynamic File Name ..

i put the logic in Message mapping -java intialization section


Container container = null;
SimpleDateFormat simpledatFormat = new SimpleDateFormat("yyyyMMdd");
Date date = new Date();
String datewithYear = simpledatFormat.format(date);
SimpleDateFormat simpledatFormat1 = new SimpleDateFormat("HHmmss");
Date date1 = new Date();
String datewithMs = simpledatFormat1.format(date1);


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

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

String oldFileName=conf.get(key);
String valueNew;

if( oldFileName == null){

 valueNew = "HRXML"+datewithYear+datewithMs+".xml";
}
else{
valueNew =oldFileName+datewithYear+datewithMs+".xml";
}
//set the new filename
conf.put(key, valueNew);

and i did in reciever File adaper adaper specific settings..

i am getting error sxmb_moni..


<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> 
- <!--  Request Message Mapping 
  --> 
- <SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="1">
  <SAP:Category>Application</SAP:Category> 
  <SAP:Code area="MAPPING">EXCEPTION_DURING_EXECUTE</SAP:Code> 
  <SAP:P1>com/sap/xi/tf/_ZHRMD5_to_HRMasterData_MM_</SAP:P1> 
  <SAP:P2>com.sap.aii.utilxi.misc.api.BaseRuntimeException</SAP:P2> 
  <SAP:P3>java.lang.NullPointerException</SAP:P3> 
  <SAP:P4 /> 
  <SAP:AdditionalText /> 
  <SAP:ApplicationFaultMessage namespace="" /> 
  <SAP:Stack>com.sap.aii.utilxi.misc.api.BaseRuntimeException thrown during application mapping com/sap/xi/tf/_ZHRMD5_to_HRMasterData_MM_: java.lang.NullPointerException</SAP:Stack> 
  <SAP:Retry>M</SAP:Retry> 
  </SAP:Error>

if we remove the dynamic File configuration logic in message mapping ..i am getting the result..

please guide me..

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Amol..

thanks alot..before you replied i did...

thanks for notifying..

thanks alot..

i awarded ponts...

regards

Former Member
0 Kudos

Hi Amul.

thanx for your response..

i am not understanding why i am getting Null Pointer Exception..and how to overcome

please guide me to solve the problem..

regards

Former Member
0 Kudos

remove the line

Container container = null;

should solve your problem.

Former Member
0 Kudos
Container container = null;

..

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

bound to get a NPE as your variable container is not getting intialized to a valid object ref here...