on 04-15-2015 6:17 PM
Hi all,
I have an RFC lookup within the message mapping to get a table from ERP which has Employee_number and Employee_Name. The table in ERP can change, so the number of values is not fixed. The RFC call sends the table structure and receives the data in the table.
Now I have to compare the values coming from the source message under field EMP_NUM to each line of the RFC result and take the corresponding Employee_Name and map it to a target field.
The number of lines in the RFC result table and the number of values in the context of EMP_NUM are different. So how can I map this different number of context changes?
Many thanks in advance.
Ramesh.
Can you elaborate a bit more?
What is the input to your RFC? a table name? and result would be the the list of columns along with values?
Can you execute the RFC in ECC and share the input and output?
This can be easily handled inside the RFC itself right? pass the empnumber and return the employee name.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Hareesh,
Yes, the input to the RFC is table name and the output is table. I have to compare a field of my source message to each row of the RFC result table and take the value that is matching. This is the requirement as there will be thousands of source fields. RFC table may be 30 or 40 rows.
so thousands of context changes for the source field have to be compared with less than 100 rows of the RFC table. Any solution please?
Thanks.
Hi Ramesh,
So you are getting the table date (two columns) as a result of RFC lookup. you can use the Hash table in PI to retrieve the employee name based on employee number from the input message.
refer the below wiki
http://wiki.scn.sap.com/wiki/display/XI/How+to+use+Cross+Reference+within+external+Database
regards,
Harish
Hi Ramesh,
Adding to Harish reply, you can use below UDF.
Execution Type : All values of context
argument1 : a (type string)
argument2 : b (type string)
argument3 : c (type string)
public void getNameById(String[] a, String[] b, String[] c, ResultList result, Container container) throws StreamTransformationException{
Map map = (Map) container.getParameter("names");
if (map == null) {
map = new HashMap();
for (int i = 0; i < b.length; i++) {
map.put(b[i], c[i]);
}
container.setParameter("names", map);
}
result.addValue((String) map.get(a[0]));
}
Mapping look like below:
EMP_NUM (From Source)---------->
EMP_NUM (From RFC result)-----> UDF------->mapWithDefault-------> TargetEMP_NAME
EMP_NAME (From RFC result)---->
Note: EMP_NUM source field must pass to UDF each value with context change, EMP_NUM and EMP_NAME from RFC must pass without context changes (use remove context change function if you have context changes) and make sure both queue are equal.
Regards,
Praveen.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.