Quantcast
Channel: Scripting Languages
Viewing all articles
Browse latest Browse all 68

How To Use SAP HANA ABAP Source Search via PowerShell

$
0
0

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


Viewing all articles
Browse latest Browse all 68

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>