cancel
Showing results for 
Search instead for 
Did you mean: 

Getting principal data as null in Adapter Module

Former Member
0 Kudos

Hello Everyone,

I am trying to work with Attachments in my Module.

The Scenario I have configured is that I have a Sender File Adapter, which picks up 2 files one as body and the second as attachment :

https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/1685 [original link is broken] [original link is broken] [original link is broken] [original link is broken]

In my Module I want to put the content of the attachment file into the main payload but the following line of Code returns a null value

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

I can see the data in this case is present as Supplementary Data but the Principal Data in the moduledata is null.

Is this expected behavior in this case / all case where we would have attachments in the payload or something is wrong in the Configurations?

Can somebody clear my doubt as to what is exactly contained in the Principal Data and what is contained in the Supplementary Data ?

Any help will be greatly appreciated.

Best Regards,

Kanwaljit

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

Try the same thing without sending attachments, and see if you get null again.

Also, are you sure that the main payload, i.e. body is not null?

Did you check in the Incoming payload in SXMB_MONI?

Regards,

Puloma.

Former Member
0 Kudos

Hi Kanwaljit,

I haven't tried to pull attachments, but I use the following code successfully to get the XI message. It looks equivalent to what you're doing. Have you already manipulated the message before this point, using another module. Maybe you've swapped the principal and supplementary data?

public ModuleData process(ModuleContext moduleContext, ModuleData inputModuleData)

throws ModuleException {

Object obj = null;

Message msg = null;

try {

obj = inputModuleData.getPrincipalData();

msg = (Message) obj;

} catch (Exception e) {

ModuleException me = new ModuleException(e);

throw me;

}

I would look in the JavaDocs for the com.sap.aii.af.mp.module.ModuleData class to see what's available. This SAP Help page tells where to find the JavaDocs.

http://help.sap.com/saphelp_nw2004s/helpdata/en/32/43d84072378031e10000000a1550b0/content.htm

Thanks,

J Wolff

Former Member
0 Kudos

I found the Error.

The Custom Module was wrongly placed in the Module Chain after the Standard SAP Adapter.

Thanks Everyone for the help.

Kanwal