Siebel - Extract Siebel File Attachment with SSEUNZIP or SSEMUZIP

To put it simple, please scroll down and see text highlighted in yellow.


How To Uncompress Files in the Siebel File System with the Original File Names? [ID 475845.1]
To BottomTo Bottom


Modified:15-Jan-2013Type:HOWTOStatus:PUBLISHEDPriority:2
In this Document
Goal
Fix
Workaround To Uncompress the File with the Original Name
Next Steps
Possible Errors and Suggestions
References

Applies to:

Siebel System Software - Version 6.0.0 [2832] and later
Information in this document applies to any platform.
Area(s):System Administration
Release(s):V5 (Siebel 99-Enterprise), V6 (Siebel 2000-Enterprise), V5 (Siebel 99 -MidMarket), V6 (Siebel 2000-MidMarket)
Database(s):All Supported Databases
App Server OS(s):All Supported Platforms
Latest release tested against:V7 (Enterprise)
Keywords:uncompress, original, file, system, fulcrum, index, expand, decompress, decompresses
This document was previously published as Siebel FAQ 1303.

Goal

How To Uncompress Files in the Siebel File System with the Original File Names?
Apply to: Siebel version 6.x.

Fix

The Siebel File System stores all file attachments in a compressed format with a proprietary naming convention. Neither Siebel InterActive nor the Fulcrum SearchServer can access or read these files directly. If either of these modules is used, maintain a copy of all file attachments in an uncompressed format in a separate directory accessible to SearchServer or Siebel InterActive. Because the Siebel client also stores file attachments in a compressed format, Fulcrum cannot be used for local searches on the client unless an uncompressed directory is also maintained there. For additional information about how remote users can use Fulcrum to search their local databases, review "Can Remote Users Use Fulcrum SearchServer Against Their Local Database? (Doc ID 475771.1)"
Siebel Systems provides two utilities to maintain the uncompressed directories. The utilities are located in the SIEBEL_HOME\siebsrvr\bin directory and they were designed only for Windows Operating System. Also they were designed for Fulcrum search and Siebel interactive and then they should not be used for anything else.
NOTE: For Siebel version 7.x, files in the Siebel file system will be accessed and indexed as part of the standard indexing operation. There is no need to uncompress these files as a separate process.Therefore the ssemuzip.exe and sseunzip.exe utilities are NO longer supported in Siebel version 7.x and above, and on this case you should consider the use of some supported methods as described in the document below:
Accessing File Attachments Through Siebel VB, Siebel eScript, and Siebel Object Interfaces (Doc ID 475513.1).
Name
Description
ssemuzip.exe
Uncompresses the files retaining some Siebel information like Table Name, Row ID and Revision ID in the file name.
sseunzip.exe
Uncompresses the files to the original file names
For example: When a file named "Timesheet.xls" is added to the Siebel File System, the Siebel application compresses the file and renames the file to the Table Name, Row Id and Revision Id and adds a .SAF as the extension. The compressed file name located in the Siebel File System directory would be in the format X.Y.Z.SAFfor example:
S_LIT_1-JH_1-3.SAF
Where
  • X is the Table Name, in this example, it has been set to the value S_LIT
  • Y is the Row Id, in this example, it has been set to the value 1-JH
  • Z is the Revision Id, in this example, it has been set to the value 1-3
After the ssemuzip.exe utility has uncompressed the files, the file names are modified and contain the following Siebel information. For the above example, the new file that is uncompressed by thessemuzip.exe utility is called:
C:\siebsrvr\BIN>ssemuzip c:\lit c:\siebfile\lit S_LIT
....
Processing c:\siebfile\lit...
Finished Processing files for table S_LIT in the Siebel File System
For the above example, the uncompressed file located in the c:\lit directory would be called:
Timesheet_S_LIT_1-JH_1-3.xls

Workaround To Uncompress the File with the Original Name
If you are interested in uncompressing the above file and maintaining the original file name, then apply the workaround that is documented below. NOTE: Examples have been provided for the Microsoft SQL Server and Oracle database as well as for the Windows platform. The workaround can also be applied to the DB2 database as well as the UNIX platforms.
The sseunzip.exe utility decompresses one file at a time and allows the uncompressed file to be renamed to the original name. After running the SQL queries, the results should be copied to a batch file that can be run in a DOS command window which will extract the files to a directory of choice with the original file names. The following SQL queries can be used as a guide. Run separate SQL queries for each table that contains documents. Use the values shown below as examples of what values to supply when you run the SQL queries in your own environment:
Siebel Server directory:           c:\sea\siebsrvr
Siebel File System directory:      c:\sea\siebfile\<subdirectory>
Export directory:                  c:\lit
Table Name:                        S_LIT
Microsoft SQL Server Database
  1. Use the Microsoft SQL Server Query Analyzer tool to run the SQL query below. Log in and change to the Siebel Database.
  2. Under the Tools > Option menu, choose the Results tab and do the following:
    1. Set the Default results target: Results to File...
    2. Uncheck the box: Print column headers (*)
  3. Under the Tools > Option menu, choose the Connection Properties tab and do the following:
    1. Check the box: Set nocount
  4. In a SQL query window, copy and paste the following select statement and change the bold values to match the values applicable to your Siebel environment:
    SELECT 'c:\sea\siebsrvr\bin\sseunzip.exe c:\sea\siebfile\lit\S_LIT_' + ROW_ID + '_' + FILE_REV_NUM + '.SAF "c:\lit\' + FILE_NAME + '.' + FILE_EXT + '"' FROM S_LITWHERE FILE_NAME IS NOT NULL
    NOTE: Make sure the single and double quotes are straight quotes when you run the SQL query in the Microsoft SQL Server Query Analyzer. The results from running the above query should be saved to a file called extract.bat on your file system.

Oracle Database
  1. Use the Oracle SQL*Plus tool to run the SQL query below. Log into the Siebel database instance.
  2. Under the Options > Environment menu, select the following:
    • Buffer Width = 300
    • Line Size = 300
    • Page Size = 50000
    • Heading = Off
  3. Copy and paste the following select statement and change the bold values to match the values applicable to your Siebel environment:
    SELECT 'c:\sea\siebsrvr\bin\sseunzip.exe c:\sea\siebfile\lit\S_LIT_' || ROW_ID || '_' || FILE_REV_NUM || '.SAF "c:\lit\' || FILE_NAME || '.' || FILE_EXT || '"' FROM S_LITWHERE FILE_NAME IS NOT NULL;
    NOTE: Make sure the single and double quotes are straight quotes when you run the SQL query in the Oracle SQL*Plus tool. The results from running the above query should be saved to a file called extract.bat on your file system.

Next Steps
The results file, extract.bat file, should look like the following:
c:\sea\siebsrvr\bin\sseunzip.exe c:\sea\siebfile\lit\S_LIT_1-JH_1-3.SAF "c:\lit\Timesheet.xls"
c:\sea\siebsrvr\bin\sseunzip.exe c:\sea\siebfile\lit\S_LIT_00-1ACQ6_0-4L.SAF "c:\lit\Narrative Service Top 10 Most Serviced Products.doc"
c:\sea\siebsrvr\bin\sseunzip.exe c:\sea\siebfile\lit\S_LIT_00-192ZO_0-VK.SAF "c:\lit\Product Line Briefing.doc"
c:\sea\siebsrvr\bin\sseunzip.exe c:\sea\siebfile\lit\S_LIT_0-AIXG_0-VL.SAF "c:\lit\Sales Pipeline Briefing.doc"
NOTE: Make sure there is a carriage return at the end of the file and remove any extraneous information like the select statement or number of records returned from the query. From a Microsoft DOS command window, run the extract.bat file.
c:\temp> extract.bat
NOTE: The extract batch file will call the sseunzip.exe utility once for each file. This means that if there are 500 files in a particular table, then the sseunzip.exe utility is called 500 times. This process can be time consuming since it has to uncompress all the files. The results from running the sseunzip.exe will look like the following:
c:\temp> extract.bat
c:\sea\siebsrvr\bin\sseunzip.exe c:\sea\siebfile\lit\S_LIT_1-JH_1-3.SAF "c:\lit\Timesheet.xls"
Unzipped 1 files.
c:\sea\siebsrvr\bin\sseunzip.exe c:\sea\siebfile\lit\S_LIT_00-1ACQ6_0-4L.SAF "c:\lit\Narrative Service Top 10 Most Serviced Products.doc"
Unzipped 1 files.
c:\sea\siebsrvr\bin\sseunzip.exe c:\sea\siebfile\lit\S_LIT_00-192ZO_0-VK.SAF "c:\lit\Product Line Briefing.doc"
Unzipped 1 files.
c:\sea\siebsrvr\bin\sseunzip.exe c:\sea\siebfile\lit\S_LIT_0-AIXG_0-VL.SAF "c:\lit\Sales Pipeline Briefing.doc"
Unzipped 1 files.







Possible Errors and Suggestions
Below is possible error that you might encounter when running the ssesunzip.exe utility and actions that you can take to try to resolve the error:
Error: Unable to open compressed file (d:\sea752_o\fs\att\S_SR_ATT_99-4GVR4_99-1DW2.SAF).
SSEUNZIP: Unable to open 'd:\sea752_o\fs\att\S_SR_ATT_99-4GVR4_99-1DW2.SAF'.
Please verify that you are using the correct version of SSEUNZIP.
Suggestion: Confirm that the file listed above does exist in the directory that is specified. In some cases, it could be that the file name is not specified correctly or the directory is not specified correctly. If there are problems with the file or directory, make the necessary corrections to the extract.bat file and rerun it again.
If the file does not exist, then edit the extract.bat file to remove the file reference. Another cause could be that the file does exist but is located in a different Siebel File System on a different Siebel Server. You will need to rerun the above SQL query and point to the other Siebel Server and the other Siebel File System.

References

NOTE:475513.1 - Accessing File Attachments Through Siebel VB, Siebel eScript, and Siebel Object Interfaces
NOTE:475771.1 - Can Remote Users Use Fulcrum SearchServer Against Their Local Database Accessing File Attachments Through Siebel VB, Siebel eScript, and Siebel Object Interfaces [ID 475513.1]
To BottomTo Bottom


Modified:03-Dec-2012Type:BULLETINStatus:PUBLISHEDPriority:2
There are no commentsComments (0)
Rate this document
Email link to this document
Open document in new window
Printable Page

In this Document
Purpose
Scope
Details
Creating a File in the Siebel File System
Getting a File from the Siebel File System
Updating a File in the Siebel File System
References

Applies to:

Siebel Tools - Version 7.0.4 [14068] and later
Information in this document applies to any platform.
Area(s):Siebel VB/eScript/COM
Release(s):V5 (Siebel 99-Enterprise), V6 (Siebel 2000-Enterprise), Version 4, V7 (Enterprise), V5 (Siebel 99-MidMarket), V6 (Siebel 2000-MidMarket), V7 (MidMarket), V7 (Professional), V8 (Enterprise), V8 (Professional)
Database(s):All Supported Databases
App Server OS(s):All Supported Platforms
Latest release tested against:V8 (Enterprise)
Keywords:File attachment, access, method, Siebel VB, Siebel BusObject Interfaces

Purpose

In Siebel applications, external files are stored in the Siebel file system. These files are compressed and stored using a specialized naming convention. Connected users have direct access to the Siebel file system. Mobile users have a local file system in the Siebel client installation directory. Copies of files retrieved from the Siebel file system during synchronization are stored in the local system for access while the client is offline. These files are accessible and readable by the Siebel client.
Siebel 7.x and Siebel 8.x.use the File System Manager for file attachments, therefore the file attaching operation is different from previous releases of Siebel applications. For the Siebel Web Client, the web browser will get the file from the user's machine and send it to the Siebel Web Server. The Siebel Web Server Extension will then send the file to a temp folder that can be accessed by the Siebel Server component. The Siebel Server then compresses the file and adds it to the Siebel File System. For more information on the File System Manager functionality, refer to Siebel Bookshelf > Siebel System Administration Guide > Siebel Server Infrastructure Administration > Administering the Siebel File System > About the Siebel File System.
Files in the Siebel file system can be manipulated programmatically using three invokable methods. This technical note documents the syntax and usage of these methods.
The supported methods are:
  • CreateFile
  • GetFile
  • PutFile
These methods are available for all business components whose Class = CSSBCFile.
In Siebel 7.x and onwards, the methods can be accessed from server script using Siebel VB or Siebel eScript, the COM Data Control, Java Data Bean, or the Mobile/Dedicated Web Client Automation Server. These methods cannot be accessed from browser script.
In Siebel 2000 and earlier, they can be accessed from Siebel VB, Siebel eScript, Siebel COM Automation Server, or the Siebel COM Data Server. The Siebel COM Automation Server and Siebel COM Data Server were known as the Siebel OLE Automation Server and Siebel OLE Data Server in Siebel 98.
In Siebel 7.x and onwards, these file attachment methods only mimic the last step of file attachment processing, which is compressing the file and putting it into the Siebel File System. There is no script mechanism that can handle the file transfer between the client and server. Therefore, if you are creating a new file attachment or updating an existing file attachment, you have to store the file in a location which is accessible to the Siebel Server, and the script will need to use a fully qualified path, including the machine name, to access the file.
NOTE: InvokeMethod is currently supported only for specific methods which have been documented in Siebel Bookshelf. Siebel Systems does not support calling other specialized methods using InvokeMethod.
For additional information on using these methods, and on other supported methods with InvokeMethod, refer to Siebel Bookshelf > Siebel Object Interfaces Reference > Interfaces Reference > Business Component Methods > InvokeMethod Method.
NOTE: The sample scripts provided are intended only to illustrate use of these methods, not to provide complete implementation-ready functionality. You will need to modify the code for your specific business requirements and test the code carefully before applying on a production environment. Siebel Systems also recommends reviewing Doc ID 477766.1 (Siebel Scripting Best Practices), for general scripting best practices, including recommendations for error handling.

Scope

This document is informational and intended for any user.

Details


Creating a File in the Siebel File System
To create a file in the Siebel file system from an external source, use the invokable method CreateFile. Before calling CreateFile, make sure that a new business component record has been created using the NewRecord method for the business component.
CreateFile Method and Arguments
CreateFile srcFilePath, keyFieldName, keepLink > RetValue
CreateFile has the following arguments:
  1. SrcFilePath. This is the fully qualified path of the file being used as the source. The file should be accessible to the machine which is running the script, as follows:
    • In Siebel 7.x and onwards, using the Siebel Web Client, the file must be accessible to the Siebel Server.
    • In Siebel 6 and earlier, or in the Siebel 7 Mobile or Dedicated Web client, the file must be accessible to the client which is running the script.
    NOTE: If the file is not located on the Siebel Server machine, it may be necessary to map the IP address of the machine where the file is located, as follows:
    1. On the Siebel Server machine, in the Windows desktop, right mouse click on My Computer, select Map Network Drive.
    2. Select a drive, for instance, drive k:, and map it to the file's machine IP Address such as \\172.20.23.46\d.
    3. If your code is in Siebel VB, refer to your file as k:\testfile.txt. In eScript, you would refer to your file as k:\\testfile.txt.
  2. KeyFieldName. This is the name of the field in the business component that contains the File Name.
    1. For example, in the Account Attachment business component, the field name is AccntFileName.
    2. To determine the correct field name, check in Siebel Tools for the Business Component > Field object. The field whose name includes "FileName" should be used.
  3. KeepLink. This applies only to URLs. The value should be "Y" or "N" depending on whether a link to the file is stored as an attachment instead of the actual file.
    NOTE: If you want to add a URL to an attachment business component, it is not required to use the CreateFile method. Instead, after creating a new record, the script can add the URL string directly to the file name field using the BusComp.SetFieldValue method.


CreateFile has the following return value:
  • RetValue. "Success" or "Error" depending on whether or not the operation succeeded.
CreateFile Example Using Siebel VB
Dim RetValue as String
Dim fileBC as BusComp
'Instantiate fileBC as the appropriate attachment buscomp
fileBC.NewRecord NewAfter
RetValue = fileBC.InvokeMethod ("CreateFile", "c:\Demo\Image.bmp", "AccntFileName", "Y")
fileBC.WriteRecord
CreateFile Example Using Siebel eScript
var RetValue;
var fileBC;
//Instantiate fileBC as the appropriate attachment buscomp
fileBC.NewRecord(NewAfter);
RetValue = fileBC.InvokeMethod ("CreateFile", "C:\\Demo\\Image.bmp", "AccntFileName", "Y");
fileBC.WriteRecord();
NOTE: When using InvokeMethod in eScript, do not attempt to pass an array of arguments. Instead, pass each argument separately.
CreateFile Example Using COM Interfaces
Dim errCode as Integer
Dim Args(2) as String
Dim RetValue as String
Dim fileBC as BusComp
'Instantiate fileBC as the appropriate attachment buscomp
Args(0) = "C:\Demo\Image.bmp"
Args(1) = "AccntFileName"
Args(2) = "Y"
fileBC.NewRecord NewAfter, errCode
RetValue = fileBC.InvokeMethod ("CreateFile", Args, errCode)
fileBC.WriteRecord

Getting a File from the Siebel File System
To get a file from the Siebel file system, use the invokable method GetFile. Before invoking GetFile, your script should query for the desired record in the attachment buscomp.
The file will be placed in the following location, depending upon the Siebel application version you are running and the client on which the script is invoked:
  • Siebel 7.x and onwards, using the Siebel Web Client: the file will be placed in the temp directory on the Siebel Server machine.
  • Siebel 7.x and onwards, using Siebel Dedicated or Mobile Web Client: the file will be placed in the temp directory on the user's local machine.
  • Siebel 6 and earlier: the file will be placed in the temp directory on the user's local machine.
If you need to open the file after retrieving it from the Siebel file system, you would need to use a function such as CreateObject in Siebel VB; however, you would need to know which application to use to open the file. For more information on the CreateObject method, refer to Siebel Bookshelf > Siebel VB Language Reference > VB Language Reference > CreateObject Function.  For information regarding creating a COM object in eScript, refer to Siebel eScript Language Reference > Siebel eScript Commands > The Global Object > COMCreateObject() Method.
GetFile Method and Arguments
GetFile keyFieldName > RetValue
GetFile has one argument: KeyFieldName. This is the name of the field in the business component that contains the file name.
  • For example, in the Account Attachment business component, the field name is AccntFileName.
  • To determine the correct field name, check in Siebel Tools for the Business Component > Field object. Use the field whose name includes "FileName".
GetFile has a return value of RetValue. This is a string containing one of the following:
  • If the operation succeeded, RetValue is "Success, <outFilePath>". OutFilePath is the fully qualified path of the file.
  • If the operation failed, RetValue is "Error".
GetFile Example Using Siebel VB
Dim RetValue as String
Dim fileBC as BusComp
'Instantiate fileBC as the appropriate attachment buscomp
'Query for the desired attachment record
RetValue = fileBC.InvokeMethod ("GetFile", "AccntFileName")
GetFile Example Using Siebel eScript
var RetValue;
var fileBC;
//Instantiate fileBC as the appropriate attachment buscomp
//Query for the desired attachment record
var RetValue = fileBC.InvokeMethod("GetFile", "AccntFileName");
Example using COM Interfaces
Dim errCode as Integer
Dim Args as String
Dim RetValue as String
Dim fileBC as BusComp
'Instantiate fileBC as the appropriate attachment buscomp
'Query for the desired attachment record
Args = "AccntFileName"
RetValue = fileBC.InvokeMethod ("GetFile", Args, errCode)

Updating a File in the Siebel File System
To update a file in the Siebel file system with a newer version of the file, use the invokable method PutFile. Before invoking PutFile, your script should query for the desired record in the attachment buscomp.
PutFile Method and Arguments
PutFile srcFilePath, keyFieldName > RetValue
PutFile has the following arguments:
  1. SrcFilePath. This is the fully qualified path of the newer version of the file. The file should be accessible to the machine which is running the script:
    1. In Siebel 7.x Web Client and onwards, the file must be accessible to the Siebel Server.
    2. In Siebel 6 and earlier, or in the Siebel 7.x Mobile or Dedicated Web client and onwards, the file must be accessible to the client which is running the script.
  2. KeyFieldName. This is the name of the field in the business component that contains the file name.
    1. For example, in the Account Attachment business component, the field name is AccntFileName.
    2. To determine the correct field name, check in Siebel Tools for the Business Component > Field object. The field whose name includes "FileName" should be used.
PutFile has the following return value:
  • RetValue. "Success" or "Error" depending on whether or not the operation succeeded.
PutFile Example Using Siebel VB
Dim RetValue as String
Dim fileBC as BusComp
'Instantiate fileBC to the appropriate attachment buscomp
'Query for the desired attachment record to be updated
RetValue = fileBC.InvokeMethod "PutFile", "c:\Demo\Image.bmp", "AccntFileName"
fileBC.WriteRecord
PutFile Example Using Siebel eScript
var RetValue;
var fileBC;
//Instantiate fileBC to the appropriate attachment buscomp
//Query for the desired attachment record to be updated
RetValue = fileBC.InvokeMethod("PutFile", "c:\\Demo\\Image.bmp", "AccntFileName");
fileBC.WriteRecord();
PutFile Example Using COM Interfaces
Dim errCode as Integer
Dim Args(1) as String
Dim RetValue as String
Dim fileBC as BusComp
'Instantiate fileBC to the appropriate attachment buscomp
'Query for the desired attachment record to be updated
Args(0) = "C:\Demo\Image.bmp"
Args(1) = "AccntFileName"
RetValue = fileBC.InvokeMethod ("PutFile", Args, errCode)
fileBC.WriteRecord

Attachment 475513.1:1














































































Comments

Popular Posts