on 02-23-2016 7:41 AM
Hi Everyone,
Can anyone please answer this?
How to store a variable (need not be global) using User Defined Functions even after the end of the session.
I've tried using GlobalContainer class, creating a variable at the beginning (i.e, in Attributes and Methods) and Importing a Java class from a jar file.
nothing works. Searched entire internet, but couldn't find anything related.
Please kindly help.
What kind of variable values do you want to store?
Maybe you can try to update a table with value mapping replication interface to your PO cache.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for the response Mr. Konrad.
I'd like to store a String which is a data in particular field of an xml.
Which I'll use it to compare with the same field of the same data type but in a different iteration. If the data in the field changes, then the new data (String) replaces the old and this new data should be stored this time.
I'm completely new to SAP but good at java. Please correct me if my approach is wrong.
Thank you
Can you elaborate your intention for storing such a persistent value? How will it be used after mapping completes?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for the response. I need to compare a field which is in already generated xml (output file) with the one I'm going to process now. My approach is that storing the field's value (String) in a variable when the 1st iteration pass and comparing it with the field in the 2nd iteration. But clean up method in UDF is not letting me do that.
I'm completely new to SAP, but good at java. So please correct me if my approach is wrong.
Thank you
Even in Java programming outside of SAP products, you cannot access the value of a variable of a previous execution during the next execution.
You will need some persistent approach to store this and GlobalContainer does not provide this. One option of persisting the value would be to store it in a custom table, if you are on single stack PI/PO, then you can store it in a Java dictionary table as detailed in the blog below.
However, storing persistent value will cause your mapping to have side effects and you should have a read on the following blog as to why that is not a good idea.
You might want to revisit the reason for the need to perform such comparison on different iterations. This is not a common requirement.
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.