Easy to use ABAP API for the Solution Manager ITSM documents
For some of the cases the standard CRM API with FMs CRM_ORDER_READ, CRM_ORDER_MAINTAIN and so on is too complex to use, the structures are not well documented and understanding of how to set one or another field in the incident or change request can take time.
There is another way to work with the CRM documents in Solution Manager 7.1 system which is called “AGS CRM one order API”. Technically it is the wrapper on the standard CRM API, but as all the wrappers it can really make the development of the ITSM enhancements much easier.
It can be found in the classes CL_AGS_CRM_1O_API and it’s child CL_AGS_CRM_1O_API_SD (for Service Desk-specific document types only) and this classes look really self-explanatory in oppose to the CRM_ORDER_MAINTAIN, and it is especially good for the beginners in development for CRM.
If you look inside the list of the class methods, you’ll see that any read or change of the Service Desk document (incident, change request, change document) like getting the application log or the SLA status, setting the MLC or business partners, adding the attachments to the documents can be developed quickly and without the deep knowledge of CRM order data structure.
To start the usage of this API you need to get the instance of the “One Order”. To do this you only need the GUID of the document and the process type.
*First step, define the object for the class
data api_object type ref to CL_AGS_CRM_1O_API.
data api_object_sd type ref to CL_AGS_CRM_1O_API_SD.
*Second step – get the instance of the class
CALL METHOD cl_ags_crm_1o_api=>get_instance
iv_header_guid = iv_guid
iv_process_type = ‘ZMIN’
iv_process_mode = gc_mode–change
eo_instance = api_object
invalid_parameter_combination = 1
error_occurred = 2
OTHERS = 3.
*Downcast for SD specific methods
api_object_sd ?= api_object
As an example I would like to show you how to set the MLC category for the document.
data ls_subject_set TYPE CRMT_SUBJECT_COM,
*Define the MLC scheme name
ls_subject_set–asp_id = ‘CAT_SCHEMA_NAME’.
*Define the MLC category ID
ls_subject_set–cat_id = ‘CATEGORY_ID’
*also add the mandatory subject parameters
ls_subject_set–profile_type = ‘A’.
ls_subject_set–katalog_type = ‘D’.
ls_subject_set–mode = ‘A’.
*now you can call the method that sets the document subject
CALL METHOD api_object->set_subject
is_subject = ls_subject_set
cv_log_handle = iv_log_handle.
*And to finalize – save the document
CALL METHOD api_object->save.