Parameter name in module configuration of adapter module in comm channel
Hi Experts,
I have developed an adapter module to read a excel file , have used the module in the sender file adapter.
What entrie should i put in parameter name and parameter value in module configuration of adapter module in comm channel.
Im too confused,,pls help
Hi Ivan,
The code is basically to read the all colums add em under xml tags and read from second row on wards the data
please find below the module data code
public ModuleData process(ModuleContext mc, ModuleData imd)throws ModuleException
Object obj = null;
Message msg = null;
MessageKey amk = null ;
amk = new MessageKey(msg.getMessageId(),msg.getMessageDirection());
Audit.addAuditLogEntry(amk, AuditLogStatus.SUCCESS,"Module called");
try {
obj = imd.getPrincipalData();
msg = (Message) obj;
XMLPayload xp = msg.getDocument();
if (xp != null)
byte by[] = convert(xp.getContent());
xp.setContent(by);
imd.setPrincipalData(msg);
catch (Exception e)
return imd;
public byte[] convert(byte src[]) throws Exception
String xmldata = "";
try
ByteArrayInputStream byteArr = new ByteArrayInputStream(src);
Workbook w = Workbook.getWorkbook(byteArr);
xmldata ="<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n"+ "<ns0:""MT_ExcelFiles"" ""xmlns:ns0=\"""urn:xyz:abc"+"\"> \n";
int a = w.getSheet(0).getRows();
int b = w.getSheet(0).getColumns();
for(int j=1;j<a;j++)
for(int i=0;i<b;i++)
xmldata = xmldata + "<"w.getSheet(0).getCell(i,0).getContents().toString()">"w.getSheet(0).getCell(i,j).getContents().toString()"</"w.getSheet(0).getCell(i,0).getContents().toString()">";
xmldata = xmldata"</ns0:""MT_ExcelFiles"+">";
w.close();
catch (Exception e)
return xmldata.getBytes();
Similar Messages
-
Dynamic configuration in adapter module
Hi friends
I need some information on how to carry out dynamic configuration in adapter module.
To be precise I want to assign file name dynamically to message header in adapter module, not in runtime mapping.
Regards
AkhilHI Akhil,
file adapter dynamic file name
Problem in dynamic file name in File reciever adapater
Dynamic File Name for Receiver File Adapter
/people/michal.krawczyk2/blog/2005/11/10/xi-the-same-filename-from-a-sender-to-a-receiver-file-adapter--sp14
Thax
Chirag -
Dynamic Configuration or Adapter module ?
Hi Experts
I need advice in the following scenarios where the interface is from a legacy file in the Source to an IDOC posting on the Target
a) The logic for the mapping is that if the File name is A then pass 123 and if the file name is B pass 456
for eg if it is IT_ABYYYYMMDD.350 then i have to pass 123 adn if it is IT_ABYYYYMMDD.350 then i have to pass 456
How is it possible to use the file name PI picks from the folder and use it in the mapping
It has to be done in the File Adapter ? do i have to write an Adapter module for it ??
how do i pass the file name in the mapping in IR ???
b) i need to derive data from the file name
for eg if the filename is IT_ABYYYYMMDD.345 and i have to derive the AB part from it and use it in the message mapping
since it is to be maped to a target field int he idoc .. how can I do that ?
Does it require a lot of coding ?
I have read about Dynamic Configuration but where and how to use it ??
can any one please help me with the steps to use or the code for deriving the value AB from the File name IT_ABYYYYMMDD.345 ??
thanks
Rohan>
RohanS wrote:
> Yes I am on track .. just two small questions ..in michal's blog
> the UDF code says
>
> DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
>
> so does the first argument in the braces = the file path ? as in the server path and location ?
>
> and secondly
> does this UDF require no input parameters cos in my mapping there is no source for this ... just that i need to derive this name and pass it to the target field so will this udf take any input argument when i am creating it in message mapping n PI 7.1?
>
> or do I just create a UDF without a variable input and write this code and return as per your code and map it to the target ?
>
> thanks
> Rohan
first one is not path i.e file adapter property of SAP PI use as it is and need to pass some input to UDF just some variable which does nothing in the mapping and map the output to your target variable
HTH
Rajesh -
Retrieving the file name in the adapter module in the sender file adapter
hi,
i need to retrieve the file name, in the adapter module. This module is placed in the sender file channel.
After the file adapter has picked up the file from the file directory, the file is placed in the archived directory.Custom adapter mofule is place in the file shanel. i need to retrieve the file name of the file in the adapter module. Is it possible to retrieve the file name?
Also is it possible to retrieve the archive directory path in module?
Regards,
MeenkashiHi Meenakshi,
I guess you are looking for this
/people/daniel.graversen/blog/2006/10/05/dynamic-configuration-in-adapter-modules
Regards
Suraj -
Retrieving sender Interface name in adapter module
Hi Gurus
Is there ne way we can retrieve interface name in the adapter module which is on the sender side?
I was thinking about using dynamic configuration in adapter module but I guess since container element cant be used inside adapter module.....it will be futile...
Regards
AkhilThe Receiver Determination step will be executed only after the message comes out of the Sender Adapter / Module and so , the Receiver Interface will obviously be unavailable in the Sender Module.
Regards
Bhavesh -
File Receiver adapter module Dynamic Configuration
Hi All
I have a adapter module in a receiver file adapter. In the code I try to access the file name through dynamic configuration,The file name gets set in the mapping.
String strFileName = msg.getMessageProperty(new MessagePropertyKey("FileName","http://sap.com/xi/XI/System/File"));
When my module get executed I get error: nested exception is: java.lang.NullPointerException: while trying to invoke the method com.sap.engine.interfaces.messaging.api.Message.getMessageProperty(com.sap.engine.interfaces.messaging.api.MessagePropertyKey) of an object loaded from local variable 'msg'
Is it possible to get file name in receiver adapter? if so why does this error occur?Yes it is possible...chk this
/people/daniel.graversen/blog/2006/10/05/dynamic-configuration-in-adapter-modules
i guess u have added this import statement in ur code:
import com.sap.engine.interfaces.messaging.api.MessagePropertyKey;
Code will be soemthing like this (FOR PI7.1)
MessagePropertyKey mpk = new MessagePropertyKey("FileName","http://sap.com/xi/XI/System/File");
String filename = msg.getMessageProperty(mpk);
Thanks
Amit -
Dynamic configuration required in sender file - Adapter Module
Hi Everybody,
I am developing an Adapter Module in the file adapter (sender) using Adapter Specific Message Attributes.
I am using Dynamic configuration inside the Module Process method in the adapter module.
We are getting an error saying Dynamic Configuration cannot be resolved.
Can anybody tell me the package to be used.
Thanks,
ZabiullaYou can access the dynamic configuration in adapter module like this:
Message msg = (Message) inputModuleData.getPrincipalData();
String fileName = msg.getMessageProperty("http://sap.com/xi/XI/System/File", "FileName");
You do not need any addition library besides the adapter module API.
Hope that helps
Stefan -
Accessing dynamically configured filename inside adapter module code.
Hi,
I am having a requirement where i have to access the filename configured using Dynamic configuration inside my receiver file adapter MODULE code. I am having PI7.1.
For accessing the DC filename i have inserted this piece of code inside my adapter module code:
MessagePropertyKey MPK =new MessagePropertyKey("FileName","http://sap.com/xi/XI/System/File");
String filename = msg.getMessageProperty(MPK);
But when i am tesing this module i am getting: "Message processing failed. exception encrypting session key".
This module is basically written for encryption.I am referring this blog:
/people/daniel.graversen/blog/2006/10/05/dynamic-configuration-in-adapter-modules
Do i need to do something else for accessing DC filename inside my module??Please help??
Thanks
AmitHi,
My code is something like this:
public ModuleData process(ModuleContext mc,
ModuleData inputModuleData)
throws ModuleException {
Object obj = null;
Message msg = null;
MessageKey amk = null;
String inpKeyLocation = (String) mc.getContextData("inpKeyLocation");
try {
obj = inputModuleData.getPrincipalData();
msg = (Message) obj;
amk = new MessageKey(msg.getMessageId(),msg.getMessageDirection());
XMLPayload xpld = msg.getDocument();
MessagePropertyKey mpk = new MessagePropertyKey("FileName","http://sap.com/xi/XI/System/File");
String filename = msg.getMessageProperty(mpk);
InputStream inps = (InputStream) xpld.getInputStream();
and so on ......
My encryption method somewhere down the line will use "filename" as one of its input.
Please help??
Thanks
Amit
Edited by: AmitSri on May 25, 2010 1:43 PM -
How to get file name in adapter module
Hi all
Is it possible to get the file name in a adapte module? If so how can I achieve this?Hi,
Check below thread. it shows code for file name.
[Re: Query regarding Adapter Module development]
-Gouri -
Hi
My Scenario is File - to - File
I have written one adapter module and i have deployed in J2ee Engine as well. In sender communication channel i have given the JNDI name like
<b>"localejbs/<JNDI Name>"</b>.I have tested the my file to file scenario by placing a file in source directory which i have mentioned in Communication channel Source Directory and File Name.But i didnt find any difference in target file.
I have used the following blog
<b>
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/da5675d1-0301-0010-9584-f6cb18c04805</b>
1.How to test the adapter module.
2.How to configure my communication channel.
Please help me its very urgent
Best Regards
Ravi Shankar BHi,
check JNDI service in visual admin to see if
your service has the same name there
>>>>1.How to test the adapter module.
by using it in a channel
>>>>2.How to configure my communication channel.
add you adapter module to the adapter module tab
in communication channel
Regards,
michal -
Dynamic conifguration for adapter module
com.sap.aii.mapping.api.DynamicConfigurationKey
Class used to create a key object for an adapter-specific attribute. The key object comprises the adapter namespace and the property name.
● com.sap.aii.mapping.api.DynamicConfiguration
Class used to read, change, or delete the value of an adapter-specific attribute. In a method, you use objects of type DynamicConfigurationKey to access the attributesFor Module Processors, check Adapter-Specific Message Attributes of the following link:
http://help.sap.com/saphelp_nw2004s/helpdata/en/17/50d440e14f8431e10000000a1550b0/frameset.htm
The methods to set/get Attributes in Adapter Module are:
Message.setMessageProperty()
Message.getMessageProperty()
The following info can be obtained in javadoc:
getMessageProperty
public java.lang.String getMessageProperty(java.lang.String namespace,
java.lang.String name)
Returns the value of an additional message property, in case that such an value exists.
Parameters:
namespace - The namespace of the property to get.
name - The name of the property to get.
Returns:
The value for the given namespace/name combination, or null, when no such value exists.
setMessageProperty
public void setMessageProperty(java.lang.String namespace,
java.lang.String name,
java.lang.String value)
throws InvalidParamException
Sets an additional message field, if supported by the Message profile implementation. Such additional fields will not be visible as an own table column in the MS message monitoring, since it is to be stored as part of the message header. This mechanism allows different protocol implementations to support more message fiels, as per default available in the MS Message interface. Such fields can be accessed through this API method, without casting to the specific Message implementation.
Parameters:
namespace - The namespace of the property to set.
name - The name of the property to set.
value - The value of the property to set. When null is given as the value param, an already set value will be deleted.
Throws:
InvalidParamException - If either the length of one of the parameters is too long, or in case of an unknown/not allowed namespace/name combination (but only if the Message implementation has the necessary knowledge about the valid namespace/name pairs).
Also, for an example, check the following blog:
/people/daniel.graversen/blog/2006/10/05/dynamic-configuration-in-adapter-modules
Regards,
Henrique. -
How to access Adapter Specific Message Attribute in my own adapter module
Hi,
I'm developing a mail adapter customer module. Now I have a requirement about getting the CC information from mail. Even if I
checked the option of "use mail package" when configing sender Mail Adapter, I still can not get CC information in my module
because it is not included in mail package.
I got to know CC information is included in ASMA(Adapter Specific Message Attribute), but how can I access ASMA in my module?
Till now I know there are two ways to access ASMA
1. use AF_Modules/DynamicConfigurationBean XI standard module to access ASMA.I did it as below:
add this module in front of my own module, then set key: write http://sap.com/xi/XI/System/Mail SHeaderCC and value :
<b>message.refToMessageId</b>(which message property should be put here?). I'm trying to get it by message.getRefToMessageId() in my
own module. But what happens is not as I expected, I get null instead of CC information. Which step I did wrong?
2. use mapping api
DynamicConfiguration conf = (DynamicConfiguration) <b>container</b>
.getTransformationParameters()
.get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create(
http://sap.com/xi/XI/System/Mail,
SHeaderCC);
but how can I get <b>container</b> object in my module?
Is there any other way to access ASMA in customer module?
Thankshi,
>>>>but how can I access ASMA in my module?
have a look at this blog:
/people/daniel.graversen/blog/2006/10/05/dynamic-configuration-in-adapter-modules
and try getMessageProperty
it's also here:
in Adapter-Specific Message Attributes link
http://help.sap.com/saphelp_nw04/helpdata/en/17/50d440e14f8431e10000000a1550b0/frameset.htm
Regards,
michal
<a href="/people/michal.krawczyk2/blog/2005/06/28/xipi-faq-frequently-asked-questions"><b>XI / PI FAQ - Frequently Asked Questions</b></a> -
Using Request Response Bean Module in FILE Adapter
Hi Experts,
Can we use Request Response Bean Module in FILE Adapter in reverse way. That is can we configure thses adapter modules in Reciever file channel and call a sender file channel in it?
My case is RFC to File synchronous case? How do we do this?
Thanks & Regards,
priyankaCan we use Request Response Bean Module in FILE Adapter in reverse way. That is can we configure thses adapter
modules in Reciever file channel and call a sender file channel in it?
My case is RFC to File synchronous case? How do we do this?
The above is not possible....Bean works only for Sender channel and not for Receiver.....requirement not possible using even a BPM as FILE does not support SYNC communication in receiver end......max you can do is split the scenario into SYNC-ASYNC bridge.
Regards,
Abhishek. -
Hi experts,
What is adapter Module all about ,If you can give me some Basics about this will be Helpfull.
with a simple example how to use it .
Thanks & Regards
ShakifHi,
While dealing with adapter modules,
1. First, create an EJB Module.
2. You create a Stateless session bean.
3. You use the following attributes for the bean,
Remote Interface: com.sap.aii.af.mp.module.ModuleRemote
Home Interface: com.sap.aii.af.mp.module.ModuleHome
Local Interface: com.sap.aii.af.mp.module.ModuleLocal
LocalHome Interface: com.sap.aii.af.mp.module.ModuleLocalHome
4. Your class must implement,
Module.process(ModuleContext, ModuleData).
5. You buiild an EAR archive and an Application Archive and then deploy this on your J2EE engine.
For async sender/receiver adapters, you use modules before the adapter module.
for sync sender/receiver adapters, you can wither use modules before the adapter module (they will affect the request message) or after the adapter module (affecting the response message).
Refer
/people/daniel.graversen/blog/2006/10/05/dynamic-configuration-in-adapter-modules
SAP NetWeaver Exchange Infrastructure - Adapter Module Development - Webinar Powerpoint
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e21106cc-0c01-0010-db95-dbfc0ffd83b3
SAP Network Blog: XI: Dynamic configuration in adapter modules - one step further
/people/michal.krawczyk2/blog/2006/10/09/xi-dynamic-configuration-in-adapter-modules--one-step-further
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/3bdc14e1-0901-0010-b5a9-a01e29d75a6a
http://help.sap.com/saphelp_nw2004s/helpdata/en/a4/f13341771b4c0de10000000a1550b0/frameset.htm
http://help.sap.com/saphelp_nw2004s/helpdata/en/fd/16e140a786702ae10000000a155106/content.htm
/people/siva.maranani/blog/2005/05/25/understanding-message-flow-in-xi
http://help.sap.com/saphelp_nw2004s/helpdata/en/6a/a12241c20af16fe10000000a1550b0/content.htm
http://help.sap.com/saphelp_nw2004s/helpdata/en/e4/6019419efeef6fe10000000a1550b0/content.htm
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/327dc490-0201-0010-d49e-e10f3e6cd3d8
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/34a1e590-0201-0010-2c82-9b6229cf4a41
thanks
swarup -
Hi
I went through a blog on this and seen that we need some jar files inorder to develop this. these are files they have mentioned in the blog
aii_af_lib.sda,
aii_af_svc.sda and
aii_af_cpa_svc.sda.
Where are these files placed in the XI server. can naybody please tell me the exact location.
thanksHi Sudhakar,
These files to be deployed in Netweaver developer studio .
Plz do refer the following blog it explains clearly...
Adapter Module Development & Module Configuration
Also refer...
ADAPTER MODULES
how to create modules on j2ee engine
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/02706f11-0d01-0010-e5ae-ac25e74c4c81
Alerts from adapter modules - the JRA way!!
Alerts from adapter modules - the JRA way!!
Alerts from adapter modules - the JRA way!!
Alerts from adapter modules - the JRA way!!
RFC calls from Adapter modules...the Web Service Way!
RFC calls from Adapter modules...the Web Service Way!
TechEd 2007: EPI351 - Developing User Enhancement Modules in the Adapter Engine
TechEd 2007: EPI351 - Developing User Enhancement Modules in the Adapter Engine
TechEd 2006: EPI350 - Developing and Testing Adapter Modules in SAP NetWeaver Exchange Infrastructure
TechEd 2006: EPI350 - Developing and Testing Adapter Modules in SAP NetWeaver Exchange Infrastructure
Migrate from Java embedding in Oracle BPEL to Adapter modules in SAP XI
Migrate from Java embedding in Oracle BPEL to Adapter modules in SAP XI
XI Mapping Module for AFW
The specified item was not found.
XI: Dynamic configuration in adapter modules - one step further
The specified item was not found.
Adapter Module Development & Module Configuration
Adapter Module Development & Module Configuration
Dynamic configuration in adapter modules
Dynamic configuration in adapter modules
Rename Attachment Adapter Module
Rename Attachment Adapter Module
Regards,
Vinod.
Maybe you are looking for
-
Deltas are not coming to RSA7 from SM13
Hi All, In BW i am not getting Delta's for 2LIS_02 Datasources, I have checked in RSA7 it is showing 0 Records, but in SM13 there are many V2 Processed Jobs. Please can anybody help me how to get Delta's to RSA7, this problem is persist since 1 week.
-
May (HTML/HTML5) in a DIV element may have as border an image repeated along the border?
-
OS X Mountain Lion download just says "Calculating" and won't download any further?
I received the free upgrade to the new OS X Mountain Lion, and when downloading in the App Store it just says that it is 53.25 MB far and "Calculating" and will not proceed. It has been like this for an entire day and wont get any further. How do I c
-
Webkit browser issue in low network coverage areas
Hello. I usually travel by areas with low network coverage. Several files I tryed to download keeps on the download windows without progress and without any warning of lost connection or pause icon. Sometimes it does show the pause icon though. I wor
-
How i can have more than one update center? e.g netbeans update center
Hi Thank you for reading How i can add Netbeans update center to my update center list ? I want to use some netbeans 4.1 plugins which Creator 2 EA 2 is based on it Can some one help me ?