This program shows how to open the project of solution manager (transaction SOLAR02) and navigate on start to particular document. The document is identified by id of logical document (LOIO). You can find LOIO (object id and class) in the URL in the attributes of the solution manager document.
Here sample URL:
http://your.solman.server:00080/sap/bc/solman/SolmanDocuments/015?_CLASS=SOLARGEN&_LOIO=3A14EE4D6E0A7A32E10000000A1A3035&LANGUAGE=DE&RELEASE=620
The URL looks a bit complicated, use function ITS_PARSE_URL to read the value of variable _LOIO.
The initial layout (open project, hierarchy and tabstrip) of transaction SOLAR02 (or program SOLAR_START)
can be set by user settings (SOLAR_SETTINGS and SOLAR_SETTINGS_EXP_NODES) stored in the table SPERS_OBJ.
The most difficult task is to collect all relevant information.
REPORT zsm_solar02.
TYPE-POOLS:
sappl.
PARAMETERS:
pa_class TYPE sdok_class OBLIGATORY DEFAULT 'SOLARGEN',
pa_objid TYPE sdok_docid OBLIGATORY DEFAULT '3A14EE4D6E0A7A32E10000000A1A3035'. " LOIO
START-OF-SELECTION.
DATA:
ls_tnotfpr TYPE tnotfpr,
lv_hier_id TYPE project_id,
ls_dmdobject TYPE dmdobject,
ls_object TYPE sdokobject,
lt_ress_range TYPE spro_ress_range,
lt_proj_range TYPE spro_proj_range,
ls_proj_range LIKE LINE OF lt_proj_range,
lt_doctitle_range TYPE s_doctitle_range,
lt_aut_range TYPE spro_ress_range,
lt_docstat_range TYPE s_docstat_range,
lt_objtype_range TYPE s_objtype_range,
lt_classif_range TYPE s_classif_range,
lt_content_data TYPE STANDARD TABLE OF cont_list,
ls_content_data TYPE cont_list,
lt_sel_node TYPE STANDARD TABLE OF hier_iface,
ls_sel_node TYPE hier_iface,
l_user_settings TYPE sausersett,
lt_text TYPE STANDARD TABLE OF textpool,
ls_text TYPE textpool,
lv_tabtype TYPE sappl_tabtype_type,
lt_expanded_node TYPE STANDARD TABLE OF tm_nodekey,
ls_expanded_node TYPE tm_nodekey,
lt_treetypes TYPE TABLE OF ttreetype.
* Read node and project id related to id of the logical document (LOIO)
SELECT SINGLE *
INTO ls_tnotfpr
FROM tnotfpr
WHERE docu_id = pa_objid.
SELECT SINGLE project_id
INTO (lv_hier_id)
FROM tpr_index
WHERE node_id = ls_tnotfpr-id.
* Read the relevant part of the projects structure information
* to find out the table register, where the document is used
ls_proj_range-sign = 'I'.
ls_proj_range-option = 'EQ'.
ls_proj_range-low = lv_hier_id.
APPEND ls_proj_range TO lt_proj_range.
SELECT SINGLE *
INTO CORRESPONDING FIELDS OF ls_sel_node
FROM tpr_index
WHERE refnode_id = ls_tnotfpr-id.
ls_sel_node-checkboxst = 'A'.
APPEND ls_sel_node TO lt_sel_node.
CALL FUNCTION 'SPROJECT_GET_DOCU_STRUCT'
EXPORTING
ress_range = lt_ress_range
proj_range = lt_proj_range
doctitle_range = lt_doctitle_range
obtyp_range = lt_objtype_range
* RESPONS_RANGE =
aut_range = lt_aut_range
docstat_range = lt_docstat_range
* CHANDATE_RANGE =
* TECHNAME_RANGE =
classif_range = lt_classif_range
classout = ''
* CLASS_ADM_RANGE =
* CLOUT_ADM =
* GLOB_RANGE =
sapdocu = 'X'
custdocu = 'X'
confdocu = 'X'
testdocu = 'X'
learndoc = 'X'
tabtype = ''
phase = ''
ressout = ''
* LIST_OF_TEMPLATES =
* ROLETYP_RANGE =
* ROLEID_RANGE =
* ROLEOUT =
* IMPORTING
* NO_CONT =
* NO_DOCU_AUTH =
TABLES
list_of_content_data = lt_content_data
list_of_sel_nodes = lt_sel_node.
* Map the key of the register to the SOLAR constant.
READ TABLE lt_content_data INTO ls_content_data INDEX 1.
READ TEXTPOOL 'SAPLSPROJECT_CONTENT_EVAL'
INTO lt_text LANGUAGE sy-langu.
READ TABLE lt_text
INTO ls_text WITH KEY entry = ls_content_data-docutabtype.
CASE ls_text-key.
WHEN '540'.
lv_tabtype = sappl_c_tabtype_sapdocu.
WHEN '550'.
lv_tabtype = sappl_c_tabtype_custdocu.
WHEN '751'.
lv_tabtype = sappl_c_tabtype_testcase.
ENDCASE.
* Save the personal SOLAR_SETTINGS with attributes of the document
l_user_settings-dtreewidth = '350'.
l_user_settings-defproject = lv_hier_id.
l_user_settings-lasttab = lv_tabtype.
l_user_settings-lastnode = ls_content_data-node_id.
l_user_settings-bcategory = 'V'.
l_user_settings-rcategory = 'C'.
l_user_settings-pcategory = 'T'.
PERFORM solar_settings_save USING 'SOLAR_SETTINGS'
l_user_settings.
* Read the hierarchy information of the node
CALL FUNCTION 'STREE_GET_NODE_USAGE'
EXPORTING
node_id = ls_tnotfpr-id
TABLES
nodes_in_structures = lt_sel_node.
LOOP AT lt_sel_node INTO ls_sel_node WHERE tree_id <> ''.
EXIT.
ENDLOOP.
ASSERT sy-subrc = 0.
CLEAR lt_sel_node.
CALL FUNCTION 'STREE_GET_PATH_TO_NODE'
EXPORTING
structure_id = ''
search_for_node = ls_sel_node
ignore_structure_id = 'X'
TABLES
node_hierarchy = lt_sel_node
i_treetypes = lt_treetypes.
* Save the personal SOLAR_SETTINGS_EXP_NODES with hierarchy information
LOOP AT lt_sel_node INTO ls_sel_node.
IF NOT sy-tabix = LINES( lt_sel_node ).
ls_expanded_node = ls_sel_node-node_id.
APPEND ls_expanded_node TO lt_expanded_node.
ENDIF.
ENDLOOP.
PERFORM solar_settings_save USING 'SOLAR_SETTINGS_EXP_NODES'
lt_expanded_node.
* Call transaction SOLAR02 (using program SOLAR_START)
SUBMIT solar_start
WITH ttype = '2' AND RETURN.
*&---------------------------------------------------------------------*
*& Form solar_settings_save
*&---------------------------------------------------------------------*
FORM solar_settings_save USING pi_key
pi_data.
CALL METHOD cl_pers_admin=>set_data
EXPORTING
p_pers_key = pi_key
p_uname = sy-uname
p_pers_data = pi_data
* P_WRITE_THROUGH = 'X'
* P_APPEND = space
* P_MODIFY = 'X'
* P_KEY_TAB =
EXCEPTIONS
pers_key_not_found = 1
data_type_error = 2
user_does_not_exist = 3
not_set_to_default = 4
pers_key_locked = 5
OTHERS = 6.
ASSERT sy-subrc = 0.
ENDFORM. "solar_settings_save
See other related notes on my website: