Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

File Split based on Condition

Hello

I have a scenario where I get a file and need to split it into two based on a condition. Is it possible to accomplish this scenario at the file adapter configuration or do I need a mapping for this.

Sample File

-


ABC1234asdfasfasdfasdfsdfasdfsdfsdfsdfasfsdfasdfsfasdfNewafasfsdfasfasdfasfafsdas

asfdasdfasfasdfasdf

asdfasdfadfasdfasfsd asdfsadfa fs

asdfasdfasfasdfasdfasdfadfsfafasfas

ABC1234asfdjoawejasdlfasdfasdfjsdfljasfjsfjaslfjasldfjasdlfsdOldfsdfadsfadfsdfasdffasdfasdfads

asdfasdfsdfa

asfdasdfasdfasdf

asdfsfasfsfsad

fasfasfasdffas

asdfasfsfa

asdfasfasfasdfas

ABC1234asfdjoawejasdlfasdfasdfjsdfljasfjsfjaslfjasldfjasdlfsdNewfsdfadsfsd23424324234234234

asdfsfasdfasfasfasfasfa

asdfasfasdfasfasfaasdfa

in the above content record always start with ABC1234 and it can have multiple sub records and it has a value new or old at column 120-123 in the first line of each record, it can have many sub records but I need to consider ABC1234 as the new record. I need to split the file into two, like one as newdata.txt and other as olddata.txt with new and old records respectively.

Files after the split should look like this

newdata.txt

-


ABC1234asdfasfasdfasdfsdfasdfsdfsdfsdfasfsdfasdfsfasdfNewafasfsdfasfasdfasfafsdas

asfdasdfasfasdfasdf

asdfasdfadfasdfasfsd asdfsadfa fs

asdfasdfasfasdfasdfasdfadfsfafasfas

ABC1234asfdjoawejasdlfasdfasdfjsdfljasfjsfjaslfjasldfjasdlfsdNewfsdfadsfsd23424324234234234

asdfsfasdfasfasfasfasfa

asdfasfasdfasfasfaasdfa

olddata.txt

-


ABC1234asfdjoawejasdlfasdfasdfjsdfljasfjsfjaslfjasldfjasdlfsdOldfsdfadsfadfsdfasdffasdfasdfads

asdfasdfsdfa

asfdasdfasdfasdf

asdfsfasfsfsad

fasfasfasdffas

asdfasfsfa

asdfasfasfasdfas

I appreciate if any one can help me with this.

Thanks in advance

Former Member
replied

> I have a scenario where I get a file and need to split it into two based on a condition. Is it possible to accomplish this scenario at the file adapter configuration

No, this is not possible.

> or do I need a mapping for this.

Yes, you can do this in a mapping.

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question