cancel
Showing results for 
Search instead for 
Did you mean: 

UDF is called twice

Former Member
0 Kudos

Hi,

I have scenario where i am storing some values in Hashmap using  StoreValues UDF. In this UDF i have input as IDOC number and the other values which will be stored  in this hashmap using the key IDOC number. Also there is another ReturnValues UDF which is having input as IDOC number and will retrieve the values based on  IDOC number and map it to respective fields in output.Both UDF excution type is "All Values Of a Context".

While executing this scenario when there are two IDOCs it should behave as shown in below sequence(Ideally).

1) StoreValues UDF for first IDOC

2) ReturnValues UDF for first IDOC

3) StoreValues UDF for second IDOC

4) ReturnValues UDF for second IDOC

But it is behaving not as expected.

It is first calling

1) StoreValues UDF for first IDOC

2) ReturnValues UDF for first IDOC

3) ReturnValues UDF for second IDOC (But as the StoreValues UDF is not executed for second IDOC, the ReturnValues UDF returns null values for second IDOC)

4) StoreValues UDF for second IDOC

As the ReturnValues UDF called twice it is returing null values for second time, which further fails in Mapping. How should i handle this scenario?

Thanks & regards,

Shilpa.

Accepted Solutions (0)

Answers (4)

Answers (4)

Pranil1
Participant
0 Kudos

I guess its a context issue. Without knowing how exactly the mapping is implemented we cant get a clear picture. so please provide us the mapping screenshots.

iaki_vila
Active Contributor
0 Kudos

Hi Shilpa,

Have you got StoreValues followed by ReturnValues for the same target node?, if you have the functions in different nodes and at the same level you shoud take advice.

Have you considered to use a Graphical variable (since SAP 7.1) for return that values ?

Check William Li's blog http://scn.sap.com/people/william.li/blog/2008/02/13/sap-pi-71-mapping-enhancements-series-using-gra...

Regards.

former_member184681
Active Contributor
0 Kudos

Hi,

I think you won't be able to force some particular sequence of executing UDFs. But you could change the execution type to All Values of Queue, so that all the data will be processed by Store Values, and then by Return Values. Thanks to this, you will avoid errors.

Regards,

Greg

Former Member
0 Kudos

Hi Greg,

I agree with your reply but if i use All Values of queue then all IDOCs data will be stored in Hashmap using the IDOC Numbers. There could be more than 3000 IDOCs that can come over. I think this would create problem in storing values for all IDOCs data in Hashmap and may get fail.

Do you have any other suggestion?

Thanks,

Shilpa

former_member184681
Active Contributor
0 Kudos

Hi,

Do you mean that 3000 IDocs are processed by PI as a single message? If so, you might be right about your performance concerns. But if they are separate messages, it shouldn't cause problems.

Regards,

Greg

iaki_vila
Active Contributor
0 Kudos

Hi Shilipa,

At first, this problem seems a context issue. Could you post the images about the queues before calling the funtions?

Regards.

Former Member
0 Kudos

Hi,

Unable to upload the screenshots.

But IDOC context is as shown below for both th UDFs.

IDOC Number1

-----------------------

IDOCNumber 2

----------------------

Thanks.