Page tree
Skip to end of metadata
Go to start of metadata

 

Purpose


At least some ECTR document types should only be created and/or edited via ECTR, while others may also be changed by Non-ECTR Users.

Solution

Preventing changes to documents outside ECTR is very restrictive. There can be different requirements to soften this restriction in special cases. This can then be added to the BAdI on a project-specific basis.

 

You can implement the solution in this BAdI:

BAdI: DOCUMENT_MAIN01
Method: before_save       
      
Code Example
METHOD if_ex_document_main01~before_save.
* ....
    CONSTANTS: lc_prefn_masterws TYPE valuepart VALUE 'PLM.MASTERWS.'.
    DATA: ls_doc_draw      TYPE /dscsag/doc_draw,
          lv_subrc         LIKE sy-subrc,
          lv_subtype       TYPE /dscsag/doc_draw_ext-subtype,
          lt_pref_masterws TYPE /dscsag/pref_t.

    FIELD-SYMBOLS: <ls_pref_masterws> TYPE /dscsag/pref.

*   Read dtype for current document
    ls_doc_draw-dokar = draw-dokar.
    ls_doc_draw-doknr = draw-doknr.
    ls_doc_draw-dokvr = draw-dokvr.
    ls_doc_draw-doktl = draw-doktl.
    /dscsag/plmdocument=>getsubtype( EXPORTING  iv_docdata = ls_doc_draw
                                     IMPORTING  ev_subtype = lv_subtype
                                                ev_return  = lv_subrc ).
    IF NOT lv_subtype IS INITIAL.
*      Check for pref "PLM.MASTERWS.<DTYPE>" in table /DSCSAG/PREF.
      if not /dscsag/preferences=>stringvalue( prefname  = lc_prefn_masterws && lv_subtype defaultvalue = '' ) is initial.
*       This document is ECTR relevant.
        DATA: lr_statics TYPE REF TO /dscsag/cl_statics.
        lr_statics = /dscsag/cl_statics=>get_instance( ).
        IF lr_statics IS BOUND.
          IF lr_statics->called_from_cad_get( ) = abap_false.
*           This call is not done via ECTR
            MESSAGE e000(26) WITH 'Save not possible. Document is managed in ECTR.' RAISING cancel.
          ENDIF.
        ENDIF.
      ENDIF.
    ENDIF.
* ...
ENDMETHOD.

The example code is not yet tested in productive environment.

The example can be enhanced with a project specific auth check e.g. to

  • allow an admin or power users user to change ECTR documents in CV02n.
  • enable workflow etc. to change status of document managed by ECTR
  • enable VEG to upload viewables to documents managed by ECTR
  • ...

 

 


 

 

Related Content

 

 

  • No labels