cancel
Showing results for 
Search instead for 
Did you mean: 

Does it matter if I call the same UDF several times in my mapping?

Former Member
0 Kudos

Hi !

I have to map one TXT file to an IDOC. One field of the source file is needed to define values of several IDOC target fields.

I've developed an advanced java UDF that receives the source field, calls an RFC via JCO to convert the source value, and returns the converted value.

Then I use this UDF as part of the graphical mapping, to define the values of about 10 or 15 fields of the IDOC. That is, the UDF is placed 10 or 15 times, one time for each target field.

My doubt is if this an expected way of solving this kind of problem..I'm worried about calling the UDF (RFC via JCO) about 15 times for each source file record...and they could be 1000 aprox !

I've added a trace, and a global variable, and inside the UDF, I check if the current input value is equal the last processed value, if it is that case, then I return automatically the buffered value (in a global variable), avoiding the call to RFC....

Checking my trace...I see that the UDF is called with several different input values in some random order, so my "optimizacion method" does nothing.

Some ideas?

Thanks. Have a nice weekend.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Matias,

we had a similar problem, and we solved it using a java has table stored in the global container.

During the mapping program, every time a new source-value has to be look up, that value becomes a new key of the hash and the result of the RFC call (target-value) is stored in the hash table as the value corresponding to that key.

So this avoid the problem of random calls with different values and you can read from the hash table if a value already exists in the hash table before calling the lookup RFC.

We implemented this solution and it works like a charm

Hope it helps,

Kind Regards,

Sergio

Former Member
0 Kudos

Hi Sergio !!!

Thanks for your help...it seems to work like a charm....we reduced the processing time form 10 minutes to 1 !!

Thanks, your points were rewarded.

Grazie molto,

Matias.

Former Member
0 Kudos

Hi Matias,

Great, I'm Happy it works fine!

Kind Regards,

Sergio

Answers (2)

Answers (2)

stefan_grube
Active Contributor
0 Kudos

My idea would be following: Write a UDF which gathers all values that have to be looked up from R/3. Asign this UDF to the target root node to make sure that this UDF is called at the beginning of the mapping.

Then you need an RFC which is able to look up all values at once. It might happen that a need a wrapper RFC for the standard. The valus are stored in a container and can be read when they are needed from a second UDF.

Regards

Stefan

Former Member
0 Kudos

if the input value and RFC returned values are fixed, you can go for value mapping instead of calling jco for every call. I mean its like set of input values you going to map with set of output values. Check whether you can use value mapping instead of RFC calls.

--Archana

Former Member
0 Kudos

Thanks.

RFC: The input value is STCD1 of table LFA1 and the output value is LIFNR, of same table...for me those are not fixed values....

Thanks anyway.

Former Member
0 Kudos

then you need to go as Sergio suggested, put the previous value in global container and check with it before making each call

--Archana