on 06-25-2015 10:17 AM
Hi All,
I need some help in understanding the use of global variables in SAP PI.
My scenario is as follows:
Source Message structure
<SMS>
<SMSParameters>
<User/>
<Password/>
<RequestID/>
</SMSParameters>
<SMSMessage>
<DestinationAddr/>
<Text/>
<TransactionId/>
<Priority/>
<SourceAddr/>
</SMSMessage>
</SMS>
Target Message Structure:
User=ABC&Password=DEF&RequestID=90342
<SMSMessage>
<DestinationAddr>ABC&XYZ</DestinationAddr>
<Text>testing</Text>
<TransactionId>4534534</TransactionId>
<Priority>2</Priority>
<SourceAddr>QWE@ZXC</SourceAddr>
</SMSMessage>
Is it possible to read the SMSParameters(User, Password, RequestID) from the Source message as global variables and use them in java mapping to achieve the above target message?
I dont want to use the UDF for this.
Hope im making sense.
Regards,
J
Hi ,
I'm not sure whether I understood you correctly .Correct me if I misunderstood .
1)Global variables (scope within mapping) ,If you want in graphical mapping then we have graphical variable option(rightclick-->Add variable),if you want to use in java mapping/udf you just need to define a static variable and use it across in that mapping.
2)For using in multiple mappings within an Operation mapping ,you can only dynamic configuration values say FileName,Filesize...
3)For usage in multiple operation mapping then need to go for Look ups.
Regards
Venkat
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Venkat,
My scenario - incoming message structure contains - 3 fields - user, password, requestid.
But i dont map them to the outgoing message.
And i somehow need to access these field values in my java mapping.
Static variables are the ones which we define in attributes and methods section of message mapping.i declared 3 variables for user, password, request id.but how do i read the values from incoming message to these variables, and how do i use them in java mapping?
Regards,
J
Hi,
You can easily achieve your requirement by finding the start and end positions using indexOf() fn
Ex:<XYZ>val</XYZ>
Parametrized Java Mapping in PI 7.1 - Process Integration - SCN Wiki
I'm sure you can achieve it .Let me know if you face any trouble.I will share the code based on your requirement.
Regards
Venkat
Hi Janan
Have you checked this document http://scn.sap.com/docs/DOC-58916?, the way to access in java mapping will be similar.
If you want to sharing data between mapping you can use also dynamic configuration: also to use static variables with methods get/set:
Regards.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
Im not sure if i understand it completely.
As per my understanding, (correct me if im wrong):
Create static variables for User, password, request id in "Attributes and Methods" section of Message mapping.
How do i read the values from source message into the static variables?
and how do i use them in the java mapping?
Regards,
J
Hi Janan,
Just now i haven't any example to show you how to work with variables.
However, i haven't clear your problem because:
1. You can get payload values in java mapping: com.sap.aii.mapping.api
2. You can set dynamic values with dynamic configuration and to get them in java mapping
Java Mapping of Adapter-Specific Message Attributes - Enterprise Services Repository - SAP Library
Check the code how to set and get values with dynamic configuration
Regards.
User | Count |
---|---|
87 | |
10 | |
10 | |
9 | |
7 | |
7 | |
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.