cancel
Showing results for 
Search instead for 
Did you mean: 

How can transfer the read file name via own developed adapter module

Former Member
0 Kudos

Hello experts,

I want to know how I can handle the following issue:

I developed a J2EE adapter module for the file adapter "sender" with the aim to read the file name of incoming files. Thereto I implement the following code like this:

public ModuleData process(ModuleContext mc, ModuleData md) throws

ModuleException

{

[...]

Hashtable mp = (Hashtable)

md.getSupplementalData("module.parameters");

String fileName = null;

if (mp != null)

fileName = (String) mp.get("FileName");

[...]

Now I get the filename which includes a order nr. I need this order number to call a RFC Adapter via mapping. So my question is how can transfer this order nr to the RFC adapter?

Kind regards,

Fatih

Accepted Solutions (1)

Accepted Solutions (1)

prateek
Active Contributor
0 Kudos

Dynamic Configuration can anyhow be used in mapping to retrieve the file name. There is no need to retrieve it in your adapter module.

Regards,

Prateek

Former Member
0 Kudos

Hello Prateek,

it is an file adapter sender and not an receiver, therefore the dyncamic configuration will not help. Furthermore in this developed module I have also to copy the file from one directory to another and afterwards I have to read the module name. This is one of the main reason, why I developed it in Netweaver Studio, but I am also open for other solutions.

Kind regards,

Erkan

Former Member
0 Kudos

Hello Suray,

if I read the file from the ftp directory via standard ftp adapter and I also set the adapter specific message attributes file name and directory. Can I read this param via udf for instance to read the file name and copy the file to another directory?

Kind regards.

Former Member
0 Kudos

Hello Prateek,

sorry for my misunderstanding, you mean in that way?

DynamicConfiguration conf = (DynamicConfiguration) container

.getTransformationParameters()

.get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);

DynamicConfigurationKey key = DynamicConfigurationKey.create(

“http://sap.com/xi/XI/System/File”,

“FileName”);

String filename = conf.get(key);

Kind regards.

former_member187339
Active Contributor
0 Kudos

Hi Faith,

Tht piece of code from Prattek will five you file name in Message MApping (provided you check the adapter specific identifiers of Sender file adpter).

Hope this iwll help you.. Also if you want to read a file and move it to some specific directory make use of the archive option of File adapter.

Its always better to call Lookup functions from mapping rather than channels

Regards

Suraj

Former Member
0 Kudos

Hi Suray,

the copying of the file to another directory has to be done first, but I also see that the adapter specific messages also have a directory variable. So I can also call a UDF function in the mapping programm or will the archive function call directly before the mapping?

Otherwise great thanks for your support.

former_member187339
Active Contributor
0 Kudos

Hi Faith,

The operation flow will be like this:

1. XI will read the file

2. Then if read was successfull it will move the file to the specified archive directory.

3. Yes you can access the Directory from which the file was picked using the dynamic configuration in UDF. Provided Directory is checked in File sender Adapter (under adapter specific identifiers)

Regards

Suraj

Answers (1)

Answers (1)

former_member187339
Active Contributor
0 Kudos

Hi,

>> to read the file name of incoming files

Use file adapter with Adapter specific identifiers selected.

>>Thereto I implement the following code like this:

use udf in message mapping and avoid module

>>Now I get the filename which includes a order nr. I need this order number to call a RFC Adapter via mapping. So my question is how can transfer this order nr to the RFC adapter?

use RFC Look up function in message mapping...

Is module so necessary in this case???

Regards

Suraj

Former Member
0 Kudos

Hi Suray,

thank you for your answer.

Now we developed this with module and it works, only I want to know how can I access to the module param which I get back from the developed module. However, can I also access to the module param including file name via RFC lookup?

Can you give me an example or an information base for udf mapping because I never use this?

Kind regards,

Fatih