cancel
Showing results for 
Search instead for 
Did you mean: 

JMS to IDOC

Former Member
0 Kudos

Hi,

I'm working on JMS to Idoc scenario, this is going to be a huge volume scenario( may be 50K messages at a time from legacy). So SAP folks needed the maximum records in a Idoc would be "10000" and should processed for 5 times something like that.

How can I achieve the same in XI. Please help me out.

-Xavier

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

How the IDOC will be created? I mean will there be 50K IDOCs for 50K messages?

Can you explain a bit more.

Former Member
0 Kudos

Sarvesh,

XI has to limit the no.of records in a Idoc ( say 5000 records in a Idoc). If we processes 10000 records it should be two idocs with 5000 records in each.

-Xavier

Former Member
0 Kudos

Write a udf with a logic as below

for (int i=0;i<input.length;i++)

{

if (input.length > 5000)

result.addContextChange();

}

Map this udf to the segment of idoc level. After every 5000 records a new idoc will be formed

Thanks

Pratichi

Former Member
0 Kudos

First of all you have to create an external definition in which you have to change the occurrence of IDOC as 1...unbounded. Then use the UDF as mentioned below to create a context change after 5000 records for example. And then map the UDF to "IDOC" segment.

While creating the UDF select the Cache as "Queue".

int count = 0;

for (int i = 0; i<input.length; i++)
{
count = count + 1;
if(count == 5000)
{
result.addValue(" ");
result.addValue(ResultList.CC);
Count = 0;
}

//if at any time records are less then 5000 then also an idoc should be created
if(input.length < 5000)
{
result.addValue(" ");
}
}

While doing the mapping you have to set the context of source node at higher level or use removeContext. e.g.

SourceNode -


>RemoveContext -


>UDF -


> IDOC.

To change the occurrence of IDOC follow step1 to 4 from below mentioned blog...

/people/michal.krawczyk2/blog/2005/12/04/xi-idoc-bundling--the-trick-with-the-occurance-change

Regards,

Sarvesh

Former Member
0 Kudos

Thanks for the quick responses...but,Its still not working.

I have a JMS input structure like this;

MT_Input 1..1

Record 1..1

Header 1..1

XXXX

XXXX

XXXX

Item 1..Unbounded

YYYY

YYYY

YYYY

and the target Idoc structure like this;

ZXXXXXXXX 1..1

IDOC 1..1

EDI_DC40 1..1

ZYYYYYYY 1..Unbounded

ZZZZ

ZZZZ

ZZZZ

If Item nodes (source side) more than 5000, I need to create a new Idoc. I have tried with above ud, But no luck!

Former Member
0 Kudos

I have done some changes in UDF, so use this one.. and secondly make sure you have changed the occurrence of IDOC otherwise it will not work.. In your example you still have the occurrence of IDOC as 1:1.

 int count = 0; 
 int count2 = 0; 

for (int i = 0; i < input.length; i++)
{
count = count + 1;
count2 = count2 + 1;
if(count == 5000)
{
result.addValue(" ");
//result.addValue(ResultList.CC);
count = 0;
} 
}
//if at any time records are less then 5000 then also an idoc should be created
if(input.length - count2 >= 0 && input.length - count2 < 4999)
{
result.addValue(" ");
}

Former Member
0 Kudos

Hi Sarvesh,

I have mapped the same with the changed Idoc structure as unbounded. But still its giving the following error.

com.sap.aii.mappingtool.tf7.IllegalInstanceException: Cannot create target element /ZXXXXXX/IDOC[2]/ZYYYYY. Values missing in queue context. Target XSD requires a value for this element, but the target-field mapping does not create one. Check whether the XML instance is valid for the source XSD, and whether the target-field mapping fulfils the requirement of the target XSD

NOte: I have mapped the UDF like...RECORD---REMOVE CONTEXTS --UDF --IDOC

-Xavier

Former Member
0 Kudos

can anbody thorow some light on this!

VijayKonam
Active Contributor
0 Kudos

This UDF has to be applied for each and every internal fields mapped in the idoc. It is not going to work if it just added at the IDOC node level. At the lower level nodes, using collapse contexts and then a split by value might work. But you should test for every field.

VJ

Former Member
0 Kudos

Thanks VJ...I have tried the same, but still its not working!

Is there any other work around for the same! Or is there any related document on SDN.

-Xavier

Former Member
0 Kudos

>NOte: I have mapped the UDF like...RECORD---REMOVE CONTEXTS --UDF --IDOC

Just note the point .... each RECORD will contain 10000 ITEM therefore the generation of IDOC should be based on ITEMS and not based on RECORD (parent segment of source). So mapping will be something like this..

ITEM--->RemoveContext --->UDF --->IDOC

And of course to map the header data of source to each IDOC, you have to use the std. function "UseOneAsMany"

Former Member
0 Kudos

Sarvesh,

Sorry...I have mentioned wrongly in my previous message, I have mapped it with ITEM segment to IDoc. since its repeating. But still no luck. And I got the error, whenever it has more than 4999 messages, if its below 4999 than its working IR testing tab. Is there anything else, I need to do for this!

-Xavier

Former Member
0 Kudos

HI,

Try to do your mapping in smaller steps. I mean first of all disable all the target nodes except IDOC parent node and then see if you are able to create desired number of IDOCs. If yes then enable the next node and do your testing and so on....

BTW, how are you doing the mapping for ZYYYYYYY segment. I hope you are doing the mapping in same way as you do for IDOC segment.

Secondly how are you doing the mapping for the fields under ZYYYYYYY segment. They should be mapped just 1:1 with SplitByValue funciton. e.g. yyyy -


>MapWithDefault -


>SplitByValue --->zzzz (This I have not tested so check other options if it doesn't work)

it will be nice if you see the queue of each element to make sure if mapping is productiong correct results and if not then either context is not set correctly or some data is missing. Basically see the queue of IDOC segment, there shoudn't be any suppressed values.

Regards,

Sarvesh

Answers (0)