<?xml version="1.0" encoding="UTF-8"?>
<SapSetup Context="Init">
  <Product Guid="{DE9B41F9-B224-4b76-9E5D-367E8A19D796}" Name="SAP BI Shared" CmdLine="BI_SHARED" WkstaDb="SapBiWksta.xml" ProdVersion="143" Visible="FALSE"/>
  <Component Guid="{E773C20A-08A9-41a0-8DF3-8BFD1A26254E}" Name="$SapBiSetup" Version="121" Min_Compliant_Version="1" SysSize="97">
    <Action Type="File" Dst="%SapSetupDir%" Condition="1=0">
      <Src>%SAPsrcDir%\SapBiSetup.exe</Src>
    </Action>
    <Action Type="File" Dst="%SapSetupDir%\setup" Condition="1=0">
      <Src>%SAPsrcDir%\setup\SapBiSetup.cfg</Src>
    </Action>
  </Component>
  <Component Guid="{D90D6783-FA88-4578-B262-0B086F62ED1E}" Name="$SAPBI ARP" Version="1" Min_Compliant_Version="1">
    <Action Type="Registry" Dst="HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\SAPBI">
      <RegValue Name="DisplayName">SAP Business Explorer</RegValue>
      <RegValue Name="DisplayVersion">7.10</RegValue>
      <RegValue Name="DisplayIcon">&quot;%SapBiDestDir%\BI\BExAnalyzer.exe&quot;,0</RegValue>
      <RegValue Name="Publisher">SAP AG</RegValue>
      <RegValue Name="URLUpdateInfo">http://service.sap.com</RegValue>
      <RegValue Name="UninstallString">&quot;%SAPSetupDir%\setup\NwSapSetup.exe&quot; /product=&quot;SAPBI&quot; /uninstall</RegValue>
    </Action>
  </Component>
  <Component Guid="{4C6645DF-8834-4b72-A87C-D60CC929CFC0}" Name="$APOLLO Files" Version="128" Min_Compliant_Version="16" Size="50425">
    <Action Type="File" Dst="%CommonProgramFiles%\SAP Shared\BW">
      <Src>%SapSrcDir%\Bi\sapbexp.xla</Src>
      <Src>%SapSrcDir%\Bi\sapbexc710.xla</Src>
      <Src>%SapSrcDir%\BI\BExAnalyzer.xla</Src>
    </Action>
    <!-- force copy .xla on update and set read-only flag! -->
    <Action Type="Script" RunAt="Install">
      <Src>
		<![CDATA[
			Dim szSrcXLA(3)
			Dim szDstXLA(3)
			szSrcXLA(1) = NWEngine.Variables.ResolveString("%SAPsrcDir%\BI\BExAnalyzer.xla")
			szDstXLA(1) = NWEngine.Variables.ResolveString("%CommonProgramFiles%\SAP Shared\BW\BExAnalyzer.xla")
			szSrcXLA(2) = NWEngine.Variables.ResolveString("%SAPsrcDir%\BI\sapbexp.xla")
			szDstXLA(2) = NWEngine.Variables.ResolveString("%CommonProgramFiles%\SAP Shared\BW\sapbexp.xla")
			szSrcXLA(3) = NWEngine.Variables.ResolveString("%SAPsrcDir%\BI\sapbexc710.xla")
			szDstXLA(3) = NWEngine.Variables.ResolveString("%CommonProgramFiles%\SAP Shared\BW\sapbexc710.xla")
			For index = 1 To 3
				NwEngine.Context.Log.Write "Script action: Forcing copy step of " & szSrcXLA(index)
				If NwEngine.Shell.FileExist( szSrcXLA(index) ) Then
					If Not NwEngine.Shell.CopyFileEx (szSrcXLA(index), szDstXLA(index), vbTrue) Then
						NwEngine.Context.Log.WriteWarning "Script Action: Forcing copy step failed!"
					End If
					NwEngine.Context.Log.Write "Script Action: Trying to set Read-Only attribute for " & szDstXLA(index)
					Set fso = CreateObject("Scripting.FileSystemObject")
					If Not fso Is Nothing Then
						Set fsoXLA = fso.GetFile( szDstXLA(index) )
						If Not fsoXLA Is Nothing Then
							fsoXLA.attributes = fsoXLA.attributes + 1
							NwEngine.Context.Log.Write "Script Action: Read-Only Flag is set."
						Else
							NwEngine.Context.Log.WriteWarning "Script Action: fso.GetFile() failed."
						End If
					Else
						NwEngine.Context.Log.WriteWarning "Script Action: Scripting.FileSystemObject cannot be created."
					End If
				End If
			Next
		]]>
      </Src>
    </Action>
    <Action Type="File" Dst="%SapBiDestDir%\BI">
      <Src>%SapSrcDir%\BI\ADODB.dll</Src>
      <Src>%SapSrcDir%\BI\AxInterop.SHDocVw.dll</Src>
      <Src>%SapSrcDir%\BI\AxMAPCONTROLLib.dll</Src>
      <Src>%SapSrcDir%\BI\AxSAPCHARTCONTROLLib.dll</Src>
      <Src>%SapSrcDir%\BI\BExAddin.dll</Src>
      <Src>%SapSrcDir%\BI\BExAddin.tlb</Src>
      <Src>%SapSrcDir%\BI\BExAnalyzer.exe</Src>
      <Src>%SapSrcDir%\BI\BExApi.dll</Src>
      <Src>%SapSrcDir%\BI\BExApi.tlb</Src>
      <Src>%SapSrcDir%\BI\BExCAControls.dll</Src>
      <Src>%SapSrcDir%\BI\BExCommon.dll</Src>
      <Src>%SapSrcDir%\BI\BExCommunication.dll</Src>
      <Src>%SapSrcDir%\BI\BExCompression.dll</Src>
      <Src>%SapSrcDir%\BI\BExControls.dll</Src>
      <Src>%SapSrcDir%\BI\BExControls2.dll</Src>
      <Src>%SapSrcDir%\BI\BExDialogOpenSave.dll</Src>
      <Src>%SapSrcDir%\BI\BExDiffViewer.dll</Src>
      <Src>%SapSrcDir%\BI\BExFormulaParser.dll</Src>
      <Src>%SapSrcDir%\BI\BExGeneratedAll.dll</Src>
      <Src>%SapSrcDir%\BI\BExInstaller.exe</Src>
      <Src>%SapSrcDir%\BI\BExLocalFormularParser.dll</Src>
      <Src>%SapSrcDir%\BI\BExOpenSaveServices.dll</Src>
      <Src>%SapSrcDir%\BI\BExQueryDesigner.dll</Src>
      <Src>%SapSrcDir%\BI\BExQueryDesignerFormulaParser.dll</Src>
      <Src>%SapSrcDir%\BI\BExQueryDesignerStarter.exe.manifest</Src>
      <Src>%SapSrcDir%\BI\BExQueryDesignerStarter.exe</Src>
      <Src>%SapSrcDir%\BI\BExRDRuler.dll</Src>
      <Src>%SapSrcDir%\BI\BExReportDesigner.dll</Src>
      <Src>%SapSrcDir%\BI\BExReportDesignerStarter.exe.manifest</Src>
      <Src>%SapSrcDir%\BI\BExReportDesignerStarter.exe</Src>
      <Src>%SapSrcDir%\BI\BExSelectorAPI.dll</Src>
      <Src>%SapSrcDir%\BI\BExSelectorDialog.dll</Src>
      <Src>%SapSrcDir%\BI\BExSharedImageList.dll</Src>
      <Src>%SapSrcDir%\BI\BExThemes.dll</Src>
      <Src>%SapSrcDir%\BI\BExVarScreen.dll</Src>
      <Src>%SapSrcDir%\BI\BExVariableScreen.dll</Src>
      <Src>%SapSrcDir%\BI\BExXMLControls.dll</Src>
      <Src>%SapSrcDir%\BI\BExXMLServices.dll</Src>
      <Src>%SapSrcDir%\BI\dte.olb</Src>
      <Src>%SapSrcDir%\BI\EnvDTE.dll</Src>
      <Src>%SapSrcDir%\BI\Interop.MSXML2.dll</Src>
      <Src>%SapSrcDir%\BI\Interop.SAPLogonCtrl.dll</Src>
      <Src>%SapSrcDir%\BI\Interop.SHDocVw.dll</Src>
      <Src>%SapSrcDir%\BI\MAPCONTROLLib.dll</Src>
      <Src>%SapSrcDir%\BI\Microsoft.mshtml.dll</Src>
      <Src>%SapSrcDir%\BI\Microsoft.StdFormat.dll</Src>
      <Src>%SapSrcDir%\BI\Microsoft.VisualBasic.Compatibility.Data.dll</Src>
      <Src>%SapSrcDir%\BI\Microsoft.VisualBasic.Compatibility.dll</Src>
      <Src>%SapSrcDir%\BI\MSDATASRC.dll</Src>
      <Src>%SapSrcDir%\BI\MSO.DLL</Src>
      <Src>%SapSrcDir%\BI\msoutl.olb</Src>
      <Src>%SapSrcDir%\BI\Office.dll</Src>
      <Src>%SapSrcDir%\BI\SAP.Connector.dll</Src>
      <Src>%SapSrcDir%\BI\SAP.Connector.Rfc.dll</Src>
      <Src>%SapSrcDir%\BI\BExWebApplicationDesigner.exe.config</Src>
      <Src>%SapSrcDir%\BI\BExWebApplicationDesigner.exe.manifest</Src>
      <Src>%SapSrcDir%\BI\BExWebApplicationDesigner.exe</Src>
      <Src>%SapSrcDir%\BI\sapbwwmd.ocx</Src>
      <Src>%SapSrcDir%\BI\SAPCHARTCONTROLLib.dll</Src>
      <Src>%SapSrcDir%\BI\stdole.dll</Src>
      <Src>%SapSrcDir%\BI\Syncfusion.Core.dll</Src>
      <Src>%SapSrcDir%\BI\Syncfusion.Edit.Windows.dll</Src>
      <Src>%SapSrcDir%\BI\Syncfusion.Grid.Base.dll</Src>
      <Src>%SapSrcDir%\BI\Syncfusion.Grid.windows.dll</Src>
      <Src>%SapSrcDir%\BI\Syncfusion.Shared.Base.dll</Src>
      <Src>%SapSrcDir%\BI\Syncfusion.Shared.Windows.dll</Src>
      <Src>%SapSrcDir%\BI\Syncfusion.Tools.Base.dll</Src>
      <Src>%SapSrcDir%\BI\Syncfusion.Tools.Windows.dll</Src>
      <Src>%SapSrcDir%\BI\VSLangProj.dll</Src>
      <Src>%SapSrcDir%\BI\VSLangProj.tlb</Src>
    </Action>
    <Action Type="Registry" Dst="HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Compatibility32">
      <RegValue Name="bexanalyzer">0x40000000</RegValue>
      <RegValue Name="bexquerydesignerstarter">0x40000000</RegValue>
      <RegValue Name="bexreportdesignerstarter">0x40000000</RegValue>
      <RegValue Name="bexwebapplicationdesigner">0x40000000</RegValue>
    </Action>
    <Action Type="Script" RunAt="Install" Condition="%PRE_SAP_BI%=FULFILLED">
      <Src>
		<![CDATA[
					nErrorCode = 0
					NwEngine.Context.Log.Write "Script-action: Running BExInstaller.exe"
					szCmdLine = Chr(34) & NWEngine.Variables.ResolveString("%SapBiDestDir%\BI\BExInstaller.exe") & Chr(34) & " /q /n"
					nErrorCode = NwEngine.Shell.Execute ( szCmdLine, vbFalse)
					If nErrorCode = 0 Then
						NwEngine.Context.Log.Write( "Script-action: BExInstaller.exe succeeded. Return code = " & nErrorCode)
					Else
						NwEngine.Context.Log.WriteError( "Script-action: BExInstaller.exe failed. Error code = " & nErrorCode)
					End If
			]]>
      </Src>
    </Action>
    <Action Type="Script" RunAt="UnInstall" Condition="%PRE_SAP_BI%=FULFILLED">
      <Src>
		<![CDATA[
					nErrorCode = 0
					NwEngine.Context.Log.Write "Script-action: Running BExInstaller.exe during uninstallation."
					szCmdLine = Chr(34) & NWEngine.Variables.ResolveString("%SapBiDestDir%\BI\BExInstaller.exe") & Chr(34) & " /q /n /uninstall"
					nErrorCode = NwEngine.Shell.Execute ( szCmdLine, vbFalse)
					If nErrorCode = 0 Then
						NwEngine.Context.Log.Write( "Script-action: BExInstaller.exe succeeded. Return code = " & nErrorCode)
					Else
						NwEngine.Context.Log.WriteError( "Script-action: BExInstaller.exe failed. Error code = " & nErrorCode)
					End If
			]]>
      </Src>
    </Action>
    <Action description="Business Explorer Analyzer - Can Only Be Used in SAP NetWeaver 7.1" Type="Shortcut" Dst="ProgramFiles\Business Explorer\Analyzer">
      <Src>&quot;%SapBiDestDir%\BI\BExAnalyzer.exe&quot;</Src>
    </Action>
    <Action description="Business Explorer Query Designer - Can Only Be Used in SAP NetWeaver 7.1" Type="Shortcut" Dst="ProgramFiles\Business Explorer\Query Designer">
      <Src>&quot;%SapBiDestDir%\BI\BExQueryDesignerStarter.exe&quot;</Src>
    </Action>
    <Action description="Business Explorer Report Designer - Can Only Be Used in SAP NetWeaver 7.1" Type="Shortcut" Dst="ProgramFiles\Business Explorer\Report Designer">
      <Src>&quot;%SapBiDestDir%\BI\BExReportDesignerStarter.exe&quot;</Src>
    </Action>
  </Component>
  <Component Guid="{985A37A5-0D57-481c-8C89-C978945B2B1E}" Name="$WAD Files" Version="117" Min_Compliant_Version="5" Size="6930">
    <Action Type="File" Dst="%SapBiDestDir%\BI">
      <Src>%SapSrcDir%\BI\SAPWADMXHTML.dll</Src>
      <Src>%SapSrcDir%\BI\WADBackendServices.dll</Src>
      <Src>%SapSrcDir%\BI\WADBExData.dll</Src>
      <Src>%SapSrcDir%\BI\WADBISPParse.dll</Src>
      <Src>%SapSrcDir%\BI\WADChartControlHost.dll</Src>
      <Src>%SapSrcDir%\BI\wadconst.dll</Src>
      <Src>%SapSrcDir%\BI\WADControllib.dll</Src>
      <Src>%SapSrcDir%\BI\WADConversion.dll</Src>
      <Src>%SapSrcDir%\BI\WADHTMLEditHost.dll</Src>
      <Src>%SapSrcDir%\BI\WADHTMLEditing.dll</Src>
      <Src>%SapSrcDir%\BI\WADLowLevelServices.dll</Src>
      <Src>%SapSrcDir%\BI\WADMain.dll</Src>
      <Src>%SapSrcDir%\BI\WADMapControlHost.dll</Src>
      <Src>%SapSrcDir%\BI\WADMetadataGeneration.dll</Src>
      <Src>%SapSrcDir%\BI\WADMXHTML.dll</Src>
      <Src>%SapSrcDir%\BI\WADPageobjects.dll</Src>
      <Src>%SapSrcDir%\BI\WADPropertiesctl.dll</Src>
      <Src>%SapSrcDir%\BI\WADRDHost.dll</Src>
      <Src>%SapSrcDir%\BI\WADRDLoader.dll</Src>
      <Src>%SapSrcDir%\BI\WADRTFIntellisense.dll</Src>
      <Src>%SapSrcDir%\BI\WADRTFIsRegEx.dll</Src>
      <Src>%SapSrcDir%\BI\WADServices.dll</Src>
      <Src>%SapSrcDir%\BI\WADSnapShots.dll</Src>
      <Src>%SapSrcDir%\BI\WADStyleSheetServices.dll</Src>
      <Src>%SapSrcDir%\BI\WADTagLocator.dll</Src>
      <Src>%SapSrcDir%\BI\WADTokenSearch.dll</Src>
      <Src>%SapSrcDir%\BI\WADWizTemplate.dll</Src>
	</Action>
	<!-- Install this shortcut only if SAP GUI is available -->
	<Action Type="Script" RunAt="Install">
	  <Src>
		<![CDATA[
			strSapGuiExeOnClient = NwEngine.Variables.ResolveString("%SapFrontEndDir%\SapGui\SapGui.exe")
			If NwEngine.Shell.FileExist( strSapGuiExeOnClient ) Then
				NwEngine.Context.Log.Write "File exists: " & strSapGuiExeOnClient
				NWEngine.Variables.InsertVariable "bIsSapGuiInstalled", "True"
			Else
				NwEngine.Context.Log.Write "File not installed: " & strSapGuiExeOnClient
				NWEngine.Variables.InsertVariable "bIsSapGuiInstalled", "False"
			End If
			NwEngine.Variables.Persistent("bIsSapGuiInstalled") = vbFalse
		]]>
	  </Src>
	</Action>
    <Action Condition="%bIsSapGuiInstalled%=True" Description="Business Explorer Web Application Designer - Can Only Be Used in SAP NetWeaver 7.1" Type="Shortcut" Dst="ProgramFiles\Business Explorer\Web Application Designer">
      <Src>&quot;%SapBiDestDir%\BI\BExWebApplicationDesigner.exe&quot;</Src>
    </Action>
  </Component>
</SapSetup>
