Reputation: 111
My task is to do all these steps programmatically:
TR_INSERT_REQUEST_WITH_TASKS
TR_RELEASE_REQUEST
My problem is that I can manually add the package to the transport request via transaction SE03
and then release it with FM TR_RELEASE_REQUEST
, but that is not the goal, everything from step 1 to 3 has to happen in one program execution if anyone can guide me how to do step 2 it would be very helpful, thanks in advance.
Upvotes: 1
Views: 2594
Reputation: 10621
To add the whole project into request you must first select all the objects from package and add them one by one. You can do it like this:
DATA: l_trkorr TYPE trkorr,
l_package TYPE devclass VALUE 'ZPACKAGE'.
cl_pak_package_queries=>get_all_subpackages( EXPORTING im_package = l_package
IMPORTING et_subpackages = DATA(lt_descendant) ).
INSERT VALUE cl_pak_package_queries=>ty_subpackage_info( package = l_package ) INTO TABLE lt_descendant.
SELECT pgmid, object, obj_name FROM tadir
INTO TABLE @DATA(lt_segw_objects)
FOR ALL ENTRIES IN @lt_descendant
WHERE devclass = @lt_descendant-package.
DATA(instance) = cl_adt_cts_management=>create_instance( ).
LOOP AT lt_segw_objects ASSIGNING FIELD-SYMBOL(<fs_obj>).
TRY.
instance->insert_objects_in_wb_request( EXPORTING pgmid = <fs_obj>-pgmid
object = <fs_obj>-object
obj_name = CONV trobj_name( <fs_obj>-obj_name )
IMPORTING result = DATA(result)
request = DATA(request)
CHANGING trkorr = l_trkorr ).
CATCH cx_adt_cts_insert_error.
ENDTRY.
ENDLOOP.
Note, that you cannot add objects that are already locked in another request, it will give you cx_adt_cts_insert_error exception. There is no way to unlock objects programmatically, only via SE03 tool.
Upvotes: 1
Reputation: 13656
In your program, you must :
TADIR
(object in columns PGMID
, OBJECT
, OBJ_NAME
, and package in column DEVCLASS
)TRINT_APPEND_COMM
or TR_APPEND_TO_COMM_OBJS_KEYS
.Upvotes: 1
Reputation: 5758
You can check code behind, Write Transport Entry in SE80 right click on package menu.
Upvotes: 0