cancel
Showing results for 
Search instead for 
Did you mean: 

Hardcoding w.r.t xi mapping

Former Member
0 Kudos

Hello guys,

How to hard code in xi mapping , in such a way if value not passed ,default used and if passed default value not used , scenario file to rfc .

Vara

Accepted Solutions (1)

Accepted Solutions (1)

claus_wallacher
Active Participant
0 Kudos

Hi Bujji,

can you clarify if

a) your CNUMBER always exists, but sometimes is empty or

b) if the complete field does not exist?

In case b) your mapping should work.

In case a) you need to check if cnumber is equal to space (using standard function equalsS)

Regards,

Claus

Former Member
0 Kudos

Yep it always exists and it might be empty some times in which case i have pass the constant or default value.

i am trying to use equalsS and i assume that one node is connected to CNumber and second input node to constant where there is no value entered to make it null ?

vara

Former Member
0 Kudos

Hi Vara -

You can use mapWithDefault in the following way:

<source> -> <mapWithDefault> -> <target>

Specify a default value in mapWithDefault properties (e.g. double-click on mapWithDefault and it'll bring up properties).

However, the caveat with this function is that the <source> element CANNOT exist for this to work. For instance, it can't be <material></material> with just an empty value. The whole <material> element should not be there, otherwise it'll just pass an empty value.

Otherwise, if you need to account for all possibilities, you need more elaborate conditional logic. I'll send you a screenshot if you post your email address.

Regards,

Jin

Former Member
0 Kudos

Thanks jin and all of you ,

As i said in my earlier posting , the field exists but it might be empty in which i cant use what u say. my email id is : varaprasad.reddy@gmail.com

To let you know the data types are all strings .

to repeat again :

CNumber field exists in the message but if it is empty i have to pass a default value.

Message was edited by: Bujji Reddy

Answers (3)

Answers (3)

claus_wallacher
Active Participant
0 Kudos

Hi Bujji,

if you need to take care of all situation, Jin may send you a screenshot as he offered.

If you know that your CNUMBER ia always there, you just mneed to replace the exist function in your solution you mentioned above with <i>equalS</i> and add the values as you mentioned (CNUMBER and constant with empty value).

Regards,

Claus

Former Member
0 Kudos

Thanks all for your help i resolved the issue with help of Jin screen shots...

vara

sam_raju
Contributor
0 Kudos

Hi Bujji Reddy,

You can hardcode using standard functions "constant" and "If then else". So if value is passed map the value to the target else map the constant to the target.

I hope this is what you meant.

Rgds,

Sam Raju

Former Member
0 Kudos

Thanks for your replys, is there any blog or any location i can find how to map ? no exp on this earlier

Thanks

Vara

sam_raju
Contributor
0 Kudos

Hi Bujji Reddy,

Refer to this how-to guide on SAP Service Maket Place.

http://service.sap.com/~form/sapnet?_SHORTKEY=01200252310000071155&_SCENARIO=01100035870000000202&_O...

Rgds,

Sam Raju

Former Member
0 Kudos

Hi Vara -

Here's a couple:

http://service.sap.com/~sapidb/011000358700003604872004E/MappingXI30.pdf

http://help.sap.com/saphelp_nw04/helpdata/en/d2/58cd3b11571962e10000000a11402f/frameset.htm

If you have questions about specifics, please post them to the forum.

Regards,

Jin

Message was edited by: Jin Shin

Former Member
0 Kudos

thanks all for the replys. Now as i explained earlier my current scenario, using if then else (Boolean function) with constant would solve my purpose ,

But how can i define the condition, How can i incorporate this one :

if <material# is null> then <constant 2000 to target >

else <material# to target>

i think i fugured out connecting nodes of constant to then and the filed material # to else but how can i define condition to if node.

thanks

Vara

sam_raju
Contributor
0 Kudos

Hi Vara,

Define the following logic:

If "exists"<standard function> material then material>target else constant>Target.

You can also use "equalS" function with the same logic to map the null value field in the source to target.

Rgds,

Sam Raju

Former Member
0 Kudos

Thanks sam,

well eventhough you are trying to explain the best way i have problem in connecting the nodes to each otehr. lemme explain the situation i kept in the editor :

Lets say i am mapping CNumber in source xml msg to KUNNR in target msg. here sith i am listing the flow of nodes.

                                                          • Cnumber

                                                            • |

                                                            • then

Cnumber --> Exists --> if --> KUNNR

                                                                • else

                                                                • |

                                                                • 501

(entered this by double click)

Now while testing if Cnumber is empty i m not getting 501 in KUNNR?

Vara

P.S.: I used * to get spacing so that i can better picturize u

Former Member
0 Kudos

btw :

exists is a node function which will return true if node exists else not how will it be useful to check whether value exists or not

Former Member
0 Kudos

Hi Vara -

You can use the Node function mapWithDefault for this purpose.

Regards,

Jin