cancel
Showing results for 
Search instead for 
Did you mean: 

Split file based on change in value in a field

Former Member
0 Kudos

Hi,

I have an input file with following rows (say):

1, 11, 111, 1111, cc1

2, 22, 222, 2222, cc1

3, 33, 333, 3333, cc1

4, 44, 444, 4444, cc2

5, 55, 555, 5555, cc2

6, 66, 666, 6666, cc3

How can I configure so that the file is split into multiple messages based on change in the last field i.e for the above example I should have the following messages..

Msg1 consisting of:

1, 11, 111, 1111, cc1

2, 22, 222, 2222, cc1

3, 33, 333, 3333, cc1

Msg2 consisting of:

4, 44, 444, 4444, cc2

5, 55, 555, 5555, cc2

Msg3 consisting of:

6, 66, 666, 6666, cc3

Note that cc1, cc2, cc3 etc. are variables but can be expected to arrive sorted like in above example. For example cc1 can be company 1000, cc2 can be company 1031, cc3 can be company 1032 etc. but in another instance, these may by companies 1020, 1021, 1051 etc. So without hardcoding the actual companies, how can I split for any company when there is a change in company. I would guess there was an easy way of doing this using node functions, not my strong point.

Thanks in advance

JB

Accepted Solutions (1)

Accepted Solutions (1)

justin_santhanam
Active Contributor
0 Kudos

James,

What's ur receiving system? See first use Content conversion in sender adapter and bring into XI. After getting the msg into XI, u can do mapping stuff and split them accoringly.

raj.

Former Member
0 Kudos

Receiving system is SAP, with a RFC call. So the file is to be split into multiple postings by calling RFC wrapper for BAPI_ACC_DOCUMENT_POST for each company. In my example, the mapping should create 3 nodes for the request part of above BAPI with the next node being created when company changes.

justin_santhanam
Active Contributor
0 Kudos

James,

You can easily do it using Multimapping. First pull all the data into XI and give us how u defined the source structure, then we will give u the mapping logic.

raj.

Former Member
0 Kudos

The source structure is:

<Bank>

<Record> occur 1

<Row> occur 0 .. unbounded

<field1> occur 1

<field2> occur 1

<field3> occur 1

<field4> occur 1

<field5> occur 1 -- this field will be the company code based on which the file is to be split

The target structure is:

<BAPI_ACC_DOCUMENT_POST> occur 0 .. unbounded

...

...

Whenever there is change in company code, a new node above is to be created with subsequent rows going into the new instance with same mapping

justin_santhanam
Active Contributor
0 Kudos

James,

See the below snapshots in the URL

Mapping

http://flickr.com/photos/8764045@N06/2260194337/sizes/o/

Change ur target message occurrences in message mapping, Similarly don't forget to change in Interface mapping too.

http://flickr.com/photos/8764045@N06/2260194333/sizes/o/

Results

http://flickr.com/photos/8764045@N06/2260194335/sizes/o/

Are u looking for the above stuffs? Are u ok with it. Actually I don't know what logic u need to do with field1 to field4. I took only field5 and did the logic.

Reply back if it doesn't helps u!

raj.

Former Member
0 Kudos

Thanks Raj, that's a start.

For the individual fields, they should go into the corresponding <item> tag in the AccountGL tags of the target message as shown..

In my example, the <field1> tags under company cc1 should go into the first output tag <AccountGL><Item(1)>

the <field1> under company cc2 will go into <AccountGL>Item(1) under the next message tag etc.

ie.

BAPI_ACC_DOCU_POST(1)

....ACCOUNTGL

........item(1)

1, 11, 111, 1111, cc1

........item(2)

2, 22, 222, 2222, cc1

........item(3)

3, 33, 333, 3333, cc1

BAPI_ACC_DOCU_POST(2)

....ACCOUNTGL

........item(1)

4, 44, 444, 4444, cc2

........item(2)

5, 55, 555, 5555, cc2

BAPI_ACC_DOCU_POST(3)

....ACCOUNTGL

........item(1)

6, 66, 666, 6666, cc3

justin_santhanam
Active Contributor
0 Kudos

James,

Apply the below logic.

Fied5(Change context)--->Splitbyvalue(Value Changed)--->item.

Now for example field1 needs to go to ITEMNO_ACC ,then

Field1(Change Context)----->SplitByvalue( Each Value )--


>ITEMNO_ACC

raj.

Former Member
0 Kudos

Thanks a lot Raj! This is exactly what I needed. Points awarded!

JB

justin_santhanam
Active Contributor
0 Kudos

No probes

raj.

Answers (1)

Answers (1)

Former Member
0 Kudos