cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic configuration for receiver adapter doesn´t work with a SFTP sender adapter

0 Kudos

Hello,

I have got a curious problem with a SFTP sender adapter.

At first I had a szenario with a sender file adapter and a receiver file adapter, both with transport protocol file system (NFS). In a mapping I used a UDF to set the file name and the directory for the receiver adapter by dynamic configuration. Everything worked fine.

Then I replaced the sender file adapter with a SFTP adapter. The file is picked up from the server, no error in SXMB_MONI, but there is no file created in the target directory! In SXMB_MONI I can see that the dynamic configuration doesn´t work, the entries for filename and directory are missing. But how can that be? The mapping and the receiver adapter are still the same, so why it shouldn´t work with another sender adapter?

Or is there anything else I have to do?

Regards,

Marcus

Accepted Solutions (1)

Accepted Solutions (1)

former_member184720
Active Contributor
0 Kudos

You just need to change the namespace in the sender sftp adpater " "http://sap.com/xi/XI/System/File"

Refer to the below discussion - http://scn.sap.com/message/14753512#14753512

0 Kudos

Hi Hareesh,

I tried this, but it doesn´t work. In SXMB_MONI / DynamicConfiguration I can see that the filename and directory receive the values of the sending SFTP adapter and not the values that I set in the UDF.

This is the configuration of the SFTP sender adapter:

And this is the configuration of the file receiver adapter:

This is the very simple UDF for setting the filename (which, as described, works wiht a file sender adapter). The UDF for the directory is similar.

Is there anything else I have to change?

Regards,

Marcus

former_member191435
Contributor
0 Kudos

Can you please use below UDF


   public String setFileName(String FileName, Container container) throws StreamTransformationException{

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

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

conf.put(key, FileName);

return FileName;  

}

Before this, you can try to change filename to FileName in your UDF..

Thanks,

sreenivas

Former Member
0 Kudos

Hello,

Ur UDF looks OK to me where u are just setting file name with "parmFileName" argument value, but tell me one thing what's the value of parameter "parmFileName"? This value is coming form source XML or what?

The reason why i am asking this becoz i can see that u are just setting file name for ur receiver file adapter and no where reading SFTP file name, so i was wondering do u really need ASMA checked in SFTP sender adapter?

Thanks

Amit Srivastava

0 Kudos

Hi Amit,

the value of "parmFileName" is set in the message mapping. It consists of a constant, the current date and a fix value depending of one static field of the incoming file, e.g. ABC_20140702_YZ. This might have also be done in the UDF, but realizing it in the message mapping was easier to me.

Maybe it is not necessary to use the ASMA in the SFTP sender adapter, because I don´t use these values in the UDF. The problem is, when I don´t activate the ASMA the values for filename and directory are not set in the DynamicConfiguration, as I can see in SXMB_MONI:

When I activate ASMA, it contains the values of the SFTP sender adapter:

But there should be the values that I set in the UDF, and it works when I replace the SFTP sender adapter with a file sender adapter. That´s what is driving me crazy...

Do you understand?

former_member184720
Active Contributor
0 Kudos

Hi Marcus - No need to enable the ASMA as you are not using them.

in SXMB_MONI you might not be able to find this attribues under Inbound Message, but check for the dynamic configuration under Responce.

Are you sending the same file from both file and SFTP adapter?

If not i suspect it could be that the static filed might be missing in the file which you sent from SFTP.

May be you do a display queue before the dynamic filename UDF to see, if you are getting the "paramFileName" correctly.

You can even test it in the other way, Just set the fileName to a constant in the UDF and see whether it works..

0 Kudos

Hi Hareesh,

the files are identical, everything is identical exept the sender adapter...

I tried setting the filename by a constant in UDF, but this doesn´t work too. In the dynamic configuration under response there is no entry for the filename.

I don´t understand it, I tested a lot in the past two days. Why shouldn`t the dynamic configuration for the receiver adapter fail when the sender adapter is changed? Might this be a bug of the SFTP adapter?

Did anybody else made this experience?

former_member184720
Active Contributor
0 Kudos

Strange.

Btw when you run from SFTP adapter, are you getting any error or  the files are being created? I assume it should fail as you have enabled the checkbox for fail if attributes are missing..

If it is creating the files, can you confirm what the file name is?

Former Member
0 Kudos

Hello,

What exactly u are getting when u just use DC Code + Enable ASMA (filename) in file receiver adapter - if possible paste file receiver adapter logs?

Never heard of DC problem while using SFTP - BTW, which version of PI u are using?

Thanks

Amit Srivastava

0 Kudos

Hi Hareesh,

no, there is no file being created. The receiver adapter shows following error:

Could not process due to error: com.sap.aii.adapter.file.configuration.DynamicConfigurationException: The Adapter Message Property 'FileName' was configured as mandatory element, but was not supplied in the XI Message header

What is right, because the dynamic configuration is not set as we can see in SXMB_MONI...

former_member184720
Active Contributor
0 Kudos

Hi Marcus - i know it's weird but personally i don't think it has got something to do with SFTP adapter as we are not reading anything from the sender.

It worked in the above suggested thread, May be you can compare the UDF and configuration once again and make sure that the cache is updated.

Former Member
0 Kudos

Hello,

According to u, if use Sender File(without checking ASMA ->FileName) in place of SFTP adapter then DC is working fine?

BTW, which version of PI u are using?

Note - I have tested DC with SFTP and it's working fine for me in PI7.31 SP05.

Thanks

Amit Srivastava

0 Kudos

Hi Amit,

see the receiver adapter error in my last answer to Hareesh.

We are on PI 7.30. BTW, our basis team recently implemented the SFTP adapter a few weeks ago, so this is the first time we use it. But I don´t think there is something "missing" in the implementation. The SFTP adapter itself looks good, receiving and archiving files on the SFTP server works, there are no errors in the adapter log.

Regards,

Marcus

0 Kudos

Yes, with a file sender adapter the DC works, that´s why I think the UDF is correct.

I´ll check everything once again, clear the cache and when it still doesn´t work i will do an extra step where I download the files from the SFTP server to a local directory without using DC, and then do a file to file szenario with setting the filename and directory dynamically. Not nice, but the main thing is it works...

And afterwards I will wait for PI 7.31 SP05...

Former Member
0 Kudos

Hello,

Only word comes to my mind - bizarre

I would suggest you to raise OSS.

Thanks

Amit Srivastava

Answers (1)

Answers (1)

former_member184948
Active Participant
0 Kudos

Hi Marcus,

First thing the SFTP adapter supports Dynamic configuration and I ve done this just last week.

The mistake you have made is in the name of namespace :

Its should be like this

<Adapter metadata location><Adapter name>

for example :

In my case it was :

http://advantco.com/xi/XI/SFTP/SFTP

So your program should be like this :

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

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

http://advantco.com/xi/XI/SFTP

Please try this.

former_member184720
Active Contributor
0 Kudos

Here SFTP is sender not the receiver

0 Kudos

That´s right, you only have to use http://advantco.com/xi/XI/SFTP/SFTP when you want to use dynamic configuration for a SFTP receiver channel, but I use a file receiver channel.

Of course, I already tried this, and of course it doesn´t work