BPC PROCESS CHAIN

45
How To… Create A Custom BPC Process Chain SAP Product Name: SAP BusinessObjects Planning and Consolidation, version for SAP NetWeaver Applicable Product Versions: 7.0 Last Updated: 06/22/2009 Enterprise Performance Management www.sdn.sap.com/irj/sdn/bpx-epm

description

BPC PROCESS CHAIN SAP BPC

Transcript of BPC PROCESS CHAIN

Page 1: BPC PROCESS CHAIN

How To…

Create A Custom BPC Process Chain SAP Product Name: SAP BusinessObjects Planning and

Consolidation, version for SAP NetWeaver

Applicable Product Versions: 7.0

Last Updated: 06/22/2009

Enterprise Performance Management

www.sdn.sap.com/irj/sdn/bpx-epm

Page 2: BPC PROCESS CHAIN

© Copyright 2007 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, and Informix are trademarks or registered trademarks of IBM Corporation 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, 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 “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 products. 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.

Page 3: BPC PROCESS CHAIN

Table of Contents 1  Scenario..................................................................................................................1 

2  Introduction ...........................................................................................................1 

3  The Step By Step Solution ......................................................................................2 

3.1  Create the Process Type Class.........................................................................2 

3.2  Create the Functional Class.............................................................................7 

3.3  Create the Custom Process Type ..................................................................11 

3.4  Create the Custom Process Chain .................................................................13 

3.5  Create the Package from the BPC Excel Client..............................................24 

3.6  Test the Package............................................................................................29 

4  Appendix ..............................................................................................................37 

4.1  Process Type Class Implementations ............................................................37 

4.1.1  SET_PC_TYPE..........................................................................................37 4.1.2  IF_RSPC_TRANSPORT~GET_TLOGO.......................................................37 4.1.3  IF_RSPC_MAINTAIN~MAINTAIN ............................................................37 4.1.4  IF_RSPC_MAINTAIN~GET_HEADER........................................................38 4.1.5  IF_RSPC_GET_VARIANT~GET_VARIANT ................................................38 4.1.6  IF_RSPC_GET_VARIANT~WILDCARD_ENABLED.....................................38 4.1.7  IF_RSPC_GET_VARIANT~EXISTS.............................................................38 4.1.8  IF_RSPC_EXECUTE~EXECUTE .................................................................39 4.1.9  IF_RSPC_EXECUTE~GIVE_CHAIN............................................................40 

4.2  Functional Class Implementations ................................................................40 

4.2.1  CONSTRUCTOR.......................................................................................40 4.2.2  IF_UJD_TASK~PROCESS..........................................................................41 

4.3  Data Manager Dynamic Scripts .....................................................................42 

4.3.1  Script for Directory Zip...........................................................................42 

Page 4: BPC PROCESS CHAIN

1 Scenario 

 Within this scenario, we will show how to create a custom BPC process chain in SAP BusinessObjects Planning and Consolidation, version for SAP NetWeaver  

2 Introduction 

The Data Manager module in SAP BusinessObjects Planning and Consolidation, version for SAP NetWeaver, utilizes SAP NetWeaver Process Chains, and provides a way for business users to execute these chains via Data Manager packages.    The BPC product has a framework which provides the ability to extend its functionality by implementing custom process types and custom process chains leveraging the ABAP programming language.    We will demonstrate how to create ABAP classes which leverage the existing framework, how to create the custom process type based on these classes, and how to create the process chain, in the NetWeaver backend system.  We will also show how to create the Data Manager package from the BPC Excel Client. In this How‐To guide we will focus on the framework implementation and not on the actual functionality of the custom process type and process chain.  In this example, we will create a custom process chain which allows the user to zip a directory in the file service module of BPC.  We will use the “TransformationFiles” directory specifically.  The reason for this is because this directory only contains files which are not stored like data files for Data Manager.  Zipping of data files for Data Manager is currently not a supported function of the BPC file service APIs.   

Page 5: BPC PROCESS CHAIN

3 The Step By Step Solution   

This “How‐To” guide contains instructions for creating the two ABAP classes which are required when building the custom BPC process type.  Basic ABAP Objects programming knowledge is required to complete this “How‐To” guide.  It is assumed that the reader understands object oriented concepts as well, as they relate to ABAP Objects.  

3.1 Create the Process Type Class The “Process Type” class is a framework class which will be referenced by the process type, which is created in a later step.  This class leverages some existing interfaces which allow it to be fitted into the BPC framework directly.  This class will handle the process type variant processing. That is, when the process type is included into a process chain, the code executed therein, allows you to create a process type variant, as well as allows you to set process type variant parameters for this custom process type.  This class will also call the underlying functional class which performs the actual function of the process type. The “Functional” class will be created in the next step.    

1. Log on to the NetWeaver system, and go to transaction SE24.  Enter the name of the process type class. Existing BPC process type classes use a similar naming convention.  It is suggested to use this same naming convention for custom BPC process types as well.  The naming convention for standard objects is CL_UJD_BPC_<meaningful name>.  So in this example, name it as ZCL_UJD_BPC_DIRZIP, for “Directory Zip”.  Click the “Create” button. 

  

Page 6: BPC PROCESS CHAIN

2. In the following dialog, enter the super class and description.  This class must be public, and marked as final. Click the “Save” button.  Again, this new class must subclass from the CL_UJD_SIMPLE_ACTOR class. 

 

 

3. In the following screen, click on the “Interfaces” Tab.  There should already be an interface listed here, which has been inherited from the super class. 

 

 

4. Add the four new interfaces as show in the image to the right. 

 

 

Page 7: BPC PROCESS CHAIN

5. Click on the “Methods” tab. Notice that new methods have been added.  In the following steps, we will create the implementation of these methods. All source code can be found in the Appendix A. 

 

 

 

 

 

 

 

 

6. First we need a static method called SET_PC_TYPE.  This method will set the process type name. It is important that this value is the same as the name of the process type which will be created later.  In this example, we will use ‘ZBPCDIRZIP’.  Create this private static method and provide its implementation.  Notice in this method, we will simply call a framework method of the class CL_UJD_CUSTOM_TYPE.  Most of the method implementations in this new class, will call framework methods.  The source code may be copied from section 4.1.1 in Appendix A. 

 

7. Double click on the IF_RSPC_TRANSPORT~GET_TLOGO method.   Enter the source code as shown in the image to the right. The source code may be copied from section 4.1.2 in Appendix A. 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Page 8: BPC PROCESS CHAIN

 

8. Double click on the IF_RSPC_MAINTAIN~MAINTAIN method. Enter the source code as shown in the image to the right. The source code may be copied from section 4.1.3 in Appendix A. 

 

 

 

9. Double click on the IF_RSPC_MAINTAIN~GET_HEADER method. Enter the source code as shown in the image to the right. The source code may be copied from section 4.1.4 in Appendix A. 

 

 

 

 

10. Double click on the IF_RSPC_GET_VARIANT~GET_VARIANTmethod. Enter the source code as shown in the image to the right. The source code may be copied from section 4.1.5 in Appendix A. 

 

 

 

11. Double click on the IF_RSPC_GET_VARIANT~WILDCARD_ENABLED method.  Enter the source code as shown in the image to the right. The source code may be copied from section 4.1.6 in Appendix A. 

 

12. Double click on the IF_RSPC_GET_VARIANT~EXISTS method. Enter the source code as shown in the image to the right. The source code may be copied from section 4.1.7 in Appendix A. 

 

 

 

 

 

 

 

 

 

Page 9: BPC PROCESS CHAIN

 

13. Double click on the IF_RSPC_EXECUTE~EXECUTE method. Copy the source code for this method from section 4.1.8 in Appendix A.  Notice there is a reference variable definition on line 8 for a class that we have not created yet.  So this class will not pass a syntax check at this point.  Also notice on line 20, here again the process type name ZBPCDIRZIP is used.  This needs to be exactly the same as the process type which we will create in a later step.  The image to the right does not represent all of the code of this method, so remember to copy it from section 4.1.8 in Appendix A. 

 

 

14. Double click on the IF_RSPC_EXECUTE~GIVE_CHAIN method. Enter the source code as shown in the image to the right. The source code may be copied from section 4.1.9 in Appendix A. 

 

 

15. Finally, save this class. Again it will not activate due to a reference to a class which is not yet created.   

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Page 10: BPC PROCESS CHAIN

3.2 Create the Functional Class The “Functional” class is the class which will be called by the process type class, and implements all of the functional code of the process type.  In other words, it executes all of the code which will do what the process type is meant to do. For example, in this scenario, it will trigger the code which will zip a directory in the BPC file service.  When building this class, there is much more freedom compared to the “Process Type” class.  Basically, you need to implement the CONSTRUCTOR method to retrieve parameters, and then implement the IF_UJD_TASK~PROCESS method which will perform the functionality.  You may, of course, create any private methods to support your functionality.  The IF_UJD_TASK~PROCESS method will then be called by the BPC process type class which was created in the previous step. 

1. From SE24, enter the name of the functional class. Existing BPC functional classes use a similar naming convention.  It is suggested to use this same naming convention for custom BPC process types as well.  The naming convention for standard objects is CL_UJD_<meaningful name>.  So in this example, name it as ZCL_UJD_DIRZIP, for “Directory Zip”.  The name of this functional class is usually the same as the process type class, without the “_BPC_” part.  Click the “Create” button. 

 

2. In the following dialog, enter the description.  This class must be public, and marked as final. Click the “Save” button. 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Page 11: BPC PROCESS CHAIN

 

3. In the following screen, click on the “Interfaces” Tab.  Add the IF_UJD_TASK interface and hit “Enter”. 

 

 

 

 

 

4. Switch to the “Attributes” tab, and enter the attributes shown in the image to the right. DO_CONFIG will hold the configuration object which is imported, and DO_CONTEXT will hold the context object.  These are required by the framework. 

 

 

5. There will be two parameters which will be implemented in the data manager user interface later on. Create two more private instance attributes as shown in the image to the right. D_SRC_DIR and D_TRG_FILE, both typed as CHAR255. These attributes will hold the parameter values from the data manager package. 

 

6. Switch to the “Methods” tab and create the CONSTRUCTOR method for this class. 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Page 12: BPC PROCESS CHAIN

7. Add a parameter for this method called IO_CONFIG.  Make it “type ref to” the CL_UJD_CONFIG class. 

 

 

 

 

 

8. Add an exception to this method as well.  Use CX_UJ_STATIC_CHECK. 

 

 

 

 

9. Click on the   icon and enter the source code for the CONSTRUCTOR method. Add some code to get the parameters from the DO_CONFIG object and set the value to the specific attributes of the class.  Notice the use of the literals, SRC_DIR and TRG_FILE. These are the parameters which will be defined later in the data manager package as well as the process type variant when building the process chain.  It is important to use these same literal values.  The source code may be copied from section 4.2.1 in Appendix A. 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Page 13: BPC PROCESS CHAIN

10. Next, create the implementation for the IF_UJD_TASK~PROCESS method.  This method will be called by the process type class and perform the actual functionality of the process type.  In our example, this method will take the parameters retrieved in the CONSTRUCTOR method and call the file service API to create a ZIP file for a directory.  Not all the required code for this method is shown in the image to the right, so copy it from section 4.2.2 in Appendix A. 

  

 

 

11. Finally save and activate both classes. Click the “Activate” icon, in the dialog, select all objects and hit “Enter”. 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Page 14: BPC PROCESS CHAIN

3.3 Create the Custom Process Type  

1. Go to transaction RSPC.  Click Settings  Maintain Process Types. 

 

 

2. This is the standard table maintenance 

screen for process types.  Click the   icon.  Then click the “New Entries” button.  

 

 

 

 

3. In this screen, enter the name of the process type, name it as ZBPCDIRZIP.  It is very important that you use this name as this is the name used when creating the process type class in the previous step.   Enter the data as shown in the image to the right. Make sure to set the “Possible Events” list box as “Process ends successful or incorrect”.  The ID field defines the icon which will be used for this process type.  After entering all the data shown 

in the image to the right, click the   icon. A transport request for the new custom process type may be required, simply create one using your customer 

package. Then click the   icon to go 

back. Click the   once again to go back to the initial screen of RSPC. 

 

 

Page 15: BPC PROCESS CHAIN

 

4. From the initial screen of RSPC, open the “Business Planning & Consolidation: System” node from the tree on the left and double click on one of the process chains.  Doing so, will 

change the process type    icon to now be active.  Click this icon to view the process types. 

  

5. Open the “BPC – Process Types” node from the tree on the left.  Notice that the new process type is now displayed here.   

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Page 16: BPC PROCESS CHAIN

3.4 Create the Custom Process Chain  

1. Now click the process chains    icon to go back to the list of process chains.  

 

 

 

 

 

2. Click the create   icon on the application toolbar to create a new process chain. 

 

 

 

 

3. In this dialog box, enter the name of the process chain.  Name it as ZBPC_DIRZIP, and enter the description as “BPC: Directory Zip”.  Then click the 

 icon.  

 

 

4. In this dialog box, click the   icon to create the “start” process variant.  Each process chain needs to implement its own unique start process variant. 

 

 

5. In this dialog box, enter the name of the process variant as ZBPC_DIRZIP_START, and the description as “BPC: Directory Zip 

Start”.  Finally, click the   icon. 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Page 17: BPC PROCESS CHAIN

 

6. The next screen gives you an opportunity to configure scheduling.   Click the “Change Selections” button. 

 

 

 

 

 

7. In the next dialog box, click the button 

for “Immediate” followed by the   icon at the bottom. 

 

 

 

 

 

 

 

 

 

 

 

8. Now click the save   icon. Then click 

 to go back. 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Page 18: BPC PROCESS CHAIN

9. Now that the variant has been created, 

click the   icon to insert it in the custom process chain. 

 

 

10. You should now see the start process in the layout to the right of the screen. 

 

 

11. The BPC process chains use a framework which requires certain standard BPC process types be inserted, in order for the process chain to work correctly in the BPC Data Manager tool.  The “Modify Dynamically” process type is one of these required types. Click on the 

process type   icon. Under the “BPC Process Types” node, add the “Modify Dynamically” process type to the process chain, by selecting it from the tree on the left and dragging and dropping it into the layout on the right. 

 

12. In the dialog box, select the /CPMB/MODIFY variant for this 

process type and click the   icon.  

 

 

13. An information message will appear, answer “No”. 

 

 

 

 

14. The process type has now been added to the layout on the right side of the screen. The process chain layout should now look like this. 

 

 

 

 

 

 

 

 

 

 

 

 

Page 19: BPC PROCESS CHAIN

15. Next, create a link between these two process types by selecting the “Start” process type, and right‐clicking and selecting, Connect With   Modify Dynamically   BPC: Modify Process Type Variant Value.   

 

16. The process types are now linked together. 

 

 

 

 

17. Next, add the standard process type “OR” from the “General Services” node in the tree on the left, to the layout on the right, by selecting it and dragging and dropping it into the layout on the right. 

 

 

 

 

 

 

18. Click the   icon in the following dialog box to add it into the process chain. 

 

 

19. The layout is then updated with the new process type. 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Page 20: BPC PROCESS CHAIN

20. Next, create a link between the “Modify Dynamically” process type, and the “OR” process type, by right‐clicking on “Modify Dynamically”, and choosing Connect with   OR   and then the random number identifier. 

 

21. A dialog box for error handling actions will appear.  Choose the radio button 

for “errors” and click the   icon.  

 

 

 

22. The process chain now looks like this. 

 

 

 

 

 

 

 

 

 

 

23. Before adding the custom process type which will do most of the functional work, insert one last process type which is needed for the BPC process chain framework.  Go back to the “BPC – Process types” node and drag and drop the “BPC: Clear BPC Tables” process type into the layout on the right. 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Page 21: BPC PROCESS CHAIN

24. In the next dialog box, enter the name of the variant as /CPMB/CLEAR and 

click the   icon. 

 

 

25. An information message will appear, answer “No”. 

 

 

 

 

 

26. The process has now been added to the layout on the right. 

 

 

 

 

 

 

 

 

 

 

27. Next, create a link between the “OR” process type and the “Clear BPC Tables” process type by selecting and right‐clicking on the “OR” process type, and selecting, Connect with   Clear BPC Tables   clear the temp data. 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Page 22: BPC PROCESS CHAIN

28. The process chain now looks like this. 

 

 

 

 

 

 

 

 

 

 

 

 

 

29. Finally, add the final process type to the process chain.  Drag and drop the process type for “BPC: Directory Zip” into the layout. 

 

 

 

30. In the following dialog box, click the  icon to create the process variant. 

 

 

 

 

31. Enter the name of the process variant as ZBPC_DIRZIP and the description as 

“BPC: Directory Zip”. Then click the   icon. 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Page 23: BPC PROCESS CHAIN

 

32. In the next screen, enter the parameters for this variant.  These parameters will be used in the Data Manager user interface later on. 

• SRC_DIR 

• TRG_FILE 

Click the save   icon. Then click   to go back. 

 

 

 

33. Now that the variant has been created, 

click the   icon to insert it in the custom process chain. 

 

 

34. The process chain should now look like this. 

 

 

 

 

 

 

 

 

 

 

 

 

35. Next, create a link from the “Modify Dynamically” process type to the “BPC: Directory Zip” process type by selecting and right‐clicking on the “Modify Dynamically” process type, and choosing, Connect with BPC: Directory Zip  BPC: Directory Zip. 

 

 

 

 

 

 

 

Page 24: BPC PROCESS CHAIN

36. In the following dialog box, make sure the radio button for “successful” is 

marked and click the   icon. 

 

 

 

 

37. Next, create a link from the “BPC: Directory Zip” process type to the “Clear BPC Tables: process type by selecting and right‐clicking on the “BPC: Directory Zip” process type and choosing, Connect with   Clear BPC Tables   clear the temp data. 

 

 

38. In the following dialog box, mark the radio button for “always” and click the 

 icon. 

 

 

 

 

39. In the next dialog box, simply choose “Connect”. 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Page 25: BPC PROCESS CHAIN

40. The completed process chain should now look like this. 

 

 

 

 

 

 

 

 

 

 

 

 

41. Check the process chain by clicking the  icon.  All process types should show 

as green. Finally click the   icon to activate the process chain. 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

42. A message saying that the process chain has been saved as “active” will then appear in the status bar. 

 

 

 

 

 

 

 

 

 

 

 

Page 26: BPC PROCESS CHAIN

43. Click on the   icon to return to the 

process chains. Then click the   icon to refresh the process chain list. The new process chain should now show in the tree to the left. It should currently be under the “Not Assigned” node. Assign this process chain to one of the BPC groups, by selecting the new process chain, under the “Not 

Assigned” node, and clicking the    icon.   

 

 

44. Enter the name of the group as 

/CPMB/BPC and click the   icon.   

 

 

 

 

45. Click the   icon to save and activate 

the process chain. Now click the   button again. The process chain is now assigned to the group. 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Page 27: BPC PROCESS CHAIN

3.5 Create the Package from the BPC Excel Client  

1. Launch the BPC Excel Client and log on to any Appset. From the action pane, click “Manage Data”.  

 

 

 

 

 

 

 

 

2. Next, click “Maintain data management”. 

 

 

 

 

 

 

 

 

 

 

 

 

3. Next, click “Manage packages (organize list)”. 

 

 

 

 

 

 

 

 

 

 

 

 

 

Page 28: BPC PROCESS CHAIN

4. In this dialog, packages are created.  In this case, we want to create the package for our newly created process chain, ZBPC_DIRZIP. Select the “System Administration” package group, and 

click the   icon, to create a new package.  

 

 

 

 

 

 

 

 

5. Click the   icon next to the input field for Process Chain.  

 

 

 

 

 

 

 

6. Select the “BPC: Planning and Consolidation: System” group on the left, and then select the ZBPC_DIRZIP process chain on the right.  Finally click the “Select” button.  

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Page 29: BPC PROCESS CHAIN

 

 

7. Continue creating the package, and enter the package name as “ZipDirectory”, and the description as “Zip Directory”.  Also check both checkboxes under Task Type. Finally click the “Add” button.   

 

 

 

 

 

 

8. Now click the “Save” button.  A message will appear stating that the package has been saved successfully, and the dialog will close. 

 

 

 

 

 

 

 

 

9. From the action pane, once again click the “Manage packages (organize list)” link to go back into the package maintenance screen. 

 

 

 

 

 

 

 

 

 

 

 

Page 30: BPC PROCESS CHAIN

10. Select the “System Administration” folder from the left,  then select the “ZipDirectory” package from the list, and right‐click on it. Choose “Modify Package” from the context menu.   

 

 

 

 

 

 

 

11. In the following dialog, click the   icon to view the package.  

 

 

 

 

 

 

 

 

12. The “Data Manager Package and Dynamic Script Editor” will then be launched.  Here the look and behavior of the dialog screen of the package can be configured.  For example, the dialog box should have an input field for the directory and an input field for output file path. Click the “Advanced” button at the top to launch the editor.  

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Page 31: BPC PROCESS CHAIN

 

13. Enter the text into the right side of the window and click the “Ok” button.  Refer to the Appendix 4.3.1 for a text version of this coding.  

 

 

 

 

14. Control is then passed back to the previous dialog, click the “Save” button.  

 

 

 

 

 

15. Control is then passed back to the previous dialog, click the ‘Save” button.  

 

 

 

 

 

 

16. Finally, at the last dialog, click “Save” one last time. A message saying that the package has been saved successfully will appear.  

 

 

 

 

 

 

Page 32: BPC PROCESS CHAIN

3.6 Test the Package Next we can test our newly created process chain.  Be advised, this will not work on any directory that contains files that are stored as “Data Manager” data files, such as any stored under the “DataFiles” directory. The reason is because these files are stored in a generated database table, and not as a binary stream, and zipping of these files is not supported by the file service API.  This is why, in this example, we navigate to the “TransformationFiles” directory. 

1. From the BPC Action Pane, click the  icon.  

 

 

 

 

 

2. Click the “Run a data management package” link in the Action Pane. 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Page 33: BPC PROCESS CHAIN

3. In the following dialog, select the “ZipDirectory” package under the “System Administration” group and click the “Run” button. 

 

 

 

 

 

 

 

 

 

 

4. The Data Manager “Run Package” dialog will then be triggered. Enter a source directory in the first field.  Enter it directly or browse to it, by clicking the icon on the right side of the field. 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Page 34: BPC PROCESS CHAIN

5. Click the “Up one level” button in the dialog. Select the “Examples” folder under “TransformationFiles” directory.  Notice that this user interface does not allow pointing to a specific directory, but only to a single file. A work around for this is to give a “dummy” file name here.  Then click “Open”. 

 

 

 

 

 

 

 

 

6.  Control is then passed back to the “Run Package” dialog. Notice here that the directory is now pointing to the dummy.zip file. 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Page 35: BPC PROCESS CHAIN

 

7.  Next simply remove the “dummy.zip” part from the file path. This will specify that we want to zip the entire contents of the “Examples” directory. 

 

 

 

 

 

 

 

 

 

 

 

8. Enter the path and file name of the output zip file.  Click the “Up one level” button, then choose the “Examples” folder under the “TransformationFiles” directory, and enter the file name as “Examples.zip”.   Finally, click the “Save” button.  The resulting ZIP file will be placed in the same directory which is being zipped. 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Page 36: BPC PROCESS CHAIN

9. Finally, click “Finish”. 

 

 

 

 

 

 

 

 

 

 

 

 

 

10. A dialog will appear stating that the package is now running.  

 

 

 

 

 

 

11.  Next. Click “View Status”. 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Page 37: BPC PROCESS CHAIN

12. Check the status of the package and make sure it is completed successfully.  Then click “Close” to close the dialog.   

 

 

 

 

 

 

 

 

 

 

13. The newly created package has been executed successfully, and the results can now be checked.  In this example, we can check to see if the file has been created, and  download it from file service to the PC, and view the zipped contents.   Go back to the NetWeaver system via SAPgui and run transaction UJFS.  Browse to the directory node. Notice that the new examples.zip file now exists.  The existence of the file means that your custom process type has been triggered successfully. 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Page 38: BPC PROCESS CHAIN

 

14. Right‐click on the file and choose “Download Document”.   

 

 

 

 

 

 

 

15.  In this dialog, choose “No”.  It is already in zip format, we don’t need to zip it again. 

 

 

 

 

 

16. Choose the file path to download to, give a file name with a .zip extension and click the “Save” button. 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Page 39: BPC PROCESS CHAIN

 

17.  Lastly, go to the zip file on your PC, and double click it.  All of the files/folders are shown. 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Page 40: BPC PROCESS CHAIN

4 Appendix  

4.1 Process Type Class Implementations 

4.1.1 SET_PC_TYPE METHOD set_pc_type. cl_ujd_custom_type=>set_pc_type( i_type = 'ZBPCDIRZIP' ). ENDMETHOD.

4.1.2 IF_RSPC_TRANSPORT~GET_TLOGO method IF_RSPC_TRANSPORT~GET_TLOGO. CALL METHOD SET_PC_TYPE. CALL METHOD CL_UJD_CUSTOM_TYPE=>IF_RSPC_TRANSPORT~GET_TLOGO EXPORTING I_VARIANT = I_VARIANT I_OBJVERS = I_OBJVERS IMPORTING E_TLOGO = E_TLOGO E_OBJNM = E_OBJNM. endmethod.

4.1.3 IF_RSPC_MAINTAIN~MAINTAIN method IF_RSPC_MAINTAIN~MAINTAIN. CALL METHOD SET_PC_TYPE. CALL METHOD CL_UJD_CUSTOM_TYPE=>IF_RSPC_MAINTAIN~MAINTAIN EXPORTING I_VARIANT = I_VARIANT I_T_CHAIN = I_T_CHAIN I_DISPLAY_ONLY = I_DISPLAY_ONLY IMPORTING E_VARIANT = E_VARIANT E_VARIANT_TEXT = E_VARIANT_TEXT. endmethod.

Page 41: BPC PROCESS CHAIN

4.1.4 IF_RSPC_MAINTAIN~GET_HEADER method IF_RSPC_MAINTAIN~GET_HEADER. CALL METHOD SET_PC_TYPE. CALL METHOD CL_UJD_CUSTOM_TYPE=>IF_RSPC_MAINTAIN~GET_HEADER EXPORTING I_VARIANT = I_VARIANT I_OBJVERS = I_OBJVERS IMPORTING E_VARIANT_TEXT = E_VARIANT_TEXT E_S_CHANGED = E_S_CHANGED E_CONTREL = E_CONTREL E_CONTTIMESTMP = E_CONTTIMESTMP. endmethod.

4.1.5 IF_RSPC_GET_VARIANT~GET_VARIANT method IF_RSPC_GET_VARIANT~GET_VARIANT. CALL METHOD CL_UJD_CUSTOM_TYPE=>IF_RSPC_GET_VARIANT~GET_VARIANT EXPORTING I_TYPE = I_TYPE I_VARIANT = I_VARIANT I_T_CHAIN = I_T_CHAIN I_T_SELECT = I_T_SELECT I_OBJVERS = I_OBJVERS IMPORTING E_VARIANT = E_VARIANT E_VARIANT_TEXT = E_VARIANT_TEXT. endmethod.

4.1.6 IF_RSPC_GET_VARIANT~WILDCARD_ENABLED method IF_RSPC_GET_VARIANT~WILDCARD_ENABLED. RESULT = CL_UJD_CUSTOM_TYPE=>IF_RSPC_GET_VARIANT~WILDCARD_ENABLED( ). endmethod.

4.1.7 IF_RSPC_GET_VARIANT~EXISTS method IF_RSPC_GET_VARIANT~EXISTS. R_EXISTS = CL_UJD_CUSTOM_TYPE=>IF_RSPC_GET_VARIANT~EXISTS( I_VARIANT = I_VARIANT I_OBJVERS = I_OBJVERS ). endmethod.

Page 42: BPC PROCESS CHAIN

4.1.8 IF_RSPC_EXECUTE~EXECUTE METHOD if_rspc_execute~execute. DATA: lo_config TYPE REF TO cl_ujd_config, lo_factory TYPE REF TO cl_ujd_task_factory, lo_actor TYPE REF TO zcl_ujd_bpc_dirzip, lo_error TYPE REF TO cx_root , l_uid TYPE sysuuid_25, lo_dir_zip TYPE REF TO zcl_ujd_dirzip. CALL FUNCTION 'RSSM_UNIQUE_ID' IMPORTING e_uni_idc25 = l_uid. e_instance = l_uid. TRY. CREATE OBJECT lo_config EXPORTING i_variant = i_variant i_type = 'ZBPCDIRZIP' i_jobcount = i_jobcount it_processlist = i_t_processlist i_logid = i_logid it_variables = i_t_variables. CALL METHOD lo_config->init. CALL METHOD cl_ujd_custom_type=>add_task_name_msg EXPORTING io_config = lo_config. CREATE OBJECT lo_factory. CREATE OBJECT lo_actor EXPORTING io_task_factory = lo_factory io_config = lo_config if_check_abort = abap_true. CALL METHOD lo_factory->init EXPORTING io_config = lo_config io_actor = lo_actor. lo_actor->if_ujd_actor~init( ). CREATE OBJECT lo_dir_zip EXPORTING io_config = lo_config. CALL METHOD lo_actor->if_ujd_actor~set_task EXPORTING io_task = lo_dir_zip. CALL METHOD lo_actor->if_ujd_actor~execute. CALL METHOD cl_ujd_custom_type=>reset_log. e_state = 'G'.

Page 43: BPC PROCESS CHAIN

CATCH cx_root INTO lo_error. TRY. CALL METHOD cl_ujd_custom_type=>set_error_status EXPORTING io_config = lo_config. CALL METHOD cl_ujd_custom_type=>write_exception_log EXPORTING io_exception = lo_error. CATCH cx_root INTO lo_error. e_state = 'R'. ENDTRY. e_state = 'R'. ENDTRY. ENDMETHOD.

4.1.9 IF_RSPC_EXECUTE~GIVE_CHAIN method IF_RSPC_EXECUTE~GIVE_CHAIN. RETURN = CL_UJD_CUSTOM_TYPE=>IF_RSPC_EXECUTE~GIVE_CHAIN( I_VARIANT = I_VARIANT ). endmethod.

4.2 Functional Class Implementations 

4.2.1 CONSTRUCTOR METHOD constructor. DATA: lv_value TYPE ujd_runparam-value. do_config = io_config. do_context = cl_uj_context=>get_cur_context( ). do_config->if_ujd_config~get_parameter( EXPORTING i_parameter = 'SRC_DIR' IMPORTING e_parameter_value = lv_value ). d_src_dir = lv_value. do_config->if_ujd_config~get_parameter( EXPORTING i_parameter = 'TRG_FILE' IMPORTING e_parameter_value = lv_value ). d_trg_file = lv_value. ENDMETHOD.

Page 44: BPC PROCESS CHAIN

4.2.2 IF_UJD_TASK~PROCESS METHOD if_ujd_task~process. DATA: lo_file_service_mgr TYPE REF TO cl_ujf_file_service_mgr. DATA: lo_exception TYPE REF TO cx_static_check. DATA: lv_doc_content TYPE uj_doc_content. DATA: lt_doc_dir TYPE ujf_t_char255. FIELD-SYMBOLS: <ls_doc_dir> LIKE LINE OF lt_doc_dir. CLEAR et_message. CLEAR es_data. CLEAR ef_success. * Add the directory to the importing table APPEND INITIAL LINE TO lt_doc_dir ASSIGNING <ls_doc_dir>. <ls_doc_dir> = d_src_dir. TRY. * Create the file service object cl_ujf_file_service_mgr=>factory( EXPORTING is_user = do_context->ds_user i_appset = do_context->d_appset_id RECEIVING r_manager = lo_file_service_mgr ). * build zip file for the directory lo_file_service_mgr->get_zipped_document( EXPORTING it_doc_dir_table = lt_doc_dir i_incl_subdir_struct = abap_true IMPORTING e_doc_content = lv_doc_content ). * Create the new zip file based on the newly created content lo_file_service_mgr->put_document( EXPORTING i_docname = d_trg_file i_compression = abap_true i_splice_zip = abap_false i_doc_content = lv_doc_content ). * Set success ef_success = abap_true. CATCH cx_static_check INTO lo_exception. ef_success = abap_false. CALL FUNCTION 'UJ0_CONV_EX2MSG' EXPORTING io_exception = lo_exception IMPORTING et_message_lines = et_message. ENDTRY. ENDMETHOD.

Page 45: BPC PROCESS CHAIN

4.3 Data Manager Dynamic Scripts  

4.3.1 Script for Directory Zip PROMPT(INFILES,%SOURCEFOLDER%,"Please enter a directory",) PROMPT(OUTFILE,%TARGETFILE%,"Please enter an output path and file name",) TASK(ZBPC_DIRZIP,SRC_DIR,%SOURCEFOLDER%) TASK(ZBPC_DIRZIP,TRG_FILE,%TARGETFILE%)