cancel
Showing results for 
Search instead for 
Did you mean: 

BPath: Filter by multiple criteria

arne_husemann
Explorer
0 Kudos

Hello,

today I tried to implement some logic using the BPath feature available with CRM 7 EhP 1.

As far as I know there is the possibility to apply some filter criteria, which are considered during evaluation.

The BPath query I used looked something like:

 ./MyRel[@ATTR1="foo"]/*$

This query could be evaluated without problems. However if more than two filter criteria were supplied the evaluation fails, e.g.

 ./MyRel[(@ATTR1="foo")|(@ATTR1="foo2")|(@ATTR1="foo3")|]/*$

The statement above throws an exception of type CX_WCF_BPATH_PARSING_ERROR.

It would be intresting to know what limitations regarding the filter functions exist.

Best Regards,

Arne

Edited by: Arne Husemann on Mar 22, 2011 10:25 PM

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Hello everybody,

thanks for the interest in BPath.

There is actally a lot of functionality included which is not (yet) used, guess I have to work on some articles in the future.

But getting back to the actual problem. The reason the first attempt is failing (even without the trailing '|') is that BPath does not support operations with more then 2 operators due to the parser construction. From functionality point of view this is no limitation since all operations can be encapsulated with brackets, but of course it is slightly more cumbersome in your case.

This means the code should work with:

./MyRel[((@ATTR1="foo")|(@ATTR1="foo2"))|(@ATTR1="foo3")]/*$

Best regards from Walldorf, Juergen

arne_husemann
Explorer
0 Kudos

Hello Jürgen,

thank you for the helpful reply. I tried it the suggested way today, everything works fine.

Best Regards,

Arne

Answers (1)

Answers (1)

CarstenKasper
Active Contributor
0 Kudos

Hi Arne,

interesting question. Never had the chance to try BPath myself as our CRM7 system is still not upgraded.

I read about BPath in the book CRM Web Client (ISBN: 978-1592293896). In chapter 5.8 there is a short introduction on BPath. If you do not have your copy yet I can check this evening. Just drop me a mail.

As far as I know there is no other publicly available documentation released by now.

Checking the CRM7 EHP1 system here, I can see that no one has used any BPath in SAP standard development.

On the technical side you could formulate your BPath and start debugging class CL_WCF_BPATH_PARSER. You might get a hang of the syntax to use. Remember to check CSS first to get all SAP Notes into the system. BPath is new and ought to be buggy

In the book it is mentioned that BPath is similar to XPath. Concerning your problem it might be a good idea to check the XPath documentation or tutorials that are readily available on the net.

./MyRel[@ATTR1="foo"][@ATTR1="foo2"]/*$

This should return a table containing all fields of the entities that have ATTR1 = foo and ATTR2 = foo. At least in XPath.

Concerning the OR query you tried to model it could be something like:

./MyRel[@ATTR1="foo" | @ATTR1="foo2"]/*$

cheers Carsten

@Arne: Frag mal im TamTamY. Da laufen einige Leute rum, die evtl. schon mal das Problem gehabt haben könnten.

CarstenKasper
Active Contributor
0 Kudos

Found some example that says it should look like this:

./MyRel[(@ATTR1="foo")|(@ATTR1="foo2")]/*$

It is quite like your first post, without the trailing pipe in the OR. Found it in class CL_AXT_RULE_SERVICES. There is a local test class that got BPath in it. Seems to be more or less the only place in the system, except for BOL core, where BPath is used.

cheers Carsten

Edited by: Carsten Kasper on Mar 30, 2011 6:54 PM

arne_husemann
Explorer
0 Kudos

Hi Carsten,

thank you for the reasearch done on this topic.You are right the trailing pipe has to be left out.

I tried it out again, but was not able to apply more than 2 filters using the BPath approach.

Regards,

Arne