Skip to main content

CRM: BPATH- sorting

Submitted by Stefan Barsuhn on

If you want to sort on your BPATH statement, the explanatory article by SAP provides an example that starts from the root node. So if you want to  sort a subnode (say to return the standard phone number (irrespective if it's mobile or landline), do it as follows:

BuilStandardAddressRel/BuilStandardAddressPhoneRel/~*[!STD_NO:DT,*]/@CALLER_NO

Explanation:

  • @CALLER_NO would normally go directly after BuilStandardAddressPhoneRel - so the sort part is like an inserted substructure
  • ~* acts as a dynamic "result data type" specification
  • ! indicates that we want to sort
  • STD_NO is the field we're sorting on (standard number indicator)
  • DT means descending sort (D means descending, A means ascending, T means "sort as text", ",*" indicates stable sorting, i.e. if two entries in the source set have the same key, their order remains unchanged) 

Tags