cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple idocs from single flat file

Former Member
0 Kudos

Hi All

I want to send data from a flat file to SAP(file to idoc)

My flat file structure is

id,name,number,city

2,R1,234,SD

2,R2,457,MD

3,R4,789,HG

3,R6,235.HG

The Field 'id' will change..after every change in 'id' ,seperate idoc should be created.

I have checked the following thread.

In the above thread ,it is asked to map v.no with remove context and use SPLIT BY VALUE on value change then do the mapping accordingly ,you can create 3 idocs for the same.

I'm confused about how to do these mappings.

Please explain the mapping in detail.

Please help

Regards

Reema

Accepted Solutions (0)

Answers (5)

Answers (5)

former_member187339
Active Contributor
0 Kudos

Hi Reema,

When you set recordsets per message to 1, As per your example the File content conversion will take only one record at a time

So first it will take 2,R1,234,SD

then 2,R2,457,MD

then 3,R4,789,HG

then 3,R6,235.HG

So during first record message mapping the source xml would look like

<root>

-<id>2</id>

-<name>R1</name>

-<number>234</number>

-<city>SD</city>

</root>

now from this source you need to make one idoc.

But i think recordset per message might not be helpful in your case, because as per your first post you need to create an IDoc for each id change. Here when file adapter picks and send one record to PI, you will not be able to decide on whether the next id is same or different

So net result is if you change mapping (and also use recordset per message) then you will not be able to handle the condition of 1 idoc per id.

and if you want to handle that, you cannot see individual messages in MONI.

You need to choose

Regards

Suraj

Former Member
0 Kudos

if your source data type is like


MT_Source
    Record           0-unbounded
       id                    ----1
       name              -----1
       number           -----1
       city               -------1

then in the sender file communication channel you have to specify file content conversion parameters as


Parameter name               parametervalue

Document Name                 MT_Source
Recordset Structure           Record,*

choose + to add more parameters


Name                                  Value

Record.fieldSeparator                      ,
Record.fieldNames                        id,name,number,city
Record.endSeparator                      'nl'

then do the maping

as


id ---->removeContext---->SplitByValue(Value change)---->Target Idoc

map according to your requirement for other fields

Former Member
0 Kudos

Hi fatima

Do i need to map 'id' with idoc node or control record segment or header segment or any other ?

Please explain.

also, don't i need to content conversion for 'id' as Key Field.

Regards

Reema

Former Member
0 Kudos

Hi

I have done the mapping and configuration as per Kubra Fatima's instructions.

I've done the mapping as

id -


>removeContext-->SplitByValue(Value change)-->idoc

But i'm not getting the desired result.

i want different idocs based on field id.

But still it is creating 1 message in moni and 1 idoc containg all the records. Records with 'id' 2 & 3 are coming in single idoc.

i need seperate idoc for different 'id' values.

Please Help

Regards

Reema

Former Member
0 Kudos

Hi All

Please suggest a solution.

Regards

Reema

former_member187339
Active Contributor
0 Kudos

Hi,

Paste here the source XML (after content conversion) and target IDoc structure that you are expecting

Regards

Suraj

Former Member
0 Kudos

Hi All

Now its working fine .

Used the mapping as id-->Remove context->splitbyvalue(valuechange)------Idoc & other nodes

Multiple idocs are generating based on field 'id'.

In Sxmb_moni there are multiple idocs one after another within one message. But in R3 they will post as separate IDOCs.

But I want Seperate messages in Sxmb_moni for all idocs.

The content conversion parameters are given as per kubra fatima's Reply.

What should i do to have seperate messages in Moni for each idoc?

Regards

Reema

former_member187339
Active Contributor
0 Kudos

Hi Reema,

By using this method you are reading the flat file completely and hence the records are also read as a single unit.

You can use the option of Recordsetpermessage in the File content conversion of your File sender channel. But doing sio there will be slight changes in your mapping.

If you requirement is to see individual messages in MONI and also post idoc for each record, then i will suggest you to use the recordsetpermessage option.

Check this link http://help.sap.com/saphelp_nw04/helpdata/EN/2c/181077dd7d6b4ea6a8029b20bf7e55/content.htm

Regards

Suraj

Former Member
0 Kudos

Hi

I have given Recordsets per message as 1 and Recordset structure as Record,*

But still only one message is coming in Moni.

What change i need to do in mapping for this ?

Regards

Reema

former_member187339
Active Contributor
0 Kudos

Hi Reema,

>>What change i need to do in mapping for this ?

You need to do a message mapping keeping the fact that only one record will be coming to PI and hence as per you requirement you need to make one IDoc. Hope you understood how the mapping should be now.

Paste here the source XML structure and the parameters you are using in file content Conversion. It will be helpful in identifying the problem

Regards

Suraj

Former Member
0 Kudos

Hi Suraj

It will be very nice of you, if you explain the mapping in detail.

Please explain the mapping in detail.

Regards

Reema

Former Member
0 Kudos

hi,

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

http://www.sdn.sap.com/irj/scn/weblogs/blog=/pub/wlg/14425

Check out these weblogs

Cheers,

Divya

Edited by: Divya Vidyanandan Prabhu on Sep 15, 2009 8:18 AM

Former Member
0 Kudos

Hi reema,

As your data should create two idocs as it have two ids

when you receive the XML file after content conversion for your data you will have four XML instances (occurences) for which two idocs have to be created..

so to implenement this you need to put the condition at the idoc root node level..

so go to idoc/node level and implement the below

id > removeContext> SpliyByValue(ValueChange) -->idoc/node

Rajesh

Former Member
0 Kudos

Hi ,

Follow these steps.................

1)First change the occurence of IDOC (by default 0..1) as specified in the thread.

2)Map your root node using remove context and use SPLIT BY VALUE( if you double click split by value you can see "value change" option ...use this otpion ) to the IDOC.

3)Then do the remaining mappin ,It will create different idocs whenver id change .

Regards,

Sekhar