Block document(per line) using SBO_SP_TransactionNotification

Thursday, October 1, 2015

Block document(per line) using SBO_SP_TransactionNotification


Most of our client are in production and service industry that require per document(lines) blocking. However, we've encounter some limitations in SAP Business One on how to block transaction using SBO_SP_TransactionNotification per line. Most of the solutions in scn.sap.com are in per document(header). So I decided to study and tweak the SBO_SP_TransactionNotificationSBO_SP_TransactionNotification is a stored procedure is to receive notification on any transaction - in other words to do some validation inSAP Business One and prevent the user from doing an action if the validation condition fails. This stored procedure(SP) is created automatically with each database.This stored procedure is fired whenever operations are performed on business objects like document or master records and User-Defined Objects. For more information about the SBO_SP_TransactionNotification or if you don't know how to use SBO_SP_TransactionNotification you may visit this post from scn.sap.com.

Back to our concern, I'll show you on how to achieved that requirements. For example, I want to block all the documents that are in the Item Group of 118 and 120 and also the Customer that has 'CI-' in their code.



 IF (@object_type = '17' AND @transaction_type IN ('A', 'U'))  
      BEGIN   
           SELECT TOP 1 @LINENUM = b.linenum  
                FROM ORDR a inner join RDR1 b on a.DocEntry = b.DocEntry  
                INNER JOIN OITM c on b.itemcode = c.ItemCode  
                          WHERE b.DocEntry = @list_of_cols_val_tab_del and c.ItmsGrpCod in ('118','120') and a.CardCode not like 'CI-%'  
           If NOT @LineNum IS NULL  
                Begin  
                     SET @error = -17  
                     SET @error_message = 'Please select a valid Item Group applicable to your Dealer!'  
                End  
      END  

That's it. You can now block any transactions per line in your document. If you have concerns, please comment below.

8 comments :

  1. How was @LINENUM declared and how does it relate to the submitted transaction set?

    ReplyDelete
  2. Nice Blog post!!!
    Thanks for sharing informative post. Great tutorial. Keep continue..
    SAP Online Training & SAP Training Courses for Basic to Advance lavel.

    ReplyDelete
  3. pls how to make it no one can sell any price below pricelist1

    ReplyDelete
  4. Prepare for American Planning Association AICP exam with our preparation material with full confidence. We offer you 100% real American Institute of Certified Planners American Planning Association AICP exam dumps for your better results. Prepare4Test’s AICP pdf dumps are verified by American Planning Association Gurus.

    ReplyDelete
  5. 100% Pass Guarantee is offered by us after American Institute of Certified Planners AICP exam preparation, with Prepare4Test’s exam dumps. You can pass the AICP exam in the first go with good marks, and it will be easy for you to attempt all AICP questions.

    ReplyDelete
  6. This comment has been removed by the author.

    ReplyDelete