Solution Documentation: Automatically attaching a new version number to the document after release
This blog is part of a series on how to control document changes in Solution Manager. Here, I describe how to pull together the release strategy and custom attribute for Solution Manager documents with an enhancement code that gives the document name a new version number. Please see the earlier blogs to understand how this function works.
What I’ve done is co-opted the technical name for a Solution Manager document (field IWB_TECH_NAME) which is always present in the general attributes tab. This technical name is not open for entry, it is only filled from standard documentation from a template project. The technical name is generated in the enhancement as a concatenation of the Document type, PMO ID and version number (released versions + 1).
It takes advantage of design of the KW database storage. The Logical Info Object (field SA01PHIO-LOIO_ID) is always the same, even between saved changes of the document. Not so the Physical Info Object (field SA01PHIO-PHIO_ID) which changes on every single save, creating a new info object. This internal versioning is transparent to the user and permanent (deleting the document in solution manager doesn’t delete the physical info object, it only removes it from the structure)
Method SAVE_DATA
METHOD if_ex_solar_documents~save_document.
CONSTANTS:
c_pmo_reference TYPE sdok_propn VALUE ‘ZDEPT’,
c_vers_abbr(3) TYPE c VALUE ‘V’.
DATA:
wa_new_name TYPE sdok_propv,
wa_doc_type TYPE sdok_propv,
wa_srch_str TYPE sdok_propv,
wa_version(2) TYPE n,
wa_mod_attr LIKE LINE OF et_modified_attributes,
wa_pre_attr LIKE LINE OF it_previous_attributes.
*———————————————————————-*
* Only perform exit if document is released
*———————————————————————-*
READ TABLE it_current_attributes TRANSPORTING NO FIELDS
WITH TABLE KEY name = ‘IWB_STATE’ value = ‘REVIEW’.
CHECK sy-subrc = 0.
*———————————————————————-*
* Ensure only count versions of same document type.
*———————————————————————-*
READ TABLE it_previous_attributes INTO wa_pre_attr
WITH KEY name = ‘IWB_SOLAR_DOCUTYPE’.
wa_doc_type = wa_pre_attr-value.
*———————————————————————-*
* Get custom attribute with PMO reference ID
*———————————————————————-*
READ TABLE it_previous_attributes INTO wa_pre_attr
WITH KEY name = c_pmo_reference.
CONCATENATE wa_doc_type wa_pre_attr-value ‘%’ INTO wa_srch_str.
*———————————————————————-*
* Count number of released versions for same document type
*———————————————————————-*
SELECT COUNT(*) FROM sa01loio AS loio INNER JOIN sa01phio AS phio
ON phio~loio_id = loio~loio_id
AND phio~lo_class = ‘SOLARGEN’
AND phio~ph_class = ‘SOLARGNSRC’
AND phio~langu = ‘EN’
AND phio~prop05 = ‘RELEASED’ ” IWB_STATE
WHERE loio~prop06 = wa_doc_type ” IWB_SOLAR_DOCUTYPE
AND loio~prop08 LIKE wa_srch_str. ” IWB_TECH_NAME
*———————————————————————-*
* Move new name with new release number to IWB_TECH_NAME
*———————————————————————-*
wa_version = sy-dbcnt + 1.
CONCATENATE wa_doc_type wa_pre_attr-value c_vers_abbr wa_version
INTO wa_new_name.
wa_mod_attr-name = ‘IWB_TECH_NAME’.
wa_mod_attr-value = wa_new_name.
APPEND wa_mod_attr TO et_modified_attributes.
ENDMETHOD.
Function modules SA_KW_RFC_IOS_PROPERTIES_GET using field (SOLARGEN-LOIO_ID) and SA_DOC_DS_SHOW_DOCUMENT were used to design this code snippet.
With this enhancement to allow versioning, the Program Management Office is provided with an additional axis to locate with SOLAR_EVAL repaort a specific document that complements the Project hierarchy (y-axis) and the Business process tabs (x-axis).