cancel
Showing results for 
Search instead for 
Did you mean: 

System matrix Time Sheet TSH1 table problem

0 Kudos

Hi experts and gurus,

In short:

I use Sap Business One 9.2 PL 04

I have problem with system matrix on Human Resources -> Time Sheet form, i am add on system matrix several new columns, and i have problem with add, update, delete data to database. New columns are user defined field in TSH1 table. I read all posts about system matrix on this forum, and read SAP SDK DOCUMENTATION, look at SAP SDK SAMPLES CODE, and i don't find solution, because system form restrict me. It will be very very nice if i can get some sample code.

Picture of Time Sheet

Long description, if you understand what is my problem in short description it's not necessary to read this, but will be nice if you read this:

Let's begin. I will describe what i am do and what i am try to do. I am do and try all to do only trough CODE because i want to make addon.

1) First i am add user defined fields on TSH1 table. If i open TimeSheet and add data to matrix, in one or in several row/rows, it will save all on Add button. New columns which are add to system matrix are bind to user defined fields in TSH1. But if i will try to update data that is terrible, data will be intermingled and update is total wrong in table. Okay, i know that i must write code if i want to update my user defined fields in TSH1, and that must be write On After Item Pressed of button "1" and on Action Success = true, there i must write update code for this user defined fields. There is no BoObjectTypes for table TSH1 and i can't acces with GetByKey to data and do what i want with data. I can UPDATE through SQL statement but i am read that SAP not recommended that and to avoid that, and i will avoid. I can't use DataTable method LoadFromDataSource because system form restrict that. I can't use UserDataSource methods GetLineData and SetLineData because system form restrict that. If you have some code sample for this please help me.

2) I am see that i haven't exit in 1) and i am try to do next. I am made User Defined Table which is No Object type. And i am add all columns which i was add in TSH1 as user defined fields, plus two columns U_AbsEntry and U_LineID in my User Defined Table. U_AbsEntry and U_LineID are some kind of imagined foreign keys but they are not linked to TSH1, they are just user defined fields like others user defined fields. U_AbsEntry is document number, U_LineID is row of that document, do same thing as AbsEntry and LineID in TSH1 table. System matrix is stay with their columns plus my new columns but i am now this new columns bind to my new User Defined Table instead to user defined fields in TSH1. Okay, at beginning this look like good idea, but after i see that i will have problem with Update and Delete. How ? Maybe i am add 5 rows in database and click Add on form, and after some time i am open form and load data to matrix and i am delete second row, okay i will delete LineID = 2 and AbsEntry = SomeDocNumber if i click on Update button. SAP System table will automatic solve this problem and in TSH1 i will have LineID = 1,2,3,4, but in my user defined table i will delete row U_LineID = 2 and i will have U_LineID = 1,3,4,5, and i will must manuel change U_LineID 3->2, 4->3, 5->4. This was some easy delete, user just delete one row, but what if user delete 1-st, 2-nd, 4-th row, and add new 6 rows after last row, or add new rows between 3-rd and 5-th row which are only stay, that is some more complicate update/delete for example.

3) Maybe to make User Defined Table and register it as User Defined Object and try to link with TSH1 ?

ALL) My main problem is that system matrix, i have on table OHEM (Human Resources -> Employee Master Data) one my new tab with EditText Object which have DataBind to User Defined Field in OHEM table and all works perfect for Add/Update/Delete data.

Picture of Employee Master Data

What you advice to me ? How to solve this ? And please post some sample code for solution ofcource if you can or give me idea how to solve this.

Accepted Solutions (0)

Answers (2)

Answers (2)

ANKIT_CHAUHAN
Product and Topic Expert
Product and Topic Expert
0 Kudos

Dear Aleksandar,

It is related to the User Defined Fields on TSH1 Table:

Even though DI API allows you to create User Defined Fields (UDF) on all tables, it is not recommended to UDF on tables which are not exposed in UDF management (Tools → Customization Tools → User Defined Fields- Management) . Also it is not possible to operate on these UDF with DIAPI,B1Studio or UIAPI. This is a limitation.

SAP Note 2281349 mentions the similar kind of issue.

In case of any issue, kindly let me know.

Kind regards,
ANKIT CHAUHAN
SAP SME Support

0 Kudos

Someone to help ?