SAP Test Management SAP Solution Manager 7.1 BPCA Self Check Program November 2014 Marcus Wefers, Chief Support Architect, Active Global Support, SAP SE Table of Contents 1. MOTIVATION FOR A BPCA SELF CHECK PROGRAM 1 2. BPCA SELF CHECK – SAP STANDARD PROGRAM WITH SAP SOLUTION MANAGER 7.1 SP11 2 3. BPCA SELF CHECK – CUSTOM PROGRAM AVAILABLE FOR SAP SOLUTION MANAGER 7.1 SP10 3 1. Motivation for a BPCA self check program Background SAP Solution Manager 7.1 includes the application Business Process Change Analyzer (BPCA) to perform change impact analysis of software changes on business processes. Typical software changes include custom developments or configurations as well as deployment of SAP Support Packages and SAP Enhancement Packages. BPCA makes use of the integration between SAP Solution Manager and managed systems, such as SAP ERP or SAP CRM. Figure 1: SAP Solution Manager used to document the entire system landscape and used business processes Motivation The BPCA Self Check program helps customers to verify that the most important BPCA prerequisites are met – reaching from user authorizations, system connectivity, UPL activation, UPL data flows from managed system to SAP Solution Manager, BPCA TBOM generation to BPCA Test Scope Optimization. Page 1 2. BPCA Self Check – SAP standard program with SAP Solution Manager 7.1 SP11 You can access the BPCA Self Check in SAP Solution Manager 7.1 SP11 via the following menu path: 1. SAP Solution Manager – Workcenter Test Management (transaction code: solman_workcenter) 2. Left navigation panel: view “Administration” 3. Select sub-view “TBOM Utilities” and click on the link “Goto TBOM Utilities” 4. A popup appears where you can select the entry “BPCA Self Check” Alternatively, you start the program AGS_BPCA_SELF_CHECK directly with transaction SE38. Figure 2: SAP Solution Manager Workcenter Test Management Page 2 Figure 3: List of available BPCA TBOM utilities 3. BPCA Self Check – custom program available for SAP Solution Manager 7.1 SP10 For our SAP co-innovation customers we have developed a BPCA self-check program for SP10, which helped these customers to find setup or authorization problems quickly. If you want to this program already with SP10 before the standard program is available for you with SP11, you can download the source code (see next section) and create your own custom program Z_BPCA_CHECK using transaction SE38. Functional Scope of the BPCA Self Check The functional scope of the check program is shown in the following step by step explanation. Please start the ABAP report via transaction SE38: Page 3 Fill out the following selection parameters 1. System ID - this is the SAP Business Suite system – role QAS / TST – which shall be used to generate TBOMs 2. Client for first SID 3. System ID – this is the SAP Business Suite system – role PRD – from which the UPL usage statistics shall be selected 4. Client for second SID 5. SAP Solution Manager project – this project shall contain the Business Blueprint which will be used to assign TBOMs and will be used through subsequent BPCA Test Scope Analysis. Note: you can automatically generate a SAP Solution Manager project which will include a Business Blueprint based on usage from your PRD system using program RUTILITY_BLUEPRINT_GENERATION as described in SAP Note 2061626. Page 4 Now you can execute the program which will return the following check results. Section 0: Header Information when and for which user the check was performed including used systems / clients and SAP Solution Manager project. Section 1: Checks for SAP Solution Manager This section includes checks for the consistency of the used project with the system landscape. In addition all required BPCA user authorizations are checked. Page 5 Section 2: Checks for the Managed System This section includes checks of the available RFCs. BPCA requires RFC of type “Read” for the PRD system and RFC of type “Trusted” for the QAS / TST system. SAP Solution Manager requires that a plug-in (ST-PI) is deployed on the managed systems. In addition the user needs authorization for a number of function modules. Section 3: Check of UPL Data First we check whether Usage and Procedure Logging (UPL) is turned on in the managed system (e.g. SAP ERP – role: PRD) and what is the data retention rate in the managed system. Second we check whether the job for UPL data transfer into the BW InfoCube of SAP Solution Manager is working. Third the MDX parser status Page 6 is checked. Finally we check the existence of UPL data in the BW InfoCube of SAP Solution Manager including the first and last date of successful extraction. Section 4: BPCA User Parameters This section includes information about the BPCA user parameters set for the selected user, e.g. the setting that user is set as BPCA expert. Page 7 ABAP source code for custom program Z_BPCA_CHECK You can create your own custom program in case you want to use the BPCA check program for SAP Solution Manager 7.1 Sp10. Please remember to use the standard program which is available with SP11. *&---------------------------------------------------------------------* *& Report Z_BPCA_CHECK *& *&---------------------------------------------------------------------* *& Check of prerequisites for BPCA *&---------------------------------------------------------------------* REPORT z_bpca_check LINE-SIZE 500. PARAMETERS: sid TYPE sysysid DEFAULT 'XUQ', "Managed System client TYPE trclient DEFAULT '800', sid_upl TYPE sysysid DEFAULT 'XUQ', "UPL System upl_clnt TYPE trclient DEFAULT '800', project TYPE project_id DEFAULT 'Z_BB_GEN'. DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA DATA g_managed_system_rfcdest_login TYPE rfcdest. g_managed_system_rfcdest_read TYPE rfcdest. g_managed_system_rfcdest_trust TYPE rfcdest. g_managed_system_rfcdest TYPE rfcdest. g_stpi_version TYPE cvers-release. g_stpi_patchlevel TYPE cvers-extrelease. g_logcmp TYPE smsy_groupsystem-logcmp. g_proj TYPE project_id. g_sys_role. lo_ex_wcit TYPE REF TO cx_ags_wcit. lv_text TYPE string. lv_project_id TYPE tproject-project_id. lv_class TYPE tproject-class. lo_bph_gen TYPE REF TO cl_ags_bpca_bph_gen_project. lv_sys_role TYPE smsy_role. lv_logcomp_exist TYPE boolean VALUE abap_false. lo_ex_bph TYPE REF TO cx_ags_bpca_bph. lv_message(100) TYPE c. lt_e071k TYPE TABLE OF e071k. lv_entry_exist TYPE boolean. lo_upl_bpca_utility TYPE REF TO cl_ags_bpca_upl_utils. lv_date_from TYPE sydatum. lv_exe_unit TYPE char128. lv_exe_type TYPE char128. lt_upl_data TYPE ags_cc_upl_output_bpca_t. lt_user_params TYPE TABLE OF bapiparam. lt_return TYPE TABLE OF bapiret2. lv_status TYPE boolean. lv_retention_period TYPE int4. lv_available_days TYPE int4. lv_job_trigger_collect TYPE boolean. lv_job_upl_collect TYPE boolean. FIELD-SYMBOLS: <fs_user_params> TYPE bapiparam. TYPE-POOLS: icon. Page 8 *&---------------------------------------------------------------------* *& Start of Initialization *&---------------------------------------------------------------------* * Move Parameters into global variables g_proj = project. * End of Initialization *&---------------------------------------------------------------------* *& Start of main program *&---------------------------------------------------------------------* * Information about used SAP WRITE: / icon_information AS sy-uzeit. WRITE: / icon_information AS WRITE: / icon_information AS sy-mandt. WRITE: / icon_information AS WRITE: / icon_information AS sid_upl,'/',upl_clnt. WRITE: / icon_information AS WRITE: /. ULINE. SolMan and SAP managed systems ICON, 'Start date and time ', sy-datum, ' ', ICON, 'SAP SolMan User: ICON, 'SAP SolMan: ', sy-uname. ' , sy-sysid, '/', ICON, 'Managed System: ICON, 'UPL System: ', sid,'/',client. ', ICON, 'SAP SolMan Project: ', g_proj. *--------------------------------------------------------------------* * Check authorization for user in SOLMAN system *--------------------------------------------------------------------* WRITE: / 'Section 1: Checks for SAP Solution Manager'. WRITE: /. * Check whether project does exist already and delete it on demand PERFORM checkproject USING g_proj. IF sy-subrc <> 0. WRITE: / icon_led_red AS ICON, 'Existence Check for project: ', g_proj, 'SolMan Project does not exist'. ELSE. WRITE: / icon_led_green AS ICON, 'Existence Check for project: ', g_proj, 'OK'. ENDIF. * Check System and Client included in Project System Landscape of SOLAR_PROJECT_ADMIN * WRITE: / 'Check SID/Client included in System Landscape of Project', g_proj, sid, cli*ent. * Create Instance for Project_ID in g_proj TRY. lo_bph_gen = cl_ags_bpca_bph_gen_project=>get_instance( iv_project_id = g_proj ). CATCH cx_ags_wcit INTO lo_ex_wcit. "No Exception expected because of previous existence check ENDTRY. *...and now retrieve the logical component and system role based on imported system and client (for Project see above) TRY. CALL METHOD lo_bph_gen->check_valid_logical_component "for g_proj EXPORTING iv_system = sid Page 9 iv_client = client iv_check_project_only = abap_true IMPORTING ev_logcomp_exist = lv_logcomp_exist CHANGING cv_role = lv_sys_role. CATCH cx_ags_bpca_bph INTO lo_ex_bph. ENDTRY. IF lv_logcomp_exist IS INITIAL. WRITE: / icon_led_red AS ICON, 'Check SID/Client included in System Landscape of Project', g_proj, sid, client, 'Failed'. ELSE. WRITE: / icon_led_green AS ICON, 'Check SID/Client included in System Landscape of Project', g_proj, sid, client, 'OK'. * Get Logical Component PERFORM get_logical_component USING sid client CHANGING g_logcmp g_sys_role. WRITE: / icon_information AS ICON, 'Logical component used: ', g_logcmp. WRITE: / icon_information AS ICON, 'System role used: ', lv_sys_role. ENDIF. WRITE: /. * Check Authority for Project CALL FUNCTION 'SPROJECT_GET_CLASS' EXPORTING project_id = g_proj IMPORTING class = lv_class. TRY. CALL METHOD cl_ags_bpca_bph_main=>authority_check_object EXPORTING im_project_id = lv_project_id im_project_class = lv_class im_type = cl_ags_wcit_constants=>c_type_proj. WRITE: / icon_led_green AS ICON, 'Authorization to read Project and Blueprint: ', 'OK'. CATCH cx_ags_wcit INTO lo_ex_wcit. lv_text = lo_ex_wcit->get_text( ). WRITE: / icon_led_red AS ICON, 'Authorization to read Project and Blueprint: ', 'Failed'. WRITE: / lv_text. ENDTRY. * Check authority to create TBOM TRY. CALL METHOD cl_ags_bpca_tbom_access=>authority_check_object EXPORTING im_type = cl_ags_wcit_constants=>c_type_bpca_tbom im_activity = cl_ags_wcit_constants=>c_activity_execute. WRITE: / icon_led_green AS ICON, 'Authorization for TBOM Generation: ', 'OK'. CATCH cx_ags_wcit INTO lo_ex_wcit. lv_text = lo_ex_wcit->get_text( ). Page 10 WRITE: / icon_led_red AS ICON, 'Authorization for TBOM Generation: ', 'Failed'. WRITE: / lv_text. * TODO: Write Recommendations ENDTRY. * Check authority to create BPCA Analysis TRY. CALL METHOD cl_ags_bpca_result_object=>authority_check_object EXPORTING im_type = cl_ags_wcit_constants=>c_type_bpca_result im_activity = cl_ags_wcit_constants=>c_activity_change. WRITE: / icon_led_green AS ICON, 'Authorization to create BPCA Analysis: ', 'OK'. CATCH cx_ags_wcit INTO lo_ex_wcit. lv_text = lo_ex_wcit->get_text( ). WRITE: / icon_led_red AS ICON, 'Authorization to create BPCA Analysis: ', 'Failed'. WRITE: / lv_text. * TODO: Write Recommendations ENDTRY. * Check authority to optimize BPCA Result TRY. CALL METHOD cl_ags_bpca_tst_sc_oa_object=>authority_check_tscoa EXPORTING iv_activity = cl_ags_wcit_constants=>c_activity_create iv_approach_id = space. WRITE: / icon_led_green AS ICON, 'Authorization for BPCA Test Scope Optimization: ', 'OK'. CATCH cx_ags_wcit INTO lo_ex_wcit. lv_text = lo_ex_wcit->get_text( ). WRITE: / icon_led_red AS ICON, 'Authorization for BPCA Test Scope Optimization: ', 'Failed'. WRITE: / lv_text. * TODO: Write Recommendations ENDTRY. WRITE: /. WRITE: /'Information:'. WRITE: / icon_information AS ICON, 'Composite role SAP_BPCA_EXE_COMP includes authorizations for BPCA TBOM creation/ BPCA Analysis display'. WRITE: / icon_information AS ICON, 'Composite role SAP_BPCA_ALL_COMP includes all required authorizations for BPCA TBOM creation and BPCA Analysis creation'. WRITE: /. ULINE. *--------------------------------------------------------------------* * Checks against Managed System 1 (Test System) *--------------------------------------------------------------------* WRITE: / 'Section 2: Checks against Managed System 1 (Test System)', sid, client. WRITE: /. * Retrieve RFC destination of type LOGIN / Read / Trusted PERFORM get_valid_rfcdest USING sid client CHANGING Page 11 g_managed_system_rfcdest_login "only needed as fallback for dyn.TBOM when TRUSTED failed g_managed_system_rfcdest_trust "For semi-dynamic TBOM generation g_managed_system_rfcdest_read. "For reading Transport Requests * Check the RFC destinations via ping PERFORM check_rfcdests USING g_managed_system_rfcdest_login g_managed_system_rfcdest_trust g_managed_system_rfcdest_read. IF sy-subrc <> 0. ENDIF. WRITE: /. *& Read ST-PI release and patch level in managed system PERFORM check_stpi_version USING g_managed_system_rfcdest_read. WRITE: /. * Check Authorizations in Managed System 1 * a) Function Module for TBOM generation WRITE: / 'Authorization checks for Function Modules to create TBOM:'. CALL FUNCTION 'FUNCTION_EXISTS' DESTINATION g_managed_system_rfcdest_read EXPORTING funcname = 'E2E_TESTING_AGENT_PFA' EXCEPTIONS function_not_exist = 1 communication_failure = 2 MESSAGE lv_message system_failure = 3 MESSAGE lv_message OTHERS = 4. IF sy-subrc = 0. CALL FUNCTION 'E2E_TESTING_AGENT_PFA' DESTINATION g_managed_system_rfcdest_read EXPORTING iv_exe_unit = space iv_exe_type = space iv_dynamic = abap_false iv_static = abap_false EXCEPTIONS communication_failure = 1 MESSAGE lv_message system_failure = 2 MESSAGE lv_message OTHERS = 3. IF sy-subrc = 1 OR sy-subrc = 2. "Missing Authorization WRITE: / icon_led_red AS ICON, 'Authorization check for function module E2E_TESTING_AGENT_PFA - Failed'. WRITE: / lv_message. ELSE. WRITE: / icon_led_green AS ICON, 'Authorization check for function module E2E_TESTING_AGENT_PFA - OK'. ENDIF. ELSE. WRITE: / icon_led_red AS ICON, 'Function module E2E_TESTING_AGENT_PFA does not exist.'. WRITE: / lv_message. ENDIF. Page 12 CALL FUNCTION 'FUNCTION_EXISTS' DESTINATION g_managed_system_rfcdest_read EXPORTING funcname = 'E2E_TESTING_AGENT_EXECHECK' EXCEPTIONS function_not_exist = 1 communication_failure = 2 MESSAGE lv_message system_failure = 3 MESSAGE lv_message OTHERS = 4. IF sy-subrc = 0. CALL FUNCTION 'E2E_TESTING_AGENT_EXECHECK' DESTINATION g_managed_system_rfcdest_read EXPORTING iv_exe_unit = lv_exe_unit iv_exe_type = lv_exe_type EXCEPTIONS communication_failure = 1 MESSAGE lv_message system_failure = 2 MESSAGE lv_message OTHERS = 3. IF sy-subrc = 1 OR sy-subrc = 2. "Missing Authorization WRITE: / icon_led_red AS ICON, 'Missing authorization for function module E2E_TESTING_AGENT_EXECHECK'. WRITE: / lv_message. ELSE. WRITE: / icon_led_green AS ICON, 'Authorization check for function module E2E_TESTING_AGENT_EXECHECK - OK'. ENDIF. ELSE. WRITE: / icon_led_red AS ICON, 'Function module E2E_TESTING_AGENT_EXECHECK does not exist.'. WRITE: / lv_message. ENDIF. CALL FUNCTION 'FUNCTION_EXISTS' DESTINATION g_managed_system_rfcdest_read EXPORTING funcname = 'E2E_TESTING_AGENT_UPL_CONVSAVE' EXCEPTIONS function_not_exist = 1 communication_failure = 2 MESSAGE lv_message system_failure = 3 MESSAGE lv_message OTHERS = 4. IF sy-subrc = 0. CALL FUNCTION 'E2E_TESTING_AGENT_UPL_CONVSAVE' DESTINATION g_managed_system_rfcdest_read EXPORTING it_upl_data = lt_upl_data iv_run_in_threads = space EXCEPTIONS communication_failure = 1 MESSAGE lv_message system_failure = 2 MESSAGE lv_message OTHERS = 3. IF sy-subrc = 1 OR sy-subrc = 2. "Missing Authorization WRITE: / icon_led_red AS ICON, 'Authorization check failed for function module E2E_TESTING_AGENT_UPL_CONVSAVE'. WRITE: / lv_message. ELSE. Page 13 WRITE: / icon_led_green AS ICON, 'Authorization check for function module E2E_TESTING_AGENT_UPL_CONVSAVE - OK'. ENDIF. ELSE. WRITE: / icon_led_red AS ICON, 'Function module E2E_TESTING_AGENT_UPL_CONVSAVE does not exist.'. WRITE: / lv_message. ENDIF. * b) Function Module for Reading Transport Requests WRITE: /. WRITE: / 'Function Modules to read Transport Requests:'. CALL FUNCTION 'FUNCTION_EXISTS' DESTINATION g_managed_system_rfcdest_read EXPORTING funcname = 'E2E_TESTING_AGENT_TRCONTENT' EXCEPTIONS function_not_exist = 1 communication_failure = 2 MESSAGE lv_message system_failure = 3 MESSAGE lv_message OTHERS = 4. IF sy-subrc = 0. CALL FUNCTION 'E2E_TESTING_AGENT_TRCONTENT' DESTINATION g_managed_system_rfcdest_read EXPORTING iv_trkorr = space TABLES et_e071k = lt_e071k EXCEPTIONS communication_failure = 1 MESSAGE lv_message system_failure = 2 MESSAGE lv_message OTHERS = 3. IF sy-subrc = 1 OR sy-subrc = 2. "Missing Authorization WRITE: / icon_led_red AS ICON, 'Authorization check Failed for function module E2E_TESTING_AGENT_TRCONTENT'. WRITE: / lv_message. ELSE. WRITE: / icon_led_green AS ICON, 'Authorization check OK for function module E2E_TESTING_AGENT_TRCONTENT'. ENDIF. ELSE. WRITE: / icon_led_red AS ICON, 'Function Module existence check Failed for function module E2E_TESTING_AGENT_TRCONTENT'. WRITE: / lv_message. ENDIF. WRITE: /. WRITE: /'Information:'. WRITE: / icon_information AS ICON, 'Composite role SAP_SM_BPCA_TBOM includes authorizations for BPCA TBOM creation in the managed system'. WRITE: /. ULINE. *--------------------------------------------------------------------* * * Check availability of UPL data *--------------------------------------------------------------------* WRITE: / 'Section 3: Check availability of UPL data'. Page 14 WRITE: /. * Check Read RFC against Managed System 2 (PRD System) WRITE: / icon_information AS ICON, 'Check Read RFC against Managed System 2 (PRD System)', sid_upl, upl_clnt. * Retrieve RFC destination of type Read CALL FUNCTION 'SCDT_GET_DEST_BY_SYSTEM' EXPORTING sysid = sid_upl mandt = upl_clnt service = 'CUST_SCOUT' IMPORTING destination = g_managed_system_rfcdest_read EXCEPTIONS tr_error = 1 no_rfc_dest = 2 OTHERS = 3. IF sy-subrc <> 0. ENDIF. WRITE: / icon_information AS ICON, 'Read RFC :', g_managed_system_rfcdest_read. * Check the RFC destinations via ping CALL FUNCTION 'RFC_PING' DESTINATION g_managed_system_rfcdest_read EXCEPTIONS OTHERS = 1. IF sy-subrc <> 0. sy-subrc = 4. WRITE: / icon_led_red AS ICON, 'System cannot be reached with Read RFC' , g_managed_system_rfcdest_read. ELSE. WRITE: / icon_led_green AS ICON, 'System can be reached with Read RFC' , g_managed_system_rfcdest_read. ENDIF. * UPL active in managed system? WRITE: /. WRITE: / 'Check UPL Status'. CALL FUNCTION 'FUNCTION_EXISTS' DESTINATION g_managed_system_rfcdest_read EXPORTING funcname = '/SDF/UPL_SYSTEM_STATUS' EXCEPTIONS function_not_exist = 1 communication_failure = 2 MESSAGE lv_message system_failure = 3 MESSAGE lv_message OTHERS = 4. IF sy-subrc = 0. CALL FUNCTION '/SDF/UPL_SYSTEM_STATUS' DESTINATION g_managed_system_rfcdest_read IMPORTING status = lv_status retention_period = lv_retention_period available_days = lv_available_days job_trigger_collect = lv_job_trigger_collect job_upl_collect = lv_job_upl_collect EXCEPTIONS Page 15 communication_failure = 1 MESSAGE lv_message system_failure = 2 MESSAGE lv_message core_logic_not_available = 3 scov_on = 4 trigger_collect_missing = 5 too_many_trigger_jobs = 6 too_many_upl_jobs = 7 OTHERS = 8. IF sy-subrc = 0. WRITE: / icon_led_green AS ICON, 'UPL active'. WRITE: / icon_information AS ICON, 'UPL Info No 1: Status = ', lv_status,'(space = off)'. WRITE: / icon_information AS ICON, 'UPL Info No 2: Retention Period = ', lv_retention_period. WRITE: / icon_information AS ICON, 'UPL Info No 3: Available Days = ', lv_available_days. WRITE: / icon_information AS ICON, 'UPL Info No 4: Job Trigger Collect = ', lv_job_trigger_collect, '(Job UPL Collector: space = off)'. WRITE: / icon_information AS ICON, 'UPL Info No 5: Job UPL Collect = ', lv_job_upl_collect,'(Job SAP SolMan Extractor:space = off)'. WRITE: /. ELSE. WRITE: / icon_led_red AS ICON, 'UPL inactive. SY-SUBRC = ',sy-subrc. WRITE: / 'Legend for SY-SUBRC:'. WRITE: / 'COMMUNICATION_FAILURE = 1 '. WRITE: / 'SYSTEM_FAILURE = 2 '. WRITE: / 'CORE_LOGIC_NOT_AVAILABLE = 3'. WRITE: / 'SCOV_ON = 4'. WRITE: / 'TRIGGER_COLLECT_MISSING = 5'. WRITE: / 'TOO_MANY_TRIGGER_JOBS = 6'. WRITE: / 'TOO_MANY_UPL_JOBS = 7'. WRITE: / 'OTHERS = 8'. ENDIF. ELSE. WRITE: / icon_led_red AS ICON, 'Failed: Function module /SDF/UPL_SYSTEM_STATUS does not exist.'. WRITE: / lv_message. WRITE: / icon_information AS ICON, 'Please install SAP Note 1878915 in UPL system'. ENDIF. PERFORM check_upl_extractor. WRITE: /. WRITE: / 'Check MDX Parser configured on Solman System (required to read UPL data):'. CALL FUNCTION 'RFC_PING' DESTINATION 'MDX PARSER' EXCEPTIONS communication_failure = 1 MESSAGE lv_message system_failure = 2 MESSAGE lv_message. IF sy-subrc = 0. WRITE: / icon_led_green AS ICON, 'MDX Parser OK.'. ELSE. WRITE: / icon_led_red AS ICON, 'MDX Parser configuration check Failed. See SAP note 1032461 and 126507 for MDX Parser setup.'. ENDIF. Page 16 WRITE /. WRITE: / 'Check Reading of UPL data for Managed System 2 in SAP SolMan BW InfoCube'. DATA lt_result TYPE ags_cc_upl_output_extract_tbl. DATA lv_days_upl TYPE i. DATA lv_bw_sysid TYPE sysid. DATA lt_log TYPE ags_upl_error_log_t. FIELD-SYMBOLS <ls_result> LIKE LINE OF lt_result. FIELD-SYMBOLS <ls_log> LIKE LINE OF lt_log. lv_bw_sysid = sid_upl. CALL FUNCTION 'AGS_CC_UPL_EXTRACT_DATES' EXPORTING sysid = lv_bw_sysid IMPORTING et_result = lt_result et_log = lt_log. SORT lt_result BY caldate ASCENDING. DELETE ADJACENT DUPLICATES FROM lt_result COMPARING caldate. lv_days_upl = lines( lt_result ). IF lt_result IS NOT INITIAL. WRITE: / icon_led_green AS ICON, 'UPL data available in SAP Solman InfoCube'. READ TABLE lt_result ASSIGNING <ls_result> INDEX 1. WRITE: / icon_information AS ICON, `First successful extraction of UPL data: `, <ls_result>-caldate . READ TABLE lt_result ASSIGNING <ls_result> INDEX lv_days_upl. WRITE: / icon_information AS ICON, `Last Succesful extraction of UPL data: `, <ls_result>-caldate. WRITE: / icon_information AS ICON, `Total successful Extractions of UPL data: `, lv_days_upl . ELSE. WRITE: / icon_led_red AS ICON, 'No UPL Data for managed system 2 in SAP Solman BW Infocube found.'. IF lt_log IS NOT INITIAL. WRITE: / 'Error Messages:'. LOOP AT lt_log ASSIGNING <ls_log>. WRITE: <ls_log>-text, /. ENDLOOP. ENDIF. ENDIF. WRITE /. * Check UPL System and Client included in System Landscape of SOLAR_PROJECT_ADMIN * Create Instance for Project_ID in g_proj TRY. lo_bph_gen = cl_ags_bpca_bph_gen_project=>get_instance( iv_project_id = g_proj ). CATCH cx_ags_wcit INTO lo_ex_wcit. "No Exception expected because of previous existence check ENDTRY. *...and now we retreive logical component and system role based on imported system and client (for Project see above) TRY. CALL METHOD lo_bph_gen->check_valid_logical_component "for g_proj EXPORTING iv_system = sid_upl Page 17 iv_client = upl_clnt iv_check_project_only = abap_true IMPORTING ev_logcomp_exist = lv_logcomp_exist CHANGING cv_role = lv_sys_role. CATCH cx_ags_bpca_bph INTO lo_ex_bph. ENDTRY. IF lv_logcomp_exist IS INITIAL. WRITE: / icon_led_red AS ICON, 'Check UPL SID/Client included in System Landscape of Project', g_proj, sid, client, 'Failed'. ELSE. WRITE: / icon_led_green AS ICON, 'Check UPL SID/Client included in System Landscape of Project', g_proj, sid, client, 'OK'. * Get Logical Component PERFORM get_logical_component USING sid client CHANGING g_logcmp g_sys_role. WRITE: / icon_information AS ICON, 'Logical component used: ', g_logcmp. WRITE: / icon_information AS ICON, 'System role used: ', lv_sys_role. ENDIF. ULINE. *--------------------------------------------------------------------* * Section 4: User Paramter *--------------------------------------------------------------------* * AGS_BPCA_TBOM_CHILDS = X -> If set, TBOM Childs are allowed * AGS_BPCA_TBOM_EXPERT = 3 -> Ability branching levels static TBOMs *--------------------------------------------------------------------* WRITE: / 'Section 4: Available User Parameter'. WRITE: /. CALL FUNCTION 'BAPI_USER_GET_DETAIL' EXPORTING username = sy-uname TABLES parameter = lt_user_params return = lt_return. LOOP AT lt_user_params ASSIGNING <fs_user_params>. FIND 'AGS_BPCA' IN <fs_user_params>-parid. IF sy-subrc = 0. WRITE: / icon_information AS ICON, <fs_user_params>-parid, <fs_user_params>-parva, <fs_user_params>-partxt. ENDIF. ENDLOOP. ULINE. *&---------------------------------------------------------------------* *& End of main program *&---------------------------------------------------------------------* *************************************************************************** ************* * Form Get Logical Component Page 18 * Retrieve Logical Component from SMSY *& --> l_sid System ID *& --> l_s_client Client *& <-- l_logcmp Logical component *& <-> l_role System role of the system related to the logiacl component *& Here we do a best guess and change the role when required *************************************************************************** ************** FORM get_logical_component USING l_sid l_client CHANGING l_logcmp l_role. DATA lt_logcmp_systems TYPE smsy_t_groupsystem. TYPE-POOLS: icon. CALL FUNCTION 'SMSYCL_GET_ASSIGNED_SYSTEMS' IMPORTING et_logcmp_systems = lt_logcmp_systems. IF sy-subrc <> 0. ENDIF. DELETE lt_logcmp_systems WHERE systemname <> l_sid OR mandt <> l_client OR logcmp = ''. DATA wa TYPE smsy_groupsystem. DATA l_noflogcmps TYPE i. DESCRIBE TABLE lt_logcmp_systems LINES l_noflogcmps . WRITE: / icon_information AS ICON, 'Logical component(s) found for ', l_sid, '/', l_client, ':', l_noflogcmps. IF l_noflogcmps = 0. "No Logical Component found CLEAR l_logcmp. ELSEIF l_noflogcmps = 1. " Exactly 1 Logical Component found READ TABLE lt_logcmp_systems INDEX 1 INTO wa. l_logcmp = wa-logcmp. * * * IF l_role <> wa-role. WRITE: / 'Role changed from ', l_role, ' to ', wa-role. ENDIF. l_role = wa-role. " Set system role to whatever role that is used for found Log.Component RETURN. ENDIF. SORT lt_logcmp_systems BY logcmp. TYPES BEGIN OF roles. TYPES logcmpname TYPE smsy_groupsystem-logcmp. TYPES nofroles TYPE i. TYPES END OF roles. DATA roles_wa TYPE roles. DATA roles_itab TYPE TABLE OF roles. DATA lastname TYPE smsy_groupsystem-logcmp. LOOP AT lt_logcmp_systems INTO wa. WRITE: / wa-groupname, ' ', wa-group_type, ' ', wa-logcmp, ' ', warole, ' ', wa-existing_role. IF lastname = wa-logcmp. ADD 1 TO roles_wa-nofroles. ELSE. Page 19 IF lastname <> ''. APPEND roles_wa TO roles_itab. ENDIF. roles_wa-logcmpname = wa-logcmp. lastname = wa-logcmp. roles_wa-nofroles = 1. ENDIF. ENDLOOP. APPEND roles_wa TO roles_itab. SORT roles_itab DESCENDING BY nofroles. READ TABLE roles_itab INDEX 1 INTO roles_wa. l_logcmp = roles_wa-logcmpname. WRITE: / roles_wa-logcmpname, ' ',roles_wa-nofroles, ' is the largest vector'. LOOP AT roles_itab INTO roles_wa. WRITE: / roles_wa-logcmpname, ' ',roles_wa-nofroles. ENDLOOP. WRITE: / icon_led_green AS ICON, 'Best matching logical component for ', sid, client, ' is ', g_logcmp. IF l_logcmp IS INITIAL. WRITE: / icon_led_green AS ICON, 'No logical component found for SID / Client -> Stop program'. EXIT. ENDIF. ENDFORM. "get_logical_component *----------------------------------------------------------------------------------* * Form get_valid_rfcdest * Retrieve RFC destinations based on SID and Client *& --> l_sysid System ID *& --> l_s_client Client *& Various RFC destinations *& <-- l_managed_system_rfcdest_login Login *& <-- l_managed_system_rfcdest_trust Trust *& <-- l_managed_system_rfcdest_read Read *----------------------------------------------------------------------------------* FORM get_valid_rfcdest USING l_sysid l_client CHANGING l_managed_system_rfcdest_login l_managed_system_rfcdest_trust l_managed_system_rfcdest_read. * Get RFC destination of type Login CALL FUNCTION 'SCDT_GET_DEST_BY_SYSTEM' EXPORTING sysid = l_sysid mandt = l_client service = 'CUST_LOGIN' IMPORTING destination = l_managed_system_rfcdest_login EXCEPTIONS tr_error = 1 Page 20 no_rfc_dest = 2 OTHERS = 3. IF sy-subrc <> 0. ENDIF. * Get RFC destination of type Read CALL FUNCTION 'SCDT_GET_DEST_BY_SYSTEM' EXPORTING sysid = l_sysid mandt = l_client service = 'CUST_SCOUT' IMPORTING destination = l_managed_system_rfcdest_read EXCEPTIONS tr_error = 1 no_rfc_dest = 2 OTHERS = 3. IF sy-subrc <> 0. ENDIF. * Get RFC destination of type Trusted CALL FUNCTION 'SCDT_GET_DEST_BY_SYSTEM' EXPORTING sysid = l_sysid mandt = l_client service = 'CUST_SYNCH' IMPORTING destination = l_managed_system_rfcdest_trust EXCEPTIONS tr_error = 1 no_rfc_dest = 2 OTHERS = 3. IF sy-subrc <> 0. ENDIF. WRITE: / 'RFC destinations: '. WRITE: / icon_information AS ICON, 'Login RFC :', l_managed_system_rfcdest_login. WRITE: / icon_information AS ICON, 'Read RFC :', l_managed_system_rfcdest_read. WRITE: / icon_information AS ICON, 'Trusted RFC:', l_managed_system_rfcdest_trust. ENDFORM. "get_valid_rfcdest *---------------------------------------------------------------------------------------------* Form Get_STPI_Version * Call managed system using RFC type READ to retrieve ST-PI Release and Patch Level * Required minimum version: 2008_1_700 or 2008_1_710 * Required minimum Patch level: 0008 * Here we will stop the program for lower ST-PI levels when the algo is clear *---------------------------------------------------------------------------------------------FORM check_stpi_version USING rfcdest. DATA itab_versions TYPE ags_smt_tsat_svers_t. DATA l_version_wa TYPE cvers. Page 21 DATA l_itab_tra_tdevc TYPE TABLE OF tdevc. CALL FUNCTION 'E2E_TESTING_AGENT_ACVERS' DESTINATION rfcdest IMPORTING et_tra_cvers = itab_versions TABLES et_tra_tdevc = l_itab_tra_tdevc EXCEPTIONS OTHERS = 1. IF sy-subrc <> 0. WRITE: / icon_led_red AS ICON, 'Check ST-PI Release / SP failed using RFC destination: ', rfcdest. WRITE: / icon_cancel AS ICON, 'Stop program'. EXIT. ELSE. LOOP AT itab_versions INTO l_version_wa WHERE component EQ 'ST-PI'. IF ( l_version_wa-release EQ '2008_1_700' AND l_version_wa-extrelease GE 8 ) OR ( l_version_wa-release EQ '2008_1_710' AND l_version_wa-extrelease GE 8 ). WRITE: / icon_led_green AS ICON, 'Check of ST-PI Release / SP succeeded'. ELSE. WRITE: / icon_led_red AS ICON , 'ST-PI Version/Level not sufficient.'. ENDIF. WRITE: / icon_information AS ICON, 'Destination: ', rfcdest, ' Version: ', l_version_wa-release, l_version_wa-extrelease . WRITE: / icon_information AS ICON, 'Minimum required ST-PI Release 2008_1_700 with SP08'. ENDLOOP. ENDIF. ENDFORM. "Check_ST-PI_version *&---------------------------------------------------------------------* *& Form getlongsysid *& Changes the system ID passed the the one retireved by LMDB *&---------------------------------------------------------------------* * <->l_sysid The system ID *----------------------------------------------------------------------* FORM getlongsysid CHANGING l_sysid. DATA systype TYPE REF TO cl_diagls_tech_syst_type. CALL METHOD cl_diagls_tech_syst_type=>get_technical_system_type EXPORTING im_type = 'ABAP' "CL_DIAGLS_TECH_SYST_TYPE=>CO_ABAP' RECEIVING re_technical_system_type = systype. DATA olmdb TYPE REF TO cl_diagls_factory. TRY. CALL METHOD cl_diagls_lmdb_factory=>new_instance RECEIVING re_landscape_factory = olmdb. CATCH cx_diagls_retrieve_exception . Page 22 ENDTRY. DATA l_tmpsysid TYPE diagls_technical_system_sid. l_tmpsysid = l_sysid. DATA retval TYPE tt_diagls_technical_systems. TRY. CALL METHOD olmdb->get_tech_systs_by_sid_type EXPORTING im_sid = l_tmpsysid im_type = systype->co_abap im_diag_relevant = abap_false RECEIVING re_technical_systems = retval. CATCH cx_diagls_retrieve_exception . ENDTRY. DATA line TYPE sdiagls_technical_system. LOOP AT retval INTO line. * write: / 'SAP System: ' , line-LONG_SID. ENDLOOP. l_sysid = line-long_sid. ENDFORM. "getlongsysid *&---------------------------------------------------------------------* *& Form CHECKPROJECT *&---------------------------------------------------------------------* * Check whether project does exist already and provide a dialog * for overwriting the exiting project. Stopps the program when an existing * project should not be overwritten *----------------------------------------------------------------------* * -->l_proj text *----------------------------------------------------------------------* FORM checkproject USING l_proj. DATA l_itab_objlist TYPE spro_objectlist_tab. CALL FUNCTION 'SPROJECT_READ' EXPORTING project_id = l_proj read_header_only = abap_true TABLES objectlist = l_itab_objlist. DATA l_inumlines TYPE int4. DESCRIBE TABLE l_itab_objlist LINES l_inumlines. IF l_inumlines <> 0. * Acrion needed ENDIF. ENDFORM. " CHECKPROJECT *&---------------------------------------------------------------------* *& Form CHECK_LOGICAL_COMPONENT *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * -->P_SID text * -->P_CLIENT text * -->P_G_LOGCMP text *----------------------------------------------------------------------* Page 23 FORM check_logical_component USING p_sid p_client p_g_logcmp. TYPE REF TO * DATA lo_bph_gen_project cl_ags_bpca_bph_gen_project. * lo_bph_gen_project = cl_ags_bpca_bph_gen_project=>get_instance( iv_project_id = g_proj * is_project_info = ls_project_info ). ** TRY. * CALL METHOD me->CHECK_VALID_LOGICAL_COMPONENT * EXPORTING * IV_SYSTEM = * IV_CLIENT = ** IV_CHECK_PROJECT_ONLY = ABAP_FALSE ** IMPORTING ** EV_LOGCOMP_EXIST = * CHANGING * CV_ROLE = * . ** CATCH CX_AGS_BPCA_BPH . ** CATCH CX_LMDB_LC_ERROR . ** ENDTRY. * * IF sy-subrc <> 0. WRITE: / 'Logical component entered by user does not exist --> stop program'. ENDIF. ENDFORM. " CHECK_LOGICAL_COMPONENT * *&---------------------------------------------------------------------* *& Form CHECK_RFCDESTS *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * -->P_G_MANAGED_SYSTEM_RFCDEST_LOGIN text * -->P_G_MANAGED_SYSTEM_RFCDEST_TRUST text * -->P_G_MANAGED_SYSTEM_RFCDEST_READ text *----------------------------------------------------------------------* FORM check_rfcdests USING l_managed_system_rfcdest_login l_managed_system_rfcdest_trust l_managed_system_rfcdest_read. CALL FUNCTION 'E2E_TESTING_AGENT_INFO' DESTINATION l_managed_system_rfcdest_login EXCEPTIONS communication_failure = 1 MESSAGE lv_message system_failure = 2 MESSAGE lv_message OTHERS = 3. IF sy-subrc <> 0. sy-subrc = 4. WRITE: / icon_led_red AS ICON, 'Login RFC destination ' , l_managed_system_rfcdest_login , ' can not be reached.'. WRITE: / lv_message. ENDIF. CALL FUNCTION 'E2E_TESTING_AGENT_INFO' DESTINATION l_managed_system_rfcdest_read Page 24 EXCEPTIONS communication_failure = 1 MESSAGE lv_message system_failure = 2 MESSAGE lv_message OTHERS = 3. IF sy-subrc <> 0. sy-subrc = 4. WRITE: / icon_led_red AS ICON, 'Read RFC destination ' , l_managed_system_rfcdest_read , ' can not be reached.'. WRITE: / lv_message. ENDIF. CALL FUNCTION 'E2E_TESTING_AGENT_INFO' DESTINATION l_managed_system_rfcdest_trust EXCEPTIONS communication_failure = 1 MESSAGE lv_message system_failure = 2 MESSAGE lv_message OTHERS = 3. IF sy-subrc <> 0. sy-subrc = 0. WRITE: / icon_led_red AS ICON, 'Trusted RFC destination ' , l_managed_system_rfcdest_trust , ' can not be reached.'. WRITE: / lv_message. ENDIF. ENDFORM. " CHECK_RFCDESTS *&---------------------------------------------------------------------* *& Form CHECK_UPL_EXTRACTOR *&---------------------------------------------------------------------* * text *----------------------------------------------------------------------* * --> p1 text * <-- p2 text *----------------------------------------------------------------------* FORM check_upl_extractor . DATA: l_date LIKE sy-datum. DATA: l_help(14) TYPE c. WRITE: / `Status check: UPL Data Extraction from SAP system 2 (UPL) to SAP Solman InfoCube`. DATA: ls_wli TYPE lc_extractor_upl TYPE '/SDF/CC_EXTRACT_UPL_EFWK', lt_log_runs TYPE lv_runs_ok TYPE lv_runs_error TYPE e2e_active_wli, e2e_extractor VALUE e2e_efwk_log_runs_tt, i, i. FIELD-SYMBOLS: <ls_log_run> LIKE LINE OF lt_log_runs. SELECT SINGLE * FROM e2e_active_wli INTO ls_wli WHERE sid = sid_upl AND extractor = lc_extractor_upl. IF sy-subrc = 0 AND ls_wli-active = abap_true. cl_e2eefwk_log_viewer=>get_e2e_efwk_log_runs( EXPORTING wli_id = ls_wli-wli_id RECEIVING Page 25 e2e_efwk_log_runs = lt_log_runs ). WRITE: / icon_led_green AS ICON, `Extractor is active.`. READ TABLE lt_log_runs ASSIGNING <ls_log_run> INDEX 1. IF sy-subrc = 0. IF <ls_log_run>-status_icon = 'ICON_LED_GREEN'. WRITE: / icon_led_green AS ICON, `Last Status: OK `. ELSEIF <ls_log_run>-status_icon = 'ICON_LED_RED'. WRITE: / icon_led_red AS ICON, `Last Status: Failed `. ENDIF. ENDIF. LOOP AT lt_log_runs ASSIGNING <ls_log_run>. CASE <ls_log_run>-status_icon. WHEN 'ICON_LED_GREEN'. ADD 1 TO lv_runs_ok. WHEN 'ICON_LED_RED'. ADD 1 TO lv_runs_error. ENDCASE. ENDLOOP. WRITE: / icon_information AS ICON,`Status of last 20 extractions: `, 'OK extractions:', lv_runs_ok, 'Failed extractions:', lv_runs_error. WRITE :/ 'Error Messages for not successfull UPL extractions: '. LOOP AT lt_log_runs ASSIGNING <ls_log_run> WHERE status_icon = 'ICON_LED_RED'. MOVE <ls_log_run>-timestamp TO l_help. l_date = l_help(8). WRITE: / icon_information AS ICON, 'Date: ',l_date,'Message: ', <ls_log_run>-message. ENDLOOP. ELSE. WRITE: / icon_led_red AS ICON, `UPL Extractor for System `, sid_upl , ` to SAP SolMan is not active`. ENDIF. ENDFORM. " CHECK_UPL_EXTRACTOR Page 26 www.sap.com © 2014 SAP SE. All rights reserved. SAP, R/3, SAP NetWeaver, Duet, PartnerEdge, ByDesign, SAP BusinessObjects Explorer, StreamWork, SAP HANA, and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP SE in Germany and other countries. Business Objects and the Business Objects logo, BusinessObjects, Crystal Reports, Crystal Decisions, Web Intelligence, Xcelsius, and other Business Objects products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of Business Objects Software Ltd. Business Objects is an SAP company. Sybase and Adaptive Server, iAnywhere, Sybase 365, SQL Anywhere, and other Sybase products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of Sybase Inc. Sybase is an SAP company. Crossgate, m@gic EDDY, B2B 360°, and B2B 360° Services are registered trademarks of Crossgate AG in Germany and other countries. Crossgate is an SAP company. All other product and service names mentioned are the trademarks of their respective companies. Data contained in this document serves informational purposes only. National product specifications may vary. These materials are subject to change without notice. These materials are provided by SAP SE and its affiliated companies ("SAP Group") for informational purposes only, without representation or warranty of any kind, and SAP Group shall not be liable for errors or omissions with respect to the materials. The only warranties for SAP Group products and services are those that are set forth in the express warranty statements accompanying such products and services, if any. Nothing herein should be construed as constituting an additional warranty.