cancel
Showing results for 
Search instead for 
Did you mean: 

Multi-Message-split with ABAP mapping and adapter specific attributes

Former Member
0 Kudos

Hi all,

With <b>ABAP-Mapping I split 1 message to n messages</b>.

So many files are generated in <b>file-Adapter</b>.

Everything fine.

But now I want the file names different using adapter specific attributes.

It is not possible to use variable substitution and write the file name in payload because of receiver restrictions.

I tried this with following similar coding in ABAP-Mapping:


data: lt_records TYPE MPP_DYNAMIC_TAB.
      Loop.
...
      l_file_name = "payload-Inbound"-information
      ls_record-namespace = 'http://sap.com/xi/XI/System/File'.
      ls_record-name = 'FileName'.
      ls_record-value = l_file_name.  "l_file_name comes from inbound-payload
      append ls_record to lt_records.
...
     Endloop.
  CALL METHOD dynamic_configuration->set_all_records
    EXPORTING
      records = lt_records.

If I start the interface I see in the monitoring the dynamic configuration with many entries for file-name in the the SOAP-Header mapping of the request message (following extract):

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>

- <!-- Mapping der Request-Message

-->

- <SAP:DynamicConfiguration xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="1">

<SAP:Record namespace="http://sap.com/xi/XI/System/File" name="FileName">BPAADDRESS.XML</SAP:Record>

<SAP:Record namespace="http://sap.com/xi/XI/System/File" name="FileName">BPABROKERROLE.XML</SAP:Record>

<SAP:Record namespace="http://sap.com/xi/XI/System/File" name="FileName">BPACOMPANYSEGMENT.XML</SAP:Record>

<SAP:Record namespace="http://sap.com/xi/XI/System/File" name="FileName">BPACUSTOMERROLE.XML</SAP:Record>

....

The result is that <b>all files have the same file name</b> (last entry in dynamic configuration).

Is it possible to write the adapter specific configuration in ABAP-mapping <u>for every single result message</u>??

Thank you for your help,

Florian

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

HI experts,

has anybody experience with the solution from Henrique?

Henrique wrote: "The possible solution is to create a custom adapter module that assembles the filename string and set the filename dynamic configuration at runtime. You'll have to put this module as the 1st in module processor chain"

Is it possible to set the dynamic configuration with module implementation for every target message in <b>1:n message-split scenario</b>??

Thanks a lot for your help,

Florian

henrique_pinto
Active Contributor
0 Kudos

Well florian, if you don't believe me, you have two options.

Either you dont believe and don't do anything, and things will be kept as they are, or you don't believe me but give it a try it anyway, since you don't have other options, and you might have a slight chance of having your requirements being met.

How to behave, that's up to you.

Regards,

Henrique.

bhavesh_kantilal
Active Contributor
0 Kudos

Florian,

I have not tried what henrique has pointed but to me it seems the most obvious and logical choice and solution. It will work for sure.

Henrique, Take a chill pill buddy I guess florian was just re confirming the solution and never intended any offence .

Regards

Bhavesh

Answers (3)

Answers (3)

Former Member
0 Kudos

Thanks for the help,

I tried with JAVA-module in file adapter where I set adapter specific attributes and it functions!!

The only negative aspect is that it is quite much effort to implement the first JAVA module (it takes some days to prepare and configure everything!).

Thanks a again to all of you, <b>problem is solved!!</b>

Florian

henrique_pinto
Active Contributor
0 Kudos

Cheers.

Indeed, developing a module for the 1st time takes quite some effort (more than a mapping anyways, but way less than developing an application from scratch), but once you get used to it, it becomes a powerful tool in your development scenarios.

Also, developing modules is a good introduction to the EJB world, and you can then jump to developing your own EJBs (and with those, you have access to all the integration layer that NetWeaver provides, creating Web Services with a click of the mouse etc.)

See, information is never too much.

Best regards,

Henrique.

Former Member
0 Kudos

Hi Florian,

Nice to hear that you cracked the issue after a long battle Hope your customer is more satisified with this solution.

And many thanks to Henrique for providing us the right direction.

Regards,

Jai Shankar

Former Member
0 Kudos

HI Jai,

thanks for you answer.

If I use variable substitution it is not possible to use a new XML-tag because of target-interface restrictions.

If I would work with attributes in the XML, it would be ok.

Is it possible to get the content of <b>an attribute</b> in the payload in <u>file-adater variable subsitution</u>?

Thanks a lot,

Florian

henrique_pinto
Active Contributor
0 Kudos

Florian,

that is the expected behavior of dynamic configuration in multimappings.

In n:m multimappings, for n > 1, the headers from source messages are not persisted; for m > 1, all target messages are set with the same header values. This is stated in online documentation (check the <i>Adapter-Specific Attributes and Multi-Mappings</i> section):

http://help.sap.com/saphelp_nw70/helpdata/en/43/09b16006526e72e10000000a422035/frameset.htm

Also, currently, variable substitution <b>cannot</b> read attribute nodes from the payload, only element nodes.

The possible solution is to create a custom adapter module that assembles the filename string and set the filename dynamic configuration at runtime. You'll have to put this module as the 1st in module processor chain. More information: /people/daniel.graversen/blog/2006/10/05/dynamic-configuration-in-adapter-modules

Regards,

Henrique.

Former Member
0 Kudos

Hi Henrique,

Nice work around.

I have a small doubt here. Can I apply dynamic configuration for every message using adapter module. Is it not the same as setting these values inside a mapping?

Or once the multimessage hits the AE, it is splitted into several messages and treated as independent messages.

Thank you.

Regards,

Jai Shankar

henrique_pinto
Active Contributor
0 Kudos

Jai,

my sugestion is:

how is the filename string assembled in the mapping?

The data to mount the string is read from some fields (or attributes) and concatenated (with some logic).

That part is, of course, the same in mapping or in adapter module.

To set the dynamic configuration, at mapping runtime, as the online documentation has stated, if you set the filename dynamic configuration with that string, it will be set for <b>all</b> target messages (the n messages in a 1:n mapping).

However, after the mapping, the n messages are split and sent 1 by 1 to AE.

If you set the filename dynamic configuration at AF through an adapter module, it will only set that string to that message, not all the other n-1 messages.

In this way, you can have separate dynamic configuration for the n messages.

Regards,

Henrique.

Former Member
0 Kudos

Hi Florian,

I've a different idea...I dont think its a "right solution" but just another work around..it involves a BPM...

In your ABAP mapping..set the dynamic config with as many variables as number of different messages...i.e. use the variables like 'FileName1', 'FileName2'...'FileName6' instead of 'FileName'. But use the same namespace 'http://sap.com/xi/XI/System/File'

Call the above mapping in a BPM and capture the individual messages and set the attribute 'FileName' from the values of 'FileName1' to 'FileName6' accordingly using Message Mapping and then send the message using the 'Send' step.

before you try this, try using the variable names 'FileName1' ...'FileName6' in the receiver adapters...enable the ASMS. <b>I know we need to select which variables from the dynamic config to be used by the adapter by specifically selecting 'FileName', 'Directory' etc...but just give it a try and see if it works..</b>

Or..instead of using a BPM..you can combine Henrique's idea...use Adapter module to set the value for 'FileName' from variables 'FileName1'...'FileName6' accordingly.

hope I'm clear..lemme know if you have any questions..

cheers

praveen

Former Member
0 Kudos

Florian,

I have tried this before (using Graphical mapping) and had the same result. After a few attempts I came to the conclusion, that you can not have different ASMA for differnet msgs generated as a result of multi mapping.

A few threads in SDN have also led me to the same conclusion.

Regards,

Jai Shankar

Shabarish_Nair
Active Contributor
0 Kudos

As Jai mentioned if that is the case, i think you should try with variable substitution.

Variable substitution -

http://help.sap.com/saphelp_nw04/helpdata/en/bc/bb79d6061007419a081e58cbeaaf28/content.htm