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
Akhil
HI 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
Similar Messages
-
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 -
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. -
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 helpHi 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(); -
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 -
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 -
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 -
Dynamic configuration of Adpater in SAP PI
Hi,
I have a requirement where in I have to dynamically configure connection adpater in SAP PI 7.1 EHP 1, the configuration data will be pulled form database on the bases of the message content.
Thanks in advance.
GautamNot sure if you are lookingg for dynamic configuration as mention in the below blog..
<a href="/people/william.li/blog/2006/04/18/dynamic-configuration-of-some-communication-channel-parameters-using-message-mapping Configuration of Some Communication Channel Parameters using Message Mapping</a>
<a href="/people/michal.krawczyk2/blog/2005/11/10/xi-the-same-filename-from-a-sender-to-a-receiver-file-adapter--sp14: The same filename from a sender to a receiver file adapter - SP14</a>
<a href="/people/daniel.graversen/blog/2006/10/05/dynamic-configuration-in-adapter-modules Configuration In Adapter Modules</a> <a href="/people/michal.krawczyk2/blog/2006/10/09/xi-dynamic-configuration-in-adapter-modules--one-step-further Configuration In Adapter Modules</a>
~SaNv... -
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> -
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 -
BPM Correlation from Dynamic Configuration not being filled
Hey guys,
I'm having the following problem with BPM correlation.
In my correlation definition, I have 2 fields: one which is filled with information from the message payload, and another one which is filled with a context object (which was created with adapter metadata and filled with dynamic configuration, as refered here: /people/michal.krawczyk2/blog/2006/10/09/xi-dynamic-configuration-in-adapter-modules--one-step-further).
All instances of BPM are with error status. And when I go into the workflow log for these processes, if I check the correlation object, it is like this:
<?xml version="1.0" encoding="utf-8" ?>
<CorrelationKey Version="001">
<Field1 />
<Field2>123456789</Field2>
</CorrelationKey>
Field1 is the one read from context object, and is not being filled (thus I think the error comes from here). Field2 is from payload and is being normally filled.
Any ideas on this matter?
Maybe the problem is not from the correlation. If not, what else could be the case? The BPM crashes on the very first step (one more reason to think that the correlation is the issue).
Thanks in advance,
Henrique.HI,
In general Correlation , concept, whatever we configured in Correlation editor , i mean in runtime which xml element should filled with which element of which interface ..as you said you have configured the local correlation to block, in block it is the first receive step, while receiving the first message which is relevent to first recieve step , i mean if it receives the one message which is related to first receive step inteface .. the respective element data will be filled in correlation id and it will assign on giud for processing , so while assign the runtime data to correlation element ( imean filling stage) check you said two elements in correlation does the first message contains these two elements ??
if so ok , no then check , and try to use the IM before calling the IP to fill the payload.
Regards
Chilla
Oh closed!!
Message was edited by:
Chandra Sekhar Chilla
Message was edited by:
Chandra Sekhar Chilla -
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. -
Dynamic configuration in ABAP Mapping
Dear All,
I have requirement to use the filename's name in the mapping to the target message.
e.g: Filename is Victor.303, i need to take this 303 and map it to the target message.
I understand i can get that value using dynamic configuration in Adapter-Specific Attributes.
But all the samples are using Java code used in UDF.
How to do the same in ABAP Mapping?
I tried:
record = dynamic_configuration->get_record( namespace = 'http://sap.com/xi/XI/System/File'
name = 'FileName').
But record-value return blank.
Best Regards,
Victor.Dear Prateek,
I changed my code with:
DATA: record TYPE mpp_dynamic.
CALL METHOD dynamic_configuration->get_record
EXPORTING
namespace = 'http://sap.com/xi/XI/System/File'
name = 'FileName'
RECEIVING
record = record.
but record-value still return as blank.
I have doubt in this, do i need to populate the FileName in the dynamic configuration (in the graphical mapping) first before i can get the value in the ABAP mapping? or System should filled it and i just can use it directly in the ABAP mapping?
How we know what is the available name and namespace in that dynamic configuration-->get record??
(e.g: my case is FileName, and in the link that you gave is ERROR.)
Any link for this?
Best Regards,
Victor.
Maybe you are looking for
-
How to debug this error.
I wrote the managed bean for shuttle.But i m getting so many errors.Can anybody help me on this. Error(62,23): type oracle.insurance.viking.asset.view.List does not take parameters Error(47,41): cannot find method findIteratorBinding(java.lang.String
-
Unable to make in-app purchase
Hi. I have an iPhone 4, and I've never made an in-app purchase before, but I tried to make one recently and it wouldn't work. All I seem to get from the app whenever I try is an error message that says 'ERROR The transaction failed'. I contacted supp
-
Header links in the web template is not working
Hi all, I have a created webtemplete in that, header links in the web template is not working. But individually header links. I am not why they are not working in webtemplete. guys please help for above situation. Thanks, James
-
Iphone 4s downgrade ios 7 please !! ios 8 its very slow
i like to downgrade my iphone 4s to ios 7.1.2 please
-
HELP! Transferring 80gb of itunes folder from MAC to PC - how do I do it?
Have just bought a new PC (acer quad core running vista) having never owned one (due to necessity) and I can't figure out how to transfer my itunes folder over to it from my G4 runing 10.5.6. If anyone can help I would be ever so grateful. Thanks.