Disclaimer: This is a proposal of an SCN Member and not an authorized solution by SAP. Pls. be aware what you do!
Motivation
In my Post I pointed out the Issue that #adt can not handle #csol warnings as #SE80 can. I described a workaround using #SE80 and another using a dirty technique in solutionamanger.
For us in the project this was not sufficient.
The goal is to "auto confirm" the CSOL warnings as we can do in #SE80. Due to project requirements this would be the only way in any case at the moment.
You can solve this using two Enhancements and a helper class:
Create helper-class:
CLASS zcl_000_adt_service DEFINITION
PUBLIC
CREATE PUBLIC.
PUBLIC SECTION.
CLASS-DATA:
sv_adt_call TYPE abap_bool VALUE abap_false,
sv_csol_check_called TYPE abap_bool VALUE abap_false.
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.
CLASS ZCL_000_ADT_SERVICE IMPLEMENTATION.
ENDCLASS.
Detect if called via ATD in SADT_REST_RFC_ENDPOINT
Create an enhancement at the top of SADT_REST_RFC_ENDPOINT:
ENHANCEMENT 1 Z_SADT_REST_RFC_ENDPOINT. "active version
**********************************************************************
* Enhancement to register an ADT call.
**********************************************************************
LOG-POINT ID z000_sap_code_enhancement SUBKEY sy-cprog FIELDS 'Z_SADT_REST_RFC_ENDPOINT'. "Optional
zcl_000_adt_service=>sv_adt_call = abap_true.
ENDENHANCEMENT.
Catch the CSOL message in function module TMW_PRJL_CSOL_CHECK when called from #adt
We did not want to do real modification, such that we used a recursive call within the enhancement of TMW_PRJL_CSOL_CHECK. After the recursion we can catch the message if we are called via #adt an ignore it. Create an enhancement at the top:
ENHANCEMENT 1 Z_TMW_PRJL_CSOL_CHECK. "active version
**********************************************************************
* Because the confirmation of CSOLocks is still not possible via ADT/Eclipse
* this enhancement helps on an interim basis.
*
* IF a CSOL conflict occurs the Solution Manager (second call of function
* module /TMWFLOW/CHECK_OBJECT_LOCK_CSL) returns a specific message. This
* message will be raised as LOCKING_NOT_ALLOWED.
*
* The conflict will be confirmed with including the object to a transport
* request which is known by the Solution Manager. So catching the specific
* message by a recursive call (depth 2) and ignoring it will cause an
* automatic CSOL conflict confirmation.
*
* To differ a call of function module TMW_PRJL_CSOL_CHECK by Eclipse/ADT and
* by an se80 session there is a flag, which is set by an enhancement of
* function module SADT_REST_RFC_ENDPOINT.
**********************************************************************
" LOG-POINT ID z000_sap_code_enhancement SUBKEY sy-cprog FIELDS 'Z_TMW_PRJL_CSOL_CHECK'. Optional
IF zcl_000_adt_service=>sv_adt_call = abap_true AND
zcl_000_adt_service=>sv_csol_check_called = abap_false.
"AND
" new zcl_001_user_service( )->is_user_parameter_set( 'Z_AUTO_CSOL_CONFIRM' ) = abap_true. "Nice to have
zcl_000_adt_service=>sv_csol_check_called = abap_true. "stop recursion
CALL FUNCTION 'TMW_PRJL_CSOL_CHECK'
EXPORTING
iv_request = iv_request
iv_suppress_dialog = iv_suppress_dialog
it_objects = it_objects
it_keys = it_keys
iv_trfunction = iv_trfunction
IMPORTING
ev_no_check_performed = ev_no_check_performed
EXCEPTIONS
locking_not_allowed = 1
warning_conflicts_exist = 2
OTHERS = 1.
zcl_000_adt_service=>sv_csol_check_called = abap_false.
CASE sy-subrc.
WHEN 0.
RETURN.
WHEN 1.
IF sy-msgid = '00' AND sy-msgty = 'E' AND sy-msgno = '001' AND
( sy-langu = 'E' AND sy-msgv1 = 'Customizable CSOL conflict for objects changed in' AND sy-msgv2 = ' other TR (Note 1591120)' ) OR
( sy-langu = 'D' AND sy-msgv1 = 'Anpassbarer CSOL-Konflikt für in and. TA geänderte' AND sy-msgv2 = ' Objekte (Hinw. 1591120' ).
"ignore/accept CSOL conflict => confirm CSOL conflict
RETURN.
ENDIF.
"re-raise
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4 RAISING locking_not_allowed.
WHEN 2.
"re-raise
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4 RAISING warning_conflicts_exist.
ENDCASE.
ENDIF.
ENDENHANCEMENT.
Additional
in the line:
" new zcl_001_user_service( )->is_user_parameter_set( 'Z_AUTO_CSOL_CONFIRM' ) = abap_true.
we placed some code to ensure that the auto confirm of #csol is only done for user who have set the set/get parameter accordingly.
This is what the coding does.
Conclusion
Now we have a #adt that "confirms" CSOL warnings immediately such that we can continue to work as normal in #adt.
Thomas Fiedler and the ATD Team are aware of this issue and are working on a standard solution.
Be aware of the disclaimer at the top.
Kind Regards
Timo