<?xml version="1.0" encoding="UTF-8"?>
<SapSetup Context="Init">
  <Product Guid="{40F73A4A-DECE-407f-BC56-86C236CE71D4}" Name="BW Common" CmdLine="BW_COMMON" WkstaDb="SapBwCommonWksta.xml" ProdVersion="138" Visible="FALSE"/>
  <Component Guid="{9659D3C1-3C75-4230-BB86-DA170E4C6381}" Name="$SAP BEX XLA" Version="32" Min_Compliant_Version="14" Size="2374">
    <!-- This registry key points to the location of files used by bw350 and bi710: "sapbex.xla", "sapbex0.xla",... -->
    <Action Type="Registry" Dst="HKCR\SAP.BusinessExplorer.Analyzer\path">
      <RegValue>%CommonProgramFiles%\SAP Shared\BW</RegValue>
    </Action>
    <Action Type="File" Dst="%CommonProgramFiles%\SAP Shared\BW">
      <Src>%SAPsrcDir%\Bw\sapbex.xla</Src>
    </Action>
    <Action Type="File" Dst="%CommonProgramFiles%\SAP Shared\BW">
      <Src>%SAPsrcDir%\Bw\sapbex0.xla</Src>
      <Src>%SAPsrcDir%\Bw\sapbexs.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%\BW\sapbex.xla")
			szDstXLA(1) = NWEngine.Variables.ResolveString("%CommonProgramFiles%\SAP Shared\BW\sapbex.xla")
			szSrcXLA(2) = NWEngine.Variables.ResolveString("%SAPsrcDir%\BW\sapbex0.xla")
			szDstXLA(2) = NWEngine.Variables.ResolveString("%CommonProgramFiles%\SAP Shared\BW\sapbex0.xla")
			szSrcXLA(3) = NWEngine.Variables.ResolveString("%SAPsrcDir%\BW\sapbexs.xla")
			szDstXLA(3) = NWEngine.Variables.ResolveString("%CommonProgramFiles%\SAP Shared\BW\sapbexs.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>
  </Component>
  <Component Guid="{E92A7287-4EA3-43e3-85D5-66EC32D338F4}" Name="$OLE Files" Version="182" Min_Compliant_Version="18" Size="7972">
    <Action Type="File" Dst="%CommonProgramFiles%\SAP Shared\BW\OleOlap">
      <Src>%SapSrcDir%\BW\oleolap\mdxpars.dll</Src>
      <Src>%SapSrcDir%\BW\oleolap\mdrmdlg.dll</Src>
      <Src>%SapSrcDir%\BW\oleolap\saprfc.ini</Src>
      <Src>%SapSrcDir%\BW\oleolap\librfc32u.dll</Src>
      <Src>%SapSrcDir%\BW\oleolap\mdrmsap.dll</Src>
      <Src>%SapSrcDir%\BW\oleolap\scerrlkp.dll</Src>
    </Action>
  </Component>
</SapSetup>
