cancel
Showing results for 
Search instead for 
Did you mean: 

FCC-Mapping all content in a single field

Former Member
0 Kudos

Hi all,

I have a requirement to map all the content in the textfiles to the single tag of xml .Do any one know how to configure this in Communication channel. I referred SAP help docs but all for mapping it with by separter or by fixed length etc.. I want to map all the contents in a single field.

Laks

Accepted Solutions (0)

Answers (2)

Answers (2)

JoelTrinidade
Active Contributor
0 Kudos

Hi,

From what i see, all the data in your file should go under one node in the XML. Right?

Well, dont use FCC here. in the sender adapter instead of FCC use message protocol as FILE and then use a java mapping.The java mapping will be similar to this wiki entry - https://wiki.sdn.sap.com/wiki/display/XI/WholePayloadtoaXML+field

Regards

joel

Shabarish_Nair
Active Contributor
0 Kudos

joel,

your reply is an exact copy paste of what i have replied in

Please be original in your posts.

Former Member
0 Kudos

Hi Shabarish and Jeol,

Thanks a lot for your answers.. I will try this . I forgot to mention one more thing ...

I have two field in the target structure.

Field1 - need to map with some content in the text file

Field2- Map everything in the text file.

In order to map the field1 , is there anyway i can do it without FCC then ?

suppose if the text file contains texts like

BEGINFIELD="testtext" some text

I need to map the "testtext" in field1 and BEGINFIELD="testtext" some text in field2

Laks

Shabarish_Nair
Active Contributor
0 Kudos

>

> Field1 - need to map with some content in the text file

> Field2- Map everything in the text file.

>

> In order to map the field1 , is there anyway i can do it without FCC then ?

>

> suppose if the text file contains texts like

> BEGINFIELD="testtext" some text

>

> I need to map the "testtext" in field1 and BEGINFIELD="testtext" some text in field2

>

> Laks

1. in the java mapping use the logic of substring to extract the value. between BEGINFIELD=" and the next occurance of "

2. pass this value between your XML tag.

Former Member
0 Kudos

Jeol,

Yes I can use Substring but I am using Message Mapping .How do I get the jar file out of this java code as it uses com.sap.aii.mapping.api.StreamTransformation ?

Laks

Shabarish_Nair
Active Contributor
0 Kudos

>

> Jeol,

>

> Yes I can use Substring but I am using Message Mapping .How do I get the jar file out of this java code as it uses com.sap.aii.mapping.api.StreamTransformation ?

>

> Laks

dont use a graphical mapping.

Directly use a java mapping (not an UDF)

Former Member
0 Kudos

Hi Sabharish,

I used this code but it is just generating empty file .... though my input text file has some content..

https://www.sdn.sap.com/irj/scn/wiki?path=/display/xi/wholePayloadtoaXML+field

though this code is successfully compiled and imported . I checked in the trace as well ,, the function in that code is getting executed. Does anyone have an idea why I am not getting the expected output ?

Laks

Shabarish_Nair
Active Contributor
0 Kudos

try to add trace to messages and see what is happening.

try to put

trace.addInfo(outputPayload);

after

outputPayload =
            "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
			+ StartXMLTag
			+ strXML
			+ EndXMLTag;

See in the trace if your file content is visible.

The only way to troubleshoot java mapping is by adding traces at various places and checking the flow.

Former Member
0 Kudos

Hey Sabharish,

Trace is not working when it is used with Java mapping in XI . Iremoved the trace instance and it worked for me .

Thanks

LAks

Shabarish_Nair
Active Contributor
0 Kudos

>

> Hi all,

>

> I have a requirement to map all the content in the textfiles to the single tag of xml .Do any one know how to configure this in Communication channel. I referred SAP help docs but all for mapping it with by separter or by fixed length etc.. I want to map all the contents in a single field.

>

> Laks

https://wiki.sdn.sap.com/wiki/display/XI/WholePayloadtoaXML+field ref this.