cancel
Showing results for 
Search instead for 
Did you mean: 

Need Help in Writing UDF

Former Member
0 Kudos

Hi all,

I need to write an UDf for the Following Requirement.

If the Input Value for a Particular Field in the Source Structure is "ABC", then I Need to Pass "XYZ" Value to the Target Field.

If the Incoming value is not "ABC" in the Source File Means I Should Pass "Constant" to the Target Structure.

Please Help me.

Regards

Phani

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

hi,

Use this code;

pass String a as argument.and result as context.

-


if(a[0].equals("ABC"))

{

result.addValue("XYZ");

}

else

{

result.addValue("constant");

}

-


Regards,

Akshay.

    • reward points if find useful.

null

Answers (3)

Answers (3)

santhosh_kumarv
Active Contributor
0 Kudos

Hi Phani....

Follow this Mapping schema...

http://www.flickr.com/photos/11767150@N03/1318915918/

My input node is Name and output node is DOCNUM.

Test results:

When Input node value is ABC

http://www.flickr.com/photos/11767150@N03/1318023341/

When Input node value is not ABC

http://www.flickr.com/photos/11767150@N03/1318024863/

Regards

Santhosh

vuyyurujyothi
Participant
0 Kudos

Hi Phani,

You can use Value Mapping (Fixed Values) for this. You can mention the constant as default value. Try to use Standard Functions before creating UDF's.

Regards,

Jyothi.

santhosh_kumarv
Active Contributor
0 Kudos

Hi No need of UDF...

Map the Input field to IF Else...

Input field--


Equals
> If
--


Target.

Give the another Equals node function as Constant containing value "ABC".

Map the a constant containing "XYZ" to the <b>THEN</b> part of IF structure.

Map the a constant containing "Constant" to the <b>ELSE</b> part of IF structure.

Regards

Santhosh

Shabarish_Nair
Active Contributor
0 Kudos

You dont need a UDF here.

This can be established using the standard functions in XI.

You can use the Boolean IF function ( http://help.sap.com/saphelp_nw04/helpdata/en/43/c4cdfc334824478090739c04c4a249/content.htm

)

and get the req. done.