on 12-04-2007 2:33 PM
Hi,
i am reading data from database. There we have a field which should tell when to create new target-datatype. Scenario is JDBC2IDoc - so when in value <ART> a "P" instead of a "H" occurs - a new IDoc should be generated.
Is this possible to achieve?! When how do i have to do this?! Do i have to map in two different steps?! First read the whole data from DB and then take this payload to map to the target structure depending on the value sin <ART>?!
Source Structure looks like this:
<?xml version="1.0" encoding="utf-8"?>
<MT_EPLAN_DB>
<row>
<ID>79</ID>
<ART>P</ART>
<DATA1>63140300065400</DATA1>
<DATA2></DATA2>
<DATA3></DATA3>
<DATA4></DATA4>
<DATUM>20071113101505</DATUM>
<PROCESSED>0</PROCESSED>
</row>
<row>
<ID>80</ID>
<ART>W</ART>
<DATA1>71000002</DATA1>
<DATA2>1</DATA2>
<DATA3>1</DATA3>
<DATA4>Bohrer </DATA4>
<DATUM>20071113101505</DATUM>
<PROCESSED>0</PROCESSED>
</row> <row>
<ID>83</ID>
<ART>P</ART>
<DATA1>66341000829400</DATA1>
<DATA2></DATA2>
<DATA3></DATA3>
<DATA4></DATA4>
<DATUM>20071114132612</DATUM>
<PROCESSED>0</PROCESSED>
</row>
<row>
<ID>84</ID>
<ART>W</ART>
<DATA1>71000002</DATA1>
<DATA2>1</DATA2>
<DATA3>2</DATA3>
<DATA4>Bohrer </DATA4>
<DATUM>20071114132612</DATUM>
<PROCESSED>0</PROCESSED>
</row>
</MT_EPLAN_DB>
can somebody help?!
br
Ur <row> node has multiple occurrences. Just map it to the receiver Idoc structure.
This way do simple mapping.
Now in ID, use conditional receiver determination. In the condition, if the value of field <ART> is "P", then use SAP system as receiver for Idoc. Otherwise mention the condition u want to use if the field is other than "P"
I think the BPM wont be required then
Regards,
Prateek
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Prateek,
Ya true. Here in the given structure, that is just a row is repeating and he just need to find the value of its first tag if it is 'P' or any other value. It can be done using the direct mapping to IDOC structure and just provide the context object at the time of MI. and then use this contect object at the time of receiver determination to find out the correct receiver depending upon the context object value at XPATH..
Sorry, i just got confused coz of Split word in the question so i thought it differently.
regards
Aashish Sinha
Hi Raj,
actually when a K occurs a new IDoc should be generated and the follow positions in row with value P should be added to the IDoc. When a new K occurs a new Idoc will be generated...
br
<b>Edit</b>: Can somebody help?! i wrote this UDF
public void devideData(String[] art,String[] b,ResultList result,Container container){
for (int i = 0; i < art.length; i++) {
if (art<i>.equals(b)){
result.addValue(art<i>);
}
}
}
But actually it does nothing else as me posted graphical mapping!
how to make the IDoc be new generated??!
br
Jens,
Please see my below results as per your logic. Kindly let me know, whether you are looking for this.
<b>Results.</b>
<b>Source</b>
<?xml version="1.0" encoding="UTF-8"?>
<ns0:MT_Source xmlns:ns0="urn:samplescenarios">
<row>
<ID>1000</ID>
<ART>A</ART>
<DATA1>1</DATA1>
<DATA2>1</DATA2>
<DATA3>1</DATA3>
<DATA4>1</DATA4>
<DATUM>1</DATUM>
<PROCESSED>1</PROCESSED>
</row>
<row>
<ID>1001</ID>
<ART>K</ART>
<DATA1>2</DATA1>
<DATA2>2</DATA2>
<DATA3>2</DATA3>
<DATA4>2</DATA4>
<DATUM>2</DATUM>
<PROCESSED>2</PROCESSED>
</row>
<row>
<ID>1002</ID>
<ART>A</ART>
<DATA1>3</DATA1>
<DATA2>3</DATA2>
<DATA3>3</DATA3>
<DATA4>3</DATA4>
<DATUM>3</DATUM>
<PROCESSED>3</PROCESSED>
</row>
<row>
<ID>1003</ID>
<ART>P</ART>
<DATA1>4</DATA1>
<DATA2>4</DATA2>
<DATA3>4</DATA3>
<DATA4>4</DATA4>
<DATUM>4</DATUM>
<PROCESSED>4</PROCESSED>
</row>
<row>
<ID>1004</ID>
<ART>P</ART>
<DATA1>5</DATA1>
<DATA2>5</DATA2>
<DATA3>5</DATA3>
<DATA4>5</DATA4>
<DATUM>5</DATUM>
<PROCESSED>5</PROCESSED>
</row>
<row>
<ID>1005</ID>
<ART>A</ART>
<DATA1>6</DATA1>
<DATA2>6</DATA2>
<DATA3>6</DATA3>
<DATA4>6</DATA4>
<DATUM>6</DATUM>
<PROCESSED>6</PROCESSED>
</row>
<row>
<ID>1006</ID>
<ART>K</ART>
<DATA1>7</DATA1>
<DATA2>7</DATA2>
<DATA3>7</DATA3>
<DATA4>7</DATA4>
<DATUM>7</DATUM>
<PROCESSED>7</PROCESSED>
</row>
<row>
<ID>1007</ID>
<ART>A</ART>
<DATA1>8</DATA1>
<DATA2>8</DATA2>
<DATA3>8</DATA3>
<DATA4>8</DATA4>
<DATUM>8</DATUM>
<PROCESSED>8</PROCESSED>
</row>
<row>
<ID>1008</ID>
<ART>P</ART>
<DATA1>9</DATA1>
<DATA2>9</DATA2>
<DATA3>9</DATA3>
<DATA4>9</DATA4>
<DATUM>9</DATUM>
<PROCESSED>9</PROCESSED>
</row>
<row>
<ID>1009</ID>
<ART>A</ART>
<DATA1>10</DATA1>
<DATA2>10</DATA2>
<DATA3>10</DATA3>
<DATA4>10</DATA4>
<DATUM>10</DATUM>
<PROCESSED>10</PROCESSED>
</row>
<row>
<ID>1010</ID>
<ART>K</ART>
<DATA1>11</DATA1>
<DATA2>11</DATA2>
<DATA3>11</DATA3>
<DATA4>11</DATA4>
<DATUM>11</DATUM>
<PROCESSED>11</PROCESSED>
</row>
<row>
<ID>1011</ID>
<ART>A</ART>
<DATA1>12</DATA1>
<DATA2>12</DATA2>
<DATA3>12</DATA3>
<DATA4>12</DATA4>
<DATUM>12</DATUM>
<PROCESSED>12</PROCESSED>
</row>
<row>
<ID>1012</ID>
<ART>P</ART>
<DATA1>13</DATA1>
<DATA2>13</DATA2>
<DATA3>13</DATA3>
<DATA4>13</DATA4>
<DATUM>13</DATUM>
<PROCESSED>13</PROCESSED>
</row>
<row>
<ID>1013</ID>
<ART>A</ART>
<DATA1>14</DATA1>
<DATA2>14</DATA2>
<DATA3>14</DATA3>
<DATA4>14</DATA4>
<DATUM>14</DATUM>
<PROCESSED>14</PROCESSED>
</row>
</ns0:MT_Source>
<b>Target</b>
<?xml version="1.0" encoding="UTF-8"?>
<ns0:MT_Target xmlns:ns0="urn:samplescenarios">
<IDOC>
<row>
<ID>1001</ID>
<ART>K</ART>
<DATA1>2</DATA1>
<DATA2>2</DATA2>
<DATA3>2</DATA3>
<DATA4>2</DATA4>
<DATUM>2</DATUM>
<PROCESSED>2</PROCESSED>
</row>
<row>
<ID>1003</ID>
<ART>P</ART>
<DATA1>4</DATA1>
<DATA2>4</DATA2>
<DATA3>4</DATA3>
<DATA4>4</DATA4>
<DATUM>4</DATUM>
<PROCESSED>4</PROCESSED>
</row>
<row>
<ID>1004</ID>
<ART>P</ART>
<DATA1>5</DATA1>
<DATA2>5</DATA2>
<DATA3>5</DATA3>
<DATA4>5</DATA4>
<DATUM>5</DATUM>
<PROCESSED>5</PROCESSED>
</row>
</IDOC>
<IDOC>
<row>
<ID>1006</ID>
<ART>K</ART>
<DATA1>7</DATA1>
<DATA2>7</DATA2>
<DATA3>7</DATA3>
<DATA4>7</DATA4>
<DATUM>7</DATUM>
<PROCESSED>7</PROCESSED>
</row>
<row>
<ID>1008</ID>
<ART>P</ART>
<DATA1>9</DATA1>
<DATA2>9</DATA2>
<DATA3>9</DATA3>
<DATA4>9</DATA4>
<DATUM>9</DATUM>
<PROCESSED>9</PROCESSED>
</row>
</IDOC>
<IDOC>
<row>
<ID>1010</ID>
<ART>K</ART>
<DATA1>11</DATA1>
<DATA2>11</DATA2>
<DATA3>11</DATA3>
<DATA4>11</DATA4>
<DATUM>11</DATUM>
<PROCESSED>11</PROCESSED>
</row>
<row>
<ID>1012</ID>
<ART>P</ART>
<DATA1>13</DATA1>
<DATA2>13</DATA2>
<DATA3>13</DATA3>
<DATA4>13</DATA4>
<DATUM>13</DATUM>
<PROCESSED>13</PROCESSED>
</row>
</IDOC>
</ns0:MT_Target>
<b></b>
If you are ok with the results, then let me know. I'll tell the logic.
raj.
HI,
Ususally the occurance of IDOC is 0-1 so maximum it will occur one time.
Now what you need to do is change the occurance of IDOC from 0-1 to 0-unbounded and import it as an external definition.
Once you have done
write an UDF
take art all values in one context
for(i=0;i<art.length;i++)
{
if(art<i>.equals("P")
{
result.addValue("true");
}
else
{
result.addValue("false");
}
}
now after this UDF give the input to if then condition and pass the value as constant and mapp this to root node of IDOC.
So if the result is true then IDOC node will be generated else it will be supressed.
Thnx
Chirag
Jens,
Please find the below logic.I've given as per my structure mentioned in previous reply.
http://flickr.com/photo_zoom.gne?id=2086514945&size=o
http://flickr.com/photo_zoom.gne?id=2086514947&size=o
http://flickr.com/photo_zoom.gne?id=2086514949&size=l
UDF
http://flickr.com/photo_zoom.gne?id=2086514953&size=o
http://flickr.com/photo_zoom.gne?id=2086514955&size=o
http://flickr.com/photo_zoom.gne?id=2086514957&size=o
Note: Please Make sure that you change the source context to one more upper level. I've shown in some of the above images. But make sure u did for everything.
I hope it helps!! If you find it difficult, please let me know.
I've used 3 UDF's for it.
<b>generateIDOC</b>
for(int i =0;i<ART.length;i++)
{
if (ART<i>.equals("K"))
{
result.addValue("");
}
}
<b>generateRow</b>
int counter =0;
for(int i =0;i<ART.length;i++)
{
if (ART<i>.equals("K") && counter==0)
{
result.addValue("");
counter =1;
}
else if(ART<i>.equals("K") && counter==1)
{
result.addContextChange();
result.addValue("");
}
else if(ART<i>.equals("P"))
{
result.addValue("");
}
}
<b>generateElement</b>
int counter =0;
for(int i =0;i<ART.length;i++)
{
if (ART<i>.equals("K") && counter==0)
{
result.addValue(""+input<i>+"");
counter =1;
}
else if(ART<i>.equals("K") && counter==1)
{
result.addContextChange();
result.addValue(""+input<i>+"");
}
else if(ART<i>.equals("P"))
{
result.addValue(""+input<i>+"");
}
}
raj.
Hi Raj,
well this is a really great solution!!! I really appreciate ur help!
I guess i have to get in contact with UDFs more deeply because it occurs more often than i thought. Even the context-changes are not in my focus yet!
Do u have some advices for doing some excersises on this issue?!
great job!! Thx!
br Jens
Hi,
According to your senario, i guess at the time of message mapping you need to map it to the other output structure you want. this is a senario of n : 1 transformation of Multi -mapping. So for this, use ccBPM to complete you steps and then configure accordingly at ID.
regards
Aashish Sinha
PS : Reward points if helpful
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Check out for some of the import links related to BPM and i hope this will help you.
/people/arpit.seth/blog/2005/06/27/rfc-scenario-using-bpm--starter-kit
https://weblogs.sdn.sap.com/pub/wlg/1403 [original link is broken] [original link is broken] [original link is broken]
Till here you can learn how to do mapping with ccBPM and after this check out for your reference.
http://help.sap.com/saphelp_nw04/helpdata/en/43/65d4dab39b0398e10000000a1553f6/content.htm
http://help.sap.com/saphelp_nw04/helpdata/en/62/dcef46dae42142911c8f14ca7a7c39/content.htm
http://help.sap.com/saphelp_nw04/helpdata/en/83/d2a84028c9e469e10000000a1550b0/content.
/people/udo.martens/blog/2005/09/30/one-logical-system-name-for-serveral-bpm-acknowledgements
/people/sudharshan.aravamudan/blog/2005/12/01/illustration-of-multi-mapping-and-message-split-using-bpm-in-sap-exchange-infrastructure
/people/kannan.kailas/blog/2005/12/07/posting-multiple-idocs-with-acknowledgement
/people/krishna.moorthyp/blog/2005/06/09/walkthrough-with-bpm
/people/michal.krawczyk2/blog/2005/06/11/xi-how-to-retrieve-messageid-from-a-bpm
/people/arpit.seth/blog/2005/06/27/rfc-scenario-using-bpm--starter-kit
regards
Aashish Sinha
PS : reward points if helpful
User | Count |
---|---|
96 | |
11 | |
11 | |
10 | |
9 | |
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.