cancel
Showing results for 
Search instead for 
Did you mean: 

Accesing additional files in the sender adapter

Former Member
0 Kudos

Hi,

I'd like to use this option in the sender file adapter: http://help.sap.com/saphelp_nwpi71/helpdata/en/44/692ab8a4b633eae10000000a1553f6/frameset.htm

--> "In the sender file adapter, you can specify additional files to be included in the XI message as attachments" ... "Additional files are transported unchanged without conversion options"

After testing I'm getting two files in the soap message, which is what I wanted. But how can I get the content of the second file (not the main one).

For example, in a custom module in the file adapter I can get the main payload as this:

public ModuleData process(ModuleContext moduleContext, ModuleData inputModuleData)

throws ModuleException {

Message msg = (Message) inputModuleData.getPrincipalData();

...

I guess that to get the second file it could be something like:

inputModuleData.getSupplementalData("?");

but don't really know what to insert there as a parameter.

Basically I would need to find out a way to access the content of that second file: it could be in a custom module, it could be in a graphical or java mapping...

Thanks!

Edited by: Jorge Lopez on Mar 17, 2009 11:09 AM

Accepted Solutions (1)

Accepted Solutions (1)

Shabarish_Nair
Active Contributor
0 Kudos

are you using 7.1 ?

then in that case the new mapping API offers you methods to access the attachments in the mapping itself.

ref: http://help.sap.com/javadocs/pi/SP3/xpi/com/sap/aii/mapping/api/package-summary.html

Former Member
0 Kudos

True, the API in PI 7.1 seems to have classes for dealing with attachments in the mapping at least.

http://help.sap.com/saphelp_nwpi71/helpdata/en/76/fc9c3d9a864aef8139d70759a499fc/content.htm

I'll test and let everybody know

Answers (3)

Answers (3)

Former Member
0 Kudos

Finally I could access that attachment in a Java mapping using this code:

private String getAttachment(TransformationInput in){

InputAttachments inpAttach = in.getInputAttachments();

Collection<String> collIDs = inpAttach.getAllContentIds(true);

Object[] arrayObj = collIDs.toArray();

getTrace().addInfo("Number of attachments: " + arrayObj.length);

String idAttachment = (String) arrayObj[0];

return new String(inpAttach.getAttachment(idAttachment).getContent());

}

and so getting the attachment in a string.

You also have to set on the flag "Read Attachments" in the Operation Mapping (PI 7.1, old Interface Mapping), so that the ABAP side passes the attachment to the Java runtime.

I'm not sure if it's possible to access the attachment in the sender adapter in a custom module

Edited by: Jorge Lopez on Mar 18, 2009 4:06 PM

MichalKrawczyk
Active Contributor
0 Kudos

hi,

if you want to have the attachment in the message payload you should

be able to use standard PayloadSwapBean

http://help.sap.com/saphelp_nw04/helpdata/EN/2e/bf37423cf7ab04e10000000a1550b0/content.htm

also describe in a few of my blogs on sdn

Regards,

Michal Krawczyk

JoelTrinidade
Active Contributor
0 Kudos

Hi Jorge,

I dont think anything of the sort suggested by you would work because its clearly mentioned that the second file would be sent as an attachment . And you cannot play around with attachments.

Regards

joel