on 09-03-2015 8:03 AM
Hi Sap All.
I have got a requirement in an Idoc to Webservice interface where I need to check a segment field in the IDOC and based on value I need to send a constant value to the target field.
here I need to use Else if conditions and I wrote the below udf but I am getting the Java Syntax error.
if ( Var1= "Nod" )
{
var1 = " nodes " ;
}
Else
if ( Var1 = "nod2" )
{
var1 = "nodes2" ;
}
Else
if ( Var1 = "nod3" )
{
var1 = "nodes3" ;
}
could any body help me in this.
Regards.
Jagdish
Hi Jagdish,
Modify the code as below.
for(int i=0;i<var1.length;i++)
{
if(var1[i].equals("Nod1"))
result.addValue("node1");
else if(var1[i].equals("Nod2"))
result.addValue("node2");
else if(var1[i].equals("Nod3"))
result.addValue("node3");
else
result.addSuppress();
}
You can also use fix values which is flexible:
Nod1 -> node1
Nod2 ->node2
Nod3 -> node3
Use key as default
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jagdish,
Why not using FixValues function?
boolean comparison is ==, not = that is assignment.
Regards,
Yee Loon
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.