Transaction Notification Debug:
This is my first contribution to the forum I hope that someone finds it useful somehow. I have searched on SAP Business One documents and I have not found anything similar to this.
Transaction notification debug is a procedure through which SAP B1 processes can be analyzed based on a few variables. It consist of a user table called @ TRANSACTIONDEBUG, a user query created to view all data from user table (Transaction Notification Debug) and another query updated in our Transaction Notification SP on our company database:
Declare @Counter AS INT
SET @Counter = ISNULL((SELECT MAX(CAST(Code AS INT)) FROM [@TRANSACTIONDEBUG]), 0) + 1
INSERT INTO [@TRANSACTIONDEBUG]
(Code, Name, U_ObjectType, U_TransactionType, U_NumOfCols, U_ListOfKey, U_ListOfCols)
SELECT @Counter, @Counter, @object_type, @transaction_type, @num_of_cols_in_key, @list_of_key_cols_tab_del, @list_of_cols_val_tab_del
*Tip: This query must be commented when we are not debugging. Otherwise user table will get updated with new entries constantly.
User table is composed of the following fields, which match with Transaction Notification variables:
@object_type: It returns the object number of the transaction that is being executed. In SAP B1 each transaction has an identifying number as a fingerprint, for example, client invoices are @object_type 13 and vendor ones are @object_type 18.
@transaction_type: In SAP B1 there are 5 transaction types , [A]dd , [U]pdate , [D]elete, [C]ancel and C[L]ose . Letter in brackets determines @transaction_type value, for example, if we want to validate the creation of some document @transaction_type must be ‘A’.
@num_of_cols_in_key: It returns the number of key fields contained in affected table.
@list_of_key_cols_tab_del: It returns the name of the key fields contained in affected table.
@list_of_cols_val_tab_del: It returns the value that is being updated in affected table key field. For example by adding a new customer, this field will return internal code from this customer. This is the key variable when doing a script to validate in SAP B1.
Procedure consists on: when we want to debug a process first thing to do is to check user table to see which is the most recent entry, right after that we will have to uncomment the debug query in TN through SQL Management Studio. Once code is uncommented we have to perform in SAP the action we want to debug. This way when we are done performing the action, we will comment TN query code again and we will check which are the new entries in table.
In our example we are going to debug a Purchase Order addition:
1.- As mentioned before, first thing to do is to view our user table @ TRANSACTIONDEBUG using our user query, to check what is the last entry added on the table:
In this case most recent entry would be code 29. Due to this we will only consider entry 30 and successive.
2.- Next thing to do is to uncomment TN query code, in order to activate debugging.
3.- Once code is active we will proceed to create PO in SAP B1.
4.- Next step is to comment again TN query code to deactivate debugging.
6.- Last thing to do is to run again user query, check which are the new entries and analyze it. In our example, as we can see there are two new entries:
First entry has been updated with following info (we ignore “Code” and “Name” fields):
@object_type: 10000013. This object type is related to accounting periods.
@transaction_type: A. Add or create.
@num_of_cols_in_key: 1.It means that affected table has only one key field.
@list_of_key_cols_tab_del: AbsEntry. It refers to the key field name. Affected table would be OFPR and description for this field is “System number”.
@list_of_cols_val_tab_del: 11372. It refers to the value that has been updated in the field.
In brief, I do not know exactly what is doing the system by adding this entry, but it really seems like some kind of period validation.
On second line:
@object_type: 22. This object type belongs to Purchase orders.
@transaction_type: A. Add or create.
@num_of_cols_in_key: 1. It means that affected table has only one key field.
@list_of_key_cols_tab_del: DocEntry. This is key field for table POR1 (lines for purchase order). Field description is “Document internal Id”
@list_of_cols_val_tab_del: 3741. This is the key field value for the entry we have just added.
Hi Javier Faces Santos...
Nice One
Regards
Kennedy
Hi Javier,
How do you know that @object_type 10000013 is OFPR?
Perhaps you know how to look at table names having only it's number?
I can't find the tables for these object types: 10000013, 10000044, 10000053, 10000062, 10000067, 310000008, 1980000003.
If you make the trick I'll be very glad or where I may read of it?
Thank you very much.
Regards,
Andrey
Hi Andrey,
Unluckely I don't have a complete table-object type relation for those Objects. It seems that they are not documented.
It was almost 3 years ago, so I am not 100 % sure, but I think that what I did in order to find it was to google it, as I always do in these cases. And the google search must have lead me into a SCN post for sure.
By doing it now I have found these SCN post:
New object ? | SCN
Several Object Types are not documented | SCN
I hope you find it useful.
Regards
Thank you very much Javier.
I'll try to find out something in the scn.
Regards,
Andrey
Great blog
Kind regards
Agustín Marcos Cividanes
HI Javier,
Thank you so much for this!
This blog really saved me when I had to create a transaction notification regarding special prices (OSPP).
Sincerely,
Melvin Banggo