cancel
Showing results for 
Search instead for 
Did you mean: 

ABAP MAPPING - 1 read file leads to 2 files after split

Former Member
0 Kudos

Hi there,

please help me finding a solution for the following task:

Currently there is an ABAP mapping (consisting of an ABAP class that implements the interface IF_MAPPING including a method EXECUTE) that is getting the complete payload by the parameter SOURCE, modifying it and rewriting it by the parameter RESULT. No big deal so far. The input structure may look as follows...

<?xml version="1.0" encoding="utf-8"?>
<RecordSet>
	<Header>
		<header00>HDR</header00>
	</Header>
	<Row>
		<field00>1</field00>
	</Row>
	<Row>
		<field00>1</field00>
	</Row>
		<Row>
		<field00>5</field00>
	</Row>
</RecordSet>

After modification in ABAP mapping the whole payload can be written and sent within one file when all <field00> have the same value. BUT when there is at least one different <field00> (as shown in my example) I want to get two different files on my ftp server that look as follows...

file 1:

<?xml version="1.0" encoding="utf-8"?>
<RecordSet>
	<Header>
		<header00>HDR</header00>
	</Header>
	<Row>
		<field00>1</field00>
	</Row>
	<Row>
		<field00>1</field00>
	</Row>
</RecordSet>

file 2:

<?xml version="1.0" encoding="utf-8"?>
<RecordSet>
	<Header>
		<header00>HDR</header00>
	</Header>
	<Row>
		<field00>5</field00>
	</Row>
</RecordSet>

How can I achieve this since I only can rewrite the whole content in just 1 parameter RESULT? How does XI afterwards recognize that there are two messages for two different files?

Thans a lot and best regards,

Ralph

Accepted Solutions (1)

Accepted Solutions (1)

udo_martens
Active Contributor
0 Kudos

Hi Ralph,

first have a look to Michals blog [Multi-Mapping without BPM - Yes, itu2019s possible!|https://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/3115] [original link is broken] [original link is broken] [original link is broken];: You need to create a target structure like

<?xml version="1.0" encoding="UTF-8"?>
<Messages>
	<Message1>
		<RecordSet>
			<Header>
				<header00>HDR</header00>
			</Header>
			<Row>
				<field00>1</field00>
			</Row>
			<Row>
				<field00>1</field00>
			</Row>
		</RecordSet>
	</Message1>
	<Message2>
		<RecordSet>
			<Header>
				<header00>HDR</header00>
			</Header>
			<Row>
				<field00>5</field00>
			</Row>
		</RecordSet>
	</Message2>
</Messages>

For the ABAP mapping refer to Roberts ABAP mapping blogs /people/r.eijpe/blog/2005/11/10/xml-dom-processing-in-abap-part-i--convert-an-abap-table-into-xml-file-using-sap-dom-approach and /people/r.eijpe/blog/2005/11/21/xml-dom-processing-in-abap-part-ii--convert-an-xml-file-into-an-abap-table-using-sap-dom-approach

Actually the split is done by the adapter engine, therefore you cant use it for ABAP adapters proxy (PI), idoc and http.

Regards,

Udo

Answers (0)