cancel
Showing results for 
Search instead for 
Did you mean: 

User Defined function for checking the value is XML field 4 passing 2 IDOC

Former Member
0 Kudos

Hi,

I have a file to IDOC scenario where the incoming XML strcuture contains the following data:

<EmployeeMasterData>

<Header> .....</Header>

<Body> ...

<Employee_Business_Unit>BU400199</Employee_Business_Unit>

<National_Insurance_Number>TN216600D</National_Insurance_Number>

......

</Body>

<Trailer>

<Identifier>FTR</Identifier>

<Number_Of_Records>1124</Number_Of_Records>

<Blank_Entry />

</Trailer>

</EmployeeMasterData>

The data in the National_Insurance_Number tag should be checked as follows:

If the first 2 characters in this tag contain 'TN' like above, the value moved to the target IDOC segment-field should be ' ' else, the value should be moved as it is.

I need to define a User defined function for this.

Can you please help me how to do this?

Regards,

Archana

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Use SubString(0,2) in Standard Function .

compare it with "TN"... if equals assign " " else tat Value

no need to use UDF..

Answers (3)

Answers (3)

Former Member
0 Kudos

U can also use standard functions as follows

1)Use if else boolean function

2)National_Insurance_No>substring(0,2)>equalsS>constant (TN)>then-->map constant(' ') to tgt.

3) else path map src to tgt as such

Former Member
0 Kudos

Hi,

Check with this UDF

public String CHECK(String a,Container container)
{ 
 String b = a.substring(0,2);
 String c;
 if(b.equals("TN"))
     c = "' '";
 else
     c = a;
return c;
}

Edited by: malini balasubramaniam on Aug 4, 2008 1:53 PM

Former Member
0 Kudos

Hi,

you can do it with standard functions.

If_1 source -> length -> greater -> constant 2

then_1 if_2 substring source 0, 2 -> equals TN

then_2 -> constant ""

else_2 -> source

else_1 source

Regards

Patrick