Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 114

Quick Guide to

DATABASE
MANAGEMENT SYSTEM
using SAP Business One
CONTENTS:
UNIT I: SAP BUSINESS ONE QUERY GENERATOR

UNIT II: CUSTOMIZATION TOOLS - USER-DEFINED FIELDS, TABLES, VALUES AND OBJECTS

UNIT III: DATA MIGRATION

UNIT IV: PRINT LAYOUT DESIGN

UNIT V: DATABASE BACKUP AND RESTORE


UNIT I: SAP BUSINESS ONE QUERY GENERATOR

Many users of SAP Business One (SBO) are unaware that there is a powerful and simple query generator
available within the standard product. The query generator is a tool that makes it easy for authorized users to
extract information from the company databases.

There are many reasons why companies would want to query the database but generally the requirement
is to produce a view of the data that does not exist in one of the standard reports offered by SAP or to present the
data in a customized format.

Take for example the common requirement to extract a business partner listing. This is a simple task using
the query generator. Let’s take a look how SAP supports this requirement.

The first thing to do is identify the names of the database fields that we want to extract in our query. This
is made simple by asking the SAP client to show ‘System Information’. To do this, drop down the ‘View’ menu from
within the SBO client and select the ‘System Information’ option so that it shows a tick as indicated in the
screenshot below:
The status bar, which extends along the entire lower edge of the SAP Business One Main Window, contains various
text fields.

The left side is designated to display important, pertinent status and debug information about any window that is
opened. By selecting System Information from the View menu, you can view detailed information of any given field
when the cursor passes over it. The information is displayed on the left side of the status bar.

The system Information contains the field description used in the table, and the name of the table where the field
is located.
SQL DATABASE TABLE IN SAP BUSINESS ONE

The foundation of every Relational Database Management System is a database object called table. Every database
consists of one or more tables, which store the database’s data/information. Each table has its own unique name
and consists of columns and rows.

The database table columns (called also table fields) have their own unique names and have a pre-defined data
types. Table columns can have various attributes defining the column functionality (the column is a primary key,
there is an index defined on the column, the column has certain default value, etc.).

While table columns describe the data types, the table rows contain the actual data for the columns.

WHO CAN BENEFIT FROM USING SQL QUERIES IN SAP BUSINESS ONE?

It may not be easy to deduce the ideal reader of this book. In fact, there are many different groups of SAP
Business One users who may need this tool.

To my knowledge, there is no standard organization chart for Small and Midsized enterprises. Most of
them are different. You may often find one person that handles more than one role. In this sense all users,
especially end users, may need this
book as long as they can use SQL query with the basic knowledge required. You may check the following list to
see if anything applies to you:
 Do you need to check specific sales results over certain time periods, for certain areas or certain
customers?
 Do you want to know who the top vendors from certain locations for certain materials are?
 Do you have dynamic updated version of your sales force performance in real time?
 Do you often check if approval procedures are exactly matching your expectations?
 Have you tried to start building your SQL query but could not get it done properly?
 Have you experienced writing SQL query but the results are not always correct or up to your
expectations?

If the answer to any of the questions mentioned earlier is "yes", then you can certainly benefit from
reading this book. It will answer each and every question mentioned earlier and give you the power to solve
complicated problems.

Consultant
If you are an SAP Business One consultant, you have probably mastered SQL query already. However, if that is not
the case, this book would be a great help to extend your consulting power. It will probably become a mandatory
skill in the future that any SAP Business One consultant should be able to use SQL query.

Developer
If you are an SAP Business One add-on developer, these skills will be good additions to your capabilities. You may
find this book useful even in some other development work like coding or programming. Very often you need to
embed SQL query to your codes to complete your Software Development Kit (SDK) project
(Note: SDK , TB1300, is another program and is not covered in this course)

SAP Business One end user


If you are simply a normal SAP Business One end user, you may need this book more. This is because SQL query
usage is best applied for the companies who have SAP Business One live data. Only you as the end users know
better than anyone else what you are looking for to make Business Intelligence a daily routine job. It is very
important for you to have an ability to create a query report so that you can map your requirement by query in a
timely manner.
Non-SAP Business One users
To the other readers who are not SAP Business One users, you could still get some hints and tips from this
book because the working and the problematic queries are both shown. Even without an SAP Business One user
interface, you may still gain some useful concepts. In one query example of this book, I will show you that even
without the actual data from my database to test the query due to localization limitation, the correct answer to
the questioner can still be deduced.

No matter what your background is, you will find this book useful whenever you need to get certain data
quickly and accurately.

Source: (Mastering SQL Queries for SAP Business One by Gordon Du)

SQL QUERY AND RELATED TERMS

Before going into the details of SQL query, I would like to briefly introduce some basic database concepts because
SQL is a database language for managing data in Relational Database Management Systems (RDBMS).
Table
Table is a key component within a database. One table or a group of tables represent one kind of data. For
example, table OSLP within SAP Business One holds all Sales Employee Data. Tables are two-dimensional data
storage place holders. You need to be familiar with their usage and their relationships with each other. If you are
familiar with Microsoft Excel, the worksheet in Excel is a kind of two-dimensional table.
Table is also one of the most often used concepts in the book. Relationships between each table may be more
important than tables themselves because without relation, nothing could be of any value. One important function
within SAP Business One is allowing User Defined Table (UDT). All UDTs start with "@".

Field
A field is the lowest unit holding data within a table. A table can have many fields. It is also called a column. Field
and column are interchangeable. A table is comprised of records, and all records have the same structure with
specific fields. One
important concept in SAP Business One is User Defined Field (UDF). All UDFs start with U_.

SQL
SQL is often referred to as Structured Query Language. It is pronounced as S-Q-L or as the word "Sequel". There
are many different revisions and extensions of SQL. The current revision is SQL: 2008, and the first major revision is
SQL-92. Most of SQL extensions are built on top of SQL-92.

Query
Query is the most common operation in SQL. It could refer to all three SQL subsets. In this book, however, you will
only learn the read-only part of the query. No Add, Delete, or Update SQL statement in DML will be discussed in
the book since it is prohibited from SAP support policy for SAP Business One database integrity. All DCL or DDL SQL
will also not be included because we neither control access to data in a database, nor define data structure for a
database. You will find SELECT leading query only within the book. Read-only query SELECT has powerful
functionality for finding useful information to meet your specific needs.

NOTE: You have to understand the risks of running any Add, Delete, or Update queries that could potentially
alter system tables even if they are User Defined Fields. Using Add, Delete or Update will your SAP license. Only
SELECT query is legitimate for SAP Business One system table.
Naming convention of tables for SAP Business One
To help you understand the previous mentioned data dictionary quickly, we will be going through the naming
conventions for the table in SAP Business One.

Three letter words


Most tables for SAP Business One have four letters. The only exceptions are number- ending tables, if the numbers
are greater than nine. Those tables will have five letters. To understand table names easily, there is a three letter
abbreviation in SAP Business One. Some of the commonly used abbreviations are listed as follows:
ADM: Administration
ATC: Attachments
CPR: Contact Persons
CRD: Business Partners
DLN: Delivery Notes
HEM: Employees
INV: Sales Invoices
ITM: Items
ITT: Product Trees (Bill of Materials)
OPR: Sales Opportunities
PCH: Purchase Invoices
PDN: Goods Receipt PO
POR: Purchase Orders
QUT: Sales Quotations
RDR: Sales Orders
RIN: Sales Credit Notes
RPC: Purchase Credit Notes
SLP: Sales Employees
USR: Users
WOR: Production Orders
WTR: Stock Transfers
"O" tables
All tables starting with "O" refer to master tables. O here represents Object. For example:
OITM: Items Master
OCRD: Business Partners Master
OSLP: Sales Employee

"A" tables
Most tables starting with "A" may mean historical log tables. A here represents
Archive. For example:
AITM: Items—History
ACRD: Business Partners—History
AUSR: Archive Users—History
Document header tables
These are special O tables with the exact same structure. They can be tables related to Sales or Purchase. These
are called Marketing Documents. These also include most Inventory transaction tables. Some examples are:

OINV: A/R Invoice Header


OPCH: A/P Invoice Header
OIGN: Goods Receipt Header

Document line tables


All tables ending with a number refer to document line detail tables or subtables for the master table. Numbers
here could refer to different properties of the header tables.
INV1: A/R Invoice Row
PCH1: A/P Invoice Row
IGN1: Goods Receipt Row
INV2: A/R Invoice—Row Expense
Examples of Document Line Tables (Linked Tables) referred here are the table names of the contents tab found on
the marketing Document.

Important table examples


Some specific tables very important for query building are listed here:

OJDT-Journal Entry: This table includes all financial journal entries no matter whether they are
automatically posted or manually posted.
OINM-Warehouse Journal: This table includes all inventory-related transactions. It is a single point
to check everything in relation to your inventory (or stock). It becomes a view in the new version. This view must
be queried very carefully.
ADOC-Document History: This table includes all document history.
However, it is wrongly named in the documentation, "Invoice History" table
in the help file.

PRACTICE YOUR SKILL: SAP BUSINESS ONE MASTER TABLES

Write down the Master Table names of the following documents or forms in SAP Business One:
FORM/DOCUMENT MASTER TABLE
1 Purchase Quotation
2 Purchase Order
3 Goods Receipts PO
4 Goods Return
5 A/P Invoice
6 A/P Credit Memo
7 Sales Quotation
8 Sales Order
9 Delivery
10 Return
11 A/R Invoice
12 A/R Credit Memo
13 Item Master Data
14 Business Partner Master Data
15 Chart of Accounts

SOLUTION: (Log in SAB Business One using SBODemoGB (OEC Computers UK) Database)
1. Purchase Quotation : The Master table name is OPQT
Activate the viewing of system information in the task bar.
To activate, On the menu bar, go to View > System Information (if System Information has a check mark, it is
already activated.)

Open the Purchase Quotation document under Purchasing A/P > Purchase Order
Mouse over to any fields on the header portion (e.g Vendor, Customer , Name, Posting Date, etc.) and check the
Master Table name on the status bar found at the bottom of SAP Window. The Four Capital Letters which starts
with "O" is the master table (Remember that master tables start with "O').
ANSWERS:
FORM/DOCUMENT MASTER TABLE
1 Purchase Quotation OPQT
2 Purchase Order OPOR
3 Goods Receipts PO OPDN
4 Goods Return ORPD
5 A/P Invoice OPCH
6 A/P Credit Memo ORPC
7 Sales Quotation OQUT
8 Sales Order ORDR
9 Delivery ODLN
10 Return ORDN
11 A/R Invoice OINV
12 A/R Credit Memo ORIN
13 Item Master Data OITM
14 Business Partner Master Data OCRD
15 Chart of Accounts OACT

PRACTICE YOUR SKILL: DOCUMENT LINE TABLES (DOCUMENT ROW TABLES)

Write down the Document Line / Document Row Table names of the following documents or forms in SAP
Business One:
Document Row Document Line Table Name
1 Contents Tab of A/R Invoice Document
2 Addresses Tab of the Business Partner Master Data
3 Contents Tab of Purchase Order Document

SOLUTIONS:
1. Contnets Tab of A/R Invoice Document - Document Line Table Name: INV1
Open Sales A/R > A/R Invoice
Mouse Over to any fields under the contents tab and check the system information.
ANSWERS:
Document Row Document Line Table Name
1 Contents Tab of A/R Invoice Document INV1
2 Addresses Tab of the Business Partner Master Data CRD1
3 Contents Tab of Purchase Order Document POR1

SQL SELECT

The SQL SELECT statement is used to select data from a SQL database table. This is usually the very first SQL
command every SQL newbie learns and this is because the SELECT SQL statement is one of the most used SQL
commands.

Note: There are other SQL syntax other than SQL Select such as SQL CREATE, SQL INSERT SQL DELETE, ETC..
However, as mentioned earlier, only SQL SELECT query is legitimate for SAP Business One system table. Using other
SQL. Other SQL Syntax will void the warranty of the SAP license as other syntax may cause error on the
functionalities of SAP Business One tables. But you may use other syntax for User-defined tables and user-defined
objects. For this material, we will focus only on SQL SELECT.

SELECT Statement
Main parts of a SELECT statement
SELECT column_list
FROM table_list
WHERE search_condition
GROUP BY group_expression
ORDER BY order_expression [ASC | DESC]

Options for SELECT column_list


a) All columns:
 SELECT *
 SELECT T1.*, T2.*
b) Specific columns:
 SELECT T1.column1, T1.column2, T2.column1
c) Only unique values:
 SELECT DISTINCT column1
d) Using aliases for column names (headlines):
 SELECT column1 AS ‘CUSTOMER NUMBER’, column2 AS ‘CUSTOMER NAME’
e) Using functions:
Instead of selecting a column directly, you can also use a function and apply it to the column, for
example:
 SELECT AVG(UnitPrice) AS ‘Average Price)
 SELECT SUBSTRING(MiddleName, 1, 1) AS ‘Middle Initial’

Have a look at the general SQL SELECT syntax:

SELECT Column1, Column2, Column3 FROM Table1

The list of column names after the SQL SELECT command determines which columns you want to be returned in
your result set. If you want to select all columns from a database table, you can use the following SQL statement:
SELECT * FROM Table1

Example: SELECT * FROM OCRD

OCRD is the Master Table name for Business Partners. The Query above will extract all columns from the table
Business Partner Master Data.

OPTION 1: (For those who are not familiar with SQL Queries)
To view result, on the Menu Bar, go to Tools > Queries > Query Generator
Type OCRD on the upper left field, then press Tab on the keyboard > Click Execute

RESULT: All Columns from OCRD (Business Partner Master Data) is displayed.
OPTION 2: (For those who are already familiar with SQL Queries)
To view result, on the Menu Bar, go to Tools > Queries > Query Generator
Click Execute (ignore the warning message) > Click Edit Mode icon (Pencil icon)
Type the query SELECT * FROM OCRD (not case sensitive) > click Execute

When the list of columns following the SELECT SQL command is replaced with asterix (*) all table columns are
returned. Word of caution here, it’s always better to explicitly specify the columns in the SELECT list, as this will
improve your query performance significantly.
The table name following the SQL FROM keyword (in our case OCRD) tells the SQL interpreter which table to use to
retrieve the data.

DETERMINING THE COLUMN NAMES IN SAP BUSINESS ONE


In the previos exercises, we learned how to view the Master Table names of forms in SAP Business One.
When viewing now the column names of each field, the same procedure applies as when viewing Master Table
names.
EXAMPLE: Determine the column name for the Document Number field in SAP Business One's Sales Order form.
SOLUTIONS
OPTION 1: .
Make sure that System Information is activated
To activate, On the menu bar, go to View > System Information (if System Information is already checked, it is
already activated.)
Open Sales A/R > Sales Order
Mouse over Document Number field and the field details in the status bar is displayed.
The column name for the field is DocNum
OPTION 2:
Determine the Master Table of the Sales Order Document
Once you already know the Master Table name (the Master Table is ORDR),
Go to Tools > Queries > Query Generator
Type ORDR on the upper left field, then press Tab on the keyboard
Look for Document Number on the Desccription column.
The Name Column displays the column names of the fields.

PRACTICE YOUR SKILL: COLUMN NAMES

Determine the column names of the following fields:


Module Document Field Column Name
1 Purchasing A/P Purchase Order Document Total
2 Purchasing A/P Purchase Order Vendor
3 Purchasing A/P Purchase Order Name
4 Purchasing A/P Purchase Order Delivery Date
5 Banking Outgoing Payment Name
6 Sales A/R A/R Invoice Name
7 Sales A/R Sales Order Delivery Date
8 Financials Chart of Accounts G/L Account
9 Financials Chart of Accounts Name
10 Financials Journal Entry Posting Date

Note: Fields in the marketing documents have the same column names.
SOLUTIONS
1. Using Option 1 will not display the column name.

The Total Before Discount (Total Document) field is composed of Currenty + Amount. Hence, two columns a
involved here. The Column for Currency and the Column for Values. In this case, we have to use OPTION 2.

Go to Tools > Queries > Query Generator


Type OPOR on the upper left field, then press Tab on the keyboard
Look for Total Document field on the Desccription column.
For ease of locating the field, Double click the Descreiption Header and the contents should be arranged
alphabetically.

ANSWERS:
Module Document Field Column Name
1 Purchasing A/P Purchase Order Document Total DocTotal
2 Purchasing A/P Purchase Order Vendor CardCode
3 Purchasing A/P Purchase Order Name CardName
4 Purchasing A/P Purchase Order Posting Date DocDate
5 Banking Outgoing Payment Name CardName
6 Sales A/R A/R Invoice Name CardName
7 Sales A/R Sales Order Posting Date DocDate
8 Financials Chart of Accounts G/L Account AcctCode
9 Financials Chart of Accounts Name AcctName
10 Financials Journal Entry Posting Date RefDate

DATA EXTRACTION USING SQL QUERIES

Generate a report showing a list of Business Partners stored in SAP. The report should reflect the Business Partner
Code, Name and Contact Person.
When you check the Master Table name, it is OCRD.
Upon Checking the Column Names of the Partner Code, Name and Contact Person, the Column Names are
CardCode, Cardname and CntctPrsn respectively

Thus, the SQL Query Statement is:


SELECT CardCode, CardName, CntctPrsn FROM OCRD

To generate the report Open the Query Generator


OPTION 1: (For those who are not familiar with SQL Queries)
On the Menu Bar, go to Tools > Queries > Query Generator
Type OCRD on the upper left field, then press Tab on the keyboard
Put you mouse cursor in the Select field.
Double Click CardCode, Cardname and CntctPrsn respectively. > Click Execute.

Scroll down to see all list of Customers and Vendors.

OPTION 2: (For those who are already familiar with SQL Queries)
Go to Tools > Queries > Query Generator
Click Execute (ignore the warning message) > Click Edit Mode icon (Pencil icon)
Type the query SELECT CardCode, CardName, CntctPrsn FROM OCRD
(not case sensitive) > click Execute

Scroll down to see all list of Customers and Vendors.


SQL Queries are not case sensitive, but the spelling matters. An incorrect spelling results to an error. You can also
write the queries continuosly or use the enter key to separate data just like the image above.
SQL WHERE

The SQL WHERE clause is used to select data conditionally, by adding it to already existing SQL SELECT query. The
WHERE caluse is used to provide limits to a set of data.
Options for WHERE search_condition
Restricts the rows returned from the SELECT.
a) AND operator: Both conditions must be true.
 WHERE CardType = ‘C’ and Country = ‘Germany’
b) OR operator: Either one of the conditions must be true.
 WHERE Country = ‘Italy’ OR Country = ‘Germany’
c) Using different operators:
 Equal: =
 Not Equal: <>, !=
 Greater, Smaller than: >, <, >=, <=
 Not Greater, Smaller than: !>, !<
d) LIKE: Compares if a string matches a certain pattern.
 CustomerName LIKE ‘Mic%’
 CustomerName LIKE ‘%roc%’
 CustomerName NOT LIKE ‘A%’
 CustomerName LIKE ‘M[ae]ier’
 CustomerName LIKE ‘M_ier’
e) BETWEEN: Specifies a range.
 WHERE Age BETWEEN 10 AND 20
 WHERE Age NOT BETWEEN 10 AND 20
f) NULL: Specifies a search for null values.
 WHERE ContactName IS NULL
 WHERE ContactName IS NOT NULL

EXAMPLE 1:
Generate a report showing a list of Customers stored in SAP. The report should reflect the Customer Code, Name
and Contact Person.
When you check the Master Table name, it is OCRD.
Upon Checking the Column Names of the Partner Code, Name and Contact Person, the Column Names are
CardCode, Cardname and CntctPrsn respectively.
Based on the condition that only customers are reflected (and will exclude Vendors), we will use the CardType
Column.

Using the CardType Column, we will use the following values:


C = Customer
S = Vendor/Supplier
L = Lead
The SQL Statment is: SELECT CardCode, CardName, CntctPrsn FROM OCRD WHERE CardType = 'C'

*Note: You have to enclose C with Single Quotations. All data other than amounts/ numeric values should be
enclosed with single quotations. (For numeric values, there is no need to enclose in a single quotation but you
have to remove commas since comma in SQL is used to separate data.)

To execute the query,

OPTION 1: (For those who are not familiar with SQL Queries)
On the Menu Bar, go to Tools > Queries > Query Generator
Type OCRD on the upper left field, then press Tab on the keyboard
Put you mouse cursor in the Select field.
Double Click CardCode, Cardname and CntctPrsn respectively.

Put you mouse cursor in the Where field


Double Click CardType, then type = 'C' (not case sensitive) next to it. > Click Execute.

You should only see list of Customers upon executing the query.
EXAMPLE 2:
We will be querying the code for all items in the Item Master Data , their Item Names, in-stock quantity,
committed quantity and ordered quantity

The code
SELECT ItemCode, ItemName, OnHand, IsCommited, OnOrder FROM OITM

Scroll down to see the full list.


If we want to select the items from our database table, having an Physical count (In-Stock) between 10 and 50, we
need to use the following SQL syntax:
SELECT ItemCode, ItemName, OnHand, IsCommited, OnOrder FROM OITM where OnHand > 10 and OnHand < 50

OPTION1:

OPTION 2:

The above SQL Statment will return the same result as option 1.

SELECT ItemCode, ItemName, OnHand, IsCommited, OnOrder FROM OITM where OnHand = 500

In this simple SQL query we used the "=" (Equal) operator in our WHERE criteria:
OnHand = 500
But we can use any of the following comparison operators in conjunction with the SQL WHERE clause:

<> (Not Equal)


SELECT ItemCode, ItemName, OnHand, IsCommited, OnOrder FROM OITM where onhand <> 0

> (Greater than)


SELECT ItemCode, ItemName, OnHand, IsCommited, OnOrder FROM OITM where onhand > 200

>= (Greater or Equal)


SELECT ItemCode, ItemName, OnHand, IsCommited, OnOrder FROM OITM where onhand >= 320

< (Less than)


SELECT ItemCode, ItemName, OnHand, IsCommited, OnOrder FROM OITM where onhand < 10
<= (Less or Equal)
SELECT ItemCode, ItemName, OnHand, IsCommited, OnOrder FROM OITM where onhand <= 1

SQL DISTINCT

The SQL DISTINCT clause is used together with the SQL SELECT keyword, to return a dataset with unique entries
for certain database table column.

We will use our Business Partners table (CRD1) to illustrate the usage of SQL DISTINCT. The name of the field is
Country. Look at the figure below.
SELECT Country FROM CRD1 SELECT DISTINCT Country FROM CRD1

*The number of results is the same as the *The results are only the countries linked to the Business
number of Business Partners recorded. Partners on record, without repeating an entry.

SQL LIKE

The SQL LIKE clause is very useful when you want to specify a search condition within your SQL WHERE clause,
based on a part of a column contents. For example if you want to select all customers having FirstName starting
with 'M' you need to use the following SQL statement:

SELECT CardCode, CardName, Address, MailAddres FROM OCRD where CardName like 'M%'

The '%' is a so called wildcard character and represents any string in our pattern.
You can put the wildcard anywhere in the string following the SQL LIKE clause and you can put as many wildcards
as you like too.

Note that different databases use different characters as wildcard characters, for example '%' is a wildcard
character for MS SQL Server representing any string, and '*' is the corresponding wildcard character used in MS
Access.

PRACTICE YOUR SKILL: REPORT GENERATION USING SQL QUERY

1. Generate a list of Business Partners having an Account Balance (Receivable or Payable) of more than 20,000 and
less than 40,000. Show The Business Partner's Code, Name and Account Balance.

2. Generate a list of Customers having a Receivable balance of more than 40,000.


3. Generate a list of unpaid A/P Invoices. Vendor Code, Name, Invoice Number, Due Date and the Document Total
ANSWERS:
1. Generate a list of Business Partners having an Account Balance (Receivable or Payable) of more than 20,000 and
less than 40,000. Show The Business Partner's Code, Name and Account Balance.

2. Generate a list of Customers having a Receivable balance of more than 40,000.

3. Generate a list of unpaid A/P Invoices. Show the Vendor Code, Name, Invoice Number, Due Date and the
Document Total

*Remember that an Invoice with a Status Open is not yet paid and an Invoice with a Status Closed is already Paid.

SQL AS

'AS' is a command to set an alias to the selected column. The Alias will be reflected in the Query Preview. To
illustrate, consider the following:

EXAMPLE:
Generate a list of unpaid A/P Invoices. The Column Headers should be as follow:
Vendor Code, Vendor Name, Invoice Number, Invoice Due Date and Invoice Amount respectively.

SOLUTION:
The query statement and the query preview should be:

Note: You have to enclose the characters after the command AS in single quotations.
Do not close the query preview yet. We are going to save queries by category by following the succeeding
proccedures

*SAVING SQL QUERIES

For queries that are executed on a recurring basis such as reports that are needed daily, weekly or
monthly, saving the SQL query statement will save time in reconstructing the statement. The results are updated
immediately as soon as changes to the database/transactions were made.

 Assuming an updated Query Preview showing the details above is needed every week. Save the Query so that you
can go back to it anytime you need to generate the list of all Unpaid A/P Invoices.
Category: Weekly Reports
Query Name: Unpaid A/P Invoices

Click Save in your Query Preview window


click Manage Categories > Select All > Add > OK
Type Unpaid A/P Invoices in the Query Name field
Click Weekly Reports to choose a category. The Query Category field will be filled out
Click Save.
*PAY A/P INVOICE NUMBER 238 AND GENERATE THE QUERY FOR UNPAID A/P INVOICES. (Use Bank Transfer, use
G/L Account 161000 - Bank Account)

In the Query Preview, A/P Invoice Number 238 is not yet paid as refleccted in the report.

After recording the payment, this invoice should not be reflected in the Query Preview anymore.

 Record an the Payment (Use Bank Transfer, use G/L Account 161000 - Bank Account)
Banking > Outgoing Payments > Outgoing Payments
Process the Payment to V23000 Anthony Smith for Invoice Number 238.

 Generate the Updated Query Preview for Unpaid A/P Invoices


Go to Tools > Queries > User Queries > Weekly Reports > Unpaid A/P Invoices

Invoice 238 is not already part of the results.

SQL ORDER BY

The SQL ORDER BY clause comes in handy when you want to sort your SQL result sets by some column(s).
However, this is more useful when you need to sort two columns. If you only intend to sort one column, you may
disregard the ORDER BY clause - just generate the needed data then double click your preferred column for
sorting.

Options for ORDER BY order_expression


Specifies the sorting of the results.
a) ASC: Sorting from Lowest to Highest Value.
 ORDER BY LastName, FirstName
b) DESC: Sorting from Highest to Lowest Value.
 ORDER BY LastName DESC, FirstName DESC
EXAMPLE 1: Generate all undelivered customer orders, and sort it by Delivery Date. Show the following details:
Customer Name, Invoice Number, Invoice Amount, Delivery Date. Use the defualt query preview headers.
The query will be taken from Delivery document, extracting only those with Open Status:

If you do not whether the sorting should be Ascending or Descending, the default is in Ascending Order.

ORDER BY clause using ASC

ORDER BY clause using DESC


Even without using the ORDER BY clause, we can sort the results by just double clicking the Due Date column
header or any column header depending on our sorting preference.

If I doubleclick Document Total column header, the result will be sorted based on Document Total

EXAMPLE 2: ORDER BY clause will be more useful in the following scenario:


Generate all undelivered customer orders, and sort it by Customer Name, then by Document Total. Show the
following details: Customer Name, Invoice Number, Invoice Amount, Delivery Date. Use the defualt query preview
headers.

The data above were sorted alphabetically by Customer Name, then Numerically by Document Total

SQL GROUP BY
The SQL GROUP BY statement is used along with the SQL aggregate functions like SUM, COUNT, AVG (average),
etc. to provide means of grouping the result dataset by certain database table column(s).
Options for GROUP BY group_expression
Specifies the groups for output rows. Calculates an aggregate value for each column from the SELECT.
 SELECT country, city, SUM(revenue) FROM…GROUP BY country, city
All columns from the select clause must have an aggregate function or be in the GROUP BY statement. It is
recommended that these be used together with an ORDER BY for ordering the output of the columns.
Examples for aggregate functions:
 AVG – Returns the average of the values in the expression
 SUM – Returns the total of the values
 MAX – Returns the highest value in the expression
 MIN – Returns the lowest value in the expression
 COUNT – Returns the number of rows
The best way to explain how and when to use the SQL GROUP BY statement is by example.

EXAMPLE 1:
Create a Query that will show how many Customers, Leads and Vendors are there in the system.
The result should show the following:
CardType Number of Business Partners
(C, S or L for Customer, Supplier of Lead) (Count of Business Partners per CardType)

SOLUTION:

EXAMPLE 2:
Create a Query that will show the total A/R Invoice amount issued per customer.
The result should show the following:
Customer Name Total A/R Invoice Amount

SOLUTION:
EXAMPLE 2:
Create a Query that will show the Average Purchases from each vendor for the year 2009 based on the recorded
A/P Invoices. The result should show the following:
Vendor Name Average Purchases

Note: Whether you SAP date is formatted as MM/DD/YYYY or DD/MM/YYY, the date format to be used in SAP will
always follow MM/DD/YYY, since this is the date format of its server - Microsoft SQL.

SOLUTION: The basis for the date should be the posting date.

You may also do as follow:

In case you also like to se the total of the averages, click CTRL on the keyboard then double click the header.
SQL HAVING

The SQL HAVING clause is used to restrict conditionally the output of a SQL statement, by a SQL aggregate function
used in your SELECT list of columns.

You can't specify criteria in SQL WHERE clause against a column in the SELECT list for which SQL aggregate function
is used.

EXAMPLE: Create a Query that will show a list of customers whose total purchases from the company, based on
A/R Invoices issued, is greater than or equal to 300,000.

The result should show the following:


Customer Name Total Sales to Customer

You might be thinking to use the the following SQL statement. The following will generate an error:

SELECT CardName as 'Customer Name', SUM(DocTotal) as 'Total Sales to Customer'


FROM OINV
WHERE SUM(DocTotal) >= 300000
GROUP BY CardName

Again, you cannot use an aggreagte function such as SUM in the WHERE clause. To generate the needed report, we
will use the HAVING clause.

SELECT CardName as 'Customer Name', SUM(DocTotal) as 'Total Sales to Customer'


FROM OINV
GROUP BY CardName
HAVING SUM(DocTotal) >= 300000

SQL TOP

SQL TOP is used together with SQL SELECT to extract a list of entries ranked on a defined confition/parameter. This
should be followed by an ORDER BY ASC or DESC statement so that SAP can determine which among the column is
the basis in determining the rank and to determine how to rank the data - lowest to highest or highest to lowest.

EXAMPLE:
Generate a list of TOP 5 A/R Invoices for the year 2009.
The Query Preview should show the following:
Customer Name Invoice Number Invoice Total
SOLUTION:

SQL JOIN

The SQL JOIN clause is used whenever we have to select data from 2 or more tables.

To be able to use SQL JOIN clause to extract data from 2 (or more) tables, we need a relationship between certain
columns in these tables.

EXAMPLE:
To illustrate, consider the following requirements: Generate the list of Top 3 Sales Employees based on delivered
goods to customer.
The SQL Query Preview should show the following:
Sales Employee Name Total Sales

SOUTIONS:
Based ont he requirement above, we are goinng to use the Delivery Document (ODLN) and the Sales Emplpyee
Column name is SlpCode
You might be thinking of Executing the following statement:

SELECT TOP 3 SlpCode as 'Sales Employee Name', SUM(DocTotal) as 'Total Sales'


FROM ODLN
GROUP BY SlpCode
ORDER BY SUM(DocTotal) DESC

The problem with the above SQL Statement is that, it only returns the Sales Employee Code and not the names.

To resolve the concern, we are going to use SQL JOIN. To determine from where table can we get the Sales
Employee Names, open a Delivery Document.
Go to Sales A/R > Delivery > Last Data Record
Choose the Dorpdown list button on the Sales Employee field > Choose Define New

Mouse over to any fiel in the resulting window - Sales Employees/Buyers Setup window
Note the Master table Name found on the status bar: OSLP
To generate the report,

OPTION 1:
RESULT:

OPTION 2: (For those who are already familiar with SQL Query)
You may also type the following SQL Query directly it the Query Preview window. Before constructing the query,
what we need to know is what column is found in both tables,Table 1 (OSLP) and Table 2 (ODLN).
The answer is SlpCode. Both tables has the column for SlpCode. This will be used in generating the needed data as
follow:

Helpful DATE Functions


GETDATE() - SQL Function to get today’s date
In the SQL Language, GETDATE() will extract the current system date - your computer's system date. In
SAP Business One, GETDATE() will extract the current system date plus the current time.

NOTE: When saving SQL Statements involving the need to extract the date today, it is safe to use the
following to exctract the date only.
DATEADD(day, DATEDIFF(day, 0, GETDATE()),0)

DATEDIFF - SQL Function to calculate the difference between two dates

DATEDIFF is a function used to add or subtract dates, which will result to a whole number.
DATEDIFF(datepart, startdate, enddate)
Datepart specifies on which part of the date to calculate the difference (for example year, month, or day).
Startdate is subtracted from enddate. If startdate is later than enddate, a negative value is returned.
The syntax is as follow:
DATEDIFF (day, Date1, Date2) Get the difference between Date1 and Date2, in number of days
DATEDIFF (month, Date1, Date2) Get the difference between Date1 and Date2, in number of months
DATEDIFF (year, Date1, Date2) Get the difference between Date1 and Date2, in number of years

EXAMPLE: Take a look at the following SQL Query Statement and Preview:
DocDate - DocDueDate (DocDate - DocDueDate): Since the two values are dates, it also returned a Date Format
as the result.

To extract the diference in number of days, we are going too use the syntax DATEDIFF.

DATEADD - SQL Function to determine a date in the future based


 DATEADD(datepart, number, date)
Datepart specifies on which part of the date a new value should be added (for example year, month, or
day).
Number specifies the value used to increment date.

DATEADD is a function used to add days, months, or years to a given date.


DATEADD(day, DATEDIFF(day, 0, GETDATE()),0) Date Today (Date Only without time)
DATEADD(day, DATEDIFF(day, 0, GETDATE()),-1) Yesterday
DATEADD(day, DATEDIFF(day, 0, GETDATE()),-5) 5 days ago
DATEADD(day, DATEDIFF(day, 0, GETDATE()),1) Tomorrow
DATEADD(day, DATEDIFF(day, 0, GETDATE()),7) 7 days from today

EXAMPLE: Generate a list of A/P Invoices that are due for payment between today and 7 days from today. All A/P
Invoice with a passed Due Date should not be part of the report. Show the Vendor Name, Invoice Number, Invoice
Amount and the Due Date.

Since the database which we are using has not been used for the current year, no data will be displayed for the
requirement above. Hence, post at least 2 A/P Invoices with the following Details:

Vendor Posting Date Due Date Item Quantity


V10000 Date Today 3 days from today A00001 20
V1010 Date Today 7 days from today A00002 20
V20000 Date Today Date Today A00003 20

Go to Purchasing A/P > A/P Invoic > Enter the needed data > Add the Invoice
Take a look at the following SQL Statement:

Third invoice which we have created is not reflected in the Query Preview. This is because GETDATE() alone is used
for the condition. Again, GEDATE() consists of date today plu time today. Hence, since the thirs invoice is created a
few seconds or minutes ago, it does not meet the criteria.

The following is the correct SQL Statement and Preview (the result should show the three invoices we have just
created unless, you posted more invoices that will fit the requirements)
You can also use the BETWEEN clause:

PRACTICE YOUR SKILL:


1. Generate a list of Uncollected A/R Invoices and show the following details:
Customer Code Customer Name A/R Invoice Number Due Date # of Days in Arrears
(Due Date less Date Today)
*The column headers as shown above should be followed

SOLUTIONS:

*DATEDIFF(day, DocDueDate, GETDATE()) - the syntax calculates for the difference between Document Due Date
and the Date today in terms of Number of days - the consideration is the number of days, ignoring now the time
portion. Hence, although GETDATE() is composed of Date + Time, the syntax is still correct.

You may also do the following which will provide the same result:
Save the Query - Category: Weekly Reports
Query Name: Uncollected A/R Invoices

EXERCISES: SQL QUERIES


(NOTE we may have different results in the Query Preview depending on the transactions that were entered in SAP
Business One.
1.1 Enter credit limits for the following Business Partners:
BP Code BP Name Credit Limit
C20000 Norm Thompson 10,000
C23900 Parameter Technology 10,000
C30000 Microchips 10,000
C40000 Earthshaker Corporation 5,000
C42000 Mashina Corporation 5,000
C60000 SG Electronics 5,000
C70000 Aquent Systems 5,000
*credit limit is in the Payment Terms tab of the Business Partner Master Data

1.2 Generate a report to show the following fields:


Customer Code Customer Name Credit Limit Deviation from Credit Limit

* Save the Query - Query Name: CL Deviation Category: Other Reports


2. Generate the TOP 5 Customers on 2009 based on Paid A/R Invoices.

3. Generate TOP 3 Sales Personnel in 2009 based on delivered goods.

4. Generate a List of uncollected invoices with amount greater than 5,000.


The report should show the following:
Customer Name, Invoice Number, Invoice Amount, Invoice Due Date, # of Days in Arrears Where # of Days in
arrears is equal to Date today Less Document Due date.
SOLUTIONS

1.1 Enter credit limits for the following Business Partners:


To update Credit Limit, open Business Partners > Business Partner Master Data
Go to Payment Terms Tab.
Enter the necessary amount on the Credit Limit field. > Click Update.

1.2 Generate a report to show the following fields:


Customer Code Customer Name Credit Limit Deviation from Credit Limit

* Save the Query - Query Name: CL Deviation Category: Other Reports

Since the needed report is not part of the default reports which can be generated in SAP Business One, use SQL to
generate a report as required:
Open Tools>Queries>Query Generator >Click Execute
Ignore the error message. Click the Pencil Icon to go to Edit Mode and enter the following:
SELECT cardcode as 'Customer Code', cardname as 'Customer Name', creditline, creditline - balance as
'Deviation from Credit Limit'
from OCRD where cardtype = 'c'

Save the Query. Click Save.


Query Name: CL Deviation Category: Other Reports
Then Click Save. You may now go back to the query by opening Tools > Queries>User Queries > General > CL
Deviation

2. Generate the TOP 5 Customers on 2009 based on Paid A/R Invoices:


If the status of the A/R Invoice is Open, this indicates that the invoice is not yet fully collected. If the status is
closed, it is already collected in full.

3. Generate TOP 3 Sales Personnel in 2009 based on delivered goods


4. Generate a List of uncollected invoices with amount greater than 5,000 - report should show the following:
Customer Name, Invoice Number, Invoice Amount, Invoice Due Date, # of Days in Arrears where # of Days in
arrears is equal to Date today Less Document Due date.
(GETDATE() in SAP Business One is composed of Date + Time)
The screenshot below was taken when the current date is 11/21/2015. Hence # of Days in Arrears as shown in the
image will be different from that of your SQL query preivew.

* Save the Query - Query Name: Uncollected A/R more than 5K Category: Other Reports
UNIT IV: CUSTOMIZATION TOOLS - USER-DEFINED FIELDS, TABLES, VALUES AND OBJECTS

4.1 SAP BUSINESS ONE USER-DEFINED FIELDS


SAP Business One provides a comprehensive set of tables and fields in each of its modules. However, if your
company requires additional tables and fields for its day-to-day work, SAP Business One enables you to create your
own user-defined fields in existing system tables or your own user defined tables.

User-defined fields, as described enable you to add fields to existing tables to keep track of additional information.
For example, you can add a field called CarNumber to the Employee Master Data table to keep track of the license
plate number for each employee. User-defined tables, can be used in one of the
following ways:
• To represent business objects, such as vehicle master data, or to group logical sets of userdefined
fields
• To hold valid values for other user-defined fields. You can link user tables to user-defined fields,
and require users to select from the values in the tables.

Creating User-Defined Fields


When creating user-defined fields, you specify a field name and the type of data to be contained in the
field. You can also specify the valid values for the field.
Procedure
1. In the menu bar, choose Tools → Customization Tools → User-Defined Fields - Management.

The User-Defined Fields - Management window opens:


The window displays a hierarchy of categories (form types) to which you can add user-defined fields.
Some categories affect a single form (such as Business Partners under Master Data), while others affect multiple
forms (Title and Rows under Marketing Documents). To view all available form types, click Expand button (black
arrow) on the chosen category.

2. Select the category to which you want to add a field, and choose Add . The Field Data window appears.
3. Specify the name and type of field by entering the following fields in the Field Data form:
 Title: The field name. The Title value cannot contain spaces or special characters.
 Description: The field display name.
 Length: The size of the field.
 Type: If the field type is Alphanumeric, the length is the maximum number of characters.
If the field is Numeric, the length is one more than the maximum number of digits.
For example, specify 10 to allow up to 10 digits to be entered.
 Type and Structure: Describes the type of data to be contained in the field.
The type and structure determines the type of data that can be entered into each field,
and how it is displayed. For more information about how different types of fields are
displayed to the user, see Entering Values in User-Defined Fields.
The following table describes the Type field options, and the Structure field options for each type:
a. Alphanumeric - A series of characters. The following are the structure options for this type:
• Regular: Lets you enter up to 254 characters.
• Address: For future use.
• Telephone No.: If automatic dialing is set up, this will let you dial the number by clicking it (not available in the
demo database).
• Text: will let you enter:
o 2 GB of text in header fields
o 255 KB of text in row fields
b. Numeric - Integers up to 10 digits long. There are no structure options for this type.

c. Date/Time - The display format for dates and time is determined by system initialization settings, located in
Administration → System Initialization → General Settings → Display tab.
Type Description / Structure Options
d. Units and Totals - Integer and decimal numbers. The following are the structure options for this type:
• Rate • Quantity
• Amount • Percents
• Price • Measure
The structures are identical except for the display format. The formats are determined by system initialization
settings located in Administration → System Initialization → General Settings → Display tab.
Type Description / Structure Options
e. General - Links and images. The following are the structure options for this type:
• Link: allow you to enter a link to a file or to a Web address
• Image: allow you to enter a link to a picture
When you add a link to a file/picture, the file/picture is copied to folders specified in the initialization settings. You
must specify these folders in Administration → System Initialization → General Settings → Path tab. Specify a
folder for files (attachments) and another for pictures.

4. Specify the valid values for the field. This step is optional. Select one or more of the following checkboxes in the
Field Data form:
Field Name Description
a. Set Valid Values for Field - Specifies that there is a predefined list of valid values for this field. For this field,
users must pick from a dropdown list of valid values. To enter a valid value, choose the New button and enter a
value and a description.

b. Set Default Value for Field - Specifies that there is a default value for the field in cases where the user does not
select one. Choose a default value from the list (if you provided a list of valid values) or enter a default value. This
setting is mandatory when the field is defined as mandatory.

c. Mandatory Field - Requires that you enter a value for this field in every document or form. If you select this
checkbox, you must specify a default value for the field.

d. Set Linked Table- Specifies that the valid values for this field are the keys (values for the Code field) in a specific
user-defined table. For more information, see Linking a User Table to a User-Defined Field. If you select this
checkbox, Set Valid Values for Field, Set Default Value for Field, and Mandatory Field are disabled.

5. Choose the Add button.

Note
The following message is displayed:

To add the field, click the Yes button.


If another user is logged on to the same company, the system displays the following
message, listing the machine from which the user is logged on:

Choose one of the following buttons:


Option Description
a. Try again - Checks again for other logged-on users and if there are none, saves the field.
b. Cancel - Cancels the save operation and returns to the User-Defined Fields - Management window.
c. Ignore Saves the field and displays the following:
To add the new field (or update the existing field), choose the Yes button. This action refreshes the database tables
connected to this field. If you are currently working with one of these tables, the information on the form being
processed is lost. In the image above, the two more users logged on to the same database will be automatically
logged out and any unsaved changes they are currently doing will be lost.

Result
The following occurs when you add a user-defined field:
• Information about the new field (such as its name, its size, and the table to which it was added) is stored in the
CUFD table (user field definition table).
• The field is added to the relevant table. The prefix U_ is added to the name of the field in the database table,
indicating that it is a user-defined field.

EXAMPLE 1 (UDF at Row Level):


Add a User - Defined Field in the Sales Order document. Name it as "Price Basis".
Title: PRICEBASIS
Description: Price Basis
Length: 20
Valid Values for Field:
Value Description
RP Regular Price
IP Introductory Price
PP Promo Price
Default Value for Field RP (Regular Price)

SOLUTION:
Go to Tools > Customization Tools > User-Defined Fields - Management
Expand Marketing Documents, then click Rows > Click Add.

Fill out the needed fields.


Title: PRICEBASIS (Again, title should not contain spaces and special characters)
Description: Price Basis
Length: 20
Choose Set Valid Values for Field. Click New to type the needed Values and their corresponding Description.
Value Description
RP Regular Price
IP Introductory Price
PP Promo Price
NOTE: Click New every time you enter a new Value and Description.
Tick mark Set Valid Value for Field and choose RP as the default value.
Click Add > then click Yes on the system message.

RESULT:

Close the User-Defined Fields - Management window.


Displaying User-Defined Fields - Row Level
User-defined fields in the row level will appear automatically as part of the columns visible in the form. UDF in the
row level of marketing documents are added as part of the visible columns under the contents tab. You can change
the position of the columns using the form settings. Also, you can hide the UDF using the form settings in the tool
bar.
To view the created UDF, Go to Sales A/R → Sales Order. A Column for Price Basis should be available in the
contents tab. To view the valid values / dropdown list in the Price Basis column, choose any customer first.

NOTE: The values in the dropdown list are fixed and a user can only add more values by updating the User-Defined
Fields Management Setup window.

EXAMPLE 2 (UDF at Header Level):


Create a UDF to appear in the Delivery document only. The UDF should have the following details:
Title: TRUCK
Description: Truck
Length: 7
Valid Values for Field:
Value Description
T1 ABC 123
T2 HIJ 345
T3 MNO 987
T4 XYZ 654
SOLUTION:
Go to Tools > Customization Tools > User-Defined Fields - Management
Expand Marketing Documents by clicking the black arrow pointing to it > click Title > Click Add.
Fill out the needed fields:
Title: TRUCK
Description: Truck
Length: 7
Choose Set Valid Values for Field. Click New to type the needed Values and their corresponding Description.
Value Description
T1 ABC 123
T2 HIJ 345
T3 MNO 987
T4 XYZ 654
NOTE: Click New every time you enter a new Value and Description.
Click Add > then click Yes on the system message.
RESULT:

Close the User-Defined Fields - Management window.

Displaying User-Defined Fields - Title/Header Level


Procedure
1. Open the Sales Order form - Go to Sales A/R → Delivery.
2. In the menu bar, choose View → User-Defined Fields.
The system displays the user-defined fields in a panel next to the form.

NOTE: The UDF for Truck will also be visible in all marketing documents such as Sales Order, A/R Invoice and even
to Purchase Order, Goods Receipts PO and A/P Invoice Documents if you choose View → User-Defined Fields after
opening the mentioned windows. To limit the UDF to be available only in the Delivery document, we have to
assign a Category for the UDF.
Modifying the Display of User-Defined Fields in the Title Level
You can modify the way user-defined fields are displayed. For example, you can choose which fields are to be
displayed and in what order. User-defined field settings are saved separately for each user and for each form.

You have many user-defined fields and you would like to display different sets each time you need to display user-
defined fields. You can create a couple of categories for different user-defined fields and change the displayed
category when necessary.

Prerequisite
A form is open with the user-defined fields panel displayed. For more information, see Displaying
Header User-Defined Fields.

EXAMPLE:
Assign a Category for the UDF Truck. Set that the UDF Truck is only active and visible in the Delivery document
and not in other documents.

SOLUTION:
A. ASSIGN A CATEGORY AND SET THE UDF AS ACTIVE AND VISIBLE IN THE DELIVERY DOCUMENT:
1. Open the Delivery Document under Sales A/R → Delivery.
2. In the menu bar, choose View → User-Defined Fields. Assigning a Category is not possible if the UDF is not
visible.
3. Go to Tools → Customization Tools → Settings
4. Choose the Visible and Active columns (put a checkmark on the boxes). The following are the information in
relation to the column headers:
Field - The display name of the field.
Visible - Specifies whether the field is to be displayed or hidden.
Active - Specifies whether a user can edit the field.
Order - Specifies the display order of the fields. 1 for First, 2 for second, 3 for third, etc. This is useful if
you have 2 or more UDFs in a form. The number must be an integer. The field with the lowest
number is displayed first; the one with the highest number is displayed last.
Category - Assigns the field to a category. You can filter the user-defined fields so only fields in a specific
category are displayed using the dropdown list at the top of the user-defined fields panel:
5. In the Category column, choose Defined New. Input Delivery Document or any category name as you see fit
then click Update.
6. Then click Cancel to close the Interest - Setup window. You will go back to the Settings -Fields - Setup windows.
In the Category column, choose Delivery Document then click OK.

7. You will return to the Delivery Document. Notice that the UDF for Truck is not anymore visible. This is because
the default category for the form is General. Change it to Delivery Document. The UDF for Truck should is now
visible.
B. SET THE UDF AS NOT VISIBLE AND NOT ACTIVE IN OTHER MARKETING DOCUMENTS.
B.1. Sales Order
1. Open the Delivery Document under Sales A/R → Sales Order.
2. In the menu bar, choose View → User-Defined Fields. Assigning a Category is not possible if the UDF is not
visible.
3. Go to Tools → Customization Tools → Settings
4. Uncheck the Visible and Active columns in the Truck row then click OK. The UDF for Truck is not anymore
visible.

DO THE SAME FOR A/R INVOICE, PURCHASE ORDER, GOODS RECEIPTS PO AND A/P INVOICE DOCUMENT.

4.2 SAP BUSINESS ONE USER-DEFINED FIELDS LINKED TO A USER-DEFINED TABLE

Creating a User-Defined Table and Linking a User Table to a User-Defined Field


Instead of defining valid values for a field within the field definition, you can specify that the valid
values are contained in a user-defined table. This can be helpful if you have several fields in different tables with
the same valid values, or when you want to update the valid values dynamically. Also, an option for Define New
will be available in the UDF and a user can add new values by choosing it.

Prerequisite
NOTE: You can link a field to a user-defined table only.
• The field type is Alphanumeric and its structure is Regular.
• The Set Valid Values for Field and Set Default Value for Field checkboxes are not selected.

Procedure
A. Create a User-Defined Table.
Create a User-Defined Table (UDT) for "DRIVER".
1. In the menu bar, choose Tools → Customization Tools → User-Defined Tables - Setup.
The User-Defined Tables - Setup window opens. Enter a Table Name and Description:
Table Name Description
DRIVER Driver
Click Update then OK.
B. Create a User-Defined Field and Link the User-Defined Table to the User - Defined Field
In the Delivery Document, add a UDF with the following details:
Title DRIVER
Description Driver
Length 20

Go to Tools > Customization Tools > User-Defined Fields - Management


Expand Marketing Documents by clicking the black arrow pointing to it > click Title > Click Add.

Fill out the needed fields:


Title: DRIVER
Description: Driver
Length: 20
Tick mark the check box for Set Linked Table and choose DRIVER.
Click Add > then click Yes on the system message.
RESULT:

Close the User-Defined Fields - Management window.

C. Add Values to the User-Defined Table.


Add the followings names of Drivers in the list of values to appear in the UDT for Drivers:
Code Name
John John Dela Cruz
Peter Peter Picas
Chris Chris Basillio
Aron Aron Seagull

OPTION 1: Tools > User Defined Windows > Choose DRIVER and type the following codes and names:
Code Name
John John Dela Cruz Click Update
Peter Peter Picas Click Update, then click OK to close the window.
OPTION 2: Additional Values can be entered by choosing Define New in the User-Defined Field linked to a table.
Open the Delivery Document. Go to Sales A/R > Delivery
If the UDF for Driver is not yet displayed, choose View > User Defined Fields on the Menu bar then choose General
on the UDF Category.
Click the Dropdown List icon on the Driver field then choose Define New. Enter the following data:
Code Name
Chris Chris Basillio Click Update
Aron Aron Seagull Click Update, then click OK to close the window.

RESULT:

Updating User-Defined Fields with Fixed Values (Not Linked to a Table)


The company bought a new Delivery Truck. Add the following Values to the UDF Truck
Value Description
T5 RTY 101

To update a user-defined field, do the following:


1. Open the User-Defined Fields – Management window by choosing Tools → Customization Tools
→ User-Defined Fields – Management.
2. Select the Truck field by expanding the Marketing Documents category. Expand also the Title sub-category
then click on Truck. Click Update. The Field Data window appears. You can update the field settings except for
Title, Type, and Structure.

3. Click New. Enter the following data:


Value Description
T5 RTY 101

4. Choose the Update button then choose Yes on the system message.

RESULT:
Close all windows then go back to Delivery Document to check the changes.

Removing User-Defined Fields


CAUTION: This action is irreversible and deletes all values saved in this field in all its related objects. A query with
a removed user-defined field displays an error when you run it.

Recommendation
NOTE: Do not remover the UDF for Truck. The following procedures are for illustration purposes only and are not
intended to remove the UDF for Truck.

To remove a user-defined field, do the following:


1. Open the User-Defined Fields – Management form by choosing Tools → Customization Tools → User-Defined
Fields - Management.
2. Select the User - Defined Field which you wish to remove (click to select).
3. Choose the Remove button > Choose Yes on the system message.

If you are sure you want to delete the UDF, Choose again Yes if you see the following system message:
4.3 CONSTRUCTING SAP BUSINESS ONE FORM SYSTEM VARIABLES AND CREATING USER-DEFINED VALUES
(UDV)* *Formerly FMS - Formatted Search

A powerful skill to learn when digging into SQL query and writing formatted search (FMS) is learning how to
construct SAP Business One system variables. You may have seen them in examples on the Internet but not
quite understood how they are constructed. We're going to show you how to find the building blocks of a
variable and construct one. Once you get to understand them it is easy to apply it in everyday situations.

The $ sign system variables will work in conjunction with the SQL query generator within the SAP client. When
writing formatted searches to customize the behavior of SAP Business One they are extremely powerful,
especially on the marketing document level.
Constructing System Variables

A SAP Business One system variable looks like this: $[$38.1.0]


It is important to learn the syntax, $[$Item.Column.DataType]

The item designates which form data matrix you are working with in the SAP client. Column stands for the
field in the table and type is a special designator related to which data type we are working with.
It is very easy to find these values to construct the variable in most cases. You simply turn on System
Information on the SAP Business One view menu. A keyboard shortcut will also turn these fields on by hitting
CTRL+Shift+I.

Once you have enabled this, hover / m o u s e over any field or label in the Business One client. You will see
something like this across the bottom status bar of the client:

System Information

Using the system variable syntax you know that the variable can be constructed as: $[$38.1.0]
System Variable Data Types: The last number in the variable stands for data type. The data type part has
a set of available options:
0 = string
1 = number
2 = currency
3 = date

When the system information does not give a column value, use 0 (zero). Instead of using the numbers for
data type, y o u m a y a l s o use their name such as $[$22.0.number]

You may also utilize database table names and field names when constructing form variables. In these
variables you would leave off the one dollar sign ($) and t h e data type. They are constructed like this:
$[ORDR.CardCode]

One last thing to know about constructing $ system variables is that sometimes the "Item" in the syntax will
need a negative sign in front of it.

What $[$-4.0.0] is telling your code is that the system variable relates to a user defined field on the header
of your document. The main form will be positive and the UDF form will be negative.

Using System Variables

Query with System Variable

A practical example is seeing how these form variables can be used is in a formatted search. When
customizing SAP Business One to make it work for your company you will be employing many of these
examples. This code snip is a SQL formatted search query that will return the value being held in the business
partner card code attached to a sales order.

SELECT $[$4.0.0]

Open up the query generator and paste the code into a query. Save the query.
EXAMPLES:
Provide the Form System Variable for the following fields:
1. Vendor field in the Purchase Order Document
2. Posting Date field of the A/R Invoice Document
3. No. field (or Document Number) of the A/R Invoice Document
4. Posting Date field of the Outgoing Payment Document
5. Preferred Vendor field of the Business Partner Master Data (under Purchasing Data tab).

SOLUTIONS:
Make sure that viewing System Information is Activated: View > System Information
Mouse Over to the needed fields to see the Item No., and the Column No. In case there is no column no.,
use Zero - 0.

ANSWERS:
1. $[$4.0.0]
2. $[$10.0.3]
3. $[$8.0.1]
4. $[$10.0.3]
5. $[$16.0.0]

DEFINING AND USING USER-DEFINED VALUES (UDV)* IN SAP BUSINESS ONE


The User-Defined Values function enables you to enter values, originated by a pre-defined search process, into any
field in the system (including user-defined fields).

You can use the formatted search function to:


• Enter values automatically into fields using various objects in the system.
• Enter values into fields using a pre-defined list.
• Enter values automatically into fields with pre-defined queries (user queries).
• Create dependencies between fields. For example, the value in field X influences the value in field Y.
• Display fields that can be displayed only by using queries. For example, User Signature, Creation Date, Open
Checks Balance (for business partners).

Defining User-Defined Values


Procedure
1. Place the cursor in a required field (any field in the current open window) and press the key combination
Alt+Shift+F2.

2. The Define User-Defined Values window opens:


Option Description Comments
Without Search in User-Defined Values No User-Defined Values is defined Select to cancel a User-Defined Values
for the field. defined for a certain field.
Search in Select to define a list of values Choose the icon to open the Field
Existing User-Defined Values applicable for the search field. Values – Setup window.
Search in Existing User-Defined Values Select to link a user-defined query Additional fields appear for this
according to Saved Query to the search field. option.

Auto Refresh - Table Fields

• Deselect the box Auto Refresh, to activate the query linked to the field only when placing the cursor in
the field and selecting from the menu bar Tools → Search Function → Search (or using the key combination
Shift+F2).

• Select the box Auto Refresh to display an additional field on the right.

Two elements must be selected to conduct an Auto Refresh for a Table type field:
• The first element is the field type used for the refresh operation: by Header field or by Table field.
• The second element is the field name.
Option User action and values Comments
When Field Changes Select to refresh the field when a Header field Any change or update of the selected field
changes. will cause the search field to be refreshed.
Select the required field from the list of Header For example, a change in the selected
fields found in the drop down list located below the Header field will refresh all the rows in the
Auto Refresh box. table.
When Exiting Altered Select to refresh the field when a Table type field Any change or update in the selected field
Column changes. will cause the search field to be refreshed.
Select the required field from the list of Table type
fields found in the drop down list located below the
Auto Refresh box.
Field User action and values Comments
Refresh Regularly Select to refresh the search field each time you open or Avoid using the Refresh Regularly
browse to the document or window containing the option under this type of query since
User-Defined Values. it might affect documents you did not
intend to affect.
If the field is linked to a query that opens a multi- row
'List of' window, the first value appearing on the list will Use the Refresh Regularly option in
be selected. specific cases only, since each time
you browse to an existing document,
all the User-Defined Valueses defined
in the document are activated. This
might cause the document to be
displayed
very slowly.

If you manually change a value


retrieved by a User-Defined Values
and save the document, the next time
you display the document, the
manually changed value will be
calculated again!

Display Saved Values Select to display the value saved in the field during the The field will be refreshed only if you
addition/update of the document. That is, the value replace the field linked to the query.
saved in the database.

Auto Refresh is not implemented in fields that cannot be updated. For example, the G/L Account
Code field in an existing journal entry, the Item Number in an existing Delivery and so on.

Auto Refresh + Refresh Regularly is similar to Auto Refresh + Display Saved Values, apart
from the fact that the last one does not refresh the value when browsing or finding a document.

Limitation: When browsing through editable documents (such as Sales Orders), Header fields
with Auto Refresh are refreshed, however the document status does not change from OK to
Update.
Example 1 - SEARCH IN EXISTING USER-DEFINED VALUES (NO QUERIES LINKED)
Create a User-Defined Value for you Business Partners' Type of Business/Category. The UDV shall be placed in
the Remarks field of the Business Partner Master Data's General tab. The list of values shall be:
Merchandising
Manufacturing
Service
GOCC
Government
Others

SOLUTIONS:
Open Business Partners > Business Partner Master Data
Put your mouse cursor in the Remarks field > Press Alt + Shift + F2
Choose Search in Existing User-Defined Values then Press the Button next to it.

The Field Values-Setup window will appear. Type the needed data:

Click Update every time a data is typed. Click OK to close the window.
Click Update on the User-Defined Values - Setup window:

OUTPUT:
You should see a magnifying glass in the Remarks field of the Business Partner Master Data (under General Tab).
Click on the magnifying glass to choose the Business Partner's Business Type/Category.
Example 2 - SEARCH IN EXISTING USER-DEFINED VALUES ACCORDING TO SAVED QUERIES
Add a User-Defined Field to Show the Business Partner Balance
The company‘s sales staff needs to see the customer’s existing balance when they are on the phone taking a new
order.
1. Add a user-defined field to the title of marketing documents to show the account balance.
Choose the relevant type and structure for amounts.

Click Add. Choose Yes on the system Message and click OK to close the window.

2. Create a query to fetch the business partner balance from the database
SELECT T0.[Balance] FROM OCRD T0 WHERE T0.[CardCode] = $[$4.0.0]
Save this query.
Go to Tools>Queries>Query Generator

Since we do not see any column number in the status bar, we will use zero (0).
Data Type = 0 for String
1 for Number
2 for Currency
3 for Date
Go to Tools > Queries > Query Generator > Execute

Then Click OK.


3. Add the query as user-defined values to the user-defined field
Open a Marketing Document. In this Illustration, Sales Order.
Go to Sales A/R>Sales Order.
To make the user defined field visible, go to View>User Defined Fields
Put the cursor on the user defined field "Balance" and press Shift + F2

Choose Search in Existing User-Defined Values according to Saved Query.


Select the query you saved earlier. Choose Auto Refresh When Field Changes.
Select the Customer/Vendor Code field. Choose Refresh Regularly.

Click OK.
Test the user-defined field
Make sure that there is a customer with a non-zero balance. If necessary, create an invoice for a customer.
In the open sales order, select a customer with balance.
The query will run and the account balance will appear in the field.
Note: To see the account balance on other marketing documents, you need to add user-defined values to each document
type. You can use the same query with these user-defined fields.

EXERCISE 1. Retrieve items from the Item Master Data window in which the Preferred Vendor is identical to the
Vendor
Code selected in a purchasing document. Thus, when creating Purchase Orders, you shall only see the items in
which the chosen Vendor is the assigned as the preferred vendor the Item Master Data window.
SOLUTION
A. Create and save the query as follows:
SELECT ItemCode from OITM Where CardCode = $[$4.0.0]
B. Link the query to the Item No. field in the required purchasing document.

EXERCISE 2. Copy a Sales Quotation to a Purchase Order.


SOULTION
Select from the menu bar Tools →User-Defined Fields →Manage User Fields. Click on Marketing
Documents and click on Title.
Create a user-defined field and name it QUOTNO.
To retrieve items from the required Sales Quotation, create the following query:
SELECT T0.ITEMCODE, T0.QUANTITY, T1.DOCNUM FROM QUT1 T0 INNER JOIN OQUT T1 ON T0.DocEntry =
T1.DocEntry WHERE T1.DocNum = $[OPOR.U_QUOTNO]
Name the query: Get Items from Quotation to Purchase Order.
To retrieve each item’s quantity from the required Sales Quotation, create the following query:
SELECT T0.QUANTITY, T0.ITEMCODE, T1.DOCNUM FROM QUT1 T0 INNER JOIN OQUT T1 ON T0.DocEntry =
T1.DocEntry WHERE T1.DocNum = $[OPOR.U_QUOTNO] AND
T0.ITEMCODE = $[$38.1.0]
Name the query: Get Quantity from Quotation to Purchase Order. Open the Purchase Order window.
Display user-defined fields (View →User-Defined Fields).
Link the query Get Items from Quotation to Purchase Order to the Item No. field. Link the query Get Quantity from
Quotation to Purchase Order to the Quantity field. Select the box Auto Refresh.
Select the Item No. field. Select Display Saved Values.
In the Sales Quotation window, enter the required Sales Quotation number in the QUOTNO user- defined field.
Click the Item No. field in the first row of the table. Press Shift+F2.
Select the required items from the list.
The Quantity field is updated automatically.
Source: http://service.sap.com/smb/sbocustomer/documentation
UNIT V: DATA MIGRATION

Data Migration Options

Import From Excel Import Using DTW

 Business Partners  Business Partners


 Items and Prices  Items
 Price Lists
Import From SAP Business One  Chart of Accounts

 Exported transactions from  Transactions


another SAP Business One  Journal Entries
database
 ...
 ...


Data migration involves selecting, extracting, and importing business data from the client’s legacy
system to SAP Business One.
 Note: Often the client will use data migration as an opportunity to cleanse their legacy data,
especially their customer and vendor data. This is the client’s responsibility, but you should be aware
that this could cause delays to the implementation project. Experienced partners mention that this
point is very often under-estimated and can have a serious impact on the success of the project.
 There are two main ways to import legacy data into SAP Business One – from within SAP Business
One you can use the Data Import from Excel utility, and from outside of SAP Business One you can
use the Data Transfer Workbench (DTW).
 Using the Data Import from Excel utility, you can import business partner data and item data. You
cannot import G/L accounts or transactional data.
 Using the Data Transfer Workbench, you can import a wide variety of objects, including business
partner and item data, the chart of accounts, and transactions such as journal entries and invoices.
 You can also export transactions (documents) from an existing SAP Business One company database
and import them into another SAP Business One company, using the Import Transactions from SAP
Business One window.
Import From Excel Utility

Business
Items
Partners

Microsoft Excel
.txt file .txt file

SAP Business One

 Using the Import From Excel utility, you can import data for business partners, items, and price lists
to a company in SAP Business One. In addition to creating new master records, you can also update
existing master records.
 You prepare the data in Microsoft Excel with the data in columns and then save the spreadsheet as
text (tab delimited).
 Then, in the utility, you select either BP or Items, and you see a complete list of all master data fields
for BP or item master data. You then select the fields to match to the columns in the Excel
spreadsheet. As you select each data field, it is removed from the selection list so you cannot assign
the same field twice.
 The following fields are mandatory in a Microsoft Excel spreadsheet to be imported:
 Business Partner: Code, name, and type (customer, vendor, or lead). If no entry exists for
the type of business partner, the system automatically selects type C for customer.
 Item: Only the item number is required for importing new item master records and updating
existing master records. SAP recommends that you import the expense and revenue
accounts for the item to prevent errors. You can also upload price lists. Specify the item
code, and for every price you want to upload, specify the price list code, price, and price list
currency.
 Choose Administration  Data Import/Export  Data Import  Import from Excel to start the
import from Microsoft Excel.
 After a successful upload, create a query on the table OCRD (business partners), OITM (items), or
ITM1 (price lists) to check if the data was imported correctly.
 Note that, even thought the templates contain every field for the object, you do not have to enter
every field. Leaving them blank in the import file will simply result in them being blank or defaulted
in SAP Business One.
Data Transfer Workbench Templates

Example:
OCRD - BusinessPartners.xlt

Save the completed template as a tab delimited or comma delimited file

 DTW provides Microsoft Excel templates that correspond to the tables in SAP Business One. Each
template is a Microsoft .xlt file and corresponds to an SAP Business One database table. Each
template name starts with the 4 character table name, for example, the main business partner
master data table is OCRD.
 The template contains a title row and comments regarding the type of data that is required for each
column. Refer to the How To Guide for DTW in the SAP Business One documentation for additional
information.
 Do not delete the first two rows in the templates. Start entering your data on row 3.
 Add one additional column for every user-defined field that you want to import.
 After you have entered or pasted your data, save the template as a text file that is tab-delimited or
comma delimited (file type .txt or .csv).
 Note: To import an object, you must have with full authorization to create the object in the SAP
Business One general authorizations. Therefore you must login to DTW as a user with these
authorizations.
Field Types in the Template

Tooltips provide field information:

Type: int
Type: string Type: enum
Specific
values

 In row 1 of the template there are tooltips that provide information of the type of data required in a
field, for example:
 Integer
 String and length
 Enum
 The tooltip for an enum type field provides the list of accepted values, for example:
 cCustomer or cSupplier
 tYES
 tNO
 bop_None
 bom_Buy
Parent and Child Templates

Templates for business partner master data


OCRD - BusinessPartners.xlt CRD4 - BPWithholdingTax.xlt
CRD1 - BPAddresses.xlt CRD5 - BPPaymentDates.xlt
CRD2 - BPPaymentMethods.xlt OCPR - ContactEmployees.xlt
CRD3 - BPAccountReceivablePayble.xlt OCRB - BPBankAccounts.xlt

 If a business
object is represented by only one table in SAP Business One (such as G/L accounts), only one
template is necessary. If a business object is represented by more than one table (for example,
business partner master data where multiple tables are used for addresses and contact persons),
one template for each table is provided.
 The templates are related in a parent and child relationship through Column A.
 There can be multiple rows in a child spreadsheet for a single row in the parent spreadsheet. For
example, there may be multiple contact employees for a business partner.
 The LineNum column in child templates is used only during Update mode. LineNum must be an
integer so if you want to update the first line/record you assign the value 0 to the LineNum field in
the data file. If you wish to update the second line/record, you assign the value 1 to LineNum and so
on.
DTW provides a step-by-step wizard for importing the prepared data in the .txt or .csv file. This uses the Data
Interface API to ensure data consistency.

 You choose the business object that you want to import or update. You can only import or update
one object at a time.
 You choose the data files that you want to import and link them to the object. Depending on the
business object there may be several data files for different tables of the same business object.
 Once you have linked the files to the object, you should verify that all source fields are mapped to
the correct target field. If you have not made any changes to columns in the template files, the
mapping should be correct. In the mapping rules you determine which column in the data file
(source fields) belongs to which field in the system (target fields). The target fields include user-
defined fields and you will need to map them to source fields. You can choose to skip the import of
certain columns by choosing Leave it Blank. You can save and reuse mapping rules.
 You can also let the system check the mapping. It returns error messages if:
 You mapped two different target fields to one source field or two different source fields to
one target field
 You did not map a source field to a mandatory target field
Tips for Data Transfer Workbench

 Get familiar with SAP Business One tables


 Follow the order you would use for manually creating data in SAP Business One
 Only enter fields that you need. Leave fields blank or generate a customized
template
 If you get an error when you import data, try creating the same data manually in
SAP Business One
 Leave the LineNum column blank for import runs
 Format column cells as text
 Use internal codes where needed
 Enter dates as yyyymmdd
 Enter decimal places as used in the localization
 Make sure text data fields do not contain delimiter characters
 To import a journal entry for a business partner, leave the AccountCode field
empty and enter the BP code in the ShortName field
The
first time you use the Data Transfer Workbench you should work with an experienced consultant who knows
the DI-API and table structure in SAP Business One. Familiarize yourself with common tables such as OACT,
OITM, OITB, and OCRD by running SQL queries.

 Follow the same order as you would for manually creating data, for example, create or import the
chart of accounts, currencies, business partner groups, banks, payment terms, item groups and
warehouses first before you import business partners, items, and transactions.
 If you do not need a field, leave it blank. Many fields are set to a default value. If you only use a few
fields, create a customized template.
 If you encounter an error during the import, try creating the same data manually in SAP Business
One
 Leave the LineNum column blank for import. This is only used for update runs.
 Format each cell in the spreadsheet as text. This prevents Excel from formatting or truncating
numeric values.
 Some fields require the internal code from SAP Business One instead of the name, for example:
 Item group codes are internally numbered starting at 100, 101, 102, etc.
 Chart of accounts drawers are internally numbered as 100000000000000,
100000000000000, 100000000000000, etc.
 Enter all dates as yyyymmdd, regardless of localization (for example, 20101215). Make sure you
format the cell as text.
 Enter decimal places as used in the localization, for example, 10,50 or 10.50
 If you import text fields, such as Remarks, make sure the text does not contain the delimiter
character that you are using in the import files, for example, if you are using comma deleted files,
then the Remarks text should not contain any commas.
 To import a journal entry for a business partner, use the Journal Entry templates and leave the
AccountCode field empty and enter the BP code in the ShortName field
Before starting the following exercises, make sure that the posting period is updated.

Exercise 1

Using DTW, import the following business partner groups to SAP Business One:

Vendor Customer
Groups Groups
V Special C Retail
V Corporate C Wholesale
V Sole C Manufacturing
V Media C Middle Men
V Partner C Special

Exercise 2

Using DTW, import the following Business Partners to SAP Business One:

VENDORS
Seq. Vendor Code Vendor Name Vendor Group Payment Terms
1 SN100 Vendor 1 V Special 3 Installments
2 SN200 Vendor 2 V Special 3 Installments
3 SN300 Vendor 3 V Special 3 Installments
4 SN400 Vendor 4 V Special 3 Installments
5 SN500 Vendor 5 V Special 3 Installments
6 SN600 Vendor 6 V Special 3 Installments

7 SN700 Vendor 7 V Special 3 Installments


8 SN800 Vendor 8 V Special 3 Installments
9 SN900 Vendor 9 V Special 3 Installments
10 SN1000 Vendor 10 V Special 3 Installments
11 SN1100 Vendor 11 V Corporate Net 30
12 SN1200 Vendor 12 V Corporate Net 30
13 SN1300 Vendor 13 V Corporate Net 30
14 SN1400 Vendor 14 V Corporate Net 30
15 SN1500 Vendor 15 V Corporate Net 30
16 SN1600 Vendor 16 V Corporate Net 30
17 SN1700 Vendor 17 V Corporate Net 30
18 SN1800 Vendor 18 V Corporate Net 30
19 SN1900 Vendor 19 V Corporate Net 30
20 SN2000 Vendor 20 V Corporate Net 30
21 SN2100 Vendor 21 V Sole Net 30
22 SN2200 Vendor 22 V Sole Net 30
23 SN2300 Vendor 23 V Sole Net 30
24 SN2400 Vendor 24 V Sole Net 30
25 SN2500 Vendor 25 V Sole Net 30
26 SN2600 Vendor 26 V Sole Net 30
27 SN2700 Vendor 27 V Sole Net 30
lert28 SN2800 Vendor 28 V Sole Net 30
29 SN2900 Vendor 29 V Sole Net 30
30 SN3000 Vendor 30 V Sole Net 30
31 SN3100 Vendor 31 V Media 2P10Net30
32 SN3200 Vendor 32 V Media 2P10Net30
33 SN3300 Vendor 33 V Media 2P10Net30
34 SN3400 Vendor 34 V Media 2P10Net30
35 SN3500 Vendor 35 V Media 2P10Net30
36 SN3600 Vendor 36 V Media 2P10Net30
37 SN3700 Vendor 37 V Media 2P10Net30
38 SN3800 Vendor 38 V Media 2P10Net30
39 SN3900 Vendor 39 V Media 2P10Net30
40 SN4000 Vendor 40 V Media 2P10Net30
41 SN4100 Vendor 41 V Partner 2P10Net30
42 SN4200 Vendor 42 V Partner 2P10Net30
43 SN4300 Vendor 43 V Partner 2P10Net30
44 SN4400 Vendor 44 V Partner 2P10Net30
45 SN4500 Vendor 45 V Partner 2P10Net30
46 SN4600 Vendor 46 V Partner 2P10Net30
47 SN4700 Vendor 47 V Partner 2P10Net30
48 SN4800 Vendor 48 V Partner 2P10Net30
49 SN4900 Vendor 49 V Partner 2P10Net30
50 SN5000 Vendor 50 V Partner 2P10Net30

CUSTOMERS
Seq. Customer Code Customer Name Customer Group Payment Terms
1 CN100 Customer 1 C Retail Cash
2 CN200 Customer 2 C Retail Cash
3 CN300 Customer 3 C Retail Cash
4 CN400 Customer 4 C Retail Cash
5 CN500 Customer 5 C Retail Cash
6 CN600 Customer 6 C Retail Cash
7 CN700 Customer 7 C Retail Cash
8 CN800 Customer 8 C Retail Cash
9 CN900 Customer 9 C Retail Cash
10 CN1000 Customer 10 C Retail Cash
11 CN1100 Customer 11 C Wholesale 2P10Net30
12 CN1200 Customer 12 C Wholesale 2P10Net30
13 CN1300 Customer 13 C Wholesale 2P10Net30
14 CN1400 Customer 14 C Wholesale 2P10Net30
15 CN1500 Customer 15 C Wholesale 2P10Net30
16 CN1600 Customer 16 C Wholesale 2P10Net30
17 CN1700 Customer 17 C Wholesale 2P10Net30
18 CN1800 Customer 18 C Wholesale 2P10Net30
19 CN1900 Customer 19 C Wholesale 2P10Net30
20 CN2000 Customer 20 C Wholesale 2P10Net30
21 CN2100 Customer 21 C Manufacturing 2P10Net30
22 CN2200 Customer 22 C Manufacturing 2P10Net30
23 CN2300 Customer 23 C Manufacturing 2P10Net30
24 CN2400 Customer 24 C Manufacturing 2P10Net30
25 CN2500 Customer 25 C Manufacturing 2P10Net30
26 CN2600 Customer 26 C Manufacturing 2P10Net30
27 CN2700 Customer 27 C Manufacturing 2P10Net30
28 CN2800 Customer 28 C Manufacturing 2P10Net30
29 CN2900 Customer 29 C Manufacturing 2P10Net30
30 CN3000 Customer 30 C Manufacturing 2P10Net30
31 CN3100 Customer 31 C Middle Men 2P10Net30
32 CN3200 Customer 32 C Middle Men 2P10Net30
33 CN3300 Customer 33 C Middle Men 2P10Net30
34 CN3400 Customer 34 C Middle Men 2P10Net30
35 CN3500 Customer 35 C Middle Men 2P10Net30
36 CN3600 Customer 36 C Middle Men 2P10Net30
37 CN3700 Customer 37 C Middle Men 2P10Net30
38 CN3800 Customer 38 C Middle Men 2P10Net30
39 CN3900 Customer 39 C Middle Men 2P10Net30
40 CN4000 Customer 40 C Middle Men 2P10Net30
41 CN4100 Customer 41 C Special 3 Installments
42 CN4200 Customer 42 C Special 3 Installments
43 CN4300 Customer 43 C Special 3 Installments
44 CN4400 Customer 44 C Special 3 Installments
45 CN4500 Customer 45 C Special 3 Installments
46 CN4600 Customer 46 C Special 3 Installments
47 CN4700 Customer 47 C Special 3 Installments
48 CN4800 Customer 48 C Special 3 Installments
49 CN4900 Customer 49 C Special 3 Installments
50 CN5000 Customer 50 C Special 3 Installments

Exercise 3

Using DTW, add the following items to SAP Business One

Item Code Item Name Item Group Preferred Vendor Unit Price
M100 New Item 1 Items SN300 100
M200 New Item 2 Items SN800 200
M300 New Item 3 Items SN1600 100
M400 New Item 4 Items SN1600 50
M500 New Item 5 Items SN1600 150
M600 New Item 6 Items SN1600 120
M700 New Item 7 Items SN1600 80
M800 New Item 8 Items SN1600 70
M900 New Item 9 Items SN1600 65
M1000 New Item 10 Accessories SN1600 65
M1100 New Item 11 Accessories SN1600 65
M1200 New Item 12 Accessories SN1600 65
M1300 New Item 13 Accessories SN1600 65
M1400 New Item 14 Accessories SN1600 65
M1500 New Item 15 Accessories SN1600 300

Exercise 3

Using DTW, create A/P invoices using the following information:

AP Invoice 1 AP Invoice 2 AP Invoice 3


Vendor SN100 Vendor SN1000 Vendor SN2000
Posting Date 25-Aug-13 Posting Date 1-Jul-14 Posting Date 13-Feb-15
Due Date 25-Aug-13 Due Date 1-Jul-14 Due Date 13-Feb-15
Document Date 25-Aug-13 Document Date 1-Jul-14 Document Date 13-Feb-15

Item Code Quantity Item Code Quantity Item Code Quantity


IN100 250 IN400 100 IN600 80
IN200 250 IN500 50
IN300 100

Exercise 4

Using DTW, create AR invoices using the following information:

A/R Invoice 1 A/R Invoice 2


Customer CN100 Customer CN200
Posting Date 13-Feb-15 Posting Date 13-Feb-15
Due Date 13-Feb-15 Due Date 13-Feb-15
Document Date 13-Feb-15 Document Date 13-Feb-15

Item Code Quantity Item Code Quantity


IN100 10 IN400 5
IN200 20 IN200 14
IN300 30 IN600 8
IN100 20

Notes:
 For do not encode comma (,) on files saved as .csv
 For fields whose valid values are tNO and tYES, use N for tNO and Y for tYES if you encounter this
error: "Data is too large".
 When importing chart of accounts, you may also use the following you encounter the error "Data is
too large."
I (for Income) instead of at_Revenues
E (for Expenses) instead of at_Expenses
N (for Not applicable) instead of at_Other
 If you still encounter the same error even after changing the valid values, check the spelling of the
valid values you used in the DTW template. (e.g. you may have typed CCustomer instead of
cCustomer, or n instead of N)
SOLUTIONS:

Exercise 1

Using DTW, import the following business partner groups to SAP Business One:

Vendor Customer
Groups Groups
V Special C Retail
V Corporate C Wholesale
V Sole C Manufacturing
V Media C Middle Men
V Partner C Special

1. Open Data Transfer Workbench


Start>All Programs>SAP Business One > Data Migration> Templates

2. On the Templates folder, open Administration > Setup > Business Partners > Business Partner Group

Open the Microsoft Excel Template OCRG - BusinessPartnerGroups. (OCRG is the table name for Vendor
Groups and Customer groups in SAP Business One)
3. Enter the required information.

GroupCode: Since we are just adding data, we can use 1,2,3,...etc. However, If we will update a Vendor
Group, we will use the exact group code in SAP Business One. We can check the group code through the
query generator.

GroupName: Enter the desired business partner group name

GroupType: Vendor or Customer Group - bbpgt_VendorGroup for Vendor and bbpgt_CustomerGroup for
Customer. (Mouse Over to the Column Headers/Titles to have a hint on how to input the required data)

Output:
4. Save the file as Comma delimited (.csv) with file name OCRG - BusinessPartnerGroups_UL (You can choose
a different file name)

5. Open SAP Business One Data Transfer Workbench


Start > All Programs > SAP Business One> Data Migration > Data Transfer Workbench
(If the databases are not appearing, click Refresh)

Log in to the database as instructed by your Professor.


6. Import the file to SAP Business One
Click Import > Next
On Step 1: Choose Set-up Data > Next
On Step 2: Choose Add New Data > Next
On Step 3: Choose Administration > Setup > Business Partners > Business Partner Groups > Next
On Step 4: Browse for the csv file prepared to add the new business partner groups > Next
On Step 5: Click Next
On Step 6: Click Next
On Step 7: Click Import
Click Finish
7. Log in to SAP Business One (using the database where the .csv file was migrated) and view the new
Business Partner Groups
Administration>Setup>Business Partners>Vendor Groups
Administration>Setup>Business Partners>Customer Groups

Exercise 2

Using DTW, import the following Business Partners to SAP Business One:
VENDORS
Seq. Vendor Code Vendor Name Vendor Group Payment Terms
1 SN100 Vendor 1 V Special 3 Installments
2 SN200 Vendor 2 V Special 3 Installments
3 SN300 Vendor 3 V Special 3 Installments
4 SN400 Vendor 4 V Special 3 Installments
5 SN500 Vendor 5 V Special 3 Installments
6 SN600 Vendor 6 V Special 3 Installments
7 SN700 Vendor 7 V Special 3 Installments
8 SN800 Vendor 8 V Special 3 Installments
9 SN900 Vendor 9 V Special 3 Installments
10 SN1000 Vendor 10 V Special 3 Installments
11 SN1100 Vendor 11 V Corporate Net 30
12 SN1200 Vendor 12 V Corporate Net 30
13 SN1300 Vendor 13 V Corporate Net 30
14 SN1400 Vendor 14 V Corporate Net 30
15 SN1500 Vendor 15 V Corporate Net 30
16 SN1600 Vendor 16 V Corporate Net 30
17 SN1700 Vendor 17 V Corporate Net 30
18 SN1800 Vendor 18 V Corporate Net 30
19 SN1900 Vendor 19 V Corporate Net 30
20 SN2000 Vendor 20 V Corporate Net 30
21 SN2100 Vendor 21 V Sole Net 30
22 SN2200 Vendor 22 V Sole Net 30
23 SN2300 Vendor 23 V Sole Net 30
24 SN2400 Vendor 24 V Sole Net 30
25 SN2500 Vendor 25 V Sole Net 30
26 SN2600 Vendor 26 V Sole Net 30
27 SN2700 Vendor 27 V Sole Net 30
28 SN2800 Vendor 28 V Sole Net 30
29 SN2900 Vendor 29 V Sole Net 30
30 SN3000 Vendor 30 V Sole Net 30
31 SN3100 Vendor 31 V Media 2P10Net30
32 SN3200 Vendor 32 V Media 2P10Net30
33 SN3300 Vendor 33 V Media 2P10Net30
34 SN3400 Vendor 34 V Media 2P10Net30
35 SN3500 Vendor 35 V Media 2P10Net30
36 SN3600 Vendor 36 V Media 2P10Net30
37 SN3700 Vendor 37 V Media 2P10Net30
38 SN3800 Vendor 38 V Media 2P10Net30
39 SN3900 Vendor 39 V Media 2P10Net30
40 SN4000 Vendor 40 V Media 2P10Net30
41 SN4100 Vendor 41 V Partner 2P10Net30
42 SN4200 Vendor 42 V Partner 2P10Net30
43 SN4300 Vendor 43 V Partner 2P10Net30
44 SN4400 Vendor 44 V Partner 2P10Net30
45 SN4500 Vendor 45 V Partner 2P10Net30
46 SN4600 Vendor 46 V Partner 2P10Net30
47 SN4700 Vendor 47 V Partner 2P10Net30
48 SN4800 Vendor 48 V Partner 2P10Net30
49 SN4900 Vendor 49 V Partner 2P10Net30
50 SN5000 Vendor 50 V Partner 2P10Net30

CUSTOMERS
Seq. Customer Code Customer Name Customer Group Payment Terms
1 CN100 Customer 1 C Retail Cash
2 CN200 Customer 2 C Retail Cash
3 CN300 Customer 3 C Retail Cash
4 CN400 Customer 4 C Retail Cash
5 CN500 Customer 5 C Retail Cash
6 CN600 Customer 6 C Retail Cash
7 CN700 Customer 7 C Retail Cash
8 CN800 Customer 8 C Retail Cash
9 CN900 Customer 9 C Retail Cash
10 CN1000 Customer 10 C Retail Cash
11 CN1100 Customer 11 C Wholesale 2P10Net30
12 CN1200 Customer 12 C Wholesale 2P10Net30
13 CN1300 Customer 13 C Wholesale 2P10Net30
14 CN1400 Customer 14 C Wholesale 2P10Net30
15 CN1500 Customer 15 C Wholesale 2P10Net30
16 CN1600 Customer 16 C Wholesale 2P10Net30
17 CN1700 Customer 17 C Wholesale 2P10Net30
18 CN1800 Customer 18 C Wholesale 2P10Net30
19 CN1900 Customer 19 C Wholesale 2P10Net30
20 CN2000 Customer 20 C Wholesale 2P10Net30
21 CN2100 Customer 21 C Manufacturing 2P10Net30
22 CN2200 Customer 22 C Manufacturing 2P10Net30
23 CN2300 Customer 23 C Manufacturing 2P10Net30
24 CN2400 Customer 24 C Manufacturing 2P10Net30
25 CN2500 Customer 25 C Manufacturing 2P10Net30
26 CN2600 Customer 26 C Manufacturing 2P10Net30
27 CN2700 Customer 27 C Manufacturing 2P10Net30
28 CN2800 Customer 28 C Manufacturing 2P10Net30
29 CN2900 Customer 29 C Manufacturing 2P10Net30
30 CN3000 Customer 30 C Manufacturing 2P10Net30
31 CN3100 Customer 31 C Middle Men 2P10Net30
32 CN3200 Customer 32 C Middle Men 2P10Net30
33 CN3300 Customer 33 C Middle Men 2P10Net30
34 CN3400 Customer 34 C Middle Men 2P10Net30
35 CN3500 Customer 35 C Middle Men 2P10Net30
36 CN3600 Customer 36 C Middle Men 2P10Net30
37 CN3700 Customer 37 C Middle Men 2P10Net30
38 CN3800 Customer 38 C Middle Men 2P10Net30
39 CN3900 Customer 39 C Middle Men 2P10Net30
40 CN4000 Customer 40 C Middle Men 2P10Net30
41 CN4100 Customer 41 C Special 3 Installments
42 CN4200 Customer 42 C Special 3 Installments
43 CN4300 Customer 43 C Special 3 Installments
44 CN4400 Customer 44 C Special 3 Installments
45 CN4500 Customer 45 C Special 3 Installments
46 CN4600 Customer 46 C Special 3 Installments
47 CN4700 Customer 47 C Special 3 Installments
48 CN4800 Customer 48 C Special 3 Installments
49 CN4900 Customer 49 C Special 3 Installments
50 CN5000 Customer 50 C Special 3 Installments

1. Open SAP Business One Data Transfer Workbench window


Start>All Programs>SAP Business One > Data Migration> Templates> Templates> Business Partners >
Business Partner Master Data > OCRD - BusinessPartners
(OCRD is the table name for Business Partner Master Data)
The Microsoft Excel template file consists of complete columns found in the Business Partner Master Data
table.
Based on the needed data above, we will only need the following columns:
 CardCode (for BP Code)
 CardName (for BP Name)
 CardType (to indicate whether the BP is a Vendor, Customer or Lead)
 GroupCode (for Vendor Group/Customer Group)
 PayTermsGrpCode (for BP Payment Terms)

OPTIONAL: You may delete unnecessary columns and leave only the five columns listed above.

On the CardType column (mouse over to the column header/title to view valid values), the following are the
valid values:
 cCustomer (for Customer)
 cSupplier (for Vendor)
 cLid (for Lead)

On the GroupCode Column, enter the actual group code assigned in SAP Business One.

To view the actual GroupCode, go to Tools> Queries> Query Generator> Click Execute> Activate the Edit
Mode by clicking this icon:
Type select * from ocrg > click Execute

On the PayTermsGrpCode, enter the Payment Terms code set in SAP Business One. You can check the
Payment Terms codes using query generator.

Using Query Generator, the Payment Terms codes are:

OCTG is the table name for the Payment Terms table in SAP Business One:
To check the table name, go to Administration> Setup> Business Partners> Payment Terms
(click Ctrl + Shift + I or go to View> System Information then mouse over to any field in the Payment
Terms window to view the table name)
Since you already have the required date, fill out the needed columns in the Microsoft Excel template file
OCRD - BusinessPartners:

Save the file as Comma delimited (.csv). Name it as OCRD - BusinessPartners_UL (or any file name of your
preference)
2. Import the file to SAP Business One using Data Transfer Workbench
On the DTW window, Click Import > Next
On Step 1: Choose Master Data > Next
On Step 2: Choose Add New Data > Next
On Step 3: Choose Business Partners > Business Partner Master Data > Next
On Step 4: Browse for the csv file prepared to add the new business partners > Next

On Step 5: Click Next


On Step 6: Click Next
On Step 7: Click Import
Click Finish

The system message shall state "100 Business Objects were imported successfully"
Log in to SAP Business One, and view the new Business Partners added:

Business Partners> Business Partner Master Data


Type * on the Code field and press enter (make sure you are in Find mode)
Scroll down to view the new Business Partners

Exercise 3

Using DTW, add the following items to the Item Master Data in SAP Business One
Item Code Item Name Item Group Preferred Vendor Unit Price
M100 New Item 1 Items SN300 100
M200 New Item 2 Items SN800 200
M300 New Item 3 Items SN1600 100
M400 New Item 4 Items SN1600 50
M500 New Item 5 Items SN1600 150
M600 New Item 6 Items SN1600 120
M700 New Item 7 Items SN1600 80
M800 New Item 8 Items SN1600 70
M900 New Item 9 Items SN1600 65
M1000 New Item 10 Items SN1600 65
M1100 New Item 11 Accessories SN1600 65
M1200 New Item 12 Accessories SN1600 65
M1300 New Item 13 Accessories SN1600 65
M1400 New Item 14 Accessories SN1600 65
M1500 New Item 15 Accessories SN1600 300

1. Open the template file(s) needed to add Item Master Data


Start>All Programs>SAP Business One > Data Migration> Templates> Templates> Inventory> Item Master
Data> OITM - Items
(OITM is the table name for Item Master Data)

The Microsoft Excel template file consists of complete columns found in the Item Master Data table.
Based on the needed data above, we will only need the following columns:
 ItemCode
 Item Name
 Items Group Code (use the Query Generator to view the Items Group Code)
 Mainsupplier (for Preferred Vendor)
(Notice the there is no column for the Unit Price. This is because, the unit price is entered in a separate
Microsoft Excel template file ITM1 - Items_Prices.)

2. Open the Query Generator to view the Items Group code.

The Table name for Items Group can be viewed in Administration> Setup> Inventory> Item Groups
(Click Ctrl + Shift + I and mouse over to the Item Group Name field)
3. Enter the required date in the template file OITM - Items. The output should be:

(Note: you may delete columns that are not needed)

4. Save the file as Comma delimited (.csv). Name it as OITM - Items_UL (you may choose a different file
name)

5. Encode the prices in Miscrosoft Office Excel template file OITM - Items_Prices
Start>All Programs>SAP Business One > Data Migration> Templates> Templates> Inventory> Item Master
Data> ITM1 - Items_Prices).

Put the integer "1" under the price list column, indicating that the price entered will be the item's Base Price.
The integer "1" for Base Price is determined through the use of the Query Generator:
The output should be:

Keep the LineNum Column Empty when saving the file/ when importing the file. You may also input the
currency GBP. This is already the currency setup in the OEC Computers Database, hence, you may leave this
column blank.

Save the file as Comma delimited (.csv). Name it as OITM - Items_Prices (or any other file name as you see
fit).

6. Using DTW, import the two csv files (OITM - Items and ITM1 -Items_Prices) to SAP Business One.
Click Import > Next
On Step 1: Choose Master Data > Next
On Step 2: Choose Add New Data > Next
On Step 3: Choose Inventory > Item Master Data> Next
On Step 4: Browse for the OITM - Items_UL in the Parent Object Items
Browse for the ITM1 - Items_Prices_UL in the Child Object for Items_Prices
On Step 5: Click Next
On Step 6: Click Next
On Step 7: Click Import
Click Finish

Log in to SAP Business One and view the Items added to the Items Master Data
Inventory> Item Master Data
Type * in the Item number field and press enter. Scroll down to view the items added
Exercise 4
Using DTW, create A/P invoices using the following information:
AP Invoice 1 AP Invoice 2 AP Invoice 3
Vendor SN100 Vendor SN1000 Vendor SN2000
Posting Date 25-Aug-13 Posting Date 1-Jul-14 Posting Date 13-Feb-15
Due Date 25-Aug-13 Due Date 1-Jul-14 Due Date 13-Feb-15
Document Date 25-Aug-13 Document Date 1-Jul-14 Document Date 13-Feb-15

Item Code Quantity Item Code Quantity Item Code Quantity


IN100 250 IN400 100 IN600 80
IN200 250 IN500 50
IN300 100

1. Open SAP Business One Data Transfer Workbench


Start>All Programs>SAP Business One > Data Migration> Templates> Templates> Purchasing> AP Invoice>
OPCH - Documents
(OPCH is the table name for AP Invoice)

The Microsoft Excel template file consists of complete columns found in the AP Invoice table.
Based on the needed data above, we will only need the following columns:
 DocNum (1 for the first AP Invoice, 2 for the Second AP Invoice, 3 for the Third AP Invoice, etc...)
 DocType (dDocuments_Items for Purchased Items and dDocuments_Service for Purchased Services)
 DocDate (Document Date: format should be YYYYMMDD)
 DocDueDate (Due Date: format should be YYYYMMDD)
 CardCode (Vendor Code)
 TaxDate (Posting Date: format should be YYYYMMDD)
The output should be:

2. The items and quantities in the contents tab of the AP Invoice are encoded in a separate Microsoft Office
Excel template file PCH1 - Document_Lines
(Start>All Programs>SAP Business One > Data Migration> Templates> Templates> Purchasing> AP Invoice>
PCH1 - Document_Lines)

PCH1 is the table name for the contents tab of the AP Invoice Document.

The Microsoft Excel template file consists of complete columns found in the AP Invoice document.
Based on the needed data above, we will only need the following columns:
 ParentKey (the DocNum based on OPCH - Documents_UL)
 LineNum (Row number under the contents tab of AP invoice Document)
 ItemCode
 Quantity
* If the purchase price of the items are not the same with the unit price entered in the Item Master
Data, you will input the purchase price in the Price column. In this exercise, since the purchase price
is not given, we assume that the purchase price would be the base price set in the Item Master Data.
The output should be:
3. Save the file as Comma delimited (.csv). Name the file as OPCH - Documents_UL (or any file name of your
preferrence)

4. Import to the Parent Object (OPCH - Documents_UL) and the Child Object (PCH1 - Document_Lines_UL) to
SAP Business One using DTW

Open Data Transfer Workbench and log-in to the database you used in the previous exercises
Click Import > Next
On Step 1: Choose Transactional Data > Next
On Step 2: Choose Add New Data > Next
On Step 3: Choose Purchasing > AP Invoice> Next
On Step 4: Browse for the OPCH - Documents_UL in the Parent Object Documents
Browse for the PCH1 - Document_Lines_UL in the Child Object for Document_Lines
> Next
On Step 5: Click Next
On Step 6: Click Next
On Step 7: Click Import. Click Finish
Log in to SAP Business One and view the AP Invoice created.
Purchasing AP> AP Invoice. Click the Last Data Record on the tool bar:

Then click the Previous Data Record on the tool bar:

Click again the Previous Data Record on the toolbar:


Exercise 5: Add the following items using Data Import
Item Number Item Description Item Group Price List Unit Price
DC1000 HP PC Set Desktop Computers Base Price GBP 40,000.00
LT1000 Lenovo S410p Laptop Laptops Base Price GBP 25,000.00
MP1000 Nokia Lumia X5000 Mobile Phones Base Price GBP 11,000.00
AC1000 Phillips B100 Headphones Accessories Base Price GBP 2,000.00
a. Go to Administration>Data Import/Export>Data Import>Import from Excel.
b. Choose Items in the Data Type to Import field. Follow the screen shots below:
c. Encode the above items to Microsoft Office Excel For the Base Price, Enter the code of the price list
Base Price. You can Check the code through the SQL Server or through the SAP B1 Query Generator:
SELECT * from OPLN

d. Save the excel file as Text (Tab Delimited) or paste the encoded data in note pad.
Use any file name as you see fit.
e. Import the text file to SAP Business One (Make sure to close the excel file when importing):
f. Go back to SAP Business One and Check the imported data in Inventory>Item Master Data
UNIT VI: PRINT LAYOUT DESIGN

1. Log-in to Computers UK using the account of the manager - Jayson Buttler


2. Create an A/R Invoice with the following details. Go to Sales A/R > A/R Invoice
Customer Code: C20000
Item No: Quantity
A00001 10
A00002 10
C00001 10
Add the A/R Invoice
3. Open another SAP Business One and log-in as Alex (All in all, two windows oF SAP Business One are
open)
Username: alex Password: (leave it blank if this is your first time to use the account of alex)

You will be asked to enter a new Password.


Old Password: (none) New Password: 1234 Confirm: 1234

4. Open the A/R Invoice created using Alex's account


Click the Layout Designer icon on the tool bar (pencil icon).
Choose AR Invoice (System) then click Set as Defualt. Click OK, Update, then OK.
and click the Print Preview icon on the tool bar and check the print layout.

5. Design the Print Layout for OEC Computer UK's A/R Invoices. It should show the following:
1. Prepared by: (who created the A/R Invoice)
2. Printed by: (who printed the invoice)
3. Printed on: (Date and Time of printing)
You may position the new fields to any part of the document as you see fit.

6. Close the print preview window of the A/R Invoice and start designing the print layout repot for A/R
Invoice.
A. Create a user defined field in marketing documents that shows who is the current user (you will
use this for the Printed by field of your Print Layout).
a. Choose Tools  Customization Tools  User-Defined Fields – Management.
b. Select Marketing Documents > Title
Choose Add and enter the following details:
Field Name or Data Type Values
Title (no spaces) User
Description User Name
Type Alphanumeric
Length 20
Structure Regular
c. Click Add. Choose Yes on the system message. Close all other windows.

d. Create a query to show the current user


Tools  Queries  Query Generator
Click Execute, then choose Edit Mode. Enter the following syntax (this will show the current
user):
SELECT U_NAME FROM OUSR WHERE INTERNAL_K = $[USER]
Click Save. Enter the following:
Query Name: User Category: General
Click Save.

e. Link the query to the created user-defined field for User:


Open Sales A/R > A/R Invoice.
Make the user defined field visible: View > User-Defiend Field
Position the cursor to the User Defined Field "User".
Click Alt+Shift+F2. Choose: Search in Existing User-Defined Values according to Saved
Query
Click Open saved Query and choose the query created to show the current user.
Choose Auto Refresh When Field Changes. Follow the image below:

Click Update.
f. Design the Print Layout (Do not close the A/R Invoice window)
Click the Layout Designer icon on the tool bar (pencil icon).
Choose AR Invoice (System) then click Manage Layout, then Edit.

g. Create the additonal field required:


To add a field, right click then choose Add field and select a field type.
Save the Print Layout: Right Click then Save as > Choose a file name.
Close All windows except the A/R Invoice.
Set the saved Print Layout Design as Default.
Click again the Layout Designer icon ont he tool bar.
Choose the layout you created then choose Set as Default.
Choose OK, Update, then OK.
You may now check the print preview of your A/R Invoice.

UNIT VII: DATABASE BACKUP AND RESTORE


Database Backup
As a database administrator, "Backup" is an important database management and maintenance task. Backup is an
exact copy of a database/program at a point in time. Hence, a backup can be restored as the original database in
case of disaster or database maintenance.

SAP Business One is an ERP system that sits on a number of database systems which includes Microsoft SQL Server,
IBM DB2 and Sybase.

For the purpose of this material, the emphasis is on Microsoft SQL Server. It is worth mentioning that SAP Business
One has a traditional backup utility called the SBO Backup Service. Microsoft SQL Server also has its own backup
tool resident in the enterprise manager.
Source: http://it.toolbox.com/blogs/sap-library/difference-between-sap-business-one-backup-and-microsoft-sql-
server-backup-9533
HOW TO BACKUP A DATABASE:
Backup the database which you are currently using (either SBODemoGB1, SBODemoGB2, SBODemoGB3, etc.)
1. Minimize SAP Business One. Go to Start > All Programs > Microsoft SQL Server 2005 (or 2008 if your Microsoft
SQL Server is 2008)> SQL Server Management Studio Express
2. In the Authentication field, choose "SQL Server Authentication" and Enter the following then click Connect
Username: sa Password: B1Admin

4. Click the Plus sign next to Databases to view all Databases.

5. Right Click on the Database you want to backup. Choose Tasks>Backup

6. Click Remove (to remove the default path) then click Add to choose where to save the backup file.
7. Select a destination for the backup file
8. Choose a path. Save the file as ".bak". Click OK.

9. Click OK, then OK again.

10. You shall see the message below. Click OK then close the SQL Server.
10. Open your chosen backup file destination to view the backup file. We will be using the backup file in the
succeeding activities.

SOLUTION:
NOTE: Do not delete anything from the SQL Server, otherwise you might delete your own database or other
databases being utilized by other classes.

STEP 1. Go to Start > All Programs > Microsoft SQL Server 2005 > SQL Server Management Studio
Express
STEP 2. In the Authentication field choose "SQL Server Authentication", enter the following:
Username: sa
Password: B1Admin
Click Connect

STEP 3. Right click on the Databases folder and choose Restore Database
STEP 4. Enter a Database Name on the To Database field (type your name, please note that
spaces are not allowed)
Under Source for restore, Choose From Device and click the browse button beside the From Device
field
Choose Add on the Specify Backup window

STEP 5. Locate the backup file StudentName.bak - remember that you were asked to save the file
with your name as the filename. (In this illustration, it is located in my PCs Drive D.).
Click Add, then click the backup file. Click OK, then OK again
STEP 6. Click OK

STEP 7. Select the file to be restored by clicking the check box under the Restore column and click OK.

NOTE: If the error bellow occur, Click on Options on the upper left of the window. If no errors were
encountered, proceed to STEP 8 in the succeeding pages.
The error above occurs either because the path is incorrect or because StudentName.bak already exist in
SAP Business One Databases or both.
if your OS is 64-bit, the path should start with Program Files (x86). For 32-bit, the path should start
with Program Files.

Edit the original file's database name. In this illustration, the backup file was originally taken from
SBODemoGB2. It was updated as SBODemoGB(Restored).

Click OK
STEP 8. The system should confirm successful restoration of database.

Close MSSQL.

STEP 9. Open SAP Business One


Choose Change Company, click Refresh
Student Name should already be on the list of databases in SAP Business One
Log-in to the newly restored database - use User ID and Password manager.
Open Sales A/R > Sales Order.
View the user-defined fields (UDF) by going to View > User-Defined Fields.
Since the restored database is saved before the creation of UDF's, you should not see any UDF.
Log in to the original database assigned to your class.

You might also like