Dynamic change file receiver file name
In actual business requirements, there are many file names that need to be dynamically changed, such as writing different file names based on some judgment logic,
There are several methods that can be used on the ID side using the XPath method. One of the methods is listed below, the UDF method,
Custom functions during message mapping,CodeAs follows:
Dynamicconfiguration conf = (dynamicconfiguration) container. gettransformationparameters (). Get (streamtransformationconstants. dynamic_configuration );
Dynamicconfigurationkey key = dynamicconfigurationkey. Create (
"Http://sap.com/xi/XI/System/File ",
"FILENAME"); // if you want to change the directory, replace filename.
String valuenew = "";
String valueold = Conf. Get (key); // obtain the name of the original file,
// If (valueold! = NULL) {// determine whether the original file name exists
Valuenew = "test"; // valueold. replaceall ("input", "output"); // change the file name to a new one.
Conf. Put (Key, valuenew );
//}
Return;
These start mapping, as long asNon-data field (non-leaf node)Mapping,
At this time, the development of the IR end is complete. The following is the ID end. The ID end is very simple. adapter-specific attributes,
Based on this idea, you can change the directory, file type, and other content.