Hi,
We have a requirement where a maintenance plan needs to be approved before it can be used to schedule calibrations.
Solution developed (not in productive use yet):
1) Transaction IP01, IP02
1a) User exit prompts for digital signature when user creates or changes a maintenance plan
1b) User exit checks that the field 'Sort field' does not contain value 'APPROVED'
2) Own developled transacrtion to approve maintenance plan
Uses FM MPLAN_CHANGE to set 'Sort field' = 'APPROVED'. Program prompts for digital signature. Only QA has access to program.
3) Transaction IP10 - Scheduling af maintenance plan
1a) User exit prompts for digital signature when user schedules a maintenance plan
2b) User exit prevents schedulering if 'Sort field' <> ’APPROVED’.
Same user exit is used in 1) and 3)
User exit IPRM0004 - ‘Maintenance plan/item: Customer check for "Save"’
*&---------------------------------------------------------------------*
*& Include ZXPRMU06
*&---------------------------------------------------------------------*
*"----------------------------------------------------------------------
*"*"Lokale Schnittstelle:
*" IMPORTING
*" REFERENCE(IMHIS_IMP) TYPE WC_WMHIS
*" REFERENCE(AMHIS_IMP) TYPE WC_WMHIS
*" REFERENCE(IMPLA_IMP) TYPE WC_WMPLA
*" REFERENCE(IMPOS_IMP) TYPE WC_WMPOS
*" REFERENCE(AMHIO_IMP) TYPE WC_WMHIO
*" REFERENCE(MHIO_TAB_IMP) TYPE WC_WMHIO
*" REFERENCE(MMPT_TAB_IMP) TYPE WC_WMMPT
*" REFERENCE(AKTYP) LIKE T370-AKTYP
*" TABLES
*" T_IMPOS_IMP TYPE WC_T_WMPOS
*" T_MMPT_IMP TYPE WC_T_WMMPT
*" EXCEPTIONS
*" NO_UPDATE
*"----------------------------------------------------------------------
* Data
DATA:
wes_link LIKE zesrecord-es_link.
* Check sort field - create / change
IF sy-tcode = 'IP01'
OR sy-tcode = 'IP02'.
IF impla_imp-plan_sort = 'APPROVED'.
MESSAGE i280(z1) WITH 'Maintenance plan can not be saved' 'with sort field set to APPROVED'.
RAISE no_update. " No save
ENDIF.
ENDIF.
* Check sort field - scheduling
IF sy-tcode = 'IP10'.
IF impla_imp-plan_sort <> 'APPROVED'.
MESSAGE i280(z1) WITH 'Maintenance plan not approved.' 'Can not be scheduled'.
RAISE no_update. " No save
ENDIF.
ENDIF.
* Initialize
wes_link+0(12) = impla_imp-warpl.
* Prompt for Password
CALL FUNCTION 'Z_PASSWORD_CHECK'
EXPORTING
userid = sy-uname
tcod = ' '
open_field_userid = ''
es_linktype = 'MP_CHG'
es_link = wes_link
reason = 'Maintenance plan created /changed'
* IMPORTING
* new_userid = w_userid
EXCEPTIONS
userid_not_found = 1
password_not_correct = 2
error_during_call_to_trans = 3
number_of_parm_not_correct = 4
no_authority_to_trans = 5
OTHERS = 6.
IF sy-subrc NE 0.
RAISE no_update. " No save
ENDIF.
Regards Bjarne.