cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping

Former Member
0 Kudos

Hello All.

I have a requirement as follows:

SOURCE

if value unequal 'blank' and numeric map value to

TARGET.

Is that possible with Graphical Mapping?

Please let me know.

Regards

Hari

Accepted Solutions (0)

Answers (7)

Answers (7)

Jitendra_Jeswan
Contributor
0 Kudos

Solution is here...

I suppose your field at both the source and target side (lets call it A) is of type STRING

Use the Following code in the UDF with context as "value"

Name that UDF as "Validate"

public String Validate(String a,Container container)

//write your code here

int b ;

if (a.length()>0)

{

try{

b = Integer.parseInt(a);

return "true";

}

catch (Exception e)

{

return "false";

// I have returned Blank here

// However you can stop your Message Processing here

}

}

else return "false";

Now do the Following MM for this Field A

A(source)-->Validate()->Use IfThanWithoutElse--->A(target)

IfThanWithoutElse: Output of check will go to "if" and A(source) will go to "than" . Output of IfWithoutElse will go to A(target).

Hope this should work.

(Assumption : The numeric values would be Integer only)

Regards.

Jeet.

Former Member
0 Kudos

Hi Jeet,

Thanks for your valuable reply.

When i try to use the same in my mapping i am getting runtime error.

Again i am posting the same issue but i need only one part of it like

Source (Integer) -


if value unequal 'blank' and numeric map value to

Target (Integer)

(if value unequal 'blank)' --- This i can handle in graphical mapping.

What could be the solution for (if value unequal numeric) in Java mapping?

Thanks & regards

Hari

Former Member
0 Kudos

Hi Raddy,

I think for your problem, the best suitable solution is giving condition at receiver determination step. when you are specifying condition at receiver determination step, you can find ur input field, operator and its equivalent value.

So there you can mension it as field !=<space or whatever char u want> (for operator chose not equal( !=) symbol)

then click on plus symbol...there u can give field = some integer.

this is same as

if ( field!=null & field = integer )

then

go to that business service

end if

so I think this solves your answer!!!

Regards,

Pavani

Former Member
0 Kudos

Hi ,

if i am not wrong ur requrement needs condition statements .........right?

XI provides various node functions and if else then is one of them u can use this ...........this below link may help u

http://help.sap.com/saphelp_nw04/helpdata/en/43/c4cdfc334824478090739c04c4a249/frameset.htm

http://help.sap.com/saphelp_nw04/helpdata/en/23/17f13a2f160f28e10000000a114084/frameset.htm

Hope this may help u

Regards,

Azeez khan.

Jitendra_Jeswan
Contributor
0 Kudos

If the datatype of the field is String, then you can use the "text functions" to get this condition check and then map the value to the target.

Regards.

Jeet.

Former Member
0 Kudos

try using standard API as below

Source--> MapWithDefaultValue -->Target.

This wud check if source eq blank and populate the default value given by u.

or u can directly use if then else and then not function

Thanks

Kiran

Edited by: kiran dasari on Jan 30, 2008 12:36 PM

Former Member
0 Kudos

Hi Kiran,

Thanks for your reply.

The solution given by you is just to map as it it..

In the given situation it need to check for Unequal 'blank' and Unequal 'numeric' as well.

Regards

Hari

Former Member
0 Kudos

if value unequal 'blank' and numeric map value to

--->

for unequal blank, you can use IfWithoutElse , compare it with constant ""(Blank), then use Not function(logical Not)

for numeric comparison you can write a UDF

Former Member
0 Kudos

yes write a UDF usin if-then-else condition or select the conditional if from functions list.

you can satisfy your condition.

BR,

Alok

Former Member
0 Kudos

Hi Alok,

As i am not aware of JAVA can you please tell me the way to overcome this problem.

Just i need the java code to handle second part (If the value unequals 'numeric').

Thanks in understanding.

Best regards

Hari

Former Member
0 Kudos

Hi,

Check the value with equals function if it is not equal to blank or numric value then pass that to if without else function and output of it map to target.

Can you please give me the exact numeric value u need to validate.

Thnx

Chirag

Former Member
0 Kudos

Hi HP CReddy,

You could either use below code in your UDF

Create new UDF then if the occurance of source and target structure is 1 use Cache parameter value or use queue for multiple occurance.

For single occurance of source

Pass the source field as A

//write your code here

try{

int abc = 0;

abc = Integer.parseInt(a);

return(Integer.toString(abc));

}catch (NumberFormatException e) {}

return("");

For multiple occurance of source

//write your code here

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

{

try{

int abc = 0;

abc = Integer.parseInt(a<i>);

return(Integer.toString(abc));

}catch (NumberFormatException e) {return("");}

}

Thanks

Swarup

Former Member
0 Kudos

Hi Chirag,

Its not a number-specific.

It should not equal to any of the numeric.

I hope you got the point.

Regards

Hari

Former Member
0 Kudos

Hi,

Can you please explain me ur requirement with example.

Thnx

Chirag