cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic configuration for Filepath using Javamapping for Passthrough

Former Member
0 Kudos

Hello Experts,

I am trying to create a dynamic filepath through java mapping .
I am using a FTP receiver adapter .

I have written the follwoing java code


private static final DynamicConfigurationKey KEY_FILEPATH =
       DynamicConfigurationKey.create(
           "http://sap.com/xi/XI/System/File",
           "Directory");
  

  
   private static final DynamicConfigurationKey KEY_FILENAME =
       DynamicConfigurationKey.create(
           "http://sap.com/xi/XI/System/File",
           "FileName");

String FileName = conf.get(KEY_FILENAME);

String dir = "XXXX"+"/"+FileName.substring(2,5)+"/"+"/XXX/"+"/";

conf.put(KEY_FILEPATH, dir);

FTP receiver adapter will have the connection details.

I am getting the below error :

"FTPEx: 550 Unexpected reply codeCreate directory operation failed.. For details, contact your FTP server vendor".

However, I find there is no issue connecting to FTP server, when I tried connecting without dynamic configuration, it works good.

thanks for your inputs and help

Accepted Solutions (1)

Accepted Solutions (1)

RaghuVamseedhar
Active Contributor
0 Kudos

Rama,

Seems FTP user does not have access to create folder (try to give 666 access to folder where you are creating dynamic folder). Please use FileZilla to test FTP user access.

Former Member
0 Kudos

In FileZilla , I am able to able to access the server and create the directory manually

azharshaikh
Active Contributor
0 Kudos

Hi Rama,

Please check if:

1. In the audit / moni log, if you are able to see the Directory path that is returned by ur UDF

2. Try to pass some constant (instead of doing Substring) value for the Directory path or pass the Directory path that is already present in the Target System for testing if you are able to access it.

3. As suggested abv, ckh the FTP user permissions (as you trying to access Filezilla using same FTP User as in your CC?)

4. Pls provide screenshot of error logs.

Regards,
Azhar

Former Member
0 Kudos

Hello Azhar,

Thanks a lot

I tried step by step , like first I passed

String dir = "XXXX"+"/";

conf.put(KEY_FILEPATH, dir);

executed the interface, it worked.

in the next step I added the substring .

like

String dir = "XXXX"+"/"+FileName.substring(2,5)+"/";

then it worked.

However, When I added more to this ,

like

String dir = "/"+"XXX"+"/"+oldFileName.substring(7,9)+"/"+"XXX"+"/"

I get the attached error :

To be more precise, This happens when a new substring has to get created,

like if folder path XXXX/AB/ is already there, then there will be no issues in creating

XXXX/AB/XXX/

However, when the program tries to create a new folder path with a new substring

like XXXX/CD , then it throws the error

former_member184720
Active Contributor
0 Kudos

Did you verify the directory value after the mapping execution and see if it's valid/expected?

Former Member
0 Kudos

Hello Hareesh,

I am sorry, I quite din't get when you say

Did you verify the directory value after the mapping execution and see if it's valid/expected?

Can you please elobrate, thanks

azharshaikh
Active Contributor
0 Kudos

Hi Rama,

Can you pls check on the following:

1. If there FTP User has Permissions to create New Dir in the Server (chk with your Unix team what permissions they have given to the FTP User, try with full permissions 777)

2. As suggested abv check in the Moni Log the Directory path that is generated by your code & verify if its a valid Dir path

3. Check whether your Substring function is returning correct value.

Hope it helps

Regards,
Azhar

Former Member
0 Kudos

Hello Azar,

I have rights to modify the FTP user permissions in the FTP , and I was able to make it from XXX to 777, for its directories and subdirectories . Which means all the directories under the FTP server will have full permissions. However, I am not sure if the FTP server by it self is set to 777.

Well, the Directory path is generated correctly. The only time we are getting error is when we try to create a  directories in hierarchy , else if we are creating just one new folder under certain path it is good.

like : XXX/AB/CD ( if directory path AB exists then there will be no issue in creating a folder CD under AB, but if Directory path XXXAB Doesnt exists already then FTP receiver adapter is throwing an error ).

Yes, substring is returning the correct value.

Thanks for inputs

RaghuVamseedhar
Active Contributor
0 Kudos

Rama,

Using FTP receiver channel we can not create hierarchy of folders at run-time. We can create only one level deep hierarchy dynamically. This is FTP limitation. Solution: - Use one level deep dynamic hierarchy.

FYI. When you restart failed message multiple times, it will be successfully. It will create one level deep hierarchy for each restart. We can create dynamic deep hierarchy folders on NFS (not on FTP).

Former Member
0 Kudos

Hi Raghu,

Thanks for the information

Answers (3)

Answers (3)

markangelo_dihiansan
Active Contributor
0 Kudos

Hi,

Aside from Hareesh's suggestion, have you checked in the receiver cc if the Create Target Directory is ticked?

Regards,

Mark

arunneerolil
Contributor
0 Kudos

Rama,

Your directory path format looks wrong.

String dir = "XXXX"+"/"+FileName.substring(2,5)+"/"+"/XXX/"+"/";

It should be

String dir = "XXXX"+"/"+FileName.substring(2,5)+"/"+"XXX"+"/";

No escape sequence is required for "/".

Try giving the complete path that you use in the FTP receiver adapter.

Also make sure that

String FileName = conf.get(KEY_FILENAME);

is returning value.

Regards,

Arun

Former Member
0 Kudos

Hi Arun,

Also, tried

String FileName = conf.get(KEY_FILENAME);

it dint work yet..

former_member184720
Active Contributor
0 Kudos

can you add "/" at the beginning and see if that helps

String dir = "/"+"XXXX"+"/"+FileName.substring(2,5)+"/"+"/XXX/"+"/";

Former Member
0 Kudos

Hi Hareesh,

I tried with

String dir = "/" +"XXX"+"/"+FileName.substring(7,9)+"/"+"Global"+"/";

conf.put(KEY_FILEPATH, dir);

conf.put(KEY_FILENAME, FileName);

Still it dint work.

Thanks for your inputs