cancel
Showing results for 
Search instead for 
Did you mean: 

UDF is required!

Former Member
0 Kudos

Hi,

I am doing a scenario SAP to Siebel and i am facing a problem with mapping.

1) Target side i have string field of length 2000 characaters.

2) I am using ORDERS standard IDOC, in that i have a segment E1EDKT2 and field TDLINE. The length of the TDLINE field is 70 characters. Basically this field is used to populate some status text data, so once the 70 characters are exhausted one more segment will be getting populated. All these TDLINE fileds shuld display as a string in the target.

ex:-

SOURCE TARGET

-


-


1)abcd abcdefghijklmnopqrstuvwxyz

2)efghij

3)klmnopq

4)rstuvwxyz

Can we achive this with standard mapping! if so plz guide me. Your help in this issue is highly solicited.

regards

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Venkat,

Tq, Jay's coding is working but small discrepancy. Hope, he wl break that.

regards

bhavesh_kantilal
Active Contributor
0 Kudos

Hi,

Just adding a a little more logic to Jai's code,

String result1=new String();
for(int j=0; j<a.length; j++){
if(!a[j].equals(ResultList.CC)){
result1 += a[j];
}
}

Let us know if this works!

Regards

Bhavesh

Former Member
0 Kudos

Vijaya,

I just recreated a similar scenario and used the same code.Its working perfectly fine. Can you make some changes in the mapping and activate it again and check the mapping.

BTW, its Jai

Regards,

Jai Shankar

Answers (11)

Answers (11)

Former Member
0 Kudos

Hi Jay & Venkat,

Thanks alot, my problem is solved.

Best regards

Former Member
0 Kudos

Hi Friends

Any inputs on how to eliminate those special characters between the lines? I mean when the second and subsequently line getting concatenated to the 1st line, prefix to the second and subsequently lines i am getting a unwanted characters like '__cC_'

Former Member
0 Kudos

Hi,

I think that is representation of Context Changes. U try changing the context of the input. Check the output in the display queue, You should not get any context changes in that.

If that doesnt work add these lines of code before ' result.addValue(result1);'


result1 = result1.replaceAll("_cC_","");
result1 = result1.replaceAll("_cC","");

Regards,

P.Venkat

Message was edited by:

Venkataramanan

Former Member
0 Kudos

Hi Jay,

I have not changed anything. Ur code is working but i am getting extra characters as specified in my previous post.

regards

Former Member
0 Kudos

Hi Bhavesh,

I am sorry to say, its thowing an error as :

Source code has syntax error: C:/usr/sap/DXI/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Map1f6cf980a54a11dbbc730014220ffc27/source/com/sap/xi/tf/_Orders05_to_Siebel_Orders_RequsetMessage_MM_.java:547: illegal start of expression public void test_channel$(String[] a,String[] b,ResultList result,Container container){ ^ C:/usr/sap/DXI/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Map1f6cf980a54a11dbbc730014220ffc27/source/com/sap/xi/tf/_Orders05_to_Siebel_Orders_RequsetMessage_MM_.java:568: ';' expected } ^ C:/usr/sap/DXI/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Map1f6cf980a54a11dbbc730014220ffc27/source/com/sap/xi/tf/_Orders05_to_Siebel_Orders_RequsetMessage_MM_.java:569: '}' expected ^ 3 errors

regards

bhavesh_kantilal
Active Contributor
0 Kudos

Hi,

String result1=new String();
for(int j=0; j<a.length; j++){
if(!a[j].equals(result.CC)){
result1 += a[j];
}
}

Can you try this code?

Regards

Bhavesh

Former Member
0 Kudos

Hi,

In bhavesh's(first one) code add this last line:

result.addvalue(result1);

Else Jai's code is perfect.

Try setting the context of the input to higher levels.

Regards,

P.Venkat

Message was edited by:

Venkataramanan

Former Member
0 Kudos

Hi Jay,

Tq u, ur code is working but the problem is in the target i am getting extra characters like"

Source

-


Awaiting Paper work

Awaiting Credif On Assignment

Extra Status Notes

Target:

-


Awaiting Paper Work_cC_Awaiting Credif on Assignment_cC_Extra Status Notes_cC

like this i am getting. Can u plz look into this!

regards

Former Member
0 Kudos

Hi Jay,

thanx for ur reply...i tried ur code but no luck

regards

Former Member
0 Kudos

Hi,

Try this..

String result1=new String();

for(int j=0; j<a.length; j++){

result1 += a[j];

}

result.addValue(result1);

Make sure ,the UDF cache value is "Queue" and the context is set to the next higher level.

Regards,

Jai Shankar

Former Member
0 Kudos

Hi,

Sorry again. Jai's last post should work i think.

Put the context of that T..LINE to parent of E1.. segment.

And also make sure Queue is the type of UDF.

Regards,

P.Venkat

Former Member
0 Kudos

Hi Dominic,

my source is not only four strings.. it may spread to over 278 strings comprises of 70 characters per string.

regards

Former Member
0 Kudos

Hi Venkat,

Still its throwing the error as:

Source code has syntax error:

C:/usr/sap/DXI/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Map2bfe79c0a53c11db87df0014220ffc27/source/com/sap/xi/tf/_Orders05_to_Siebel_Orders_RequsetMessage_MM_.java:539: cannot resolve symbol

symbol : variable length

location: class java.lang.String

for(int j=0; j<a.length; j++){

^

C:/usr/sap/DXI/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Map2bfe79c0a53c11db87df0014220ffc27/source/com/sap/xi/tf/_Orders05_to_Siebel_Orders_RequsetMessage_MM_.java:540: array required, but java.lang.String found

result += a[j];

^

2 errors

regards

Former Member
0 Kudos

Hi Vijaya,

using the standard concat function only lets you concat two strings. Here's a simple UDF for your 4 Strings:


String concatString = new String() ;
concatString = str1+ "" + str2+ "" +str3+ "" + str4;
return concatString;

You have to define a UDF with 4 input values (str1-4).

If you're not sure if all strings will be filled use the standard function "mapWithDefault". Otherwise you'll get an error.

Regards

Dominic

former_member189558
Contributor
0 Kudos

Hi Vijaya,

I do not have XI open .. but I guess this can be done using standard functions..

You have to use the concatenate function and there is a function I guess which suppresses spaces...

Please let me know if you are able to find those.

Thanks and Regards,

Himadri

Former Member
0 Kudos

Hi,

You can use advanced UDF to concatenate.

Input to the UDF is TDLINE(with context as parent of E1EDKT2):

input: a

The following is the code:



String result=null;
for(int i=0' i<a.length, i++){
result += a<i>;
}

return result;

Regards,

P.Venkat

Former Member
0 Kudos

Hi Venkat,

Thnx 4 ur quick reply. I have tried with ur coding, but its throwing an error. Can u plz look in to this, as i am not tht gud in java.

Source code has syntax error: C:/usr/sap/DXI/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Mapdc72ffb0a53711dbadef0014220ffc27/source/com/sap/xi/tf/_Orders05_to_Siebel_Orders_RequsetMessage_MM_.java:539: unclosed character literal for(int i=0' i<a.length, i++){ ^ C:/usr/sap/DXI/DVEBMGS00/j2ee/cluster/server0/./temp/classpath_resolver/Mapdc72ffb0a53711dbadef0014220ffc27/source/com/sap/xi/tf/_Orders05_to_Siebel_Orders_RequsetMessage_MM_.java:544: illegal start of expression } ^ 2 errors

I tried ur code as follows:

public String result(String a,Container container){

String result=null;

for(int i=0' i<a.length, i++){

result += a<i>;

}

return result;

Former Member
0 Kudos

>>for(int i=0' i<a.length, i++){

Use

for(int i=0; i<a.length;i++)

Regards,

Jai Shankar

Former Member
0 Kudos

Hi,

Sorry that was typo errors. Thanks Jai for pointing out.

Check with this code:



String result=null;
for(int j=0; j<a.length; j++){
result += a[j];
}
 
return result;
 

Regards,

P.Venkat.

Message was edited by:

Venkataramanan