on 11-28-2014 1:32 PM
Hello All
I need help in mapping to create multiple segments in target with the output of RFC lookup under correct context.
I am able to achieve multiple target segments w.r.t. output of RFC lookup but context is wrong.
Let me explain why I am telling context is wrong.
This Interface is JDBC to IDOC.
IDOC structure is like below:
MATMAS05 1..1
IDOC 1..1
E1MARAM 1..9999
E1MVKEM 0...9999
VKORG
I am fetching multiple rows at a time. I am taking example of fetching 2 rows now.
I have a table in ECC system which contains values of VKORG and REGION
REGION VKORG
NEU 1060
1510
1640
Source structure as below
I am fetching two records from SQL table.
HostLocID (REGION) = NEU
Now I wanted to achieve below target structure:
MATMAS05
IDOC
E1MARAM
E1MVKEM
VKORG 1060
E1MVKEM
VKORG 1510
E1MVKEM
VKORG 1640
E1MARAM
E1MVKEM
VKORG 1060
E1MVKEM
VKORG 1510
E1MVKEM
VKORG 1640
But I am getting all the E1MVKEM under 1st generated E1MARAM
MATMAS05
IDOC
E1MARAM
E1MVKEM
VKORG 1060
E1MVKEM
VKORG 1510
E1MVKEM
VKORG 1640
E1MVKEM
VKORG 1060
E1MVKEM
VKORG 1510
E1MVKEM
VKORG 1640
E1MARAM
Below is the mapping
For E1MARAM
For E1MVKEM
Fopr VKORG
Please let me know how to achieve the above result.
Thanks
Dheeraj Kumar
Hello,
The problem is at runtime, you don't know for a given region how many VKORG are going to come...
So either change RFC output and get all the VKORGs for a particluar Region in a single output as a comma separated value (1060, 1061,...) and then use UDF to split the values and maintian context which i beleive can be done easily or u can request one more output from a RFCLookup which would give u the count of VKORG values for each Region. And then u can use UDF to split the values of VKORG into correct context using the count.
Thanks
Amit Srivastva
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
can you try removing "remove context" for E1MVKEM and test?
also please share display queue for RFC loop up and concat function.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
looks tricky to me. not sure we can get the output from rfc with correct context.
will NEU be same for all row node? if yes you can follow this mapping.
you have to take care of context of E1MVKEM.
let us assume your first example.
input count(NEW) = 2
output count(1060,1510,1640,1060,1510,1640) = 6
now you need to split the context to 2. this you can achieve using UDF.
//AbstractTrace trace = container.getTrace();
int n = count[0];
for( int i = 0,j =1; i<values.length;i++,j++)
{
result.addValue(values[i]);
// trace.addInfo(values[i]);
if( ( j % n) == 0)
{
result.addContextChange();
}
}
Hello Muniyappan
The logic and code you provided worked perfectly fine if only one kind of REGION records are coming from source table. But now there is change in requirement and accordingly I need to change mapping and UDF code.
Previously I took example of getting records for only one REGION at a time, but using SELECT query in sender cc we cannot restrict to pick up one kind of REGION in 1st call and then other kind of REGION in second call. In source table REGION are many e.g. BRA, NEU, LATAM etc.
Using stored procedure this can be done or not, I have no idea. If this can be achieved then my problem is resolved otherwise need to do changes in mapping.
Sender CC can fetch records like below
Table in ECC contains one Sales_Org for BRA and seven Sales_Org for NEU
According to above input I need to achieve:
One IDOC for both BRA
Two segments of E1MARAM
One segment of E1MVKEM under both E1MARAM
One IDOC for NEU
One segment of E1MARAM
Seven segment of E1MVKEM under one E1MARAM
IDOC
E1MARAM
E1MVKEM
E1MARAM
E1MVKEM
IDOC
E1MARAM
E1MVKEM
E1MVKEM
E1MVKEM
E1MVKEM
E1MVKEM
E1MVKEM
E1MVKEM
I am able to achieve
IDOC
E1MARAM
E1MARAM
IDOC
E1MARAM
but E1MVKEM contexts are in wrong shape
Mapping screenshots are below
Mapping of E1MVKEM
Display Queue of RFC Lookup
Display Queue of Divide
Wrong input and output values. It should be [1], [1] and [7]
Display Queue of ContextChange
Input 1 should be [1], [1], [7]
Output should be [BRA]
Context Change
[BRA]
Context Change
[NEU]
[NEU]
[NEU]
[NEU]
[NEU]
[NEU]
[NEU]
I tried to modify you code but did not succeed. I am not good in Java.
IDOC Mapping
E1MARAM Mapping
Please reply ASAP need this urgently.
Thanks
Dheeraj Kumar
User | Count |
---|---|
88 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.