We can activate ABAP objects programmatically, to do that we just need to call the function module ‘REPS_OBJECT_ACTIVATE’.
Please find below the sample code:

 *Data Declaration:
PARAMETERS:
  p_objectToActivate TYPE e071-obj_name.

*Function module to activate object:
CALL FUNCTION 'REPS_OBJECT_ACTIVATE'
  EXPORTING
   OBJECT_NAME        = p_objectToActivate    "Object to activate
   OBJECT_TYPE        = 'REPS'                "Type of the object
 EXCEPTIONS
   NOT_EXECUTED       = 1
   OTHERS             = 2
          .
IF SY-SUBRC = 0.
  Message 'The object has been activated successfully.' Type 'I'.
ENDIF.


Serkan AKKAVAK
Computer Engineer
ABAP Developer & SAP S/4 HANA Logistics Consultant
Contact : serkurumsal@yandex.com