cancel
Showing results for 
Search instead for 
Did you mean: 

UDF Request for Assistance

Former Member
0 Kudos

Hi Experts,

I am trying to work on a UDF that would filter messages for a particular receiver and check if a particular field exists in the payload. The problem is, I am not very familiar in creating UDF. Can you kindly help me on this?

Say for example I have to create a filter for messages going to AMERICA, and the payload should contain the field HAWAII. If field HAWAII does not exist, the message should catch an exception.

I hope you can help me on this.

Kind regards,

Grace

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi All,

The UDF itself is pointed to another UDF that would look up in the Database which will return the receivers. The receiver determination set up that we are using is a bit complicated to explain and as to why we are using the UDF. I just need the codes if I want to check if a particular field exists in the payload.

Can you kindly provide the codes if I will try to check if a field exists?

Thanks.

Former Member
0 Kudos

Hi,

I am still not sure why you can't use the Exist API to check if the filed exists or not. But by UDF coding there is one way as below.

Refer below code

Cache parameter : Context --- It will refer to particular context witin single message

pass the field -->UDF --> (your next UDF or receiver)

//Write code here

// Now if the seder field will be exist then it will have some value in it ot atleast balnk field. Thus

//you may check for it.

if(a.length == 0) //A.length = 0 indicates that the specific field is not available and supressed

//proceed ahead with required code

else

// Raise exception

Thanks

Swarup

Edited by: Swarup Sawant on Jan 2, 2009 10:08 AM

Former Member
0 Kudos

Hi,

You can use UDF or Node functions for this simple requirement. You can throw exception in UDF also.

Look for creating UDF in SAP-Help different ways of creating UDF.

Thanks,

RamuV

Former Member
0 Kudos

Hi Swarup,

The interface is being used by many Plants/Warehouses, so we are also using database look up for this. The purpose of the UDF is to route the message to a dummy receiver if the payloads lacks "HAWAII" field.

Let it be clear that sample name HAWAII is not a field value but it is the field name.

I just don't know what is the correct syntax if I would like to check if a particular field exists or not.

Kind regards,

Grace

prateek
Active Contributor
0 Kudos

Why can't you use the standard function "Exists". There is no need of a UDF.

The purpose of the UDF is to route the message to a dummy receiver

UDF itself could not route a message, it could only be used to process on field values in mapping. Based on these values, you may perform certain activities in receiver determination in ID.

Regards,

Prateek

Former Member
0 Kudos

Hi,

As mentioned in above answer, you could Exist function to check teh availability of the particular field.

No need of UDF for this.

Now for routing to particular receiver you can either go for enhanced Receiver determination also. Thus based on mapping you could divart to the dummy receivers.

on SDN you will get blog for step- by step activity to use enhanced Receiver determination.

thanks

Swarup

Edited by: Swarup Sawant on Jan 2, 2009 9:39 AM

Former Member
0 Kudos

Hi,

Your below requirment could be possible with using the axisting node functions also.

something like

Field --> if value is HAWAII then pass --> Target field.

Why you need UDF for this. Also do you want to raise the exception for this or have to supress that payload and have to pass other payload containing the field value HAWAII.

Thanks

Swarup