

$btnGetIncludes_Click={
$Pair = $txtUser.Text + ":" + $txtPassword.Text
$encodedCreds = [System.Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes($pair))
$basicAuthValue = "Basic " + $encodedCreds
$header = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$header.Add("cache-control", "no-cache")
$header.Add("authorization", $basicAuthValue)
$header.Add("accept", "*/*")
$header.Add("accept-encoding", "gzip, deflate")
$header.Add("operation", "get")
$header.Add("inclpattern", $txtPattern.Text)
$RequestURI = "http://nsp.mysystem.de:8000/z_handle_inc?sap-client=001"
Try {
$Result = Invoke-WebRequest -Uri $RequestURI -Method Get `
-Headers $header -ErrorVariable RestError
} Catch {
} Finally {
If ($Result.StatusCode -eq 200) {
$JSON = $Result.Content | ConvertFrom-Json
ForEach ($Line in $JSON) {
$AllIncludes.Items.Add($Line)
}
} Else {
Write-Host $RequestURI $RestError $Result.StatusCode
}
}
} METHOD get_incl."-----------------------------------------------------
AUTHORITY-CHECK OBJECT 'S_DEVELOP'
ID 'ACTVT' FIELD '03'.
IF sy-subrc <> 0.
RAISE not_authorized.
ENDIF.
CHECK iv_inclpattern IS NOT INITIAL.
SELECT name FROM trdir INTO TABLE rt_incl WHERE name LIKE iv_inclpattern AND
subc = 'I' AND appl = SPACE.
ENDMETHOD.

You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 36 | |
| 33 | |
| 31 | |
| 28 | |
| 26 | |
| 26 | |
| 20 | |
| 15 | |
| 12 | |
| 11 |