cancel
Showing results for 
Search instead for 
Did you mean: 

Problem to concatenate data (IDOC)

Former Member
0 Kudos

Hi experts,

I am facing the following problem :

i'm designing IDOC to JDBC scenario. On the source message of my mapping, I have the segment E1KNVVL of my idoc that contains the data TDLINE (the occurence of the segment is 0...9999). The problem is that I would like to concatenate all the TDLINE together if they exist.

Example :

I have one segment KNVVL that contains abc in TDLINE.

I have a second segment KNVVL that contains def in TDLINE.

I would like to have abcdef in my target message.

The problem is that def does not always exist or can exist several times.

I could not figure out the right conditions, I even tried java mapping but did not work.

Any help would be greatly appreciated,

Regards,

Jamal

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Jamal,

if you use graphical mapping.

Use a UDF, set the radiobutton context!

Name your importparameter TDLINE.

	String returnString = "";
	for (int i = 0; i < TDLINE.length; i++) {
		returnString = returnString+ TDLINE<i>;
	}
	return returnString;

Regards Mario

Edited by: Mario Müller on Jul 31, 2008 4:25 AM

Answers (3)

Answers (3)

Former Member
0 Kudos

Thanks so much, Mario UDF works perfectly fine.

I just had to add Result.addvalue at the end

Thanks a million for you help every one!!!

Former Member
0 Kudos

The problem is that def does not always exist or can exist several times.

--->

To handle this in UDF which Mario has suggested, just keep a if condition

String returnString = "";

if(TDLINE.length>0){
	for (int i = 0; i < TDLINE.length; i++) {
		returnString = returnString+ TDLINE<i>;
	}
	return returnString;
}  // end if
else
return TDLINE[0];

While creating UDF use TDLINE as input parameter and Cache Queue

Edited by: Mugdha Kulkarni on Jul 31, 2008 11:16 AM

Former Member
0 Kudos

use the below graphical mapping

TDLINE->remove context->add -


>targetmessage

KNVVL----


>

here add is the udf which has 2 inputs

1) TDLINE(use remove context node function after TDLINE)

2) KNVVL

add

use cache parameter context

public void add(String () a,String () b,ResultList result,Container container)

{

String c = " ";
 for(int i=0;i<b.length;i++)
 {
  c = c + a(i) + " ";
 }
result.addValue(c);

}

}

Edited by: malini balasubramaniam on Jul 31, 2008 11:14 AM

Edited by: malini balasubramaniam on Jul 31, 2008 11:18 AM