cancel
Showing results for 
Search instead for 
Did you mean: 

File - XI - Multiple IDOCS issue

SudheerJ
Participant
0 Kudos

Hello,

We have a PlainFile–TO–Idoc SAP XI Scenario. We have configured everything and it is working fine. However, we have a new requirement where we need to produce multiple idocs from one file. I mean, in the text file we can have something similar to this:

HEADER;XYZ;123;123456

DETAIL;XYZ;123;123456

DETAIL;XYZ;123;123456

DETAIL;XYZ;123;123456

DETAIL;XYZ;123;123456

..

..

..

..

TRAILER;XYZ;123;456

Now for every 1000 "detail" records from the above structure it should create another idoc.

So can you tell us how to solve this problem? Is there anything we can do to configure SAP XI so we can send 1 File to multiple IDOCS.

Thanks in advance.

Sudheer

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Sudheer,

For this, you need to write UDF.

This UDF will count the number of "detail" record and new context will be generated for the target Idoc root where ever Detail exceeds 1000.

The subsequent details record will be put in the next Idoc.

Kindly reward with points if found useful.

Regards,

Jayanti.

SudheerJ
Participant
0 Kudos

Jayanti,

Thanks for your response.

Can you please elaborate on how to handle this situation through UDF i.e. if possible can you please help me out with some example code for UDF creation on how to trigger a new message based on a condition.

Thanks in Advance!!

justin_santhanam
Active Contributor
0 Kudos

Sudheer,

First of all you need to change the occurrence of IDOC. Make sure it has 0..Unbounded. Then , if you provide the source strucutre will tell how to proceed further.

raj.

SudheerJ
Participant
0 Kudos

Raj,

I have changed the occurence of idoc, can you please help me out how to proceed further.

Regards,

Sudheer

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Sudheer!

If your IDocs are generated only based on the details, then you could use set File Content Conversion's "Recordsets per message" to 1000, to make file adapter, create a new message for each 1000 records it reads, this will make the scenario work as if it receives several files of 1000 records each, instead of one file with thousands of records.

Another similar idea, to avoid touching your current scenario, could be to create a "pre-processing" scenario, File-Xi-File that only splits the input file into smaller files of 1000 records each. Then the current scenario should pick the output of this pre-processing scenario to do its work.

Check this:

Recordsets per mesage, will send, different idocs, not an idoc package. If you want Idoc package, you could use graphical mapping and udf to manage multiple occurances (you will have to edit the imported IDOC definition, for occurance = unbounded)

Regards,

Matias

nisarkhan_n
Active Contributor
0 Kudos

Matias,

I am bit confused on your reply....if i select the recordset per message some number suppose 100, fiel apdter collects 100 messgaes each time and sends it as a single message to target..thats what i was under impression...

suppose file adpater picks 100 messages till it delivers 100 mesages to IDOC 1, it doesnt send remainng 100 is that what you mean.....

Correct me if i am wrong in my understnading.

nisarkhan_n
Active Contributor
0 Kudos

for ex same situation in file to file case

if source file has 1000 records if my source file adapter recordset permessage is 100 then would i get 10 files at target side?

i think handling the above requiremnt trough UDF is good approach.

Edited by: Nisar Khan on Feb 29, 2008 8:13 PM

SudheerJ
Participant
0 Kudos

Hi Matias,

Thanks for the response.

I am not getting several files of 1000records, I am getting one single file which will contain more than 1000 records and for every thousand records in that file i need to generate a new file.

One more thing, as i am getting one single file with several records in it how XI handles or counts first 1000 messages and initiates an new idoc if i put 1000 in the Records per message parameter.

Please help me out.

Thanks in Advance!!

justin_santhanam
Active Contributor
0 Kudos

Sudheer,

I would say, it's best to go for mapping logic and split them accordingly.

raj.

Former Member
0 Kudos

Hi Sudheer !

I know you are receiving a single file with more than 1000 records.

If you use the "recordsets per message" option of the file adapter sender under file content conversion, the file adapter instead of sending a single XML message to XI Integration Engine with the whole content of the file, will create N XML messages, one per each 1000 records of your input file.

Now, if your input file has 5500 records, you have one single XML message with 5500 records.

With recordsets per message, you could have 6 XML messages, 5 of 1000 records and 1 of 500 records.

Then, XI will process each message as if they came from different files, so it will generate 6 IDocs instead of a single one. Those will travel as 6 different messages to SAP ERP. This mean that the split is made physically.

The other solution, using UDF, allows you to create multiple instances of an IDOC document inside a single message, it is called IDOC package. This will travel to SAP ERP as only ONE package/message, but inside it will contain several documents, in this case 6 ( 5x1000 + 1x500). This will be one single message for XI, but 6 different idoc documents for SAP ERP. This kind of split is logical.

The udf solution requires you to export the IDOC imported definition as an XSD file, edit its content to convert it to a "idoc package" definition, allowing multiple idoc inside instead of one and then re-import the idoc definition. Then via mapping you will be able to determine change of contexts and assign records to each IDOC per each 1000 records.

If you still have doubts, please ask

Regards,

Matias

ps: please award points if helpful.

Former Member
0 Kudos

Hi Nisar !

Check my last post.

The recordsets per message option of the File Content Conversion of File Adapter Sender, allow you to force the file adapter to define how many records you want as a MAXIMUM for each message sent to XI. If your file has 1001 records and your recordsets per message is set to 1000, then the file adapter will send 2 XML messages to XI, one with 1000 records, and one with a single record. It does not have a wait or buffer mechanism, it just splits the input file while reading it. Each segment message results unrelated with the other ones belonging to the same input file. XI process them as different messages. Also you have to use QoS = EOIO to be sure that the segments are processed in order !

Regards,

Matias.

SudheerJ
Participant
0 Kudos

Hi Matias,

Thanks a lot for your response, very helpfull answer, let me try out whatever you have said and i will let you know the result of this.

Thanks & Regards,

Sudheer

nisarkhan_n
Active Contributor
0 Kudos

Sudheer,

The Recordsetper message will not help in your case as you have

Header

Data

Tailer

you req is to split the 1000 data records into Single IDOC, but wth each tailer right?

SudheerJ
Participant
0 Kudos

Hi Nisar,

Thanks for the response.

You are right My Structure is

Header

Detail

Trailer

How to get an separate idoc for every 1000 detail records.