cancel
Showing results for 
Search instead for 
Did you mean: 

Data Type - Mail attachment as String

Former Member
0 Kudos

Hello everyone!

I currently have a business requirement for reading an e-mail box, parsing the attachment (which can be different types of content) and forwarding to the correct interface. So far, I've been doing:

- Sender e-mail with payloadswap, so it reads the attachment;

- Then an enhanced receiver determination will read the content and based on it will define to which interface to forward.

From testing the mapping program of the receiver determination, it is working correctly. However, during runtime, it returns a "Cannot produce element" exception. Since I don't have a fixed incoming type, I've created a Data Type as

  - <Structure name> | Complex type

      - xmlPayload   | xsd:String

However it seems this somehow doesn't match the incoming message. Can someone give me any hints on how should my Data Type be? I just need a single string (since I don't know the content yet) so I can execute the Enh.Receiver mapping to check it.

Thanks in advance and

Best regards,

Lucas Santos

PS: This has probably been asked before, but couldn't find anything with the Search. Must improve my searching skills!

Accepted Solutions (1)

Accepted Solutions (1)

MichalKrawczyk
Active Contributor
0 Kudos

hi,

>>>Enh.Receiver mapping to check it.

then just use a java mapping in which you can do the check (substring etc)

and create the receiver determination target structure - just don't use the message mapping

Regards,

Michal Krawczyk

Former Member
0 Kudos

Hello Michal!

Thanks for the feedback. Yes, I am using(trying) the enh.rec. mapping program to read the content and decide to which Service it will route. However, during the runtime, I receive the "Cannot produce target fields" exception, even though the mapping test works fine. Right now, it doesn't even need any content as I've put fixed values for testing, but still it seems the data type is empty!

I've based my scenario on the http://wiki.sdn.sap.com/wiki/display/SI/Step+by+Step+guide+to+Explain++Enhanced+Receiver+Determinati...

but without any message mapping for the interfaces, just the enh.receiver mapping. But it still seems the root node is empty! Any ideas?

Many thanks for your help and

BR,

Lucas Santos

MichalKrawczyk
Active Contributor
0 Kudos

Hi,

as I said - use anything but not the message mapping - like java mapping for example

and you can:

a) read the content of the e-mail nicely

b) it won't be validated

Regards,

Michal Krawczyk

Former Member
0 Kudos

Hello Michal!

Thanks once again. I think I get the idea, however I still have some questions:

EDIT: I've created the java mapping. However, I am using XI 7.0, so I don't have the mapping objects like InputAttachments or InputPayload to access the content of the files. Is there any other way? Or at least any other idea on changing the scenario so I can properly read the payload of the attached XML in order to determine target interface?

Appreciate any further insights you can provide!

Best regards,

Lucas Santos

Former Member
0 Kudos

Hi!

I've created the java mapping as recommended. However, I am using XI 7.0, so I don't have the mapping objects like InputAttachments or InputPayload to access the content of the files. Is there any other way? Or at least any other idea on changing the scenario so I can properly read the payload of the attached XML in order to determine target interface?

BR,

Lucas Santos

MichalKrawczyk
Active Contributor
0 Kudos

Hi,

>>>Or at least any other idea on changing the scenario so I can properly read the payload of the attached XML in order to determine target interface?

but you said that you've used the bean so that you don't need the attachment as the attachment is in the main payload right ? so why do you need to check attachment ? it's already in the main mapping right ?

can you determine the reciever from the attachment in the main message after you've "swapped" it ?

Regards,

Michal Krawczyk

Former Member
0 Kudos

Hello Michal!

I have an e-mail that comes with attachment -> swapbean to have it as main payload -> now I need to check the content of it. However, right now I don't see how to proceed, since I can't have a fixed data type, and when it comes to mapping looks like I get nothing available there.

It seems I am really missing something (that it is not hard), but I just can't/don't know how to simply check the payload as a string at this moment!

Thanks for the help so far!

BR,

Lucas

MichalKrawczyk
Active Contributor
0 Kudos

Hi Lucas,

>>>I have an e-mail that comes with attachment -> swapbean to have it as main payload -> now I need to check the content of it. However, right now I don't see how to proceed, since I can't have a fixed data type

I believe you're not that far

1. if the attachment is in the main payload then you don't need anything else:

a) you can use any data type (with java mapping it does not matter)

b) you can check it's content in the java mapping

2. can you remove the ext. rec det for a minute and test the flow and make sure

the attachment is in the correct place? (main payload) - remove any mappings you have too

3. now once you see the attachment in the main payload you will be able to work with that in your java mapping

4. check the swapbean config to make sure everything is properly configured there (but the test from point 2 will prove it)

Regards,

Michal Krawczyk

Former Member
0 Kudos

Hello Michal!

Amazing help so far! Indeed, I create the Java Mapping, loaded the inputstream and saved it to the target file with an extra concatenated string on its content, and it worked like a charm!

My last question now is:

- Ok, the java mapping is working (I can now easily change it to parse the file and check for whichever content I need). I've tried then to switch to the enhanced rec. determination mapping (target interface -> Receiver), however it is expecting a "Receiver" type of object. Is it possible to gather the outcome of this Java Mapping to an input for a Message Mapping?

Yet again, thanks!

BR,

Lucas Santos

MichalKrawczyk
Active Contributor
0 Kudos

hi,

>>>>> however it is expecting a "Receiver" type of object. Is it possible to gather the outcome of this Java Mapping to an input for a Message Mapping?

a) yes - you can have multiple mappings in one operation mapping but --> b)

b) you can create the receiver structure in java mapping itself  - you don't need the message mapping at all - just select the correct receiver structure from the SAP BASIS SWCV as per ehn receiver scenarios guides

Regards,

Michal Krawczyk

Former Member
0 Kudos

Hello Michal!

Indeed, I've manually created the XML in the Java Mapping for the target "Receivers" object. Now it works perfectly!

Thanks and

BR,

Lucas Santos

MichalKrawczyk
Active Contributor
0 Kudos

nice going

Regards,

Michal Krawczyk

Answers (0)