Sei sulla pagina 1di 24

SAP How-To Guide Master Data Governance for Financials

How To Master Data Governance for Financials: Send a Mail notification during the governance process

Applicable Releases: EhP5

Version 1.0 August 2011

Copyright 2011 SAP AG. All rights reserved. No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG. The information contained herein may be changed without prior notice. Some software products marketed by SAP AG and its distributors contain proprietary software components of other software vendors. Microsoft, Windows, Outlook, and PowerPoint are registered trademarks of Microsoft Corporation. IBM, DB2, DB2 Universal Database, OS/2, Parallel Sysplex, MVS/ESA, AIX, S/390, AS/400, OS/390, OS/400, iSeries, pSeries, xSeries, zSeries, z/OS, AFP, Intelligent Miner, WebSphere, Netfinity, Tivoli, Informix, i5/OS, POWER, POWER5, OpenPower and PowerPC are trademarks or registered trademarks of IBM Corporation. Adobe, the Adobe logo, Acrobat, PostScript, and Reader are either trademarks or registered trademarks of Adobe Systems Incorporated in the United States and/or other countries. Oracle is a registered trademark of Oracle Corporation. UNIX, X/Open, OSF/1, and Motif are registered trademarks of the Open Group. Citrix, ICA, Program Neighborhood, MetaFrame, WinFrame, VideoFrame, and MultiWin are trademarks or registered trademarks of Citrix Systems, Inc. HTML, XML, XHTML and W3C are trademarks or registered trademarks of W3C, World Wide Web Consortium, Massachusetts Institute of Technology. Java is a registered trademark of Sun Microsystems, Inc. JavaScript is a registered trademark of Sun Microsystems, Inc., used under license for technology invented and implemented by Netscape. MaxDB is a trademark of MySQL AB, Sweden. SAP, R/3, mySAP, mySAP.com, xApps, xApp, SAP NetWeaver, and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world. 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 AG 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. These materials are provided as is without a warranty of any kind, either express or implied, including but not limited to, the implied warranties of merchantability, fitness for a particular purpose, or non-infringement. SAP shall not be liable for damages of any kind including without limitation direct, special, indirect, or consequential damages that may result from the use of these materials. SAP does not warrant the accuracy or completeness of the information, text, graphics, links or other items contained within these materials. SAP has no control over the information that you may access through the use of hot links contained in these materials and does not endorse your use of third party web pages nor provide any warranty whatsoever relating to third party web pages. SAP NetWeaver How-to Guides are intended to simplify the product implementation. While specific product features and procedures typically are explained in a practical business context, it is not implied that those features and procedures are the only approach in solving a specific business problem using SAP NetWeaver. Should you wish to receive additional information, clarification or support, please refer to SAP Consulting. Any software coding and/or code lines / strings (Code) included in this documentation are only examples and are not intended to be used in a productive system environment. The Code is only intended better explain and visualize the syntax and phrasing rules of certain coding. SAP does not warrant the correctness and completeness of the Code given herein, and SAP shall not be liable for errors or damages caused by the usage of the Code, except if such damages were caused by SAP intentionally or grossly negligent. Disclaimer Some components of this product are based on Java. Any code change in these components may cause unpredictable and severe malfunctions and is therefore expressively prohibited, as is any decompilation of these components. Any Java Source Code delivered with this product is only to be used by SAPs Support Services and may not be modified or altered in any way.

Document History
Document Version 1.00 Description First official release of this guide

Typographic Conventions
Type Style Example Text Description Words or characters quoted from the screen. These include field names, screen titles, pushbuttons labels, menu names, menu paths, and menu options. Cross-references to other documentation Example text Emphasized words or phrases in body text, graphic titles, and table titles File and directory names and their paths, messages, names of variables and parameters, source text, and names of installation, upgrade and database tools. User entry texts. These are words or characters that you enter in the system exactly as they appear in the documentation. Variable user entry. Angle brackets indicate that you replace these words and characters with appropriate entries to make entries in the system. Keys on the keyboard, for example, F2 or ENTER.

Icons
Icon Description Caution Note or Important Example Recommendation or Tip

Example text

Example text

<Example text>

EXAMPLE TEXT

Table of Contents
1. 2. 3. Business Scenario............................................................................................................... 1 Background Information ..................................................................................................... 1 Step-by-Step Procedure ...................................................................................................... 2 3.1 3.2 3.3 3.4 3.5 3.6 Create a New Workflow ................................................................................................ 2 Modify the Workflow Container ..................................................................................... 4 Modify Activation Step .................................................................................................. 7 Add a Mail Notification Step ....................................................................................... 11 Configuration .............................................................................................................. 13 Example Coding for Program-Exit Class .................................................................... 14

Send a Mail Notification During the MDGF Process

1.

Business Scenario

SAP Master Data Governance for Financials (MDGF) provides business processes to find, create, change and delete financial master data. It supports the governance of financial master data in a centeral hub and the distribution to connected operational and business intelligence systems. Master data in MDGF is maintained by change request. The processes of MDGF are business workflow-driven and can include several approval and revision phases, and the collaboration of all users participating in the master data maintenance. This scenario addresses when a change request is finally approved, all users affected will get an Email with a protocol of the change request. The Email contains change request metadata as well as the data that has been maintained during processing of the change request. This How To Guide describes possible solution to send out Email notification from the workflow.

2.

Background Information

A new workflow step is added into the workflow template. You may adjust at which point the sending mail step can be inserted as long as you have maintained the elements in workflow container.

September 2011

Send a Mail Notification During the MDGF Process

3.

Step-by-Step Procedure

The following is a description of how to send an Email notification after activating a change request. The scenario takes workflow WS75700040 as an example. The workflow WS75700040 only contains three dialog steps.

The idea is that add a program-exit to the activation step of workflow. After the activation step add a new step with type Send Email. Example is developed in QV5/Client 005, tested in QV5/Client 405.

3.1
...

Create a New Workflow

1. At cross client, enter transaction SWDB. Fill workflow WS75700040 and press ENTER

2. Select Workflow in menu and select Save as

September 2011

Send a Mail Notification During the MDGF Process

3. In the prompted window, fill in abbreviation and name. Click

4. A new workflow number is generated automatically. Activate the workflow.

September 2011

Send a Mail Notification During the MDGF Process

3.2
...

Modify the Workflow Container


a. Create a data type Structure

1. Create a new structure and new table type in the DDIC using transaction SE11. This will handle the assigned object list of the change request.

b. Create a data type Table Type

September 2011

Send a Mail Notification During the MDGF Process

2. Go to transaction SWDD, input the workflow that just created automatically. Select Workflow Container at the left side.

3. Use the context menu to create two new container elements

September 2011

Send a Mail Notification During the MDGF Process

a. EMAILRECEIVER This element is used to store users that need to be notified by Email. Its of type SWHACTOR. The properties are shown as below.

b. CREQUEST_OBJLST This element is used to store master data in change request.

September 2011

Send a Mail Notification During the MDGF Process

3.3
...

Modify Activation Step

1. In transaction SWDD, select step 000298 nderungen aktivieren in Navigation area.

September 2011

Send a Mail Notification During the MDGF Process

2. At right panel, choose the option Copy and Edit Task from the dropdown list of Task ID.

3. Fill in all fields like following. Note: There may be errors in setting work item text here. You may set the work item text after binding.

September 2011

Send a Mail Notification During the MDGF Process

4. In tab Container, create two new container elements CREQUEST_OBJLST and EMAILRECEIVER. Set the data type and properties just like before. Save the task and go back to the step definition.

5. Binding the workflow container element with task container element.

September 2011

Send a Mail Notification During the MDGF Process

6. Create a new class using transaction SE24, which inherits interface IF_SWF_IFS_WORKITEM_EXIT. Implement the method IF_SWF_IFS_WORKITEM_EXIT>EVENT_RAISED to set the container element EMAILRECEIVER and CREQUEST_OBJLST. The example class ZCL_WORKFLOW_EXIT is added at bottom. 7. In step activation, go to tab Program Exits and add class ZCL_WORKFLOW_EXIT. The example code of the class can be found in 3.6 Example Coding for Program-Exit Class 8. Save the workflow and click at the top of the activity.

September 2011

10

Send a Mail Notification During the MDGF Process

3.4

Add a Mail Notification Step

1. At left area of workflow builder, select Step Types That Can Be Inserted, and then move the Send Mail and drop down after the activation step.

September 2011

11

Send a Mail Notification During the MDGF Process

2. Fill in information to the step. You may insert element via icon Insert Expression.

3. Click tab Control and create a new task. 4. Double click the new task and create a new element CREQUEST_OBJLST in the container jsut like steps before. If you run into locking issues, maintain the standard task using transaction PFTS. 5. Binding between workflow container element and task container element. (Availability of the parameters SIGN & ENCRYPT depend on the setup of the workflow and might not be available. )

September 2011

12

Send a Mail Notification During the MDGF Process

6. Save the workflow and click 7. Activate the whole workflow.

at the top of the activity.

3.5

Configuration

1. At MDG client, go to transaction MDGIMG. Go to node General Settings->Process Modeling>Workflow->Other MDG Workflows->Define Workflow Step Numbers. Add three steps for the new created workflow.

2. Create a change request type with the new created workflow. The change request type can be created at MDGIMG->General Settings->Process Modeling->Change Requests->Create Change Request Type 3. Assign agents in MDGIMG->General Settings->Process Modeling->Workflow->Other MDG Workflows->Assign processor to Workflow Step Number (Simple Workflow) 4. To make users in SAP system can receive and email, following settings are needed. a. Add the email address in SU01 (or make sure its there) b. Set Comm. Method to E-mail in SU01 c. In SO16, tab Mail sy.grp, radio button Send to Home Addresses of Users d. In SO16, tab Addressing, Reset buffer

September 2011

13

Send a Mail Notification During the MDGF Process

3.6

Example Coding for Program-Exit Class

Example Coding: METHOD if_swf_ifs_workitem_exit~event_raised. DATA: lo_workitem TYPE REF TO if_swf_ifs_parameter_conta


iner, lt_objlst lv_return ls_swotobjid lv_crequest lv_edition lv_edtn_type lv_model lo_model lt_message lt_message1 lt_objlst_ele lr_data ls_objlst ls_objlst_ele lv_obj ls_entity_prop ls_fdep ld_entity lv_entity_txt lv_field_txt ls_receiver lt_receiver_temp lt_receiver lr_badi_wf_agent ld_agent_filter lo_table lo_struct lo_line

TYPE TYPE TYPE TYPE TYPE TYPE TYPE TYPE TYPE TYPE TYPE TYPE TYPE TYPE TYPE TYPE TYPE TYPE TYPE TYPE TYPE TYPE TYPE TYPE TYPE TYPE TYPE TYPE

usmd_ts_crequest_objkey, sysubrc, swotobjid, usmd_crequest, usmd_edition, usmd_edition_type, usmd_model, REF TO if_usmd_model, usmd_t_message, usmd_t_message, zusmd_t_entity,

REF TO data,
usmd_s_crequest_objkey, zusmd_s_entity, string, usmd_s_entity_prop, usmd_s_fdep, usmd_entity, usmd_value, usmd_value, swhactor, tswhactor, tswhactor, REF TO usmd_wf_agent, swcont-value, REF TO cl_abap_tabledescr, REF TO cl_abap_structdescr, REF TO cl_abap_datadescr,

September 2011

14

Send a Mail Notification During the MDGF Process

ls_comp lo_type

TYPE abap_compdescr, TYPE REF TO cl_abap_typedescr. TYPE any, TYPE any, TYPE any, TYPE ANY TABLE.

FIELD-SYMBOLS: <f_obj>
<f_value> <f_struct> <f_obj_tab>

The email is sent only after the activation of master data CHECK im_event_name EQ if_swf_ifs_workitem_exit=>c_evttyp_after_execut

ion.

*Get instance of workflow item lo_workitem = im_workitem_context->get_wi_container( ). * Get Change request number TRY. CALL METHOD lo_workitem->get EXPORTING name = '_WI_OBJECT_ID' IMPORTING value = ls_swotobjid. lv_crequest = ls_swotobjid-objkey+0(12). CATCH cx_swf_cnt_elem_not_found . CATCH cx_swf_cnt_elem_type_conflict . CATCH cx_swf_cnt_unit_type_conflict . CATCH cx_swf_cnt_container . ENDTRY.

* *

Get object list of the change request Get data model SELECT SINGLE usmd_edition FROM usmd120c INTO lv_edition WHERE usm d_crequest = lv_crequest. IF sy-subrc EQ 0. SELECT SINGLE usmd_edtn_type FROM usmd020c INTO lv_edtn_type WHE RE usmd_edition = lv_edition. IF sy-subrc EQ 0. SELECT SINGLE usmd_model FROM usmd010c INTO lv_model WHERE usm d_edtn_type = lv_edtn_type. ENDIF. ENDIF. IF lv_model IS NOT INITIAL. CALL METHOD cl_usmd_model=>get_instance EXPORTING i_usmd_model = lv_model IMPORTING eo_instance = lo_model et_message = lt_message.
September 2011 15

Send a Mail Notification During the MDGF Process

ENDIF. IF lt_message IS INITIAL. CALL METHOD lo_model->if_usmd_model_crequest~crequest_get_objlist EXPORTING i_crequest = lv_crequest IMPORTING ets_crequest_objkey = lt_objlst et_message = lt_message1. ENDIF. APPEND LINES OF lt_message1 TO lt_message. LOOP AT lt_objlst INTO ls_objlst. CLEAR ls_objlst_ele. ls_objlst_ele-entity = ls_objlst-fieldname. ASSIGN ls_objlst-r_data->* TO <f_obj>. lo_type = cl_abap_typedescr=>describe_by_data( <f_obj> ). CHECK lo_type->kind = cl_abap_typedescr=>kind_table.
lo_table ?= lo_type. lo_line = lo_table->get_table_line_type( ). ASSIGN <f_obj> TO <f_obj_tab>. IF lo_line->kind = cl_abap_typedescr=>kind_struct. lo_struct ?= lo_line. IF lo_line->kind = cl_abap_typedescr=>kind_struct. lo_struct ?= lo_line. IF <f_obj_tab> IS ASSIGNED. LOOP AT <f_obj_tab> ASSIGNING <f_struct>. CLEAR: lv_obj,ld_entity.

Get text of entity type CALL METHOD cl_usmd_services=>fieldname2entity EXPORTING io_model = lo_model i_fieldname = ls_objlst-fieldname
RECEIVING r_entity

= ld_entity.

CALL METHOD cl_usmd_services=>entity2text EXPORTING io_model = lo_model i_entity = ld_entity = lv_entity_txt. CONCATENATE lv_entity_txt ':' INTO lv_obj SEPARATED BY
space. RECEIVING r_text

* Get master key of ld_entity READ TABLE lo_model>dt_entity_prop INTO ls_entity_prop WITH KEY usmd_entity = ld_entity.

September 2011

16

Send a Mail Notification During the MDGF Process

LOOP AT lo_model>dt_fdep INTO ls_fdep WHERE fieldname EQ ls_entity_prop-r_fprop>fieldname. IF sy-subrc EQ 0. ASSIGN COMPONENT ls_fdepmasterfield OF STRUCTURE <f_struct> TO <f_value>. ASSERT <f_value> IS ASSIGNED. ENDIF. * Get text of field name CALL METHOD cl_usmd_services=>fieldname2text EXPORTING io_model = lo_model i_fieldname = ls_fdep-masterfield = lv_field_txt. CONCATENATE lv_obj lv_field_txt ' ' <f_value> ' ' INTO lv_obj SEPARATED BY space . ENDLOOP. ls_objlst_ele-value = lv_obj. APPEND ls_objlst_ele TO lt_objlst_ele. ENDLOOP. ENDIF. ENDIF. ENDIF. ENDLOOP. TRY. CALL METHOD lo_workitem->set EXPORTING name = 'CREQUEST_OBJLST' value = lt_objlst_ele. CATCH cx_swf_cnt_elem_not_found . CATCH cx_swf_cnt_elem_type_conflict . CATCH cx_swf_cnt_unit_type_conflict . CATCH cx_swf_cnt_container . ENDTRY. ************************************************************* **** *Set parameter EMAILRECEIVER ** Call BAdI to get agents IF ld_agent_filter IS INITIAL. ld_agent_filter = if_usmd_wf_agent=>gc_filter-standard. ENDIF. GET BADI lr_badi_wf_agent
FILTERS agent_filter = ld_agent_filter. IF lr_badi_wf_agent IS BOUND. CALL BADI lr_badi_wf_agent->get_agents RECEIVING r_value

EXPORTING
September 2011 17

Send a Mail Notification During the MDGF Process

id_appstep id_crequest if_single_proc id_index

= = = =

'1'
lv_crequest

'' 0

IMPORTING
et_agent et_message

= lt_receiver_temp = lt_message.

ENDIF. APPEND LINES OF lt_receiver_temp TO lt_receiver. IF lr_badi_wf_agent IS BOUND. CALL BADI lr_badi_wf_agent->get_agents EXPORTING id_appstep = '2' id_crequest = lv_crequest if_single_proc = '' id_index = 0 IMPORTING et_agent = lt_receiver_temp et_message = lt_message. ENDIF. APPEND LINES OF lt_receiver_temp TO lt_receiver. IF lr_badi_wf_agent IS BOUND. CALL BADI lr_badi_wf_agent->get_agents EXPORTING id_appstep = '3' id_crequest = lv_crequest if_single_proc = '' id_index = 0 IMPORTING et_agent = lt_receiver_temp et_message = lt_message. ENDIF. APPEND LINES OF lt_receiver_temp TO lt_receiver. TRY. CALL METHOD lo_workitem->set EXPORTING name = 'EMAILRECEIVER' value = lt_receiver. CATCH cx_swf_cnt_elem_not_found . CATCH cx_swf_cnt_elem_type_conflict . CATCH cx_swf_cnt_unit_type_conflict . CATCH cx_swf_cnt_container . ENDTRY. IF lv_return IS INITIAL. ENDIF. ENDMETHOD.

September 2011

18

www.sdn.sap.com/irj/sdn/howtoguides

Potrebbero piacerti anche