Product BPs - an example
the following BPs are used to add, modify or delete a Product data entity.
BP_Product_add()
This BP adds Product Data Entities to the database - everything is done in a transaction, with 2 BPs ...
Syntax
1. PROCEDURE BP_dbProduct_add(LOCAL p_R_dbProduct is Record of dbProduct, LOCAL p_sUser is string,p_nReturnPK is 8 byte int,p_sErrorMessage is string)
the above procedure starts a transaction, calls BP_dbProduct_add_private() and handles the transactions success or failure.
2. PROCEDURE BP_dbProduct_add_private(LOCAL p_R_dbProduct is Record of dbProduct, LOCAL p_sUser is string <useful>, p_nReturnPK is 8 byte int,p_sErrorMessage is string)
this procedure has the BPs main functionality -
if it fails, false is returned, p_sErrorMessage has the error and BP_dbProduct_add() rolls back the transaction.
if it is successful, true is returned and BP_dbProduct_add() commits the transaction.
* BPs with transactions always have this type of calling - a procedure starts a transaction, calls the main BP procedure (with the sames parameters it received) and takes care of a transaction success or failure.
The main BP procedure - in this type of call - ends with _private.
BP_Product_modify()
This BP modifies a Product Data Entity in the database - everything is done in a transaction, with 2 BPs ...
Syntax
1. PROCEDURE BP_dbProduct_modify(LOCAL p_R_dbProduct is Record of dbProduct,LOCAL p_sUser is string,p_sErrorMessage is string)
the above procedure starts a transaction, calls BP_dbProduct_modify_private() and handles the transactions success or failure.
2. PROCEDURE BP_dbProduct_modify_private(LOCAL p_R_dbProduct is Record of dbProduct,LOCAL p_sUser is string <useful>,p_sErrorMessage is string)
this procedure has the BPs main functionality -
if it fails, false is returned, p_sErrorMessage has the error and BP_dbProduct_modify() rolls back the transaction.
if it is successful, true is returned and BP_dbProduct_modify() commits the transaction.
BP_Product_delete()
This BP deletes a Product Data Entity from the database - everything is done in a transaction, with 2 BPs ...
Syntax
1. BP_dbProduct_delete(LOCAL p_nPK is 8 byte int,LOCAL p_sUser is string, p_sErrorMessage is string)
the above procedure starts a transaction, calls BP_dbProduct_delete_private() and handles the transactions success or failure.
2. procedure BP_dbProduct_delete_private(LOCAL p_nPK is 8 byte int,LOCAL p_sUser is string, p_sErrorMessage is string)
this procedure has the BPs main functionality -
if it fails, false is returned, p_sErrorMessage has the error and BP_dbProduct_delete() rolls back the transaction.
if it is successful, true is returned and BP_dbProduct_delete() commits the transaction.
* the above image shows the db_Product_add_private BP in the alpha360 erp Business Application - WX26