Anda di halaman 1dari 7

TECHNICAL NOTE 59: Deleting Data Through Interface Manager

Last Modified: Area(s): Application(s): Release(s):

10 October 2002 EIM / Enterprise Integration Manager Siebel Sales Enterprise V5 (Siebel 99-Enterprise), V6 (Siebel 2000-Enterprise), Version 4, V7 (Enterprise), V5 (Siebel 99 -MidMarket), V6 (Siebel 2000MidMarket), V7 (MidMarket)

Latest release tested against: V7 (Enterprise)

Notice This technical note is also applicable to Siebel eBusiness Application, MidMarket Edition. Background Siebel eBusiness Application provides three mechanisms for deleting records through Enterprise Integration Manager (EIM). This technical note briefly covers these scenarios and then gives details of how to delete records that cannot be removed by directly utilizing these mechanisms. This document assumes a working knowledge of EIM and SQL statements. The example SQL statements provided in this technical note would change depending on which release is installed. Check the Interface Tables Reference Guide to determine which fields comprise the user key and the names of the required fields. Although Siebel 2000 and Siebel 7 continue to support the S_*_IF tables, the suggested interface tables are called EIM_*, example: EIM_CONTACT. In Siebel 7.5 all the _IF tables have been deactivated. Customer must use EIM_ table for all interface jobs. Siebel version 7 information: The new S_PARTY table introduced in Siebel version 7 has many implications on performing DELETE with EIM. For further information, please refer to the ALERT 0359: EIM EXPORT / DELETE functionality for S_PARTY based tables in Siebel version 70. Summary Through the EIM server module, Siebel eBusiness Application provides a powerful mechanism for two-way information exchange with other enterprise applications such as manufacturing, order entry, accounting, and customer service applications. The EIM provides full transaction control, including support for bulk import, export, delete, and merge operations through Siebel Interface tables. Of the available operations, deleting allows for the purging of data from the Siebel eBusiness Application tables. Three mechanisms are available for specifying which rows should be deleted: 1. Deleting all rows for a named table 2. Deleting data rows identified by user key values in the corresponding interface table

3. Deleting data rows identified by a WHERE-clause expression in the configuration file In method 3 mentioned above, the WHERE clause specifies one or more columns in the base table. For example, if all accounts that had not been modified since January 1, 1993 had to be deleted, then the following line would be used in the EIM configuration file to delete those accounts: delete matches = EIM_ACCOUNT, (last_upd < '1993-01-01') If method 3 is to be used, the columns must be available in the base table. There are two specific situations where the columns that are not in the base table for the delete processing may need to be specified. These are: 1. A column from a joined table representing a one-to-many relationship (normally represented in the Siebel eSales User Interface (UI) as a picklist) 2. A column from a joined table represented by a many-to-many relationship (normally represented in the Siebel eSales UI as a multi-value group) An example of each scenario would be: 1. The SIC codes for an account 2. The source or campaign associated with a specific contact (this is not exposed in the default configuration, but is given here as it is a good basis for an example that follows) These two scenarios cannot be solved by using method 3 indicated above, because users must look to the non-base tables to qualify the match (column NAME in S_INDUST for example 1 and column NAME in table S_SRC for example 2.). However, if the user keys of the records to be deleted could somehow be placed into the appropriate interface table then method 2 could be used to delete these records (remember that this method uses the records in the interface table to drive which base table records should be deleted). This technical note describes a method that allows for the deleting of rows that fall into either of the two categories. All example SQL statements have been written to run against an Oracle database. Approach 1 The steps to achieve the required results are as follows: 1. 2. 3. 4. Make sure that the appropriate interface table is empty. Export user key columns for all records in the base table into the interface table. Delete those records that do not match the criteria for deletion from the interface table. Perform the delete processing.

Step Details The following example explains how to delete all those accounts with a particular SIC code. 1. Make sure that the interface table is empty Although the interface table need not actually be empty, this step is included to highlight the behavior that any records left in the interface table before the delete step WILL be

deleted from the corresponding base table unless the batch numbers are modified accordingly to exclude them. 2. Export user key columns for the base table into the interface table. In this example, all of the user key columns for S_ORG_EXT are exported into EIM_ACCOUNT (if there is some way of reducing this list, given the columns that users can qualify against, then do so, otherwise export all rows). Export only the user key columns so that the size of the interface table is minimized. The configuration file for this process would look like: [Siebel Interface Manager] USER NAME = "SADMIN" PASSWORD = "SADMIN" PROCESS = Export All Accounts ; This process demonstrates exporting data into the Siebel ; account interface table. The if_row_batch_num ; is 1 for the rows to be exported. [Export All Accounts] TYPE = EXPORT BATCH = 1 TABLE = EIM_ACCOUNT ONLY BASE COLUMNS = S_ORG_EXT.NAME, S_ORG_EXT.LOC, S_ORG_EXT.BU_ID EXPORT ALL ROWS = TRUE 3. Delete from the interface table those accounts that do not match the criteria for deletion This step will clear from the interface table those rows that SHOULD NOT be deleted from the base table. In the example, accounts that do not have a specific SIC code are being removed form the interface table. If the SIC code is, for example, 10, then the following SQL statement would be used against EIM_CONTACT to remove these rows or accounts: DELETE FROM EIM_ACCOUNT // Delete accounts with no match WHERE ACCNT_NAME NOT IN (SELECT NAME // Get name, loc for accounts FROM S_ORG_EXT WHERE (ROW_ID IN (SELECT OU_ID FROM S_ORG_INDUST WHERE INDUST_ID IN (SELECT ROW_ID FROM S_INDUST WHERE SIC = '10')))) Note that in this example all accounts that have the specified SIC code are deleted, even if they also have other SIC codes. To keep those accounts that also had other SIC codes, the following SQL would be required:

DELETE FROM EIM_ACCOUNT // Delete accounts with no match WHERE ACCNT_NAME NOT IN (SELECT NAME // Get name, loc for accounts FROM S_ORG_EXT WHERE (ROW_ID IN (SELECT OU_ID FROM S_ORG_INDUST WHERE INDUST_ID IN (SELECT ROW_ID FROM S_INDUST WHERE SIC = '10'))) AND ROW_ID NOT IN (SELECT OU_ID FROM S_ORG_INDUST WHERE INDUST_ID IN (SELECT ROW_ID FROM S_INDUST WHERE SIC <> '10'))) Variations on the DELETE statement, which will remove from the interface table all those rows that are not to be deleted from the base table during delete processing, should, in general, be possible. 4. Perform the delete processing Now that the interface table contains the user key for those rows to be deleted, EIM can be used with the delete operation. In the example, the following configuration file contents would perform a delete of the required rows. This can be further extended to perform the delete in multiple phases or batches etc. Before running EIM, be sure to set the appropriate values for IF_ROW_STAT ('FOR_IMPORT') and IF_ROW_BATCH_NUM (100 in this example): [Siebel Interface Manager] USER NAME = "SADMIN" PASSWORD = "SADMIN" PROCESS = Delete Accounts With SIC ; This process demonstrates deleting data from the Siebel ; account table. The if_row_batch_num is 100 for the rows ; to be deleted. [Delete Accounts With SIC] TYPE = DELETE BATCH NUMBER = 100 TABLE = EIM_ACCOUNT DELETE ROWS = TRUE DELETE EXACT = TRUE

Approach 2 The second approach is to merge steps 1 and 2 from Approach 1. That is, the interface table is directly populated with the required row set to be deleted. In the example, the following SQL would populate the interface table EIM_ACCOUNT with those account user key that would need

to be deleted (in this example, delete all accounts with SIC code '10' and which have no other SIC code):

INSERT INTO EIM_ACCOUNT (PARTY_UID, PARTY_TYPE_CD, IF_ROW_STAT, IF_ROW_BATCH_NUM,S_PARTY.ROW_ID) SELECT S_PARTY.PARTY_UID, S_PARTY.PARTY_TYPE_CD, 'FOR_IMPORT', 100, S_PARTY.ROW_ID FROM S_PARTY, S_ORG_EXT WHERE S_PARTY.ROW_ID = S_ORG_EXT.PAR_ROW_ID AND (S_ORG_EXT.NAME) IN (SELECT NAME FROM S_ORG_EXT WHERE (ROW_ID IN (SELECT OU_ID FROM S_ORG_INDUST WHERE INDUST_ID IN (SELECT ROW_ID FROM S_INDUST WHERE SIC = '10'))) AND ROW_ID NOT IN (SELECT OU_ID FROM S_ORG_INDUST WHERE INDUST_ID IN (SELECT ROW_ID FROM S_INDUST WHERE SIC <> '10'))) The benefit of this approach is that it should, in general, require less system resources (example: database structures such as rollback segments and system resources such as CPU and disk I/O) to achieve the same result. Whenever deleting records using EIM, always take extra care because once the records are deleted they are removed from the Siebel database. Consider all steps that should be taken prior to the delete to allow for quick recovery should the delete be incorrect (example: backup, export etc.). Another Example As another example, if a user wanted to delete all contacts associated with a specific source (PC Expo 1996) for which no corresponding opportunity exists. That is, the contacts were originally loaded and associations made to the source. Upon completion of the campaign, all contacts for the campaign where no opportunity was generated are to be deleted. In this example, a contact can only be linked to one source. Use the second approach to populate the interface table (EIM_CONTACT) before running the delete process in Interface Manager. The SQL statements required to populate the interface table S_CONTACT_IF would be as follows:

INSERT INTO EIM_CONTACT

(PARTY_UID, PARTY_TYPE_CD, IF_ROW_STAT, IF_ROW_BATCH_NUM,ROW_ID) SELECT PERSON_UID, 'Person', 'FOR_IMPORT', 100, CON.ROW_ID FROM S_CONTACT CON, S_SRC SRC, S_ORG_EXT ORG WHERE CON.SRC_ID = SRC.ROW_ID AND ORG.ROW_ID = CON.PR_DEPT_OU_ID AND SRC.NAME = 'PC Expo 1996' AND CON.ROW_ID NOT IN (SELECT PER_ID FROM S_OPTY_CON CON, S_SRC SRC WHERE CON.SRC_ID = SRC.ROW_ID AND SRC.NAME = 'PC Expo 1996')

Notes: The interface table column ROW_ID has been set to the contact ROW_ID to make sure uniqueness (the field is a required field). The account name and location are also extracted so that the correct contact is deleted (the contact last name and first name is unique to an account location so be sure that the correct contact for the correct account or location is deleted).

The EIM configuration file is as follows: [Siebel Interface Manager] USER NAME = "SADMIN" PASSWORD = "SADMIN" PROCESS = Delete Contacts For Source ; This process demonstrates deleting data from the Siebel ; contact table. The if_row_batch_num is 100 for the rows ; to be deleted. [Delete Contacts For Source] TYPE = DELETE BATCH = 100 TABLE = EIM_CONTACT DELETE ROWS = TRUE DELETE EXACT = TRUE

Comments Generally, Siebel applications provide the columns required to qualify records for delete (or for that matter export) in the appropriate interface table. This alleviates the need to know both SQL statements and the Siebel eSales data model. However, the above technique shows how, through the use of SQL statements and a working knowledge of the Siebel eSales data model, users can define record sets that would not otherwise be possible. In general, always use the standard mechanisms within EIM for deleting records wherever possible. If the above technique is to be used, then make sure that an individual experienced in writing SQL statements that also has a working knowledge of the Siebel Sales Enterprise data model is involved (such as the local DBA, Siebel Technical Account Manager or Systems Integrator). If the SQL statements that defines the record set to be deleted is written incorrectly, and EIM is run to process the set, the records will be deleted and it will be very difficult to reverse the operation.

Also, the above SQL statements will work well for small data sets, but care should be taken in writing such SQL statements for large data sets where database and other system resources should be carefully considered.

Anda mungkin juga menyukai