cancel
Showing results for 
Search instead for 
Did you mean: 

XPATH to determine node name in condition of Interface determination

Former Member
0 Kudos

Hi,

does anybody out there know whether one can use a condition such as "name(/p1:Envelop/p1:Body/*)" to retrieve the name of the first element underneath the Body structure which is usually the payload. In the example below. I'd like to retrieve "ns0:BAPI_USER_GET_DETAIL" or just "BAPI_USER_GET_DETAIL" which I would like to than compare in my "=" condition.

<?xml version="1.0" encoding="iso-8859-1"?>

<sap:Envelope xmlns:sap="urn:sap-com:document:sap" version="1.0">

<sap:Header xmlns:rfcprop="urn:sap-com:document:sap:rfc:properties">

<saptr:From xmlns:saptr="urn:sap-com:document:sap:transport">BC1</saptr:From>

<saptr:To xmlns:saptr="urn:sap-com:document:sap:transport">BC2</saptr:To>

</sap:Header>

<sap:Body>

<ns0:BAPI_USER_GET_DETAIL xmlns:ns0="urn:sap-com:document:sap:rfc:functions">

<CACHE_RESULTS/>

<USERNAME>bauerd</USERNAME>

</ns0:BAPI_USER_GET_DETAIL>

</sap:Body>

</sap:Envelope>

I have a client that once to migrate his SAP BC interfaces to PI without having to change the sending application which is a CICS mainframe application. The mainframe application invokes various BAPI's by just passing in a different payload into the above envelope. The payload is always the request structure for the BAPI. The message is send synchronously to SAP BC which than calls the BAPI and returns the response to the caller, again in form of the above envelope and as payload the BAPI response structure.

To convert this to PI I have to be able to initiate different interface mappings depending on what BAPI is requested. This is pretty straight forward as there are no special mapping transformation taking place in SAP BC for both the BAPI request and response. However I need to determine what interface mapping to call depending on BAPI requested by the CICS application.

As said the customer does not want to change the sending application. The only part we are allowed to change is the URL which changes from SAP BC to the SAP PI Plain HTTP sender adapter. The post will always use the same outbound message interface. Therefore I can't use SAP PI's standard receiver determination. Using this adapter I will also be able to get access to the whole message envelope as outlined above.

I already got all of this working nicely with the exception that I can't determine what BAPI is requested and therefore what interface mapping I have to trigger in my interface determination.

Has anybody used a condition as above and if so how should it look like in the condition editor. The one outlined above does not seem to work. However it is also not failing in PI.

Also I don't want to change my approach for doing this. However if it is not possible to retrieve the node name using the xpath statement (as outlined above) in the condtion editor than I will have to look for a different approach to resolve this problem. Any suggestions would than be more than welcome.

.

Many thanks in advance.

Dieter

Accepted Solutions (1)

Accepted Solutions (1)

stefan_grube
Active Contributor
0 Kudos

If the structure is not too big, you can use:

//ns0:BAPI_USER_GET_DETAIL EX

otherwise take the full path:

/p1:Envelop/p1:Body/ns0:BAPI_USER_GET_DETAIL EX

The namespaces have to be declared.

Regards

Stefan

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Stefan,

that worked like a breeze straight away.

Thanks for your input.

By the way, your name sounds familiar. Have you been working in Australia.

Dieter