Skip to Content
0

Dynamic Target FileName in SAP CPI/HCI Is not working

Apr 20 at 12:46 PM

302

avatar image

Hello Everyone,

I am working on 2.39.7 CPI tenant and I am unable to create receiver file name dynamically based on my source payload.I did maintained the correct X-PATH in content modifier. Its a straight interface no calls to external systems hence there is no chance to loose data from header value.

Followed the below blogs and links which did not help me in creating the dynamic file name.

https://blogs.sap.com/2016/07/10/sap-hcp-is-sap-hci-dynamic-configuration-for-sftp-adapter/

https://answers.sap.com/questions/264585/add-message-content-to-filename-in-my-scenario-in.html

PS: ---> I also tried with script by fetching header values and setting the CamelFileName in header.

---> Dynamic File name worked partially by deleting the CamelFileName in content modifier however filenames creating with exchange Id.This was not my requirement.

Any inputs on this issue,please?

Cheers

Pavan Nukala

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

7 Answers

Best Answer
Pavan kumar May 03 at 05:13 PM
1

Hello Sriprasad and Morten,

Issue resolved.Able to create file name dynamically.

Test1 header I am fetching with an XPath to obtain a filename contains a newline character before and after the actual name and this is the reason for the failure.

remove newline characters by setting below parameter in content-modifier.

//Record/normalize-space()

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Hello Pavan,

Thanks A Lot for the update on resolution part it really helps our community members.

1
Sriprasad Shivaram Bhat
Apr 21 at 08:22 AM
1

Hello Pavan,

I dont see any bug in Setting Filename dynamically ( even i have tried again now) it works fine with new version also.

Could you please share your receiver channel configuration ( hope you are trying to set the target filename in first SFTP channel not the one connected to Exception subprocess).

Regards,

Sriprasad Shivaram Bhat

Show 2 Share
10 |10000 characters needed characters left characters exceeded

Hello SriPrasad,

Initially,I tried with main iflow with out exception sub process however still I have the same issues.Then I decided to have the exception to find runtime error log details by creating XML file.Yes I am trying to create file name in first SFTP channel.

Please find attached screen shots of receiver SFTP channel.

1-sftp.png (15.7 kB)
2-sftp.png (19.3 kB)
0

missing attachments

3-sftp.png (9.4 kB)
4-sftp.png (8.0 kB)
0
Sriprasad Shivaram Bhat
Apr 21 at 03:23 PM
1

Hey Pavan,

This works well and good with 2.39.6.I dont see any issue with you IFlow and Configuration. Something might have changed in latest release.Please create a case to SAP.

Regards,

Sriprasad Shivaram Bhat

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Hello Sriprasad,

Thanks for your support over weekend.Appreciate It.

I started working on this interface since 8-Apr-2018 before my latest tenant version.Initially i was under the impression that something wrong from my side however after confirming and understanding the log in each pipe line step then i posted this question.Anyways will raise incident with SAP and will keep posted the status.

sftp-folder.png (48.1 kB)
capture.png (47.3 kB)
0
Sriprasad Shivaram Bhat
Apr 20 at 12:54 PM
1

Hello Pavan,

Could you please share screenshot of content modifier where you have set the CamelFilename header with screenshot of your receiver SFTP channel.

Regards,

Sriprasad Shivaram Bhat

Share
10 |10000 characters needed characters left characters exceeded
Morten Wittrock
Apr 20 at 01:21 PM
1

Hi Pavan

This sounds like you're not setting the header, you expect to be setting. After your Content Modifier step, double check the header by, for instance, writing it to the log in a Script step with the following code (assumes log level Debug or higher):

import com.sap.gateway.ip.core.customdev.util.Message;

def Message processData(Message message) {
    def log = messageLogFactory.getMessageLog(message)
    log.setStringProperty("CamelFileNameHeader", message.getHeaders().get("CamelFileName"))
    return message
}

Also, it would be helpful if you posted your inbound XML, and described how you want to extract the file name.

Regards,

Morten

Share
10 |10000 characters needed characters left characters exceeded
Pavan kumar Apr 20 at 01:10 PM
0

Hello SriPrasad,

Thanks for the quick response.Here we go,please find below screen shots for your reference.


content.png (21.4 kB)
filename.png (12.5 kB)
iflow.png (45.6 kB)
files.png (16.4 kB)
error.png (10.6 kB)
Show 2 Share
10 |10000 characters needed characters left characters exceeded

Hello Pavan,

Please share your input XML.

Regards,

Sriprasad S Bhat

0

Hi SriPrasad,

here is my source xml

<?xml version="1.0" encoding="UTF-8"?>
<Details>
<Record>
3_TestToSAPPIPOMessageFeatures
</Record>
</Details>
0
Pavan kumar Apr 20 at 08:21 PM
0

Hi Morten,

Appreciate for your response.If I read correctly,you are suggesting to enable the log through script?

I enabled the trace and verified the log in each and every step of camel pipe line step in WebUI.CamelFileName is setting from the definitions given in the content modifier however receiver SFTP channel failed to fetch/get the dynamic file name from the header and ultimately failing to create the receiver file,then I am handling the exception and creating the error.xml please find below screens for your reference.If I am not wrong, this may be bug in SFTP ;-)


trace.png (66.3 kB)
trace2.png (110.6 kB)
trace3.png (31.0 kB)
Share
10 |10000 characters needed characters left characters exceeded