Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
patrick_winkler
Product and Topic Expert
Product and Topic Expert

Introduction

If you use the ADT wizard to generate a business configuration maintenance object, the automatic transport determination is enabled by default as of release 2405. When the Edit action is performed, a customizing transport request is determined automatically. You can find the determination logic in the ABAP documentation of method get_transport_request of interface if_mbc_cp_rap_tdat_cts.

This blog shows you how to migrate an existing maintenance object to enable the automatic transport determination in edit mode.

If you do not want automatic transport determination, you can choose the option "Manual" instead of "Manual with preselection" when generating a new maintenance object in the wizard.

This blog is relevant for:

Further reading:

Behavior definition and implementation

In the behavior definition, add the annotation "with additional implementation" to the draft action Edit:

 

draft action ( features : instance ) Edit with additional implementation;

 

Save and activate. Place the cursor on Edit and use the quick assist (Ctrl+1) to generate the missing method implementation.
If you use a transport object, implement the method as follows. Adjust the placeholders my_singleton_entity_name and my_singleton_entity_alias accordingly.

 

  METHOD EDIT.
    CHECK lhc_rap_tdat_cts=>get( )->is_transport_mandatory( ).
    DATA(transport_request) = lhc_rap_tdat_cts=>get( )->get_transport_request( ).
    IF transport_request IS NOT INITIAL.
      MODIFY ENTITY IN LOCAL MODE my_singleton_entity_name
        EXECUTE SelectCustomizingTransptReq FROM VALUE #( ( %IS_DRAFT = if_abap_behv=>mk-on
                                                            SingletonID = 1
                                                            %PARAM-transportrequestid = transport_request ) ).
      reported-my_singleton_entity_alias = VALUE #( ( %IS_DRAFT = if_abap_behv=>mk-on
                                     SingletonID = 1
                                     %MSG = mbc_cp_api=>message( )->get_transport_selected( transport_request ) ) ).
    ENDIF.
  ENDMETHOD.

 

If the method IS_TRANSPORT_MANDATORY is not available because you do not use a transport object, use the following source code instead. Prior to release 2402, the ADT wizard did not generate a transport object by default. Adjust the placeholders my_singleton_entity_name, my_basis_table and my_singleton_entity_alias accordingly.

 

  METHOD EDIT.
    TRY.
        DATA(task_or_request) =  cl_bcfg_cd_reuse_api_factory=>get_transport_service_instance(
                                   iv_objectname = my_basis_table
                                   iv_objecttype = cl_bcfg_cd_reuse_api_factory=>simple_table )->get_transport_request( )->get_task( ).
        IF task_or_request IS NOT INITIAL.
          DATA(transport_request) = xco_cp_cts=>transport->for( task_or_request )->get_request( )->value.
        ENDIF.
      CATCH cx_bcfg_transport_request
            cx_xco_runtime_exception.
        CLEAR transport_request.
    ENDTRY.
    IF transport_request IS NOT INITIAL.
      MODIFY ENTITY IN LOCAL MODE my_singleton_entity_name
        EXECUTE SelectCustomizingTransptReq FROM VALUE #( ( %IS_DRAFT = if_abap_behv=>mk-on
                                                            SingletonID = 1
                                                            %PARAM-transportrequestid = transport_request ) ).
      reported-my_singleton_entity_alias = VALUE #( ( %IS_DRAFT = if_abap_behv=>mk-on
                                     SingletonID = 1
                                     %MSG = mbc_cp_api=>message( )->get_transport_selected( transport_request ) ) ).
    ENDIF.
  ENDMETHOD.

 

1 Comment