cancel
Showing results for 
Search instead for 
Did you mean: 

Create seperate Idoc If Line Items reach 999 count

Former Member
0 Kudos

Hi all,

I have requirement like this

File(xml) to Idoc Interface, i need to check the line item count and if it is greater than 999, i need to create second idoc for remaining line items

For EX:

XML file contains 1050 Line Items

I need to create 1 Idoc with 999 Line items and second Idoc with 51 Line Items

If i have the .TXT file means, i could split that record set per message option.

Please advice me in this...

Regards

Accepted Solutions (1)

Accepted Solutions (1)

abhijitbolakhe
Advisor
Advisor
0 Kudos

Hi

Use the following UDF

For IDoc node mapping, item records will be input to UDF.

int count = a.length;

int b=999;

result.addValue("");

for(int i=0;i<count;i++)

{

if (i>=b){

result.addValue(""); // if records > 999, add IDoc node

b=b+999;

}

}

Complete the rest of the mapping .

Regards

Abhijit

Former Member
0 Kudos

Heloo,

Thanks for all replies. I have to check for another condition too

I need to create Idocs based on the company code change & that particular company code reached 999 lineitems then create another Idoc for that.

EX:

I have 1500 Line Items in file

1050 Items are related to Company Code "1100"

remaining 450 related to company code "1200"

For this i need to create idocs like this

one idoc with 999 line items which will contain 1100 company code

second idoc with 51 line items which will contain 1100 company code

Third Idoc with 450 line items which contain 1200 company code

To create separate idoc when company code is changed like this

company code--sort-Split By Value(Value Change)--Collapse ContextIdoc Segment(099999)

Please let me know how to satisfy both the conditions

Regards

Answers (2)

Answers (2)

Former Member
0 Kudos

Closing this thread as my requirement changed

Former Member
0 Kudos

Hi Vamsi,

As you said, If the file received is TXT. Count can be handled through Content Conversion on the sender side using File communication Channel.

Let's talk about if the file received by PI is an xml, The scenario can be completed using java mapping. As we have the full control over the target and source xml.

Thanks,

Kiran.