Sql loader Customer Interface for dummies

63
1 Oracle’s SQL*LOADER and Oracle’s CUSTOMER INTERFACE for DUMMIES © 2002 George R Lewycky keywords: oracle, financials, receivables, customer interface, sql*loader, sqlldr, customer data Email: [email protected] www : http://georgenet.net/oracle Introduction and Overview This document will illustrate step by step how to use both the SQL*Loader and Interface data to load customer data for Receivables and other financial products which use Customers. With Oracle’s poor documentation and tech support and how they force you into using their consultants projects on a tight budget such a basic task can become an expensive time consuming task. I suffered for months trying to load my legacy customer data into Oracle Financials – AR and after all the research and suggestions I stuck with using SQL*Loader to load the data into the Oracle tables. Only to learn later on that Oracle “requires” other fields, values, settings in order for the interface to port the data from the interface table into the real table(s) which are used by Oracle’s Accounts Receivable. Oracle’s Customer Interface imports and validates current and/or historical customer information from other systems into Receivables. Once customer information is imported into the system, you can use Customer Interface menu option to import additional data for that customer, such as additional contacts or addresses, and to update existing information. You can also manually update and add new information using the Customer windows. The RA_CUSTOMERS_INTERFACE_ALL table is one of the Customer Interface tables that Oracle Receivables uses to import customer, address, profiles, and site information. Receivables uses this customer information to create records in the RA_CUSTOMERS, RA_ADDRESSES_ALL, RA_CUSTOMER_RELATIONSHIPS_ALL, and RA_SITE_USES_ALL tables. The interface then deletes all records from the table(s) after all of your customer data is successfully imported.

description

Sql loader Customer Interface for dummies.pdf

Transcript of Sql loader Customer Interface for dummies

Page 1: Sql loader Customer Interface for dummies

1

Oracle’s SQL*LOADER and

Oracle’s CUSTOMER INTERFACE

for DUMMIES

© 2002 George R Lewycky

keywords: oracle, financials, receivables, customer interface, sql*loader, sqlldr, customer data

Email: [email protected]

www : http://georgenet.net/oracle

Introduction and Overview

This document will illustrate step by step how to use both the SQL*Loader and

Interface data to load customer data for Receivables and other financial products which use Customers.

With Oracle’s poor documentation and tech support and how they force you into using their consultants projects on a tight budget such a basic task can become an

expensive time consuming task. I suffered for months trying to load my legacy customer data into Oracle Financials

– AR and after all the research and suggestions I stuck with using SQL*Loader to load the data into the Oracle tables. Only to learn later on that Oracle “requires”

other fields, values, settings in order for the interface to port the data from the interface table into the real table(s) which are used by Oracle’s Accounts

Receivable. Oracle’s Customer Interface imports and validates current and/or historical

customer information from other systems into Receivables.

Once customer information is imported into the system, you can use Customer Interface menu option to import additional data for that customer, such as additional contacts or addresses, and to update existing information. You can also

manually update and add new information using the Customer windows.

The RA_CUSTOMERS_INTERFACE_ALL table is one of the Customer Interface tables that Oracle Receivables uses to import customer, address, profiles, and site information. Receivables uses this customer information to create records in the

RA_CUSTOMERS, RA_ADDRESSES_ALL, RA_CUSTOMER_RELATIONSHIPS_ALL, and RA_SITE_USES_ALL tables.

The interface then deletes all records from the table(s) after all of your customer data is successfully imported.

Page 2: Sql loader Customer Interface for dummies

2

Customer Interface also ensures that records marked for insertions are unique and that the updates exist. The same applies to the updates which must pre-exist.

Page 3: Sql loader Customer Interface for dummies

3

Table of Contents

Introduction and Overview

What is needed, Preliminary Set Up and Special SQL functions Postal Code, Address Validation

Automatic Customer and Site Numbering

Default Profile Class & Profile Class Amounts How to acquire the valid values for Country Codes

Quickcodes: Customer Category, Class, Type, Site Use Code

Creating a duplicate TABLE of an existing Table

Copying the data from one TABLE to another

DELETE ALL ROWS (RECORDS) FROM THE TABLE

How to execute SQL*Loader

Errors and tips SQL*Loader-625: Multibyte character error in control file.

Truncating trailing spaces from the Name

Validating record inserted using SQL*Plus

Customer Interface tables and their destination table(s)

Creating Data and Control files for SQL*LOADER

Other Tips and Procedures Useful Excel macro to create custom delimiter

Creating a copy of an existing table to test with Comma Delimited a SQL statement to extract data

Data tips Cleaning up your customer file

(removing old, redundant data) Transform all data into uppercase

Remove special characters such as “ and , else extracts, etc. Will become troublesome

Page 4: Sql loader Customer Interface for dummies

4

Customer Interface

What it does

Limitations Reporting Error Handling

Setup values

Page 5: Sql loader Customer Interface for dummies

5

Creating a duplicate TABLE of an existing Table

Copying the data from one TABLE to another

DELETE ALL ROWS (RECORDS) FROM THE TABLE

SQL> select territory_code||','||nls_territory from fnd_territories

2 order by nls_territory;

TERRITORY_CODE||','||NLS_TERRITOR

---------------------------------

DZ,ALGERIA

US,AMERICA

AU,AUSTRALIA

AT,AUSTRIA

BH,BAHRAIN

BD,BANGLADESH

BE,BELGIUM

BR,BRAZIL

BG,BULGARIA

CA,CANADA

CN,CHINA

RU,CIS

HR,CROATIA

CY,CYPRUS

CZ,CZECH REPUBLIC

Page 6: Sql loader Customer Interface for dummies

6

WHAT IS NEEDED and SETTING UP

The following is needed on the PC you are working on:

1. SQL*PLUS

2. SQLLDR.EXE (DOS program on the Server machine)

3. .ctl file containing the SQL*LOADER code 4. files containing data which matches the fields in SQL*Loader

Try to use NOTEPAD or WORKPAD as your editor for these files.

NOTE: keep the sqlldr.exe or sqlload.exe (dos program) and the data and control (.ctl) files all

in the same directory to simplify locating and updating files and reading errors, etc.

Copy the dos program from the server box.

Page 7: Sql loader Customer Interface for dummies

7

SETUP ���� SYSTEM ���� SYSTEM OPTIONS ���� TAX

1. Postal Code range from 00000 – 99999-9999 or

from 00000 – ZZZZZ-ZZZZ (if international) 2.Address Validation set to: NO VALIDATION

If you don’t turn off address validation you will be compounded with these messages in the error

report for each customer record. Oracle should just default to address validation to OFF.

address reference has 2 different countries

address reference has 2 different addr1 values

address reference has 2 different cities

address reference has 2 different postal codes

address reference has 2 different states

address reference has 2 identical site use codes

address reference has 2 different customers

Page 8: Sql loader Customer Interface for dummies

8

SETUP ���� SYSTEM ���� SYSTEM OPTIONS ���� TRANS AND CUSTOMER

1. CHECK the box AUTOMATIC CUSTOMER NUMBERING

2. CHECK the box AUTO SITE NUMBERING

Page 9: Sql loader Customer Interface for dummies

9

CUSTOMERS ���� PROFILE CLASSES

Page 10: Sql loader Customer Interface for dummies

10

Using the Profile Class DEFAULT as shown below populate the Following fields with the values shown:

� Payment Terms - 30 Net � Days in Period - 30

NOTE: the box at the top right identifies “DEFAULT” as the

profile to be used for Interface process

Page 11: Sql loader Customer Interface for dummies

11

Now click on the “Profile Class Amounts” tab and in the first empty box under the

Currency heading choose your desired currency from the pop up list.

Page 12: Sql loader Customer Interface for dummies

12

How to acquire the valid values for Country Codes

LOAD DATA

INFILE 'cust_jan13b.txt'

replace INTO TABLE RA_CUSTOMERS_INTERFACE_ALL

FIELDS TERMINATED BY '","'

(

AGENCY_SKIP FILLER,

CUST_SKIP FILLER,

ORIG_SYSTEM_CUSTOMER_REF,CUSTOMER_NAME,ADDRESS1,

ADDRESS2,CITY,STATE,

POSTAL_CODE,COUNTRY,INSERT_UPDATE_FLAG,

LAST_UPDATED_BY,

LAST_UPDATE_DATE,

CREATED_BY,CREATION_DATE,CUSTOMER_CATEGORY_CODE,

CUSTOMER_CLASS_CODE,

CUSTOMER_STATUS,

CUST_SKIP2 FILLER,

CUST_NUMBER FILLER,

ORIG_SYSTEM_ADDRESS_REF,

PRIMARY_SITE_USE_FLAG,SITE_USE_CODE,

CUSTOMER_TYPE

)

Use this SQL code to derive Oracle’s country codes you must use in your COUNTRY

column shown above.

select territory_code,nls_territory from fnd_territories

order by nls_territory SQL> / TE NLS_TERRITORY -- ------------------------------ DZ ALGERIA US AMERICA AU AUSTRALIA AT AUSTRIA BH BAHRAIN BD BANGLADESH BE BELGIUM BR BRAZIL BG BULGARIA CA CANADA CN CHINA ……… ……… ………

Page 13: Sql loader Customer Interface for dummies

13

Creating a duplicate TABLE of an existing Table This isn’t copying the data or entire database but rather making an exact copy of a table’s structure to test a load or copy the data into. create table <newtablename> as select * from <source or original tablename>;

Example: SQL> create table temp_cust_int AS Select * from ra_customers_interface;

Copying the data from one TABLE to another insert into <main table> select * from <temporary table>

DELETE ALL ROWS (RECORDS) FROM THE TABLE

SQL> SQL> delete from temp_cust_int; 221 rows deleted. SQL> commit 2 ; Commit complete.

Page 14: Sql loader Customer Interface for dummies

14

Validate the table by using the DESCription command shown below

Page 15: Sql loader Customer Interface for dummies

15

Page 16: Sql loader Customer Interface for dummies

16

Click the FLASHLIGHT ICON on the upper right corner and then a pop-up box appears. Type the word customer in front of the “%” to perform a string search for all the customer related variables as shown below.

Page 17: Sql loader Customer Interface for dummies

17

SQL> / CREATED_BY LOOKUP_TYPE LOOKUP_CODE ---------- ------------------------------ ------------------------------ 1013 CUSTOMER_CATEGORY BOE 1013 CUSTOMER_CATEGORY CON ED 1013 CUSTOMER_CATEGORY CON ED & LEGAL 1013 CUSTOMER_CATEGORY CON ED-LEGAL 1013 CUSTOMER_CATEGORY CONTRACTOR 1 CUSTOMER_CATEGORY CUSTOMER 1013 CUSTOMER_CATEGORY DDC 1013 CUSTOMER_CATEGORY DEP-LEGAL 1013 CUSTOMER_CATEGORY DEVELOPER 1013 CUSTOMER_CATEGORY DOT 1013 CUSTOMER_CATEGORY DOT-LEGAL CREATED_BY LOOKUP_TYPE LOOKUP_CODE ---------- ------------------------------ ------------------------------ 1013 CUSTOMER_CATEGORY FARE MEDIA 1013 CUSTOMER_CATEGORY FARE MEDIA-OTHER 1013 CUSTOMER_CATEGORY LEGAL 1013 CUSTOMER_CATEGORY LIB-FARE MEDIA 1013 CUSTOMER_CATEGORY LIRR-FARE MEDIA 1013 CUSTOMER_CATEGORY MNRR-FARE MEDIA 1013 CUSTOMER_CATEGORY MTA METRO-NORTH LOCK. 1013 CUSTOMER_CATEGORY MTA-B&T-OTHER

Page 18: Sql loader Customer Interface for dummies

18

1013 CUSTOMER_CATEGORY MTA-HDQ-LOCK 1013 CUSTOMER_CATEGORY MTA-HDQ-OTHER 1013 CUSTOMER_CATEGORY MTA-HDQ-RENT & CONCESS CREATED_BY LOOKUP_TYPE LOOKUP_CODE ---------- ------------------------------ ------------------------------ 1013 CUSTOMER_CATEGORY MTA-LIB-LOCK. 1013 CUSTOMER_CATEGORY MTA-LIB-OTHER 1013 CUSTOMER_CATEGORY MTA-LIRR-FARE MEDIA 1013 CUSTOMER_CATEGORY MTA-LIRR-LOCK 1013 CUSTOMER_CATEGORY MTA-LIRR-OTHER 1013 CUSTOMER_CATEGORY NYC DDC 1013 CUSTOMER_CATEGORY NYC DEP 1013 CUSTOMER_CATEGORY NYC DEP-LEGAL 1013 CUSTOMER_CATEGORY NYC DOT 1013 CUSTOMER_CATEGORY NYS-DOT 1013 CUSTOMER_CATEGORY OTHER CREATED_BY LOOKUP_TYPE LOOKUP_CODE ---------- ------------------------------ ------------------------------ 1013 CUSTOMER_CATEGORY OTHER-CON EDISON LEGAL 1013 CUSTOMER_CATEGORY OTHER-LEGAL 1013 CUSTOMER_CATEGORY PARATRANSIT 1013 CUSTOMER_CATEGORY PARKS 1013 CUSTOMER_CATEGORY POLICE 1 CUSTOMER_CATEGORY PROSPECT 1013 CUSTOMER_CATEGORY SCRAP SALES 1 CUSTOMER_OR_VENDOR BOTH 1 CUSTOMER_OR_VENDOR CUSTOMER 1 CUSTOMER_OR_VENDOR VENDOR 1 CUSTOMER_PROSPECT_CODE CUSTOMER 1 CUSTOMER_PROSPECT_CODE NEITHER 1 CUSTOMER_PROSPECT_CODE PROSPECT 1 CUSTOMER_RANK 1 CREATED_BY LOOKUP_TYPE LOOKUP_CODE ---------- ------------------------------ ------------------------------ 1 CUSTOMER_RANK 2 1 CUSTOMER_RANK 3 1 CUSTOMER_RANK 4 1 CUSTOMER_RANK 5 1 CUSTOMER_STATUS A 1 CUSTOMER_STATUS I 1 CUSTOMER_STATUS X 1 CUSTOMER_STATUS A 1 CUSTOMER_STATUS I 1 CUSTOMER_TYPE I 1 CUSTOMER_TYPE R 1 CUSTOMER_TYPE SPONSOR 1 CUSTOMER_TYPE STUDENT 109 rows selected. select lookup_type,lookup_code,end_date_active from fnd_lookup_values_vl where (lookup_type between 'CUSTOMER_' and 'CUSTOMER_X') order by lookup_type, end_date_active

Page 19: Sql loader Customer Interface for dummies

19

SQL> ED Wrote file afiedt.buf select created_by,lookup_type,lookup_code from fnd_lookup_values_vl where lookup_type between 'CUSTOMER' and 'CUSTOMER_' SQL> / CREATED_BY LOOKUP_TYPE LOOKUP_CODE ---------- ------------------------------ ----------------------------- 1013 CUSTOMER CLASS MTA 1013 CUSTOMER CLASS NYC 1013 CUSTOMER CLASS OTHER 1 CUSTOMER CLASS PUBLIC SECTOR COMPANIES

Page 20: Sql loader Customer Interface for dummies

20

LOOKUP_TYPE LOOKUP_CODE ------------------------------ --------------------------- SITE_USE_CODE ACK SITE_USE_CODE BILL_TO SITE_USE_CODE BOL SITE_USE_CODE CM SITE_USE_CODE DELIVER_TO SITE_USE_CODE DRAWEE SITE_USE_CODE DUN SITE_USE_CODE INV SITE_USE_CODE LEGAL SITE_USE_CODE MARKET SITE_USE_CODE SHIP_TO LOOKUP_TYPE LOOKUP_CODE ------------------------------ --------------------------- SITE_USE_CODE SOLD_TO SITE_USE_CODE STMTS 13 rows selected. SQL> ED Wrote file afiedt.buf 1 select lookup_type,lookup_code from ar_lookups 2* where lookup_type='SITE_USE_CODE' SQL>

Page 21: Sql loader Customer Interface for dummies

21

If you are loading Contact information (phone number and contact person) via the Customer Interface you will need to “ADD” TELEPHONE_TYPE to AR_LOOKUPS and add codes such as VOICE and FAX which correspond to the required data in the RA_CONTACT_PHONES_INT_ALL table as shown below in the sample record and sqlldr

code

"1","2377","12377","I","CORNELIUS","SIGETY","212","410-8789","27-Jun-03","-1","27-Jun-03","-1","CUST","5000","CUST5000","PHONE","PHONE5000","CONT","CONT5000","VOICE

LOAD DATA INFILE 'phone0603.txt' insert INTO TABLE RA_CONTACT_PHONES_INT_ALL FIELDS TERMINATED BY '","' (AGENCY_SKIP FILLER, CUST_SKIP FILLER, ORIG_SYSTEM_CUSTOMER_REF, INSERT_UPDATE_FLAG, CONTACT_FIRST_NAME, CONTACT_LAST_NAME, TELEPHONE_AREA_CODE, TELEPHONE, LAST_UPDATE_DATE, LAST_UPDATED_BY, CREATION_DATE, CREATED_BY, CUST_SKIP1 FILLER, CUST_SKIP2 FILLER, ORIG_SYSTEM_ADDRESS_REF, CUST_SKIP3 FILLER, ORIG_SYSTEM_TELEPHONE_REF, TELEPHONE_TYPE)

Page 22: Sql loader Customer Interface for dummies

22

How to execute SQL*LOADER

Run your MS-DOS prompt using the Command Prompt as shown below:

You cannot run this DOS program through the START ���� RUN method!!!!!

Page 23: Sql loader Customer Interface for dummies

23

Create a single directory, which contains the following:

1. sqlldr.exe you might need to COPY it from the SERVER box

NOTE: You need SQL*PLUS installed and configured on your machine or simply

Run from the server box

2. all your data files delimited and formatted for SQL*LOADER

filename must match the filenames listed in the .CTL code run below

Try to create a delimeter such as “,”

Example.

“First Name”,”Last Name”,”Phone”,”

using a comma might not be unique or sufficient for your data. I’ve seen

some people using “]” also

3. all your SQL*LOADER code to load the data files into the interface tables

NOTE: all code must end in .CTL

4. SQL*Plus

Page 24: Sql loader Customer Interface for dummies

24

Page 25: Sql loader Customer Interface for dummies

25

Beware of this Error

SQL*Loader-625: Multibyte character error in control file SQL*Loader: Release 8.1.7.0.0 - Production on Thu May 2 10:07:31 2002 (c) Copyright 2000 Oracle Corporation. All rights reserved.

SQL*Loader-625: Multibyte character error in control file.

LOAD DATA INFILE 'C:\MY SQL\cust_apr30.txt’ you might need to fully re-type this line, don’t ask me why

Re-typing the line seems to fix the problem and load data

Page 26: Sql loader Customer Interface for dummies

26

Enter SQL*PLUS and validate the record count and perform a

commit transaction:

The following is needed on the PC you are working on:

5. SQL*PLUS

6. SQLLDR.EXE (DOS program on the Server machine)

Click on the ICON to start SQL PLUS or run through your START menu

Shortcut to Sqlplusw.lnk

In this example enter the following in lowercase:

Username apps

Password apps Host string vis Vision db or the name of your instance

NOTE: this matches the “sqlldr” screen print shown below:

apps/apps@vis is all one word!!!!

sqlldr apps/apps@vis control=loadint6

Page 27: Sql loader Customer Interface for dummies

27

after the sql loader is finished, start sql*plus and then enter commit; as shown below; (this is so that the Transaction is finalized)

then validate the record count as shown below:

the commands you enter are in BOLD

Oracle8i Enterprise Edition Release 8.1.7.1.1 - Production

With the Partitioning option

JServer Release 8.1.7.1.1 - Production

SQL> commit;

Commit complete.

SQL> select count(*) from ra_customers_interface_all;

COUNT(*)

----------

1

1* select count(*) from RA_CUSTOMER_PROFILES_INTERFACE

SQL> /

COUNT(*)

----------

2

SQL>

Page 28: Sql loader Customer Interface for dummies

28

Truncating trailing spaces from Customer Name

If your upload file has fixed length fields and particularly the NAME field has trailing spaces

you will need to REMOVE these trailing spaces BEFORE you run the interface otherwise

searching customers will encounter problems.

Example: “ABC Co” is not the same as “ABC Co “

1. Log into SQL*PLUS

2. run the following SQL code

update ra_customers_interface_all

set customer_name=rtrim(customer_name);

and then

COMMIT;

NOTE: If you have to do this after the Customer Interface took place use this SQL code

update hz_parties

set party_name=rtrim(party_name);

and then

COMMIT;

Example of fixed Length DATA:

9306","BILL CLINTON ","106 CRAZY AVE "," "," 9307","NY CITY TRANSIT ","107 CRAZY AVE "," "," 9308","LARRY ELLISONS YACHT ","108 CRAZY AVE "," "," 9309","MAD SCIENTIST YADA 9309","109 CRAZY AVE "," ","

NOTE: THESE FIXED FILES ARE MUCH EASIER TO CREATE and READ

Example of variable Length DATA: 9306","BILL CLINTON","106 CRAZY AVE",""," 9307","NY CITY TRANSIT","107 CRAZY AVE",""," 9308","LARRY ELLISONS YACHT","108 CRAZY AVE",""," 9309","MAD SCIENTIST YADA 9309","109 CRAZY AVE","","

ALSO NOTE REGARDLESS OF THE FORMAT THE “DELIMITER” must be consistent

TEXT WRITE PROGRAM (excel macro) http://tushar-mehta.com/excel/software/text_write_program/index.html has a real useful Macro

“Text Write Program” to delimit “,” for a text file to be loaded into oracle using SQL, etc

Excel will only do commas !!!

Page 29: Sql loader Customer Interface for dummies

29

Truncating spaces and lines on your data file

9306","BILL CLINTON ","106 CRAZY AVE "," "," 9307","NY CITY TRANSIT ","107 CRAZY AVE "," "," 9308","LARRY ELLISONS YACHT ","108 CRAZY AVE "," "," 9309","MAD SCIENTIST YADA 9309","109 CRAZY AVE "," "," blank line blank line end of file

The flat ASCII text file containing your data should not: � Contain extra spaces at then end of any line � Contain blank lines before the EOF (end of file) is reached, otherwise record counts will

be misleading along with error messages.

Page 30: Sql loader Customer Interface for dummies

30

Customer Interface Validation Rules

The Customer Interface program validates the data you load in the Customer Interface tables by

ensuring that the columns in the interface tables reference the appropriate values and columns in

the rest of the system. The interface supports the same data relationship for customer information

as the customer window.

If you are trying to perform updates, Customer Interface ensures that the record to be updated

either already exists within the system or is in the interface table in the insert mode.

Additionally, Customer Interface ensures that certain column values are consistent with each

other. For example, if a profile class is not assigned to a customer, the interface program ensures

that interest charge, collector, discount terms, and other profile class information is defined in the

appropriate columns.

Customer Interface also ensures that records marked for insertion are unique

This process is a cumbersome trial and error process. With misleading and convoluted error

messages.

RA_CUSTOMERS_INTERFACE Requirements

To import a customer, address, or business purpose, populate the following mandatory columns

of RA_CUSTOMERS_INTERFACE:

o ORIG_SYSTEM_CUSTOMER_REF

o INSERT_UPDATE_FLAG

o CUSTOMER_NAME

o CUSTOMER_NUMBER (if you are not using Automatic Customer Numbering)

o CUSTOMER_STATUS

o LAST_UPDATED_BY

o LAST_UPDATE_DATE

o CREATED_BY

o 7CREATION_DATE

If you are importing an address and a business purpose, you must also populate the following

tables:

o PRIMARY_SITE_USE_FLAG (If you are inserting an address)

o LOCATION (If you are not using Automatic Site Numbering)

o SITE_USE_CODE (If you are inserting an address)

o ADDRESS1

o ORIG_SYSTEM_ADDRESS_REF

Page 31: Sql loader Customer Interface for dummies

31

Customer Interface Transfer Report

A/R generates the Customer Interface Transfer report each time you run Customer Interface.

This report lists the number of records imported into each table and specific error messages

describing any problems. If a record in the interface tables has several problems, the Customer

Interface Transfer report displays multiple error messages to help you fix all the problems in one

step. You can then interface the records successfully the next time you run the Customer

Interface program.

You may need to make changes in either your feeder program or the system to resolve the errors.

The Customer Interface Transfer Report has 3 main sections:

o Header Section

o Summary of Transfer Section

o Exception Records Section

The header section displays the date and the time that Customer Interface began processing your

transactions. The date is displayed in the format DD-MON-YY, while the time is displayed in

the 24-hour format (so that 2:30 PM displays as 14:30). The header section also displays the

concurrent request ID used by the Concurrent Manager and the user ID of the person who

submitted the Concurrent Request.

The Summary of Transfer section displays a count of the customer information processed for

each of the tables updated by the interface program.

The Exception Records Section displays detailed error messages for each record in each interface

tables not successfully processed. This section also displays the original system reference

columns from the interface tables to help you identify and correct exception records.

Page 32: Sql loader Customer Interface for dummies

32

After Successfully running the Customer Interface the data is

moved from to/from the tables upon which tables you populate

FROM: TO:

RA_CUSTOMERS_ALL HZ_PARTIES HZ_PERSON_PROFILES HZ_ORGANIZATIONS_PROFILES HZ_CUSTOMER_ACCOUNTS RA_ADDRESSES_ALL HZ_PARTY_SITES HZ_LOCATIONS HZ_CUST_ACCT_SITES_ALL RA_PHONES HZ_CONTACT_POINTS HZ_CUST_CONTACT_POINTS RA_CONTACTS HZ_CUST_ACCCOUNT_ROLES HZ_ORG_CONTACTS HZ_PARTIES HZ_PARTY_RELATIONSHIPS RA_CONTACT_ROLES HZ_ROLE_RESPONSIBILITY RA_CUSTOMER_RELATIONSHIPS_ALL HZ_CUST_ACCT_RELATE_ALL RA_SITE_USES_ALL HZ_CUST_SITE_USES_ALL AR_CUSTOMER_PROFILE_CLASSES HZ_CUSTOMER_PROFILE_CLASSES AR_CUST_PROF_CLASS_AMOUNTS HZ_CUST_PROF_CLASS_AMOUNTS AR_CUSTOMER_PROFILES HZ_CUSTOMER_PROFILES AR_CUSTOMER_PROFILE_AMOUNTS HZ_CUSTOMER_PROFILE_AMOUNTS

.

For the interface to work at a bare minimum you need

RA_CUSTOMERS_ALL & RA_ADDRESSES_ALL populated with

the correct data before running the interface

Page 33: Sql loader Customer Interface for dummies

33

Below is a Cross-Reference table of the current A/R Customer file

extract against the Oracle Interface table

Create a cross reference table of Oracle’s fields versus your fields. Especially note

the NOT NULL fields which must be given values even if the field has no use to

you.

Field from Legacy

A/R Notes Oracle Interface Field Description Length Null/Not Null

original customer number 4 digit number ORIG_SYSTEM_CUSTOMER_REF VARCHAR2 240 NOT NULL

"I"nsert or "U"pdate tells Oracle if record is to be added or updated "I" INSERT_UPDATE_FLAG VARCHAR2 1 NOT NULL

Customer Name CUSTOMER_NAME VARCHAR2 360 NOT NULL

Oracle will create CUSTOMER_NUMBER VARCHAR2 30 NULL

To be determined CUSTOMER_STATUS VARCHAR2 1 NULL

To be determined CUSTOMER_TYPE VARCHAR2 25 NULL

Address Line 1 ADDRESS1 VARCHAR2 240 NULL

Address Line 2 ADDRESS2 VARCHAR2 240 NULL

Address Line 3 if applicable ADDRESS3 VARCHAR2 240 NULL

Address Line 4 if applicable ADDRESS4 VARCHAR2 240 NULL

City CITY VARCHAR2 60 NULL

State STATE VARCHAR2 60 NULL

"USA" 95% data COUNTRY VARCHAR2 60 NULL

LAST_UPDATED_BY NUMBER 15 NOT NULL

date entered LAST_UPDATE_DATE DATE NOT NULL

CREATED_BY NUMBER 15 NOT NULL

date entered CREATION_DATE DATE NOT NULL

NOTE: Where “NOT NULL” is given a value must be given for the record

Page 34: Sql loader Customer Interface for dummies

34

Procedure for Porting the Customized Customer spreadsheet into Oracle

� Save the Excel spreadsheet as a .CSV file to delimit the file so that Oracle’s SQL code

can segregate each field

� Download the file to the PC � Customized SQL code has been written and tested using Oracle’s SQL*Loader which has

been tested to upload the data to Oracle’s table: RA_CUSTOMERS_INTERFACE_ALL

In a DOS Window run the dos program SQLLDR.EXE

> sqlldr apps/apps@vis all one word!!!

Control = loadtbag.ctl < enter a filename containing the code > Loadtbag.ctl is shown below: load data

infile 'c:\MY SQL\oracust.txt' flat file of the DATA !!!!

replace replace or append

into table tbagcust Oracle table created above

fields terminated by '","' delimiter

(AUTH,CUST, NAME, all fields ADDRESS1,ADDRESS2,ADDRESS3,ADDRESS4, CITYCOUNTRY,STATE,ZIP,PHONE,CONTACT,DATEADDED )

sample of the data file

NOTE: the first field DOESN’T have “,” preceding it, only succeeding it !!!!!!

This is due to fields terminated by '","' which is the delimiter separating the

fields just like we do for spreadsheets

----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8 ********************************* Top of Data ********************************** 1","0066","ABC BUS MANUFACTURING ","1506 30TH STREET ","NORTHWEST 1","0068","ABC RAIL PRODUCTS CORP. ","11TH & WASHINGTON STREETS"," 1","0070","ABCO REFRIGERATION SUPPLY","49-70 31ST STREET "," 1","0090","ABEE PRINTING CORP. ","305-1 KNICKERBOCKER AVE. ","

If you use append data must already be on the table

Other options were explored for loading this data and SQL*Loader was found to be the most

effective for the amount of data being processed.

Useful Excel Macro to delimit “,” - note Excel alone wont allow such a delimiter

TEXT WRITE PROGRAM (excel macro)

http://tushar-mehta.com/excel/software/text_write_program/index.html has a real useful Macro

“Text Write Program” to delimit “,” for a text file to be loaded into oracle using SQL, etc

Excel will only do commas !!!

Page 35: Sql loader Customer Interface for dummies

35

How to execute SQL*LOADER

Run your MS-DOS prompt using the Command Prompt as shown below:

You cannot run this DOS program through the START ���� RUN method!!!!!

Page 36: Sql loader Customer Interface for dummies

36

Create a single directory, which contains the following:

4. sqlldr.exe you might need to COPY it from the SERVER box

NOTE: You need SQL*PLUS installed and configured on your machine or simply

Run from the server box

5. all your data files delimited and formatted for SQL*LOADER

filename must match the filenames listed in the .CTL code run below

Try to create a delimeter such as “,”

Example.

“First Name”,”Last Name”,”Phone”,”

using a comma might not be unique or sufficient for your data. I’ve seen

some people using “]” also

6. all your SQL*LOADER code to load the data files into the interface tables

NOTE: all code must end in .CTL

4. SQL*Plus

Page 37: Sql loader Customer Interface for dummies

37

Page 38: Sql loader Customer Interface for dummies

38

Page 39: Sql loader Customer Interface for dummies

39

Before you run the Interface ���� Customer you should run SQL*Plus and count the amount of

records in the tables you uploaded the data into.

Note after you run a successful Customer Interface Oracle will automatically delete all the

records you uploaded.

Page 40: Sql loader Customer Interface for dummies

40

Procedure for invoking the Oracle Interface Processing after

the data has been loaded into the

RA_CUSTOMER_INTERFACE_ALL table

Within Oracle A/R choose the “Interface” sub-menu and then choose

“Customer” so that Oracle can insert (or update), process, validate and

“spread” out the data into numerous tables automatically

After selecting Customer another screen will then appear as shown on the next page

Page 41: Sql loader Customer Interface for dummies

41

This screen now appears to port the file into Oracle’s interface table

Page 42: Sql loader Customer Interface for dummies

42

The following is needed on the PC you are working on:

SQL*PLUS

SQLLDR.EXE (DOS program on the Server machine)

Click on the ICON to start SQL PLUS

Shortcut to Sqlplusw.lnk

In this example enter the following in lowercase:

Username apps

Password apps

Host string vis Vision db

NOTE: this matches the “sqlldr” screen print shown below:

apps/apps@vis is all one word!!!!

sqlldr apps/apps@vis control=loadint6 log=yadaint

Page 43: Sql loader Customer Interface for dummies

43

Validate the table by using the DESCription command shown below

Page 44: Sql loader Customer Interface for dummies

44

Page 45: Sql loader Customer Interface for dummies

45

Creating a duplicate TABLE of an existing Table This isn’t copying the data or entire database but rather making an exact copy of a table’s structure to test a load or copy the data into. create table <newtablename> as select * from <source or original tablename>;

Example: SQL> create table temp_cust_int AS Select * from ra_customers_interface;

Copying the data from one TABLE to another insert into <main table> select * from <temporary table>

DELETE ALL ROWS (RECORDS) FROM THE TABLE

SQL> SQL> delete from temp_cust_int; 221 rows deleted. SQL> commit 2 ; Commit complete.

Page 46: Sql loader Customer Interface for dummies

46

Comma Delimiting a SQL statement output for a spreadsheet, etc

SQL> select territory_code||','||nls_territory from fnd_territories

2 order by nls_territory;

TERRITORY_CODE||','||NLS_TERRIT --------------------------------- DZ,ALGERIA US,AMERICA AU,AUSTRALIA AT,AUSTRIA BH,BAHRAIN BD,BANGLADESH BE,BELGIUM BR,BRAZIL BG,BULGARIA CA,CANADA CN,CHINA RU,CIS HR,CROATIA CY,CYPRUS CZ,CZECH REPUBLIC

Page 47: Sql loader Customer Interface for dummies

47

Validate the table by using the DESCription command shown below

Page 48: Sql loader Customer Interface for dummies

48

How to acquire the valid values for Country Codes

LOAD DATA

INFILE 'cust_jan13b.txt'

replace INTO TABLE RA_CUSTOMERS_INTERFACE_ALL

FIELDS TERMINATED BY '","'

(

AGENCY_SKIP FILLER,

CUST_SKIP FILLER,

ORIG_SYSTEM_CUSTOMER_REF,CUSTOMER_NAME,ADDRESS1,

ADDRESS2,CITY,STATE,

POSTAL_CODE,COUNTRY,INSERT_UPDATE_FLAG,

LAST_UPDATED_BY,

LAST_UPDATE_DATE,

CREATED_BY,CREATION_DATE,CUSTOMER_CATEGORY_CODE,

CUSTOMER_CLASS_CODE,

CUSTOMER_STATUS,

CUST_SKIP2 FILLER,

CUST_NUMBER FILLER,

ORIG_SYSTEM_ADDRESS_REF,

PRIMARY_SITE_USE_FLAG,SITE_USE_CODE,

CUSTOMER_TYPE

)

Use this SQL code:

select territory_code,nls_territory from fnd_territories order by nls_territory SQL> / TE NLS_TERRITORY -- ------------------------------ DZ ALGERIA US AMERICA AU AUSTRALIA AT AUSTRIA BH BAHRAIN BD BANGLADESH BE BELGIUM BR BRAZIL BG BULGARIA CA CANADA CN CHINA ………

Page 49: Sql loader Customer Interface for dummies

49

How to STRING 2 or more columns together. You might have to merge two fields together as shown below. Columns “S” and “T” form column “U”. This is needed for Oracle’s use for the ORIG_SYSTEM_ADDRESS_REF field. Note the formula =S1&””&T1 For more info use EXCEL’s HELP look for:

“About joining text and values in multiple cells”

Page 50: Sql loader Customer Interface for dummies

50

HOW TO USE SQL*Loader

sqlldr.exe – dos program to load the data into oracle tables .log = results of load .txt = data

.ctl = sql loader code to load the columns into tables

KEEP ALL THESE FILES AND THE PROGRAM ALL IN THE SAME DIRECTORY

MAKE A NEW VERSION OF THE .CTL WHEN NECESSARY ALSO

Page 51: Sql loader Customer Interface for dummies

51

Page 52: Sql loader Customer Interface for dummies

52

Code for CUSTOMER INTERFACE

loadracust2.ctl

LOAD DATA

INFILE 'abagcus2.txt' DATA FILE!!!!!!!!!!!!!!!!!!!!!!!!!

replace INTO TABLE RA_CUSTOMERS_INTERFACE_ALL ****** see below

FIELDS TERMINATED BY '","' TRAILING NULLCOLS

(

ORIG_SYSTEM_CUSTOMER_REF,CUSTOMER_NAME,ADDRESS1,

ADDRESS2,ADDRESS3,ADDRESS4,CITY,STATE,

POSTAL_CODE,COUNTRY,INSERT_UPDATE_FLAG,

LAST_UPDATED_BY,

LAST_UPDATE_DATE,

CREATED_BY,CREATION_DATE,CUSTOMER_CATEGORY_CODE,

CUSTOMER_STATUS,ORIG_SYSTEM_ADDRESS_REF,

PRIMARY_SITE_USE_FLAG,SITE_USE_CODE,

CUSTOMER_TYPE

)

loadraprof3.ctl

LOAD DATA

INFILE 'abagprof2.txt' data file

replace INTO TABLE RA_CUSTOMER_PROFILES_INT_ALL

FIELDS TERMINATED BY '","' TRAILING NULLCOLS

(

ORIG_SYSTEM_CUSTOMER_REF,

INSERT_UPDATE_FLAG,

CREDIT_HOLD,

LAST_UPDATED_BY,

LAST_UPDATE_DATE,

CREATED_BY,CREATION_DATE,

ORIG_SYSTEM_ADDRESS_REF,

CUSTOMER_PROFILE_CLASS_NAME

)

replace INTO TABLE RA_CUSTOMERS_INTERFACE_ALL

on this line other than REPLACE, you also have INSERT if the table hasn’t been used before

Page 53: Sql loader Customer Interface for dummies

53

loadrainv.ctl

LOAD DATA

INFILE 'annainv0812.txt'

replace INTO TABLE RA_INTERFACE_LINES_ALL

FIELDS TERMINATED BY '","' TRAILING NULLCOLS

(ORIG_SYSTEM_BILL_CUSTOMER_REF,

AMOUNT,BATCH_SOURCE_NAME,SET_OF_BOOKS_ID,LINE_TYPE,

DESCRIPTION,CURRENCY_CODE,CONVERSION_TYPE,

INTERFACE_LINE_ID,INTERFACE_LINE_CONTEXT

)

loadraerr.ctl

LOAD DATA

INFILE 'annaerror.txt'

replace INTO TABLE RA_INTERFACE_ERRORS_ALL

FIELDS TERMINATED BY '","' TRAILING NULLCOLS

(INTERFACE_LINE_ID

)

loadradist.ctl

LOAD DATA

INFILE 'annadist.txt'

replace INTO TABLE RA_INTERFACE_DISTRIBUTIONS_ALL

FIELDS TERMINATED BY '","' TRAILING NULLCOLS

(INTERFACE_LINE_ID,INTERFACE_LINE_CONTEXT,ACCOUNT_CLASS

)

Page 54: Sql loader Customer Interface for dummies

54

SAMPLE DATA FORMAT:

12000","I","N","-1","15-AUG-02","-1","15-AUG-02","","DEFAULT"," 12000","I","N","-1","15-AUG-02","-1","15-AUG-02","CUST2001","DEFAULT","

note the following:

� the end of each RECORD must end in “,” � end of each column (field) is separated with a “,” � the start of each RECORD is just the data � the delimiter specified in the sqlloader code is first used between the first and 2nd field (column)

Creating Comma Delimited File

� If you are on a legacy mainframe system I suggest using SYNCSORT/DFSORT to pull desired fields into a fixed flat file. Only problem you might have are extra trailing spaces that can pose a problem with the name field, etc.

o Also you might be able to generate unique sequence numbers for use by Oracle

� Use Excel, Lotus, Quattro to produce a spreadsheet of data with a unique delimiter.

Page 55: Sql loader Customer Interface for dummies

55

How to STRING 2 or more columns together. You might have to merge two fields together as shown below. Columns “S” and “T” form column “U”. This is needed for Oracle’s use for the ORIG_SYSTEM_ADDRESS_REF field. Note the formula =S1&””&T1 For more info use EXCEL’s HELP look for:

“About joining text and values in multiple cells”

Page 56: Sql loader Customer Interface for dummies

56

Page 57: Sql loader Customer Interface for dummies

57

Procedure to LOAD THE DATA !!!!!!!!!!!!

1. Keep the .ctl, .txt (data) and sqllldr.exe all in the same directory

2. CLICK : START then PROGRAMS then COMMAND PROMPT to enter DOS -

YOU HAVE TO ENTER DOS THIS WAY AND NOT THROUGH THE RUN

PROMPT!!!!!!!!!!!

3. Change directory to the directory with the data, .ctl and sqllldr.exe reside

Page 58: Sql loader Customer Interface for dummies

58

IN YOUR DOS WINDOW RUN YOUR SQLLOADER CODE AS SHOWN ABOVE

HERE IS THE SYNTAX

DOS> sqlldr apps/apps@argt CONTROL FILENAME

CONTROL FILENAME IS THE CODE CONTAINING THE

COLUMNS, TABLENAME BEING LOADED ( .ctl )

EX.

Sqlldr apps/apps@argt loadracust2

Page 59: Sql loader Customer Interface for dummies

59

NOW WHAT??????

After it runs ok you will see “commit point” appearing for breakpoints indicating

Records went through YOU SHOULD CHECK THE .log files

Loadracust2.log

SQL*Loader: Release 8.1.7.0.0 - Production on Mon Aug 26 10:23:59 2002 (c) Copyright 2000 Oracle Corporation. All rights reserved. Control File: loadracust2.ctl Data File: abagcus2.txt Bad File: abagcus2.bad Discard File: none specified (Allow all discards) Number to load: ALL Number to skip: 0 Errors allowed: 50 Bind array: 64 rows, maximum of 65536 bytes Continuation: none specified Path used: Conventional Table "AR"."RA_CUSTOMERS_INTERFACE_ALL", loaded from every logical record. Insert option in effect for this table: REPLACE TRAILING NULLCOLS option in effect Column Name Position Len Term Encl Datatype ------------------------------ ---------- ----- ---- ---- --------------------- ORIG_SYSTEM_CUSTOMER_REF FIRST * CHARACTER Terminator string : '","' CUSTOMER_NAME NEXT * CHARACTER Terminator string : '","' ADDRESS1 NEXT * CHARACTER Terminator string : '","' ADDRESS2 NEXT * CHARACTER Terminator string : '","' ADDRESS3 NEXT * CHARACTER Terminator string : '","' ADDRESS4 NEXT * CHARACTER Terminator string : '","' CITY NEXT * CHARACTER Terminator string : '","' STATE NEXT * CHARACTER Terminator string : '","' POSTAL_CODE NEXT * CHARACTER Terminator string : '","' COUNTRY NEXT * CHARACTER Terminator string : '","' INSERT_UPDATE_FLAG NEXT * CHARACTER Terminator string : '","' LAST_UPDATED_BY NEXT * CHARACTER

Page 60: Sql loader Customer Interface for dummies

60

Terminator string : '","' LAST_UPDATE_DATE NEXT * CHARACTER Terminator string : '","' CREATED_BY NEXT * CHARACTER Terminator string : '","' CREATION_DATE NEXT * CHARACTER Terminator string : '","' CUSTOMER_CATEGORY_CODE NEXT * CHARACTER Terminator string : '","' CUSTOMER_STATUS NEXT * CHARACTER Terminator string : '","' ORIG_SYSTEM_ADDRESS_REF NEXT * CHARACTER Terminator string : '","' PRIMARY_SITE_USE_FLAG NEXT * CHARACTER Terminator string : '","' SITE_USE_CODE NEXT * CHARACTER Terminator string : '","' CUSTOMER_TYPE NEXT * CHARACTER Terminator string : '","' Table "AR"."RA_CUSTOMERS_INTERFACE_ALL":

1 Row successfully loaded. 0 Rows not loaded due to data errors. 0 Rows not loaded because all WHEN clauses were failed. 0 Rows not loaded because all fields were null. Space allocated for bind array: 65016 bytes(12 rows) Space allocated for memory besides bind array: 0 bytes

Total logical records skipped: 0

Total logical records read: 1

Total logical records rejected: 0 Total logical records discarded: 0 Run began on Mon Aug 26 10:23:59 2002 Run ended on Mon Aug 26 10:24:03 2002 Elapsed time was: 00:00:03.62 CPU time was: 00:00:00.19

Then you can run your interface, etc……………….

The amount loaded should equal the amount read.

Page 61: Sql loader Customer Interface for dummies

61

INTERFACE ERROR HANDLING You are running Customer Interface and there is an error message in the INTERFACE_STATUS column, but you don't know what it means.

SQL> select interface_status from ra_customers_interface_all; change to appropriate table INTERFACE_STATUS

B0,O3,E2,D1,D2,D3,D4,D5,D6,D7,D0,E1, B0,O3,E2,D1,D2,D3,D4,D5,D6,D7,D0,E1, B9,B0,O3,E2,D1,D2,D3,D4,D5,D6,D7,D0,E1, B0,O3,E2,D1,D2,D3,D4,D5,D6,D7,D0,E1, B9,B0,O3,E2,D1,D2,D3,D4,D5,D6,D7,D0,E1,

NOTE: THIS APPLIES TO ALL INTERFACE TABLES!!!!!!!!!!!!!!! EACH TABLE HAS THIS FIELD

Metalink, and search for Document ID: 1073634.6 Doc ID: Note:1073634.6

Subject: CUSTOMER INTERFACE STATUS ERROR CODES

Page 62: Sql loader Customer Interface for dummies

62

SQL LOADER sample and example Find the DOS program “SQLLDR.EXE” you might have to copy it from your server machine and onto your PC where you are loading the data from. Resides in the “bin” directory. Do a file search in Windows for that exact filename. Enter “sqlldr.exe | more “ to see the commands

http://ugweb.cs.ualberta.ca/~c391/manual/chapt5.html VERY GOOD!!!!

http://utenti.lycos.it/yanorel4/1/ch25.htm Que: Using oracle 8Chapter 25 Using SQL*Loader and Export/Import http://www.smckearney.com/oracle/sqlloader.php

Oracle Resources Using SQL-Loader to load data into

Oracle

http://kachina.kennesaw.edu/~agalewsk/SQLloader.html http://technet.oracle.com/doc/server.815/a67792/ch04.htm

http://www.doag.org/mirror/frank/faqloadr.htm http://misdev.fnal.gov/oracledoc/v8.1.7/DOC/server.817/a76955/ch03.htm http://gis.stpaul.gov/docs/oracle/server803/A54652_01/ch08.htm http://www.cs.uvm.edu/oracledoc/server.815/a67792/ch03.htm

http://people.cs.uchicago.edu/~matei/TA/CS235/or-load.html Using the Oracle Bulk Loader

http://ugweb.cs.ualberta.ca/~c391/labs/Sqlplus_Sqlloader.html GOOD EXAMPLE!

http://wpi.wpi.edu/server.815/a67792/ch04.htm CASE STUDIES

http://www.rumken.com/ioug2000/Paper421.htm Replacing 3GL Data Loading with SQL*Loader and Database Triggers

http://ftp.ora.com/orsqlloader/ Oracle SQL*Loader: The Definitive Guide Examples

NOTE: If using Excel save spreadsheet at “CSV” to create comma delimited file SQL*LOADER ERROR LISTING: http://storacle.princeton.edu:9001/oracle8-doc/server.805/a58312/newch73.htm http://info-it.umsystem.edu/oradocs/doc/server/doc/MSG73/ch7.htm

http://wpi.wpi.edu/server.815/a67792/ch07.htm LOG FILE

Page 63: Sql loader Customer Interface for dummies

63

Written by George R Lewycky

5/14/02 4:43 PM

[email protected]

http://georgenet.net/oracle

http://groups.yahoo.com/group/OracleSharedInfo/