To activate objects programmatically
The below code can be used to activate any object programmatically.
PARAMETERS p_object type e071-obj_name.
CALL FUNCTION 'REPS_OBJECT_ACTIVATE'
EXPORTING
OBJECT_NAME = p_object
OBJECT_TYPE = 'REPS'
EXCEPTIONS
NOT_EXECUTED = 1
OTHERS = 2
.
IF SY-SUBRC = 0.
Message 'Objects ACtivated' Type 'I'.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
The value 'REPS' is passed for the field 'OBJECT_TYPE' in the function module which would accept only Report names as inputs. Hence this sample code can be used to activate only other report programs. By changing that value other types of objects can also be activated.