cancel
Showing results for 
Search instead for 
Did you mean: 

Adapter Module Filename in File Receiver Channel

ralf_zimmerningkat3
Participant
0 Kudos

Hi All,

is it possible to set the Filename in File Receiver Adapter from Adapter Module?

I know that it is possible to read the data


Channel ch = new Channel(moduleContext.getChannelID());
path = ch.getValueAsString("file.targetDir");

I Need to set the filename in Adapter Module, using of Payload is not possible because Payload is not xml.

Dynamic Parameters in Message Header is not possible because it is an multi mapping process an i need dynamic Filename for each Part

payload after mapping is like

MainDocument

SubMainDocument

MainDocument

SubMainDocument

i need special Name for each SubMainDocument in FileReceiverAdapter

regards

ralf

Accepted Solutions (0)

Answers (1)

Answers (1)

prateek
Active Contributor
0 Kudos

using of Payload is not possible because Payload is not xml.

Are u bypassing the IR part. If no, and if the message is in XI, then it will be in xml format

Still, if u want to edit the filename in module then it is possible

Regards,

Prateek

ralf_zimmerningkat3
Participant
0 Kudos

The Message is XML in the XI but i have to convert in CSV Format. This will be done by Conversion Agent.

The CMTransformBean is the first Module in the Channel an change the Format.

so the CallSapAdapter Module could not read anything from the payload.

But i dont know how to write the filename!

Edited by: Ralf Zimmerningkat on May 22, 2008 1:54 PM

prateek
Active Contributor
0 Kudos

/people/sap.user72/blog/2005/07/15/copy-a-file-with-same-filename-using-xi

Regards,

Prateek

ralf_zimmerningkat3
Participant
0 Kudos

Thanks for the weblog but i only found code to read the filename

an that is not the problem

 Channel channel = new Channel(moduleContext.getChannelID());
Stirng filename = channel.getValueAsString("file.sourceFileName");

i need something like

Channel channel = new Channel(moduleContext.getChannelID());
 *channel.setValueAsString*("file.sourceFileName") =filename ;

regards ralf

stefan_grube
Active Contributor
0 Kudos

When you want to set the filename dynamically, you should go for adapter specific parameters:

Message msg = (Message) inputModuleData.getPrincipalData();
msg.setMessageProperty("http://sap.com/xi/XI/System/File", "FileName", fileName);

You have to activate the same in channel.

Check out for blogs about this topic.

Regards

Stefan

Edited by: Stefan Grube on May 22, 2008 3:05 PM

ralf_zimmerningkat3
Participant
0 Kudos

Hi Stefan

afaik adapter specific parameters read the values from message header.

do to multi mapping there is only one header vor different payloads and i need a special filename for each payload.

reading from payload is not possible because the conversion argent change the xml format to csv.

thanks

ralf

stefan_grube
Active Contributor
0 Kudos

No, the adapter framework provides a message header for each message individually.

I have just tested this last week, it works.

Regards

Stefan

ralf_zimmerningkat3
Participant
0 Kudos

Hello Stefan,

interface mapping is an mapping like this:


outbound_interface => Inbound_Interface1
                             => Inbound_Interface2
                            => Inbound_Interface3

in sxmb_moni this looks like this


Soap_Header
Soap_Body
Payloads
     =>MainDocument ( application/xml ) 
    => SubMainDocument ( text/xml ) 
     =>MainDocument ( application/xml ) 
    => SubMainDocument ( text/xml ) 

First SubMainElement is routing to FileReceiverAdapeter A where Filename has to be like "NameA%nr%"

second SubMainElement is routing to FileReceiverAdapeter B where Filename has to be like "NameB%nr%"

%nr% is som value from the Payload.

Payload is not xml because using of Conversion Argent!!

I Think there is only one Dynamic in Header for all subelements, i have test it!

ralf

stefan_grube
Active Contributor
0 Kudos

The adapter framework creates an individual header for each message; you cannot see this in SXMB_MONI. (but you can see it in message monitor for adapter).

I tell you, it worked for me. Just give it a try.

Regards

Stefan

Edited by: Stefan Grube on May 23, 2008 12:46 AM

ralf_zimmerningkat3
Participant
0 Kudos

Sorry, but I Have test it.

if you need informations from mapping in the header and set the informations during mapping with udf like this:

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

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

    conf.put(key, filename);

return filename;

there is only one header information for each mapping also in adapter monitoring

- <SAP:DynamicConfiguration SOAP:mustUnderstand="1">
  <SAP:Record namespace="http://sap.com/xi/XI/System/File" name="FileName">099message4</SAP:Record> 
  </SAP:DynamicConfiguration>

sorry but i canot upload any pictures

stefan_grube
Active Contributor
0 Kudos

As you pointed out yourself, you cannot do this in mapping, you need to do this in adapter module.

In IS there is only one header, in AF each message has his own header.

I gave you code for adapter module, not for mapping. It does not work in mapping.

Regards

Stefan

ralf_zimmerningkat3
Participant
0 Kudos

I know that the code is for adapter, but my scenario is proxy to file and i have to use values from mapping for the filename.

stefan_grube
Active Contributor
0 Kudos

You can put the adapter module before the conversion agent module, then you can access the xml payload.

You started the thread by asking for an adapter module, so I assumed that you can access the data you need in the module.

It is a little difficult for me, to give an advice, when I have to guess, what the customer really wants.

So I would suggest that I describe, what I have done for my scenario to make it work and you can check, if you can do this similar or not.

I did a mapping step, where a introduced a new element for every message, where I put information which I need for the adapter module.

The module reads the information and stores this in the message header. The additional node is deleted by the module.

This workaround is necessary, as the IS does not provide individual headers, but the adapter framework creates them. So the dynamic headers have to be set in the module. dynamic headers put by mapping are ignored.

Hope that helps

Stefan