cancel
Showing results for 
Search instead for 
Did you mean: 

"File Name already exist" issue using SFTP Advanco Adapter

Former Member
0 Kudos

Dear Friends,

We have created outbound interface (i.e. SAP[Proxy] to Client[SFTP]).

Client is Bank application, so we have used Signing & Encryption method using SFTP advanco adapter.

We are using Dynamic File name option as we are getting file name from SAP

In Advanced tab, ASMA: Checked, Overwrite ASMA Namespace:http://sap.com/xi/XI/System/File , File Name: Checked

In File Access tab, File Name Scheme: tried giving (*,[FileName:WRyyyymmddHHMMSS], %FileName% etc etc.)

In General File Name scenarios,

Method 1: If file name is coming from Sender, then Dynamic File name in Mapping, ASMA Settings in channel and File Name parameter are ignored

Method 2: If file name is not coming from sender then we give file name in File Access Parameter and mode as Add Time Stamp/Counter/MessageID

In our scenario, we used Method 1, but strangely it is trying to create file using both the options i.e. Dynamic File Name & File Access Parameter and in channel monitoring it is popping up File already exist(even though it is created for the first time).

We also verified SFTP server folder has no Restriction/additional permissions for placing the files. I have browsed previous SCN discussion and tried all the possibilities, But no LUCK

The above problem is resolved by checking "Overwrite Existing File" in processing tab. But client's opinion was not to Overwrite the files.

Please share you thoughts, if you guys have come across such issue.

Thank you !

Accepted Solutions (0)

Answers (3)

Answers (3)

former_member183908
Active Contributor
0 Kudos

Date dat = new Date(); // get the current date

DateFormat df = new SimpleDateFormat("yyyyMMddHHmmss"); // set the format

// Declaration Part

MappingTrace objTrace = container.getTrace();

DynamicConfiguration objDynConf = null;

DynamicConfigurationKey objDynConfKey = null;

String strSrcFileName = null;

final String URI = "http://advantco.com/xi/XI/SFTP/SFTP";

final String NODE = "FileName";

// Set the File Name dynamically based on the Input 'strFileName'

try

{

//added below sleep stmt to avoid the file name conflcits. want to make 2 sec delay before it compile the file name.

Thread.sleep(2000);

String strFileName ="1040hw_" + df.format(dat) + ".xml";

// Get the Stream Transformation Constants from the Dynamic Configurations

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

// Create the Target Dynamic Configuration Payload

objDynConfKey = DynamicConfigurationKey.create(URI, NODE);

// Write the Input File Name to the Target Dynamic Configuration Payload

objDynConf.put(objDynConfKey, strFileName);

// Set the Stream Transformation Constants in the Target Dynamic Configuration Payload

container.setParameter(StreamTransformationConstants.DYNAMIC_CONFIGURATION, objDynConf);

}

catch(Exception objException)

{

objTrace.addWarning("Exception while setting the Source File Name"+objException.getMessage());

}

return ( "" );

please use this UDF code and modify accordingly to your requirement.I used this UDF in one my IDOC to FILE interface using SFTP Advantco.I used sleep statement to avoid the filename conflict

Thanks

Former Member
0 Kudos

Good Thought, gave a try but it did not work.

Dynamic file name is working as expected so we are getting no issue with the File Name.

I think there will not be any issue if check "Overwrite existing file" option in channel as the proxy is executed at a particular time and content of message will be same.

former_member183908
Active Contributor
0 Kudos
I think there will not be any issue if check "Overwrite existing file" option in channel as the proxy is executed at a particular time and content of message will be same.

absolutely correct.It means when you check Overwrite existing file you don't have any issues so definitely you have the duplicate entries with same file name.

I have checked Dynamic Configuration step in SXMB_MONI. But did not find any multiple messages

Did you check all the messages which processed?

Thanks

Former Member
0 Kudos

Yes, I have checked all the messages. Everything looks fine.

1st Message to Receiver1 (ECC)

2st Message to Receiver2 (Client)

3st Message, Branch step (i.e. in RD given 2 receivers)

former_member183908
Active Contributor
0 Kudos

why don't you try to replicate with SAP SFTP and see if it works or not also if you have non central adapter engine please try to run the interface and see this is just a trail and error not the exact fix.


1st Message to Receiver1 (ECC)

2st Message to Receiver2 (Client)

3st Message, Branch step (i.e. in RD given 2 receivers)

what is this flow?your flow supposed to be SAP ECC To File which you are using Proxy to SFTP rite?

Thanks

Former Member
0 Kudos

We have only SFTP advanco adapter installed in our PI Server. All the interfaces are using SFTP adapter provided but advanco. And we are using central adapter engine only.

Interface flow:

                    --SAP ECC File server (archiving Non encrypted file)

SAP ECC--|

                    --Client (encrypted file)

I have reported this error to my counter part at onsite and shared the same solution i.e. "Overwrite existing file" and they are OK as the content of the message is not modified and the Interface will be executed only once in a day.

Thanks Pavan for the replies.

Regards,

Rajesh G

former_member183908
Active Contributor
0 Kudos

okay very strange issue however if you want to explore the issue please deploy the SAP SFTP in Sandbox or DEV its for free and try to replicate the end to end interface may be in future it can be a big problem sometimes if it overwrites the actual business data.Give a try it does not take much time.

Please close this thread if you are fine with the issue resolution.

Thanks

former_member183908
Active Contributor
0 Kudos

can you check the file name in Dynamic Configuration step in SXMB_MONI for all the messages which were processed recently and see if there is any issue with duplicate filename sometimes multiple messages can deliver within the seconds.Your filename does not have milliseconds so please check for the file names from MONI and compare

Thanks

Former Member
0 Kudos

Hi Pavan,

Thanks for the reply.

I have checked Dynamic Configuration step in SXMB_MONI. But did not find any multiple messages.

giridhar_vegi
Participant
0 Kudos

Hi Rajesh,

Please check the udf in message mapping

Thanks

Giridhar.

Former Member
0 Kudos

Hi Giridhar,

UDF looks alright, as we are getting the file name as expected (WR*****YYYYMMDDHHMMSS) which is coming from Sender i.e. SAP.