In current project, explored Directory API web service call to programmatically called in powershell script, query each configuration scenario, get each ID objects and it details, then output to text file. Automated and simplified! Here are the script coding, to be run in Powershell:

cls
function Format-XML ([xml]$xml, $indent=2)
{
    $StringWriter = New-Object System.IO.StringWriter
    $XmlWriter = New-Object System.XMl.XmlTextWriter $StringWriter
    $xmlWriter.Formatting = "indented"
    $xmlWriter.Indentation = $Indent
    $xml.WriteContentTo($XmlWriter)
    $XmlWriter.Flush()
    $StringWriter.Flush()
    Write-Output $StringWriter.ToString()
}
function SOAP2XML ()
{
    $uri = "http://" + $server + ":" + $port + $path
    $secpasswd = ConvertTo-SecureString $pass -AsPlainText -Force
    $credential = New-Object System.Management.Automation.PSCredential($user, $secpasswd)
    $xml = (Invoke-WebRequest -uri $uri -Method POST -ContentType "text/xml; charset=utf-8" -Credential $credential -Body $body).Content
    $xdoc = new-object System.Xml.XmlDocument
    $xdoc.LoadXml($xml)
    return $xdoc
}
$server = "<<Your PI Hostname/IP>>"
$port = "<<Your Port, e.g. 50000>>"
$user = "<<Your User ID>>"
$pass= "<<YOur Password>>"
#####
$path_ConfigurationScenarioInImplBean = "//ConfigurationScenarioInService/ConfigurationScenarioInImplBean"
$path_ReceiverDeterminationInImplBean = "//ReceiverDeterminationInService/ReceiverDeterminationInImplBean"
$path_InterfaceDeterminationInImplBean = "//InterfaceDeterminationInService/InterfaceDeterminationInImplBean"
$path_CommunicationChannelInImplBean = "//CommunicationChannelInService/CommunicationChannelInImplBean"
$path_SenderAgreementInImplBean = "//SenderAgreementInService/SenderAgreementInImplBean"
$path_ReceiverAgreementInImplBean = "//ReceiverAgreementInService/ReceiverAgreementInImplBean"
$body_ConfigurationScenarioQueryRequest = "<?xml version=`"1.0`" encoding=`"UTF-8`"?><SOAP-ENV:Envelope xmlns:xs=`"http://www.w3.org/2001/XMLSchema`" xmlns:SOAP-ENV=`"http://schemas.xmlsoap.org/soap/envelope/`" xmlns:xsi=`"http://www.w3.org/2001/XMLSchema-instance`"><SOAP-ENV:Body><yq1:ConfigurationScenarioQueryRequest xmlns:yq1='http://sap.com/xi/BASIS'></yq1:ConfigurationScenarioQueryRequest></SOAP-ENV:Body></SOAP-ENV:Envelope>"
$param_ConfigurationScenarioID = ""
$body_ConfigurationScenarioReadRequest = "<?xml version=`"1.0`" encoding=`"UTF-8`"?><SOAP-ENV:Envelope xmlns:xs=`"http://www.w3.org/2001/XMLSchema`" xmlns:SOAP-ENV=`"http://schemas.xmlsoap.org/soap/envelope/`" xmlns:xsi=`"http://www.w3.org/2001/XMLSchema-instance`"><SOAP-ENV:Body><yq1:ConfigurationScenarioReadRequest xmlns:yq1='http://sap.com/xi/BASIS'><ReadContext>User</ReadContext><ConfigurationScenarioID>" + $param_ConfigurationScenarioID + "</ConfigurationScenarioID></yq1:ConfigurationScenarioReadRequest></SOAP-ENV:Body></SOAP-ENV:Envelope>"
$param_SenderPartyID = ""
$param_SenderComponentID = ""
$param_InterfaceName = ""
$param_InterfaceNamespace = ""
$param_ReceiverPartyID = ""
$param_ReceiverComponentID = ""
$body_ReceiverDeterminationReadRequest = "<?xml version=`"1.0`" encoding=`"UTF-8`"?><SOAP-ENV:Envelope xmlns:xs=`"http://www.w3.org/2001/XMLSchema`" xmlns:SOAP-ENV=`"http://schemas.xmlsoap.org/soap/envelope/`" xmlns:xsi=`"http://www.w3.org/2001/XMLSchema-instance`"><SOAP-ENV:Body><yq1:ReceiverDeterminationReadRequest xmlns:yq1='http://sap.com/xi/BASIS'><ReadContext>User</ReadContext><ReceiverDeterminationID><SenderPartyID>" + $param_SenderPartyID + "</SenderPartyID><SenderComponentID>" + $param_SenderComponentID + "</SenderComponentID><InterfaceName>" + $param_InterfaceName + "</InterfaceName><InterfaceNamespace>" + $param_InterfaceNamespace + "</InterfaceNamespace><ReceiverPartyID>" + $param_ReceiverPartyID + "</ReceiverPartyID><ReceiverComponentID>" + $param_ReceiverComponentID + "</ReceiverComponentID></ReceiverDeterminationID></yq1:ReceiverDeterminationReadRequest></SOAP-ENV:Body></SOAP-ENV:Envelope>"
$body_InterfaceDeterminationReadRequest = "<?xml version=`"1.0`" encoding=`"UTF-8`"?><SOAP-ENV:Envelope xmlns:xs=`"http://www.w3.org/2001/XMLSchema`" xmlns:SOAP-ENV=`"http://schemas.xmlsoap.org/soap/envelope/`" xmlns:xsi=`"http://www.w3.org/2001/XMLSchema-instance`"><SOAP-ENV:Body><yq1:InterfaceDeterminationReadRequest xmlns:yq1='http://sap.com/xi/BASIS'><ReadContext>User</ReadContext><InterfaceDeterminationID><SenderPartyID>" + $param_SenderPartyID + "</SenderPartyID><SenderComponentID>" + $param_SenderComponentID + "</SenderComponentID><InterfaceName>" + $param_InterfaceName + "</InterfaceName><InterfaceNamespace>" + $param_InterfaceNamespace + "</InterfaceNamespace><ReceiverPartyID>" + $param_ReceiverPartyID + "</ReceiverPartyID><ReceiverComponentID>" + $param_ReceiverComponentID + "</ReceiverComponentID></InterfaceDeterminationID></yq1:InterfaceDeterminationReadRequest></SOAP-ENV:Body></SOAP-ENV:Envelope>"
$body_SenderAgreementReadRequest = "<?xml version=`"1.0`" encoding=`"UTF-8`"?><SOAP-ENV:Envelope xmlns:xs=`"http://www.w3.org/2001/XMLSchema`" xmlns:SOAP-ENV=`"http://schemas.xmlsoap.org/soap/envelope/`" xmlns:xsi=`"http://www.w3.org/2001/XMLSchema-instance`"><SOAP-ENV:Body><yq1:SenderAgreementReadRequest xmlns:yq1='http://sap.com/xi/BASIS'><ReadContext>User</ReadContext><SenderAgreementID><SenderPartyID>" + $param_SenderPartyID + "</SenderPartyID><SenderComponentID>" + $param_SenderComponentID + "</SenderComponentID><InterfaceName>" + $param_InterfaceName + "</InterfaceName><InterfaceNamespace>" + $param_InterfaceNamespace + "</InterfaceNamespace><ReceiverPartyID>" + $param_ReceiverPartyID + "</ReceiverPartyID><ReceiverComponentID>" + $param_ReceiverComponentID + "</ReceiverComponentID></SenderAgreementID></yq1:SenderAgreementReadRequest></SOAP-ENV:Body></SOAP-ENV:Envelope>"
$body_ReceiverAgreementReadRequest = "<?xml version=`"1.0`" encoding=`"UTF-8`"?><SOAP-ENV:Envelope xmlns:xs=`"http://www.w3.org/2001/XMLSchema`" xmlns:SOAP-ENV=`"http://schemas.xmlsoap.org/soap/envelope/`" xmlns:xsi=`"http://www.w3.org/2001/XMLSchema-instance`"><SOAP-ENV:Body><yq1:ReceiverAgreementReadRequest xmlns:yq1='http://sap.com/xi/BASIS'><ReadContext>User</ReadContext><ReceiverAgreementID><SenderPartyID>" + $param_SenderPartyID + "</SenderPartyID><SenderComponentID>" + $param_SenderComponentID + "</SenderComponentID><InterfaceName>" + $param_InterfaceName + "</InterfaceName><InterfaceNamespace>" + $param_InterfaceNamespace + "</InterfaceNamespace><ReceiverPartyID>" + $param_ReceiverPartyID + "</ReceiverPartyID><ReceiverComponentID>" + $param_ReceiverComponentID + "</ReceiverComponentID></ReceiverAgreementID></yq1:ReceiverAgreementReadRequest></SOAP-ENV:Body></SOAP-ENV:Envelope>"
$param_PartyID = ""
$param_ComponentID = ""
$param_ChannelID = ""
$body_CommunicationChannelReadRequest = "<?xml version=`"1.0`" encoding=`"UTF-8`"?><SOAP-ENV:Envelope xmlns:xs=`"http://www.w3.org/2001/XMLSchema`" xmlns:SOAP-ENV=`"http://schemas.xmlsoap.org/soap/envelope/`" xmlns:xsi=`"http://www.w3.org/2001/XMLSchema-instance`"><SOAP-ENV:Body><yq1:CommunicationChannelReadRequest xmlns:yq1='http://sap.com/xi/BASIS'><ReadContext>User</ReadContext><CommunicationChannelID><PartyID>" + $param_PartyID + "</PartyID><ComponentID>" + $param_ComponentID + "</ComponentID><ChannelID>" + $param_ChannelID + "</ChannelID></CommunicationChannelID></yq1:CommunicationChannelReadRequest></SOAP-ENV:Body></SOAP-ENV:Envelope>"
$path = $path_ConfigurationScenarioInImplBean
$body = $body_ConfigurationScenarioQueryRequest
$xdoc = new-object System.Xml.XmlDocument
$xdoc = SOAP2XML
$oConfigList = $xdoc.Envelope.Body.ConfigurationScenarioQueryResponse.ConfigurationScenarioID
foreach ($oConfigurationScenarioID in $oConfigList)
{
    $sb = New-Object System.Text.StringBuilder
    $sw = New-Object System.IO.StringWriter($sb)
    $line = ""
    $oConfigurationScenarioID
    $param_ConfigurationScenarioID = $oConfigurationScenarioID
    $body_ConfigurationScenarioReadRequest = "<?xml version=`"1.0`" encoding=`"UTF-8`"?><SOAP-ENV:Envelope xmlns:xs=`"http://www.w3.org/2001/XMLSchema`" xmlns:SOAP-ENV=`"http://schemas.xmlsoap.org/soap/envelope/`" xmlns:xsi=`"http://www.w3.org/2001/XMLSchema-instance`"><SOAP-ENV:Body><yq1:ConfigurationScenarioReadRequest xmlns:yq1='http://sap.com/xi/BASIS'><ReadContext>User</ReadContext><ConfigurationScenarioID>" + $param_ConfigurationScenarioID + "</ConfigurationScenarioID></yq1:ConfigurationScenarioReadRequest></SOAP-ENV:Body></SOAP-ENV:Envelope>"
    $path = $path_ConfigurationScenarioInImplBean
    $body = $body_ConfigurationScenarioReadRequest
    $xdoc = new-object System.Xml.XmlDocument
    $xdoc = SOAP2XML
    $oConfig = $xdoc.Envelope.Body.ConfigurationScenarioReadResponse.ConfigurationScenario
    $line = "ConfigurationScenarioID:"
    $sb.AppendLine($line)
    $line = "------------------------"
    $sb.AppendLine($line)
    $line = $oConfig.ConfigurationScenarioID
    $sb.AppendLine($line)
    $sb.AppendLine("")
    $sb.AppendLine("")
    $line = "BusinessSystem:"
    $sb.AppendLine($line)
    $line = "---------------"
    $sb.AppendLine($line)
    foreach ($o in $oConfig.BusinessSystem)
    {
        $line = $o.PartyID + " | " + $o.ComponentID
        $sb.AppendLine($line)
    }
    $sb.AppendLine("")
    $sb.AppendLine("")
    $line = "CommunicationChannel:"
    $sb.AppendLine($line)
    $line = "---------------------"
    $sb.AppendLine($line)
    foreach ($o in $oConfig.CommunicationChannel)
    {
        $param_PartyID = $o.PartyID
        $param_ComponentID = $o.ComponentID
        $param_ChannelID = $o.ChannelID
        $body_CommunicationChannelReadRequest = "<?xml version=`"1.0`" encoding=`"UTF-8`"?><SOAP-ENV:Envelope xmlns:xs=`"http://www.w3.org/2001/XMLSchema`" xmlns:SOAP-ENV=`"http://schemas.xmlsoap.org/soap/envelope/`" xmlns:xsi=`"http://www.w3.org/2001/XMLSchema-instance`"><SOAP-ENV:Body><yq1:CommunicationChannelReadRequest xmlns:yq1='http://sap.com/xi/BASIS'><ReadContext>User</ReadContext><CommunicationChannelID><PartyID>" + $param_PartyID + "</PartyID><ComponentID>" + $param_ComponentID + "</ComponentID><ChannelID>" + $param_ChannelID + "</ChannelID></CommunicationChannelID></yq1:CommunicationChannelReadRequest></SOAP-ENV:Body></SOAP-ENV:Envelope>"
        $path = $path_CommunicationChannelInImplBean
        $body = $body_CommunicationChannelReadRequest
        $xdoc = new-object System.Xml.XmlDocument
        $xdoc = SOAP2XML
        $oCC = $xdoc.Envelope.Body.CommunicationChannelReadResponse.CommunicationChannel
        $sb.AppendLine("")
        $line = $o.PartyID + " | " + $o.ComponentID + " | " + $o.ChannelID + " (Adapter Type = " + $oCC.AdapterMetadata.Name + ")"
        $sb.AppendLine($line)
        $sb.AppendLine("")
        $tblCC = @()
        foreach ($o in $oCC.AdapterSpecificAttribute)
        {
            $item = New-Object System.Object
            $item | Add-Member -MemberType NoteProperty -Name "Name" -Value $o.Name
            $item | Add-Member -MemberType NoteProperty -Name "Value" -Value $o.Value
            $tblCC += $item
        }
        $lines = $tblCC | Format-Table -AutoSize | Out-String
        foreach ($line in $lines -split "`r`n")
        {
            if($line.Trim() -ne "")
            {
                $temp = "    " + $line
                $sb.AppendLine($temp)
            }
        }
        $sb.AppendLine("")
        $tblCCParam = @()
        foreach ($o in $oCC.AdapterSpecificTableAttribute)
        {
            foreach($row in $o.ValueTableRow)
            {
                $item = New-Object System.Object
                $item | Add-Member -MemberType NoteProperty -Name "Name" -Value $row.ValueTableCell[0].Value
                $item | Add-Member -MemberType NoteProperty -Name "Value" -Value $row.ValueTableCell[1].Value
                $tblCCParam += $item
            }
        }
        $lines = $tblCCParam | Format-Table -AutoSize | Out-String
        foreach ($line in $lines -split "`r`n")
        {
            if($line.Trim() -ne "")
            {
                $temp = "    " + $line
                $sb.AppendLine($temp)
            }
        }
    }
    $sb.AppendLine("")
    $sb.AppendLine("")
    $line = "SenderAgreement:"
    $sb.AppendLine($line)
    $line = "----------------"
    $sb.AppendLine($line)
    foreach ($o in $oConfig.SenderAgreement)
    {
        $line = $o.SenderPartyID + " | " + $o.SenderComponentID + " | " + $o.InterfaceName + " | " + $o.InterfaceNamespace + " | " + $o.ReceiverPartyID + " | " + $o.ReceiverComponentID
        $sb.AppendLine($line)
        $param_SenderPartyID = $o.SenderPartyID
        $param_SenderComponentID = $o.SenderComponentID
        $param_InterfaceName = $o.InterfaceName
        $param_InterfaceNamespace = $o.InterfaceNamespace
        $param_ReceiverPartyID = $o.ReceiverPartyID
        $param_ReceiverComponentID = $o.ReceiverComponentID
        $body_SenderAgreementReadRequest = "<?xml version=`"1.0`" encoding=`"UTF-8`"?><SOAP-ENV:Envelope xmlns:xs=`"http://www.w3.org/2001/XMLSchema`" xmlns:SOAP-ENV=`"http://schemas.xmlsoap.org/soap/envelope/`" xmlns:xsi=`"http://www.w3.org/2001/XMLSchema-instance`"><SOAP-ENV:Body><yq1:SenderAgreementReadRequest xmlns:yq1='http://sap.com/xi/BASIS'><ReadContext>User</ReadContext><SenderAgreementID><SenderPartyID>" + $param_SenderPartyID + "</SenderPartyID><SenderComponentID>" + $param_SenderComponentID + "</SenderComponentID><InterfaceName>" + $param_InterfaceName + "</InterfaceName><InterfaceNamespace>" + $param_InterfaceNamespace + "</InterfaceNamespace><ReceiverPartyID>" + $param_ReceiverPartyID + "</ReceiverPartyID><ReceiverComponentID>" + $param_ReceiverComponentID + "</ReceiverComponentID></SenderAgreementID></yq1:SenderAgreementReadRequest></SOAP-ENV:Body></SOAP-ENV:Envelope>"
        $path = $path_SenderAgreementInImplBean
        $body = $body_SenderAgreementReadRequest
        $xdoc = new-object System.Xml.XmlDocument
        $xdoc = SOAP2XML
        $oSndD = $xdoc.Envelope.Body.SenderAgreementReadResponse.SenderAgreement
        $oSndD_CC = $oSndD.CommunicationChannel
        $line = $line = "    Sender Communication Channel = " + $oSndD_CC.PartyID + " | " + $oSndD_CC.ComponentID + " | " + $oSndD_CC.ChannelID
        $sb.AppendLine($line)
        $sb.AppendLine("")
    }
    $sb.AppendLine("")
    $sb.AppendLine("")
    $line = "ReceiverAgreement:"
    $sb.AppendLine($line)
    $line = "------------------"
    $sb.AppendLine($line)
    foreach ($o in $oConfig.ReceiverAgreement)
    {
        $line = $o.SenderPartyID + " | " + $o.SenderComponentID + " | " + $o.InterfaceName + " | " + $o.InterfaceNamespace + " | " + $o.ReceiverPartyID + " | " + $o.ReceiverComponentID
        $sb.AppendLine($line)
        $param_SenderPartyID = $o.SenderPartyID
        $param_SenderComponentID = $o.SenderComponentID
        $param_InterfaceName = $o.InterfaceName
        $param_InterfaceNamespace = $o.InterfaceNamespace
        $param_ReceiverPartyID = $o.ReceiverPartyID
        $param_ReceiverComponentID = $o.ReceiverComponentID
        $body_ReceiverAgreementReadRequest = "<?xml version=`"1.0`" encoding=`"UTF-8`"?><SOAP-ENV:Envelope xmlns:xs=`"http://www.w3.org/2001/XMLSchema`" xmlns:SOAP-ENV=`"http://schemas.xmlsoap.org/soap/envelope/`" xmlns:xsi=`"http://www.w3.org/2001/XMLSchema-instance`"><SOAP-ENV:Body><yq1:ReceiverAgreementReadRequest xmlns:yq1='http://sap.com/xi/BASIS'><ReadContext>User</ReadContext><ReceiverAgreementID><SenderPartyID>" + $param_SenderPartyID + "</SenderPartyID><SenderComponentID>" + $param_SenderComponentID + "</SenderComponentID><InterfaceName>" + $param_InterfaceName + "</InterfaceName><InterfaceNamespace>" + $param_InterfaceNamespace + "</InterfaceNamespace><ReceiverPartyID>" + $param_ReceiverPartyID + "</ReceiverPartyID><ReceiverComponentID>" + $param_ReceiverComponentID + "</ReceiverComponentID></ReceiverAgreementID></yq1:ReceiverAgreementReadRequest></SOAP-ENV:Body></SOAP-ENV:Envelope>"
        $path = $path_ReceiverAgreementInImplBean
        $body = $body_ReceiverAgreementReadRequest
        $xdoc = new-object System.Xml.XmlDocument
        $xdoc = SOAP2XML
        $oRecD = $xdoc.Envelope.Body.ReceiverAgreementReadResponse.ReceiverAgreement
        $oRecD_CC = $oRecD.CommunicationChannel
        $line = $line = "    Receiver Communication Channel = " + $oRecD_CC.PartyID + " | " + $oRecD_CC.ComponentID + " | " + $oRecD_CC.ChannelID
        $sb.AppendLine($line)
        $sb.AppendLine("")
    }
    $sb.AppendLine("")
    $sb.AppendLine("")
    $line = "ReceiverDetermination:"
    $sb.AppendLine($line)
    $line = "----------------------"
    $sb.AppendLine($line)
    foreach ($o in $oConfig.ReceiverDetermination)
    {
        $sb.AppendLine("")
        $line = $o.SenderPartyID + " | " + $o.SenderComponentID + " | " + $o.InterfaceName + " | " + $o.InterfaceNamespace + " | " + $o.ReceiverPartyID + " | " + $o.ReceiverComponentID
        $sb.AppendLine($line)
        $param_SenderPartyID = $o.SenderPartyID
        $param_SenderComponentID = $o.SenderComponentID
        $param_InterfaceName = $o.InterfaceName
        $param_InterfaceNamespace = $o.InterfaceNamespace
        $param_ReceiverPartyID = $o.ReceiverPartyID
        $param_ReceiverComponentID = $o.ReceiverComponentID
        $body_ReceiverDeterminationReadRequest = "<?xml version=`"1.0`" encoding=`"UTF-8`"?><SOAP-ENV:Envelope xmlns:xs=`"http://www.w3.org/2001/XMLSchema`" xmlns:SOAP-ENV=`"http://schemas.xmlsoap.org/soap/envelope/`" xmlns:xsi=`"http://www.w3.org/2001/XMLSchema-instance`"><SOAP-ENV:Body><yq1:ReceiverDeterminationReadRequest xmlns:yq1='http://sap.com/xi/BASIS'><ReadContext>User</ReadContext><ReceiverDeterminationID><SenderPartyID>" + $param_SenderPartyID + "</SenderPartyID><SenderComponentID>" + $param_SenderComponentID + "</SenderComponentID><InterfaceName>" + $param_InterfaceName + "</InterfaceName><InterfaceNamespace>" + $param_InterfaceNamespace + "</InterfaceNamespace><ReceiverPartyID>" + $param_ReceiverPartyID + "</ReceiverPartyID><ReceiverComponentID>" + $param_ReceiverComponentID + "</ReceiverComponentID></ReceiverDeterminationID></yq1:ReceiverDeterminationReadRequest></SOAP-ENV:Body></SOAP-ENV:Envelope>"
        $path = $path_ReceiverDeterminationInImplBean
        $body = $body_ReceiverDeterminationReadRequest
        $xdoc = new-object System.Xml.XmlDocument
        $xdoc = SOAP2XML
        $oRD = $xdoc.Envelope.Body.ReceiverDeterminationReadResponse.ReceiverDetermination
        $line = "    Rule"
        $sb.AppendLine($line)
        foreach ($oRD_Rule in $oRD.Rule)
        {
            $line = "        Condition"
            $sb.AppendLine($line)
            $oRD_AtomicConditionBlock_Count = 0
            foreach ($oRD_AtomicConditionBlock in $oRD_Rule.Condition.AtomicConditionBlock)
            {
                $oRD_AtomicConditionBlock_Count = $oRD_AtomicConditionBlock_Count + 1
                $oRD_AtomicCondition_Count = 0
                foreach ($oRD_AtomicCondition in $oRD_AtomicConditionBlock.AtomicCondition)
                {
                    $oRD_AtomicCondition_Count = $oRD_AtomicCondition_Count + 1
                    if($oRD_AtomicCondition_Count -eq 1)
                    {
                        $line = "            ("
                    }
                    else
                    {
                        $line = "             "
                    }
                    $line = $line + $oRD_AtomicCondition.LeftExtractor.Value + " " + $oRD_AtomicCondition.Operator  + " " + $oRD_AtomicCondition.RightExtractor.Value
                    if($oRD_AtomicCondition_Count -ne $oRD_AtomicConditionBlock.ChildNodes.Count)
                    {
                        $line = $line + " AND"
                    }
                    else
                    {
                        $line = $line + " )"
                    }
                    $sb.AppendLine($line)
                    $line = ""
                }
                if($oRD_AtomicConditionBlock_Count -ne $oRD_Rule.Condition.ChildNodes.Count)
                {
                    $line = "            OR"
                    $sb.AppendLine($line)
                }
            }
            $line = "        Receiver"
            $sb.AppendLine($line)
            $line = "            " + $oRD_Rule.Receiver.CommunicationComponent.Value
            $sb.AppendLine($line)
            $sb.AppendLine("")
        }
        $line = "    NoReceiverBehaviour = " + $oRD.NoReceiverBehaviour
        $sb.AppendLine($line)
    }
    $sb.AppendLine("")
    $sb.AppendLine("")
    $line = "InterfaceDetermination:"
    $sb.AppendLine($line)
    $line = "-----------------------"
    $sb.AppendLine($line)
    foreach ($o in $oConfig.InterfaceDetermination)
    {
        $sb.AppendLine("")
        $line = $o.SenderPartyID + " | " + $o.SenderComponentID + " | " + $o.InterfaceName + " | " + $o.InterfaceNamespace + " | " + $o.ReceiverPartyID + " | " + $o.ReceiverComponentID
        $sb.AppendLine($line)
        $param_SenderPartyID = $o.SenderPartyID
        $param_SenderComponentID = $o.SenderComponentID
        $param_InterfaceName = $o.InterfaceName
        $param_InterfaceNamespace = $o.InterfaceNamespace
        $param_ReceiverPartyID = $o.ReceiverPartyID
        $param_ReceiverComponentID = $o.ReceiverComponentID
        $body_InterfaceDeterminationReadRequest = "<?xml version=`"1.0`" encoding=`"UTF-8`"?><SOAP-ENV:Envelope xmlns:xs=`"http://www.w3.org/2001/XMLSchema`" xmlns:SOAP-ENV=`"http://schemas.xmlsoap.org/soap/envelope/`" xmlns:xsi=`"http://www.w3.org/2001/XMLSchema-instance`"><SOAP-ENV:Body><yq1:InterfaceDeterminationReadRequest xmlns:yq1='http://sap.com/xi/BASIS'><ReadContext>User</ReadContext><InterfaceDeterminationID><SenderPartyID>" + $param_SenderPartyID + "</SenderPartyID><SenderComponentID>" + $param_SenderComponentID + "</SenderComponentID><InterfaceName>" + $param_InterfaceName + "</InterfaceName><InterfaceNamespace>" + $param_InterfaceNamespace + "</InterfaceNamespace><ReceiverPartyID>" + $param_ReceiverPartyID + "</ReceiverPartyID><ReceiverComponentID>" + $param_ReceiverComponentID + "</ReceiverComponentID></InterfaceDeterminationID></yq1:InterfaceDeterminationReadRequest></SOAP-ENV:Body></SOAP-ENV:Envelope>"
        $path = $path_InterfaceDeterminationInImplBean
        $body = $body_InterfaceDeterminationReadRequest
        $xdoc = new-object System.Xml.XmlDocument
        $xdoc = SOAP2XML
        $oID = $xdoc.Envelope.Body.InterfaceDeterminationReadResponse.InterfaceDetermination
        $line = "    Rule"
        $sb.AppendLine($line)
        foreach ($oID_Rule in $oID.Rule)
        {
            $sb.AppendLine("")
            $line = "        Condition"
            $sb.AppendLine($line)
            $oID_AtomicConditionBlock_Count = 0
            foreach ($oID_AtomicConditionBlock in $oID_Rule.Condition.AtomicConditionBlock)
            {
                $oID_AtomicConditionBlock_Count = $oID_AtomicConditionBlock_Count + 1
                $oID_AtomicCondition_Count = 0
                foreach ($oID_AtomicCondition in $oID_AtomicConditionBlock.AtomicCondition)
                {
                    $oID_AtomicCondition_Count = $oID_AtomicCondition_Count + 1
                    if($oID_AtomicCondition_Count -eq 1)
                    {
                        $line = "            ("
                    }
                    else
                    {
                        $line = "             "
                    }
                    $line = $line + $oID_AtomicCondition.LeftExtractor.Value + " " + $oID_AtomicCondition.Operator  + " " + $oID_AtomicCondition.RightExtractor.Value
                    if($oID_AtomicCondition_Count -ne $oID_AtomicConditionBlock.ChildNodes.Count)
                    {
                        $line = $line + " AND"
                    }
                    else
                    {
                        $line = $line + " )"
                    }
                    $sb.AppendLine($line)
                    $line = ""
                }
                if($oID_AtomicConditionBlock_Count -ne $oID_Rule.Condition.ChildNodes.Count)
                {
                    $line = "            OR"
                    $sb.AppendLine($line)
                }
            }
            $line = "        Mapping   = " + $oID_Rule.Mapping.Name + " | " + $oID_Rule.Mapping.Namespace
            $sb.AppendLine($line)
            $line = "        Interface = " + $oID_Rule.Interface.Name + " | " + $oID_Rule.Interface.Namespace
            $sb.AppendLine($line)
            foreach ($oID_Channel in $oID_Rule.MappingParameters.Channel)
            {
                $line = "        Channel = " + $oID_Channel.Name + " | " + $oID_Channel.Value.ComponentID + " | " +  $oID_Channel.Value.ChannelID
                $sb.AppendLine($line)
            }
        }
    }
    $fullFilePath = "C:\documentation\" + $server + "\" + $oConfig.ConfigurationScenarioID + ".txt"
    $sb.ToString() | Out-File $fullFilePath
}

Reference and inspired by:
http://scn.sap.com/community/pi-and-soa-middleware/blog/2015/06/09/how-to-use-integration-directory-api
http://scn.sap.com/docs/DOC-64581
 

SAP PI Directory API Documentation using Powershell
Tagged on:         

Leave a Reply

Your email address will not be published.