cancel
Showing results for 
Search instead for 
Did you mean: 

Creation of custom BO Instance fails

0 Kudos

Hi all,

I'm facing a very strange behaviour here.

Situation:

I have a custom BO with lock-entries for employees and periods so that timesheets can be posted only in open periods.

So in an extendsion to BO TimeEntry I check those entries. Since I'm not allowed to do a TimeLock.Create() in the Validation-OnSave, I have to do this in the event BeforeSave.

1. In the BeforeSave-Event of the TimeEntry I create a new entry of TimeLock with EmployeeUUID and Period.
Check, works in Debugger!

2. Then the BeforeSave-Event of the TimeLock kicks in and extends some fields like Employeenumber, Name and so on.
Check, works in Debugger!

3. Then the Validation-OnSave from the TimeEntry starts.
There I do a query on EmployeeUUID and Period (the same values as in step 1!) and no item is found.
So the check fails.

Also in the created WorkcenterView I don't see the entry.

When I ignore the check and return true in the Validation-OnSave and so the transaction is finished - then the entry is there.

Has anybody an idea on what is going on there?
It sounds so absurd, seems I'm falling over SAP's 80s concept of the LUW here.
But even then, why is the instance there in step 2 but not in step 3?

What could be a solution for that?

Any idea highly welcome!

thanks in advance,
Reinhard

Accepted Solutions (1)

Accepted Solutions (1)

VVancalbergh
Contributor
0 Kudos

I have had the same issue. Basically you have to move your check to the BeforeSave and set a flag (an extension field type Indicator) that you name "TimeLockFound" for instance and set to true or false. Then in the Validation-OnSave you only check whether TimeLockFound is true or not. If true, raise your error message and return false. If false, return true.

It sucks, but that's the way it is.

Answers (0)