on ‎2024 Oct 10 9:21 AM
Hi Experts,
I have a requirement to read the BO entity using partial key. I have 3 key fields in the BO and want to read the data using only the first two key fields. When I pass only two fields to the READ statement it is not fetching any value. The third key is a numeric type and it will be defaulted as "0" when no data is passed. Is there any way to overcome this issue?
The pseudo code is below. Any help would be appreciated!
READ ENTITY IN LOCAL MODE <Root_entity>
ALL FIELDS WITH VALUE #( ( %key-field1 = value1
%key-field2 = value2
"%key-field3 = <No value is passed here> -- This is an integer type
) )
RESULT DATA(lt_result)
FAILED DATA(lt_failed).
Request clarification before answering.
That may not be possible on the BO beh. implementation.
I had a situation where a validation would require a similar logic, but it turned out that I needed to improve the data model, creating a relationship between a root and a child entity in order to achieve my goal. Something that worth considering in some cases.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey.
Well, EML does not support SELECT statements.
If you want to stick to the EML language, you might need to do the following:
1. Create a Root entity with key1, key2
2. Create a Child entity with key1, key2, key3
3. Use READ ENTITIES to read the root entity with the full key (key1, key2) with an association to the Child entries.
This way you'll be able to fetch all the child result data "using the child entity partial key".
This approach might have some benefits if you are making use of Draft features. Handling draft features with SELECT statements will become a challenge.
| User | Count |
|---|---|
| 8 | |
| 7 | |
| 6 | |
| 6 | |
| 5 | |
| 3 | |
| 3 | |
| 3 | |
| 3 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.