cancel
Showing results for 
Search instead for 
Did you mean: 

Java Mapping for SOAP sender text to xml requirement

former_member183906
Active Contributor
0 Kudos

The requirement is third party server is sending text file using SOAP adapter as attachments. We can't use File adapter or any other adapter apart of SOAP adapter due to third party server limitation.

The file need to be picked up by PO using SOAP attachments and need to be mapped to SAP idoc.

Due to soap sender , we need to use Java mapping here to convert text document to XML. Can anyone please provide java mapping for below file -

44,20160203,63584,23600004,3
45,20140303,1101032,23600004,3

There can be N number of lines starting from 44 or 45 or 46.

Target XML fields one can name as A,B,C,D,E under node MessageDetails.

Regards

Accepted Solutions (0)

Answers (2)

Answers (2)

apu_das2
Active Contributor
0 Kudos

Hi Vijay,

You can easily read the attachment using InputAttachment method in JAVA mapping. Use Collection to store the value and then create your output accordingly. This is really very easy when the attachment is containing xml data and you will get multiple blog in SCN to refer the code.

But, as your input is a text file and I am assuming that data is here with some separator. I shall suggest you, to create 2 separate scenarios.

1) One is SOAP to file scenario (NFS) - In the sender channel use module - PayloadSwapBean and store the file in AL11. Simple pass through scenario.

2) File to IDOC scenario - Use FCC to read the file. Your xml will be created for you by file adapter without the hassle of JAVA mapping and map to the idoc accordingly.

Thanks,

Apu

markangelo_dihiansan
Active Contributor
0 Kudos

Hi Vijay,

No need to use Java Mapping, you can use a UDF to read the text file.

https://archive.sap.com/discussions/thread/1341089

Create the target structure. Afterwards, once you have extracted the text contents, map it to the target structure.

Regards,

Mark