cancel
Showing results for 
Search instead for 
Did you mean: 

UI5 + Draft + BOPF Validation + ABAP

0 Kudos

Hello,

i am using Draft for one of the applications written in UI5. I am using DraftController for creating and managing Draft versions. Now, i am trying to create an item for an existing draft entity and execute a validation to pre-check if the number chosen by the user is correct, if not i would like to issue an error to UI and force the user to provide other item number. The validaion is executed and the check is done and an error should be thron so i add the NODE id to the ET_FAILED_KEY internal table + issuing message. This is however not working and the Draft entry is created. Am i missing somewhere here or it is not possible to fail a draft item being created (which would not make sense in my opinion). Any suggestions would be highly appreciated.

BR

Jakub

Accepted Solutions (0)

Answers (3)

Answers (3)

cwolter90
Participant
0 Kudos

Does the Gateway-Service access the BOPF with SADL?

Which validation type did you use? I guess, if it is a consistency validation, you have to add a consistency group called "SAVE_PREVENTION' and add assign the validation to it.

0 Kudos

The BOPF is generated out of CDS, so it is not changed in BOB* T-Codes on backend. I have changed in BOBX and the group is assigned to the validation.

It turns out, that the validation is working properly upon activation of the DRAFT, but not when creating a DRAFT entry. I assume it could be a feature, but still i should be able to dismiss an entry before i create it's draft clone.

0 Kudos

Yes it is getting triggered.

The message is issued like this:

        IF ls_data-isactiveentity = abap_false.
          DATA(lv_lifetime) = /bobf/cm_frw=>co_lifetime_state. "draft
        ELSE.
          lv_lifetime = /bobf/cm_frw=>co_lifetime_transition.  "active
        ENDIF.


        eo_message->add_message(
            EXPORTING is_msg  = VALUE #( msgid = 'ZTEST'  " example
                  msgno = 050
                  )
                   iv_node = is_ctx-node_key
                iv_key  = ls_data-key
                iv_attribute = {attribute from UI}
                iv_lifetime  = lv_lifetime
            ).

eo_message is initialized before, if not bound and {attribute from UI} is the property from Constant Interface (blended out since customer namespace). Anyway i have tried with both STATE/TRANSITION lifetime for DRAFT but did not work.

cwolter90
Participant
0 Kudos

Did you check, wheter you validation is triggered?

Could you post the coding, which issues the message?