cancel
Showing results for 
Search instead for 
Did you mean: 

Want to Block Large IDoc at PI

Former Member
0 Kudos

I have a scenario where an ECC system sends IDocs to PI 7.0 and then they route to SAP MDM (MDM Adapter). At times, we have had an issue where large idocs cause import issues at MDM. We have (and continue to) looked into it on the MDM side, but I would also like to be able to block files larger than a certain filesize at the PI Receiver Determination. I was thinking I could condition there and send smaller files on, but have larger files route elsewhere.

I see that I can use "Context Objects" in the receiver determination condition, and SourceFileSize is one of the options. Problem is, the conditions only have operators EQ, NE, ~ and EX. There is not a ">" or "<". The XPath Expression field in the window where you select Context Object is also always grayed out.

Any suggestions?

Accepted Solutions (1)

Accepted Solutions (1)

former_member854360
Active Contributor
0 Kudos

Hi,

Instead of Creating Custom field and then cal culating file size in that field.

you can go with a simple approach.

Create XMLFILEPORT in ECC for that particular IDOC.

http://help.sap.com/saphelp_nw70/helpdata/en/3f/faa288bb7911d2897f0000e8216438/content.htm

Then pick up the IDOC XML by using File Adapter .

So it will be File to MDM Adapter scenario.

Then you can use enhanced receuiver determination to check the file size

You can go with enhanced receiver determination and using a mapping with dynamic configuration read the fileSize and then dynamically create the receiver determination.

If filesize<100 then create only receiver in mapping

Refe this blog

/people/venkataramanan.parameswaran/blog/2006/03/17/illustration-of-enhanced-receiver-determination--sp16

http://help.sap.com/saphelp_nw04/helpdata/en/43/a5f2066340332de10000000a11466f/content.htm

Former Member
0 Kudos

Is it impossible to do what I want without creating the file port? The customer's preference is to do nothing on the sender's ECC system.

I have been working on a solution based on your July 25 posting, but am at the point where I need to be able to get the filesize in my UDF and I have/prefer IDoc adapter on the source side. I can test this setup, but there is no option for setting the Adapter-Specific Message Attributes.

Former Member
0 Kudos

Try this approach

1) In your message mapping program , choose the root node of your IDOC in the source , select return as XML -> pass it as input to the length function(Text function) , the output of which will be the IDOC xml size in characters(read bytes).

2) If you choose to go with Enhanced Receiver determination option, do step 1 above in that mapping, and generate the service node with your MDM System name if the size is acceptable for MDM

3) if not generate the service node with a different system name or dont generate it in the mapping and handle it in the receiver determination(radio buttons that show up there to decide what to do with the message if no receiver found)

Thanks

Saravana

Former Member
0 Kudos

Hello Keith,

Just use a java mapping to perform the Enhanced Rcvr Determination Mapping. Just count the number of bytes in the input stream and use that to decide which receiver b.s to route the message to.

A sample code to calculate the size

public int getSize(InputStream input) throws IOException {

byte[] buffer = new byte[4096];

int counter = 0, n=0;

while (-1 != (n = input.read(buffer)))

counter += n;

return counter;

}

In you mapping just say

getZize(inStream) < Your defined value

MDM receiver BS

else

Dummy Server BS

The payload for each of the case could be used as a hard coded string.

Let me know if confused you more than helping you

Regards

Jai

Former Member
0 Kudos

Saravana,

Can you elaborate on how I "select return as XML" which is noted in your recommendation? When I map the root node to length, the resulting value is just null/0. I don't see "select return as XML" as a mapping function.

Thanks!

baskar_gopalakrishnan2
Active Contributor
0 Kudos

>Can you elaborate on how I "select return as XML" which is noted in your recommendation? When I map the root node to length, the resulting value is just null/0. I don't see "select return as XML" as a mapping function.

Your version is 7.0. Return as XML functionality is available in 7.1 onwards. Hope that helps.

Former Member
0 Kudos

Keith, my bad... the functionality i mentioned is available from 7.1 version. since you are in 7.0 , you may have to go for other options.

1) you could go with a Java mapping for enhanced receiver determination and calculate the idoc size in the java mapping from the inputstream.

2) you could write an RFC in your sender sap system that will read the EDID4 table and return the IDOC size. call this RFC using RFC lookup from your enhanced RD mapping and decide on what to do based on the size

3) XSLT mapping could be an option, well i have not much idea on that, but you may find helpful blogs on returning entire XML payload as a string.

4) An ugly way i can think of is , in your Enhanced RD mapping, if you know the segment which is going to repeat on and on and which in turn affects your target xml size , chk the count of the that segment(s) in your message mapping and if it goes beyond a threshold value , avoind sending it to MDM

Thanks

Saravana

Answers (3)

Answers (3)

former_member200962
Active Contributor
0 Kudos
I see that I can use "Context Objects" in the receiver determination condition, and SourceFileSize is one of the options.

If I am not wrong SourceFileSize is applicable only for File interfaces (File --> PI) and may not be valid for IDOC --> PI.

For IDOC --> PI one option would be the one explained by Ravi. Other would be do not generate the IDOC itself.

If business approves you can also ask the ECC developers to restrict the IDOC content to a fixed number of records (say 1000) which you think can be less than your required limit. So that you do not have to block anything in PI.

The XPath Expression field in the window where you select Context Object is also always grayed out.

You can either use XPath or Context Objects....moreover if you try using SourceFileSize in Xpath it wont have any meaning.

former_member854360
Active Contributor
0 Kudos

Hi ,

You can go with enhanced receiver determination and using a mapping with dynamic configuration read the fileSize and then dynamically create the receiver determination.

If filesize<100 then create only receiver in mapping

Refe this blog

/people/venkataramanan.parameswaran/blog/2006/03/17/illustration-of-enhanced-receiver-determination--sp16

http://help.sap.com/saphelp_nw04/helpdata/en/43/a5f2066340332de10000000a11466f/content.htm

former_member181962
Active Contributor
0 Kudos

Hi Keith,

As an alternative, you can create a custom segment (IDOC enhancement) to calculate the idoc size (in source side) and use that value in your receiver determination.

Best Regards,

Ravikanth Talagana