cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping Description to TDLINE ( multiple )

Former Member
0 Kudos

Hello Friends,

I need to do a mapping where description ( text ) need to be mapped to Idoc-field TDLINE. Tdline has a size around 132 char. And description from source can be longer than 132 charter...

e.g:

Source Message

-


<Product>

<Description>will be the special instructions information required for

the shop floor that the planner may have added..

</Description>

</Product>

Target Message

<IDocSegment>

<TDLINE>will be the special instructions</TDLINE>

<TDFormat> * </TDFormat>

</IDocSegment>

<IDocSegment>

<TDLINE>information required for the shop floor</TDLINE>

<TDFormat> * </TDFormat>

</IDocSegment>

<IDocSegment>

<TDLINE>that the planner may have added..</TDLINE>

<TDFormat> * </TDFormat>

</IDocSegment>

How I can achieve this ? do I need to create a java function or so ?

please suggest...

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member187339
Active Contributor
0 Kudos

Hi Shah,

Yes you need to have a java udf to do this. Try using this code

This an advanced udf for all values of the queue


public void RemarkSplit(String[] input, ResultList result, Container container) throws StreamTransformationException{
int i = 0;
int start = 0;
int end = 0;
int var = 0;
int empty = 0;

AbstractTrace trace;
 trace = container.getTrace();

//loop through entire values in input array
for (int j=0; j<input.length; j++) { 
	 if (input[j].length() == 0) {

           result.addValue(" ");
           
      }
    else {
                //repeat for the length of each value
		for (i=0;i<input[j].length(); i=i+132){
			start =i;
			end =i+132;
    			if (input[j].length( )> end) {
			        result.addValue(input[j].substring(start,end));
			}
	
			if (!(input[j].length()==0)){
				if (end >= input[j].length()) { 
					end = end -132;
					result.addValue( input[j].substring(end,input[j].length()));
			     }
	  
			} 	
		   }
      }	
}

Regards

Suraj

Former Member
0 Kudos

Hello ,

thanks suraj for your input, one question fuction-coad which you provided does not return anything ? void ?

Thanks Sven for your reply , can you please suggest how I can dublicate the segment with in UDF ?

Regards,

Haider

Edited by: Shah H on Feb 22, 2010 1:01 PM

former_member187339
Active Contributor
0 Kudos

Hi Shah,

>>Thanks Sven for your reply , can you please suggest how I can dublicate the segment with in UDF ?

For duplicating the parent node you need to use the same udf code with the parent node.

The code which I wrote might need some changes (which you can do by providing different length input and checking the display queue of the udf)

Regards

Suraj

Former Member
0 Kudos

hi Suraj,

I searched the fourm and did not get an example which explains HOW to dublicate the node using code ?

so I make 132 char string assign/map to segment1 then again take next 132 char assign/map to 2nd segmnet and so on.....

former_member187339
Active Contributor
0 Kudos

Hi Shah,

One way to get the segment E1EDKT2.repeated is

input (132 length field) > UDF (the code which I wrote)> splitbyValue (for each Value)--> E1EDKT2

>>I searched the fourm and did not get an example which explains HOW to dublicate the node usin

Rather than searching SDN, these things should be done at your end to get a satisfactory output result

Regards

Suraj

sbuttler77
Active Participant
0 Kudos

When XI evalutes how many target nodes it needs to create it looks at the resultList that your UDF creates and replicates

the target nodes according to the number of values in your resultList. So when you have n values in your resultList

XI is going to create n repetitions of your target segment (as long as your cardinality is 0..unbounded/99999999).

e.g., create an UDF that populates your resultList with three empty strings

result.addValue("");

result.addValue("");

result.addValue("");

mapped to a target nodes with cardinality of 0..999999 will create the node 3 times.

Former Member
0 Kudos

is it possible to dynamically duplicate the segment of Idoc ?

stefan_grube
Active Contributor
0 Kudos

This is only possible with a UDF.

sbuttler77
Active Participant
0 Kudos

TDLINE is 0..1 so you can only have 1 per E1EDKT2.

E1EDKT2 cardinality is 0..9999999999 so you need to come up with an UDF that splits your string into

132 char chunks and passes these to the resultList. If you map the UDF to E1EDKT2 it should replicate

your segment as many times as you need it (# of 132char chunks).

Then map your UDF to TDLINE for the text itself.