on 04-13-2011 1:01 PM
HI,
my target is to create a node for every item(wich belongs to the right header-ordernumber) in my source mapping. But sometimes there is no <pos> for a specific header(i.e. ordernumber 222)
Sourcemessage-Structure: (RFC CONTROL_RECIPE_DOWNLOAD)
<head>
<Ordernumber>111
<Ordernumber>222
</head>
<pos>
<ordernumber_pos>111
<ordernumberpos>10
<posdata>xxx
</pos>
<pos>
<ordernumber_pos>111
<ordernumberpos>20
<posdata>yyy
</pos>
1. Do you have an UDF example to reach this ?
I think i have to loop over all <pos> to find the right one(maybe concat ordernumber an pos) .
2. Which returnvalue is used to avoid creating a node ?
Thx,
Gordon
Edited by: Gordon Breuer on Apr 13, 2011 2:01 PM
As you said for each pos you need to create one target node, so in this case there will be 2 nodes..can you give one example where your scenario is failing.. also let me know if source message can come as mentioned below.. the last pos 555 is not present under header-->Ordernumber. If this is not the case then you will not require any udf hopefully.
<head>
<Ordernumber>111
<Ordernumber>222
</head>
<pos>
<ordernumber_pos>111
<ordernumberpos>10
<posdata>xxx
</pos>
<pos>
<ordernumber_pos>111
<ordernumberpos>20
<posdata>yyy
</pos>
<pos>
<ordernumber_pos>555
<ordernumberpos>10
<posdata>zzz
</pos>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can go thorugh this blog for to understanding the context handeling concept (look into sap help to read more) but setting the desired context depends on case to case that's why I asked you to provide an example.
/people/riyaz.sayyad/blog/2006/04/23/introduction-to-context-handling-in-message-mapping
Hi Gordon,
This is achievable. Please do the following:
Create an UDF of type All values of Queue.
Have three arguements, first Ordernumber, second ordernumber_pos, third removeContext(count(Ordernumber))
In the UDF,
int counter = var3.length;
for(int i =0; i<counter ;i++)
{
for (int j = 0; j < counter; j++)
{
if (var1<i> == var2[j])
{
result.addValue(" ");
result.addContextChange(); // - check if this line is required during testing, if context required keep it, else remove this line
}
}
}
Change the i & j start and end conditions based on your understanding
>> Which returnvalue is used to avoid creating a node ?
Just use return statement if u dont wish to create a node. Or if inside a for loop, use continue statement to skip adding result.addValue() step. It will go the next value of the loop.
Cheers,
Souvik
Edited by: Souvik Chatterjee on Apr 13, 2011 6:14 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
You can create a UDF with 2 input fields for orderNumber and orderNumber_pos. For the orderNumber_pos, use a mapWithDefault so that you get the missing nodes in your UDF.
Then in the code, use a for loop to iterate through the two input arrays to create the ouput. Create the UDF as a queue function.
Regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
82 | |
10 | |
10 | |
9 | |
6 | |
6 | |
5 | |
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.