cancel
Showing results for 
Search instead for 
Did you mean: 

Any Exit /Abort function in the Graphical Mapping?

Former Member
0 Kudos

Greetings

is there any way to exit the current mapping using?

I have a scenario where I need not to skip mapping if a specific condition is met.

Regards,

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

HI,

You have to skip mapping is it means that if certain condition will be staified then your mapping should execute else the interface should have to be failed.....or vice versa

For this kind of requirment you could generate the SMART Exception in XI.

Refer below blog....

SAP Network Blog: Throwing Smart Exceptions in XI Graphical Mapping

/people/alessandro.guarneri/blog/2006/01/26/throwing-smart-exceptions-in-xi-graphical-mapping

SAP Network Blog: XI/PI: Throwing Generic Exceptions from any type of Mapping

/people/michal.krawczyk2/blog/2007/04/26/xipi-throwing-generic-exceptions-from-any-type-of-mapping

If you have mulitple mappings based on condition then

you can actually choose your mapping based on the input data using xpath in your interface determination

ref: /people/suraj.sr/blog/2006/01/05/multiple-inbound-interfaces-within-a-service

Thanks

Swarup

Answers (4)

Answers (4)

Former Member
0 Kudos

Problem solved thanks for Ranjit and all of you experts,

1. My main message mapping do and RFCLookup and map it to ValueX, if a null was returned Value=0.

2. I created an additional validation map which creates the message only when ValueX is not 0, I used creatif the required filed is not equal to 0 and made the main node as optional in my datatype.

Many thanks

ranjit_deshmukh
Active Participant
0 Kudos

Congratulations!!

Former Member
0 Kudos

The suggested answer created another problem, it causes the message queues to stop because of raising an exception

ranjit_deshmukh
Active Participant
0 Kudos

Hi,

do u want to continue the procedure by skipping the mapping?

you know - you can use context object to verify the condition and by using the extended receiver determination in ID - you can select the other receiver and hence interface mapping to continue.

Ranjit

Former Member
0 Kudos

Hi Ranjit

I didn't get what you mean, can you explain that more?

ranjit_deshmukh
Active Participant
0 Kudos

Lets say-

obj is a context object i have created and assigned to say a field <IFNumber>in the source xml

and now I have to use a different mapping when obj(IFNumber) equals to say "1000"

this can be checked at runtime using the condition editor in the receiver determination.

there i need to put the condition, and what i can do is - i create a different receiver and a different interface mapping that this receiver should use.

Hence whenever obj=1000 the condition editor will help to choose the other receiver and this is how i control the flow at runtime.

i know my explanation is little clumsy but i think u can get the idea at least.

Ranjit

Former Member
0 Kudos

Hi,

Probably just try to de-register the queues from SMQR tcode.and then try it out.

Thanks

Swarup

Former Member
0 Kudos

I tried clearing the queues and starting allover again, but everytime I catch an exception, the queue will stop

Former Member
0 Kudos

Ranjit

I am not aware that there is a "condition editor" in the receiver determination. How to go there?

ranjit_deshmukh
Active Participant
0 Kudos

please add this as a comment below the blog so that Michal can reply on this.

Ranjit

Former Member
0 Kudos

I just did

thank you

ranjit_deshmukh
Active Participant
Former Member
0 Kudos

Hi,

You can try this option, but not sure abt this

You can make your condition like following

in the receiver determination ---

You can place the condition on one incoming field

if field1 euals to "your input value" then call the interface otherwise dont

Regards

Seshagiri

ranjit_deshmukh
Active Participant
0 Kudos

Hi,

is your problem solved?

Ranjit

Former Member
0 Kudos

No,

even the receiver determination solution has no use to me.

inside my message mapping I am doing an RFCLookup through a UDF to get a value. if this value was null I want to skip mapping the current record. in webMethods I can do this by doing a branch on the RFC output. But couldn't find a similar way in XI

ranjit_deshmukh
Active Participant
0 Kudos

Hi Baheej,

how about using 2 mappings in a sequence?

say in the first mapping you do your RFC look up in an udf and get the value from RFC in to a field

Now in the subsequent second mapping step what you can do is - put a condition based on the value of this field and map it to the parent tag of your record

e.g lets say following is your target xml struct of the first mapping in which "Field1" is the result of RFC lookup

<DATA>

<Field1>null</Field1>

<Field2>

<Field3>

</DATA>

Now in the next mapping you use the same source and target xml wherein put a condition for tag <DATA>

like: DATA=createIf(Field1!=null)

Then you can skip the record if Field1 is "null".

The above created Message mappings can be put one after another in one IM.

i hope this gives a stimulus.

Ranjit

Former Member
0 Kudos

I think it is a good idea,

but as far as I know, createif will only work with "exists" if I used "not equals" I will get "Cannot cast null to boolean" error .

ranjit_deshmukh
Active Participant
0 Kudos

Now you have got on the right track.

DATA=createIf(Field1!=null) was just to give you an idea,

but this you can impliment in 2-3 ways if you want.

1. If you see u have used the boolean notEquals function which is why you get this error.

first of all you need to know in what format you will get the result of the RFC (string/boolean etc.)

Now it is in your hand to return the value in the UDF u r trying to use for RFC look up

if you get the null as response what you can do is - just put a condition while writing the return statement in UDF as:

if(RFCReturn == null)

return ""+0; //as the return parameter expected is in string format

else

return ""+RFCReturn;

and in this manner in the mapping you can now use the notEquals as:

notEquals(Field1,"0")

2. You can use the Text functions like compare or equalsS along with ifElse to achive your target

like this it is up to you how to do it.

Ranjit

Former Member
0 Kudos

I have done it all now,

however, if I got a valid RFC lookup my map is good, however if I got the other exception value (0) the map will fail with "Check xml instance is valid for source xsd and target-field mapping fulfills requirements of target xsd"

I am comparing two text, if they are not equals , then creatif the first element

Former Member
0 Kudos

I have done it all now,

however, if I got a valid RFC lookup my map is good, however if I got the other exception value (0) the map will fail with "Check xml instance is valid for source xsd and target-field mapping fulfills requirements of target xsd"

I am comparing two text, if they are not equals , then creatif the first element

ranjit_deshmukh
Active Participant
0 Kudos

Hi Baheej,

it is realy very hard to visualize your problem.. until i touch ur mapping i cant be of real help- all i can do is guide you..

as far as i think this is very basic one and you have to really need to read and analyze the errors that you get.

you know the errors that the java code throws are not very simple to understand- and that to combined with xml- it gets worse.

but anyway- i think you should check with the occurences of your tags this kind of errors you wil get in case there is a tag with occurence 1..unbounded and you might have run ur scenario with only one record which is faulty -because of which it cudnt create at least one of it or it is 1..1

please check for this kind of basic things.

Ranjit

justin_santhanam
Active Contributor
0 Kudos

Baheej,

In your lookup UDF , can you try this and let us know what exactly u are getting.


MappingTrace tr = container.getTrace();

tr.addInfo(""+Write your RFC return value variable here+"");

Let us know what u get, so that it would be wasy to suggest.

raj.

Former Member
0 Kudos

Problem solved thanks for Ranjit and all of you experts,

1. My main message mapping do and RFCLookup and map it to ValueX, if a null was returned Value=0.

2. I created an additional validation map which creates the message only when ValueX is not 0, I used creatif the required filed is not equal to 0 and made the main node as optional in my datatype.

Many thanks

henrique_pinto
Active Contributor
0 Kudos

>

> inside my message mapping I am doing an RFCLookup through a UDF to get a value. if this value was null I want to skip mapping the current record. in webMethods I can do this by doing a branch on the RFC output. But couldn't find a similar way in XI

If that's the case, won't mapping ResultList.SUPRESS satisfy your needs? Map this value to the current record if your condition is met after Lookup.

Regards,

Henrique.

Former Member
0 Kudos

Hello again

I have applied "Throwing Smart Exceptions in XI Graphical Mapping"

but the problem with it will through an exception in the queue and it will stop all messages in the same queue.

what i needed is just to skip the mapping on some cases. Can I do this without holding the queues?

Former Member
0 Kudos

thanks a lot Swarup

This what I was looking for:

SAP Network Blog: Throwing Smart Exceptions in XI Graphical Mapping

/people/alessandro.guarneri/blog/2006/01/26/throwing-smart-exceptions-in-xi-graphical-mapping