Escolar Documentos
Profissional Documentos
Cultura Documentos
For example, your client requires end users to enter BP Name and Customer Code with a certain naming
conversion when adding or updating a Business Partner in SAP Business One.
Rule #1: The BP Name must be entered when adding or updating a BP in SAP Business One.
When the end user is entering or updating a Business Partner master data record in SAP Business One, they
wont able to save the BP unless the BP Name is entered.
If the BP Name field is blank, SAP Business One blocks adding or updating this BP, and displays the error
message Enter BP Name in the status bar.
Rule #2: The customer code must follow the naming convention C****** when adding or updating a customer
record in SAP Business One.
The customer code must start with prefix C indicating it as a customer. Any other leading character will not be
allowed for customer entry and will result in the error message Customer Code must start with C.
Solution Options:
Option 1: Implement these additional validation rules with a customized UI API Add-On by listening for
ItemEvent(et_Click) of the Add/Update button in the BP Master Data form. The validation will be triggered
when the button is clicked. Before SAP Business One commits the transaction the BPName is validated
against the rule. If the BPNAme violates the rule, SAP Business One stops the transaction by setting
BubbleEvent as false. However, this document doesnt aim to discuss this in detail.
Option 2: Customizing SAP Business One, Version for SAP HANA with SSP add-on solutions, such as B1UP
(SAP Business One Usability Package) from BoyumIT, CoreSuites from CoreSystems etc. Please contact the
SSP directly if youre interested on it.
Option 3: Customizing SAP Business One, version for SAP HANA by implementing the built-in procedure
SBO_SP_TransactionNotification with SAP HANA SQL Script. The following sections will discuss the solution
in detail.
Implementing SBO_SP_TransactionNotification
with SAP HANA SQL Script
SBO_SP_TransactionNotification is a built-in procedure of SAP Business One which is triggered when
Adding/Updating/Deleting a record of any business data, such as Business Partner Master Data, Marketing
Documents (Sales Order, A/R Invoice etc.), etc.
Prerequisites: You should have knowledge of SAP HANA SQL and SQL Script. More details about SAP HANA
SQL and SQL Script are available here.
http://help.sap.com/hana_platform#section7
http://help.sap.com/hana/SAP_HANA_SQL_and_System_Views_Reference_en.pdf
http://help.sap.com/hana/SAP_HANA_SQL_Script_Reference_en.pdf
The interface of SBO_SP_TransactionNotification:
in transaction_type nchar(1),
-- [A]dd, [U]pdate, [D]elete, [C]ancel, C[L]ose
in num_of_cols_in_key int,
in list_of_key_cols_tab_del nvarchar(255),
in list_of_cols_val_tab_del nvarchar(255) ) LANGUAGE SQLSCRIPT AS -Return values
error int;
-- Result (0 for no error)
error_message nvarchar (200); -- Error string to be displayed
begin error := 0;
error_message := N'Ok';
----------------------------------------------------------------------ADD
YOUR CODE HERE
---------------------------------------------------------------------- -Select the return values
select
:error,
:error_message
FROM dummy;
end;
Parameters
@objecttype
@transaction_type
@num_of_cols_in_key
Example
2 (Business Partner)
U (update)
1
@list_of_key_cols_tab_de
l
CardCode
@list_of_cols_val_tab_de
l
C40001
error := 0;
error_message := N'Ok';
----------------------------------------------------------------------ADD
YOUR CODE HERE
--Adding additional validation rules for BP.
if :object_type='2' and (:transaction_type='A' or :transaction_type='U') t
hen
--Scenario#1: Check if records count number of given CardCode and
--CardName is blank
select count(*) into cnt from "SBODEMOUS"."OCRD"
where "CardCode" =
:list_of_cols_val_tab_del and IFNULL("CardName",'')='';
if :cnt>0 then
error := -111;
error_message := 'Enter BP Name';
end if;
--Scenario#2: Check if records count number of given CardCode
and
--it is a customer
--and CardCode doesn't with C
cnt := 0; --Reset the count again for next validation
select count(*) into cnt from "SBODEMOUS"."OCRD"
where "CardType" = 'C' and "CardCode" =
:list_of_cols_val_tab_del andnot("CardCode" like 'C%');
if :cnt>0 then
error := -112;
error_message := 'Customer Code must start with C';
end if;
END if;
----------------------------------------------------------------------- Select the return values
select
:error,
:error_message
FROM dummy;
end;
About SAP HANA SQLScript
SQLScript is a collection of extensions to Structured Query Language (SQL). The extensions are:
Data extension, which allows the definition of table types without corresponding tables.
Functional extension, which allows definitions of (side-effect free) functions which can be
used to express and encapsulate complex data flows.
It supports complicated control logic such as conditional processing, loop, cursor, etc., as well as many built-in
functions for string, mathematical, datetime etc.