cancel
Showing results for 
Search instead for 
Did you mean: 

SAP XI/PI/PO Message Mapping IDoc Missing Segment Context Fail

0 Kudos
1,133

Hi Community,

I have following issue. I am currently creating a mapping from an IDoc to a SOAP request message. In the IDoc I have multiple segments which I have to map to a single field and I wanted to use the Suppress functionality to only use one value.

In the IDoc Segment I am checking if in the field TAXTYPE if the 3 position equals 0. So in this example the outcome should be 0002. I know it's not elegant but that's I have to work with.

Here is the Segment from the IDoc:

<E101BUS_EI_TAXNUMBER SEGMENT="1">
	<APPL_SNAME>BUS_EI_TAXNUMBER</APPL_SNAME>
	<CURRENT_STATE>X</CURRENT_STATE>
	<E101BUS_EI_BUPA_TAXNUMBER SEGMENT="1">
		<APPL_SNAME>BUS_EI_BUPA_TAXNUMBER</APPL_SNAME>
		<TASK>I</TASK>
		<E101BUS_EI_STRUC_TAX SEGMENT="1">
			<APPL_SNAME>BUS_EI_STRUC_TAX</APPL_SNAME>
			<TAXTYPE>AB1</TAXTYPE>
			<TAXNUMXL>0003</TAXNUMXL>
		</E101BUS_EI_STRUC_TAX>
	</E101BUS_EI_BUPA_TAXNUMBER>
	<E101BUS_EI_BUPA_TAXNUMBER SEGMENT="1">
		<APPL_SNAME>BUS_EI_BUPA_TAXNUMBER</APPL_SNAME>
		<TASK>I</TASK>
		<E101BUS_EI_STRUC_TAX SEGMENT="1">
			<APPL_SNAME>BUS_EI_STRUC_TAX</APPL_SNAME>
			<TAXTYPE>AB0</TAXTYPE>
			<TAXNUMBER>0002</TAXNUMBER>
		</E101BUS_EI_STRUC_TAX>
	</E101BUS_EI_BUPA_TAXNUMBER>
	<E101BUS_EI_BUPA_TAXNUMBER SEGMENT="1">
		<APPL_SNAME>BUS_EI_BUPA_TAXNUMBER</APPL_SNAME>
		<TASK>I</TASK>
		<E101BUS_EI_STRUC_TAX SEGMENT="1">
			<APPL_SNAME>BUS_EI_STRUC_TAX</APPL_SNAME>
			<TAXTYPE>AB2</TAXTYPE>
			<TAXNUMBER>0001</TAXNUMBER>
		</E101BUS_EI_STRUC_TAX>
	</E101BUS_EI_BUPA_TAXNUMBER>
	<E101BUS_EI_TAX_COMMON SEGMENT="1">
		<APPL_SNAME>BUS_EI_TAX_COMMON</APPL_SNAME>
		<E101BUS_EI_STRUC_TAX_COMMON SEGMENT="1">
			<APPL_SNAME>BUS_EI_STRUC_TAX_COMMON</APPL_SNAME>
		</E101BUS_EI_STRUC_TAX_COMMON>
		<E101S_EI_STRUC_TAX_COMMON_X SEGMENT="1">
			<APPL_SNAME>BUS_EI_STRUC_TAX_COMMON_X</APPL_SNAME>
			<NAT_PERSON>X</NAT_PERSON>
		</E101S_EI_STRUC_TAX_COMMON_X>
	</E101BUS_EI_TAX_COMMON>
</E101BUS_EI_TAXNUMBER>

This is my message mapping flow:

After testing and checking the Queue you can see that PI is using the SUPPRESS value as last result and therefore ignores my found value.

I found this blog which mentions that it can work if you change the context:

The Use of “suppress” in the XI 3.0 Graphical Mapping Tool

But there I have the next issue, if you check again the IDoc XML you can see that to TAXTYPE AB1 you don't have the field TAXNUMBER but TAXNUMXL instead. So if I change the context to E101BUS_EI_TAXNUMBER I would have 3 TAXTYPES but only 2 TAXNUMBER and therefore SAP PI doesn't map the corrent number into the field:

Queue results for SOAP field:


Queue result for TAXNUMBER

Is there anychance I can exclude entries if there are missing the required field in the IDOC?

Or any other ways I can use the mapping without creating userfunctions?

Thanks a lot.

BR,

Andreas

View Entire Topic
isuru_fernando24
Explorer

Hello,

You need to change the context level of the input segments tax type and tax number in such a way that you build the queue in the different way. Check these two posts about PI/PO queues and UseOneAsMany function.

Cheers!

Isuru

0 Kudos

Hello Fernando,

thank you for you time and help. I had a lock at your amazing blogs and tried a solution with remove context:

The queue from removecontext receives all input and then instead of commiting each value, it now collects them and removes the SUPPRESS values:

But Stefan mentioned to work with context but also with mapwithdefault and formatbyexample which I think is a more clean solution.

Thank you very much. You helped me a lot.

BR,

Andreas