on 2022 Nov 11 12:17 AM
Hi,
I am using late numbering for a child entity in a managed draft enabled BO. The user has access to the entity via a table on the parent entity's object page. The user can create multiple entries in this table while in draft mode.
My numbering in ADJUST_NUMBERS needs to take into account the a mandatory value that the user maintains. For this, I need to be able to read the draft table entries when setting the numbering.
The mapped attribute in ADJUST_NUMBERS has a PID assigned, which gives me a unique key for each draft entry about to be saved. The draft table maintains uniqueness through the use of draft UUID. It does not appear that the %pid is related to this draftUUID.
How would I go about reading the corresponding draft table entry for a given PID?
Thanks,
Matt
Request clarification before answering.
You can use an EML READ passing the %PKY (edit: previously I mentioned %PID which is part of the %pky) and setting the %is_draft flag to on. The %PID field maps directly to the draftUUID, however it might be possible that this entry currently does not exist in the draft table, as the draft provider has a buffer holding modifications of the current session. These modifications are only persisted once the save sequence is executed.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi dominikeiraelias,
Thanks for the suggestion!
It took me a while to figure out, but you need to specify the EML read in a different way. You cannot specify draft at all (not on or off) - I guess because in ADJUST_NUMBERS the records are somewhere in between?. You also need to specify in full the %pky and not just the %pid (in my case, there are multiple fields making up the table key, some of which are already populated.
So in the end, the call that works looks like this:
READ ENTITIES OF <business object> IN LOCAL MODE
ENTITY <entity>
FIELDS ( <fields you need> )
WITH VALUE #( FOR <structure> IN mapped-<entity> (
%pky = VALUE #( %pid = <structure>-%pid
field1 = <structure>-%tmp-<field1>
field2 = <structure>-%tmp-<field2> ) ) )
RESULT DATA(lt_result)
FAILED DATA(ls_failed).
| User | Count |
|---|---|
| 18 | |
| 7 | |
| 7 | |
| 6 | |
| 4 | |
| 4 | |
| 4 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.