on 06-28-2020 7:37 AM
Hi,
I have a requirement to change the name of the file inside CPI(Cloud Platform Integration).
I am receiving a file from an external SFTP folder and need to change the name of the file inside CPI. For example, if the name of the file that I receive from the external SFTP connection is Test123, I need to change the name of the file to Test-123 inside CPI.
I tried using Camel file name and groovy script but was not able to do the same. If anyone has an example code of doing this through groovy script, it would be very helpful.
Thanks,
Sushanth
Hi
In content modifier read incoming filename .
Name--FileName value--${file:name.noext}
In groovy script change filename
import com.sap.gateway.ip.core.customdev.util.Message;
import java.util.HashMap;
def Message processData(Message message) {
String Name = message.getProperty('FileName');
String a = "X" + Name; <modify file name as per your requirement>
message.setProperty("FileName1",a);
return message;
}
In Receiver adapter put filename as ${property.FileName1}.csv.
Thanks
Harsha
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi sushanth.hulkod3,
Could you please check below blog for more details.
https://blogs.sap.com/2016/07/10/sap-hcp-is-sap-hci-dynamic-configuration-for-sftp-adapter/
hope this helps !
thank and regards,
Praveen T
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Thanks for your reply.
I will not be able to use the technique mentioned in the blog:
https://blogs.sap.com/2016/07/10/sap-hcp-is-sap-hci-dynamic-configuration-for-sftp-adapter/
In my case, I will have to split the incoming file name and then use the substring function. If you have an example of a CPI artifact using groovy script that can do the above function, it would be very helpful.
Thanks,
Sushanth
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
89 | |
10 | |
9 | |
9 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.