Hello community,

here a tiny example how to use SAP HANA ABAP Source Search via PowerShell. After my question here, in the ABAP in Eclipse forum, I see how easy it is to use the ABAP Source Search from outside an SAP system. After the activation of the business function SRIS_SOURCE_SEARCH is it also possible with only one http get request to use it.

#-Begin-----------------------------------------------------------------

  $User = "BCUSER"
  $Password = Read-Host -Prompt "Passwort" -AsSecureString
  $Cred = New-Object System.Management.Automation.PSCredential($User, $Password)

  $System = "http://nsp.mysystem.de:8650/"
  $TextSearch = "sap/bc/adt/repository/informationsystem/textsearch"
  $SearchString = "?searchString=Record"
  $Params = "&searchFromIndex=1&searchToIndex=10"

  $RequestURI = $System + $TextSearch + $SearchString + $Params
  [XML]$SearchResult = Invoke-RestMethod -Uri $RequestURI -Credential $Cred -Method Get

  $Cnt = $SearchResult.textSearchResult.textSearchObjects.textSearchObject.Count
  For ($i = 0; $i -lt $Cnt; $i++ ) {
    $Obj = $SearchResult.textSearchResult.textSearchObjects.textSearchObject[$i]
    Write-Host $Obj.adtMainObject.description " - " $Obj.adtMainObject.name 
  }

#-End-------------------------------------------------------------------

In my example I search the word Record with a maximum of 10 hits.

ABAPSourceSearchPowerShell.jpg

Enjoy it.

Cheers
Stefan

To report this post you need to login first.

2 Comments

You must be Logged on to comment or reply to a post.

Leave a Reply