Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

SAP PI/XI Mapping Split Message By Certain Field Value

Former Member
0 Kudos

Hello Experts,

I have to map an edifact file to IDOC . My problem is that i want to split file everytime field that holds edifact code is BGM. For Example if I have a file like this :

BGM  11111111111111

LIN    22222222222222

LIN    33333333333333

BGM  44444444444444
LIN    55555555555555

I will map this file to a message like this :

code: BGM
mes:  1111111111111

So I need to create a split to create one IDOC everytime code is BGM. In this Example I'll have to create 2 IDOCS . First will have first three lines and second will have the remaining two.

Regards

9 REPLIES 9

Former Member
0 Kudos

Are you using any middleware? It is very simple in Middleware.

e.G for SAP PI/PO in graphical mapping you can map the BGM segment to IDOC node in target structure for this.

R

0 Kudos

No I don't

0 Kudos

The heading of the post says you are using SAP PI.

Anyway how you are receiving the file? via FTP or you are placing it the local PC/Application server and then trying to read it?

R

0 Kudos

Sorry my fault,
Yes I'm using SAP XI .

0 Kudos

Then as I said. It is very easy in XI graphical mapping. Only thing you might need to do is to change the XSD of the IDOC to accept multiple occurrence( 1 to unbounded). So you can manually edit the XSD of the Idoc or create an external message and use that as the target structure.

0 Kudos

I've already done this . My problem is splitting lines everytime code is BGM and place them in IDOC.

0 Kudos

Oh I see. BGM is not a segment(My bad : I thought you are using EDIFACT) rather a value in segment. Then I don't think them it is possible via graphical mapping. You may want to explore ABAP(If not single stack PO)/Java/XSLT mapping .

0 Kudos

Solved it using UDF

0 Kudos

Ok great.Glad to know. Please close the thread.