cancel
Showing results for 
Search instead for 
Did you mean: 

Graphical Mapping : Repeat Idoc nodes automatically

Former Member
0 Kudos

Hi,

My scenario is: "message -> XI -> IDoc", with the idoc TXTRAW.TXTRAW02.

I have a unique source field that I need to cut into several occurences of segment <E1TXTRW> of this IDoc.

My Source:


<text>         (which appears only once in my source)
  My very long text (1.000 characters)
</text>    

My Target: what I want is:


<E1TXTRW>      (occurrence is 1..3600)
   <TLINE> the 72th first characters of my source</TLINE>  (occurrence is 0..1)

<E1TXTRW> 
  <TLINE>the next 72th characters of my source</TLINE>

(...)
and so on until the last characters...
(..)

<E1TXTRW>      (last occurrence)
   <TLINE>the last characters of my source</TLINE>

For that, I use a UDF to cut my source into several target lines plus a "UseOneAsAny", but the problem is that the segment <E1TXTRW> is not automatically duplicated !!, I have it only once when I test my mapping.

Uselly with "UseOneAsAny" a XML tag is automatically create. Is there a limitation when target is an IDoc ?

Note: I cannot duplicate manually myself this IDoc segment in the graph mapping (with the right option), because I don't know how many times the segment <E1TXTRW> has to be repeated, coz it depend of the length of my source

Any help, any suggestion are welcome !

Thanks

Mickael

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

What u need to do is:

U need to first check the length of the input string. once u got the length then divide the length by 72. u will get the value that many time s ur target segment will repeate.

for example.

144 lenth of the input string divide by 72 hence u will get 2 now 2 times ur <E1TXTRW> segment repeates. for repeating the node u need to write the UDF.

now how to split the string u can use substring fuction and select the required string.

this will work only whne u have the input string length in the multiples of 72. if the length of input string is 140 then above logic will not work.

chirag

Former Member
0 Kudos

Hi Chirag,

right it's eaxctly what my UDF do, but the problem is not to cut the source text into several lines.

The problem is that the segment <TXTRAW> is not repeated.

So I generate several target lines but only the first appear in my target IDoc.

Not simply !

Mickael

Former Member
0 Kudos

Hi,

From ur first reply i gave u the solution.

Now with this reply i m confused. where u got stuck. what ur UDF do.

ur queue will be

1

2

if this the status of ur queue then it will generate two times <E1TXTRAW> segment.

chirag

Former Member
0 Kudos

Mike

can u give us a screenshot of ur MM plz

regards

krishna

Former Member
0 Kudos

also.. can u give us a screenshot of ur mapping

regards

krishna

Former Member
0 Kudos

Hi Krishna,

1. My mapping is here:

[url] <A HREF='http://uploadmb.com/dw.php?id=1207783570'>MHU - Mapping - Queue.jpg</A>[url]

Note that I do some test, and I'm not that that UseOneASMany is necessary, as the outbound of my UDF is nice.

261 = length of my source text

Madame, Mo = The 1st part of my cut

nsieurVo = The 2nd part of my cut

2. The result:

[url] <A HREF='http://w1.uploadmb.com/dw.php?id=1207867294'>MHU - Mapping - Result.jpg</A>[url]

we see that only the first line with "261" is generated !!

:-(((

Mickael

Former Member
0 Kudos

Mike

I really dont understand why you want to map the data elements in the source to "E1TXTRW" in the target???

Shoudnt you be mapping them to a data element like TLINE or something in the target instead of mapping it to root(E1XTRW)

regards

krishna

Former Member
0 Kudos

Hi krishna,

For instance I use the same mapping :

1. at the node level "E1TXTRW", in order to generate this node as many time it's necessary (remind occurs 1..3600). I agree with you that the value (261, Madame...) will not be used for this level, but XI will only use its contexts and queues to kow the occurence.

2. at the field level "TLINE" in order to give my text (remind occurs 0..1)

End normally with the management of Queue and Context the duplication of "E1TXTRW" should be done automatically, should not it ?

But maybe I'm wrong....

Mickael

Former Member
0 Kudos

Hi

+1. at the node level "E1TXTRW", in order to generate this node as many time it's necessary (remind occurs 1..3600). I agree with you that the value (261, Madame...) will not be used for this level, but XI will only use its contexts and queues to kow the occurence.

only for getting the no of occurences you dont have to do that mapping ...simple drag and drop from "target -> source> and raise the context of the source to a level above. and then do a split value...

regards

krishna

Former Member
0 Kudos

Hi Krishna,

I totally agree with you, but I tried to find a solution with UseAsOneMany, because with only the SplitByValue the result is bad : only one segment E1TXTRW.

Note: that the change of source context has no effect, because this source field appear only once : occurs 0..1 for all above levels.

<A HREF='http://w1.uploadmb.com/dw.php?id=1207873498'>MHU - Mapping - Queue simplified.jpg</A>

<A HREF='http://uploadmb.com/dw.php?id=1207790334'>MHU - Mapping - Result simplified.jpg</A>

To be continued

I continue to search...

Mickael

Former Member
0 Kudos

Hi Michael,

Did you get the solution? I ma having the same problem. I want to repeat the segment . SAP Help(http://help.sap.com/saphelp_nw04/helpdata/en/1f/ea0fb12403844bbb6c4cbc8a00cda9/frameset.htm) says that the splitbyvalue will generate number of segments based upon the minOccurs. So if you need four you need to have minOccurs as 4. This is wierd.

Former Member
0 Kudos

Hi Michael,

Did you get the solution? I am having the same problem. I want to repeat the segment . I have four context changes in the resultlist but only first one is getting mapped. SAP Help(http://help.sap.com/saphelp_nw04/helpdata/en/1f/ea0fb12403844bbb6c4cbc8a00cda9/frameset.htm) says that the splitbyvalue will generate number of segments based upon the minOccurs. So if you need four you need to have minOccurs as 4. This is wierd. How are you planning to resolve it?

thanks,

rakesh

Former Member
0 Kudos

I am having a similar problem. I have to create one additional segment than the input and hardcode some values into the field of those segment. any idea how to go about it. I have a segment EIEDKA1 and in the input the occurence is 2. So after mapping my output should have 3 occurences of EIEDKA1. Can someone post the UDF for the same. I am very new to SAP XI and finding it hard to get this cracked.Appreciate your help

Former Member
0 Kudos

Hi,

give the occurences of E1TXTRW to "o...many)

regards

krishna

Former Member
0 Kudos

hi Krishna,

in standard, occurrence is already 1..3600. so for me it's enough. I'm not sure that to change to "MaxOccurs=Unbounded" will be a solution.

Have you already done that ?

Mickael

Edited by: Mickael Huchet on Apr 10, 2008 10:22 AM