Some example queries for this SP

Within this book, you have already found quite a few example queries. There is no exception in this chapter. I do believe query by example is one of the most efficient ways to learn queries.

Case 1—Blocking an outgoing payment for a specific BP

A user is trying to block outgoing payments (Object 46) for a specific Business Partner for some reason by using the following SP:

IF (@Object_Type = '46') AND (@transaction_type in (N'A', N'U'))
BEGIN
  IF EXISTs (SELECT T0.[DocEntry] FROM OVPM T0 WHERE 
  T0.[DocEntry] = @list_of_cols_val_tab_del and T0.CardCode = 'V0271')
  BEGIN
    SET @error = 10
    SET @error_message = N'Block BP'
  END  
END

However, this SP blocks all outgoing payments for all BP Codes. What is the problem with this ...

Get Mastering SQL Queries for SAP Business One now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.