This document covers how to schedule a batch job using MDR in SAP Cloud Application Studio and usage of Adobe LiveCycle Designer in generating PDF Form to use in CAS.

Thanks to my colleagues Vaibhav Kwatra,Kartik Saini,bhupinder sharma ,DEEPAK SINGHAL , Jayant Saini , Atul Malhotra ,Ajay Salwahan as they have helped and contributed in preparation of this document.


Table of Contents


    1.      Problem Statement

    Sometimes it is required to broadcast the information (reports) related to the business transactions to the business users in periodic    manner.


For example: – User would be interested in getting the information for the opportunities getting expired in next four weeks/one month.



    2.      Solution

MDR:


A MDR (mass data run) is the automatic mass processing of a task or a business transaction. Mass data runs enable mass processing of business data and are used in business processes, for example, invoice runs, payment authorization runs, or balance confirmation runs. When a user schedules a mass data run, the system executes it as a background job. As part of this document, we shall be sending the notification via email having report attachment. Detail about the solution is described in the section 3 of the document.


    • In the SAP cloud solution, customer uses the mass data run to schedule an action for many instances of a custom business object.
    • We can schedule a MDR on daily basis or at a particular time.
    • Multiple MDR’s can be scheduled at a time.
    • MDR runs in the background independent of the current processes.



    3.      Detailed Solution

    3.1 Custom Object and MDR Creation

         

          Following are the initial steps for our solution:-


      1. Create a custom object.
      2. Create a query.
      3. Create Script file and define Action.
      4. Create Screen for Custom Object.
      5. Create PDF for email Attachment.
      6. Assigning Solution to work center.

         

3.1.1. Create a custom object

  • First we need to build a solution which will contain our custom business object.
  • Enter the description and select Customer Relationship Management as deployment unit from the dropdown.

                /wp-content/uploads/2016/05/2_954734.png

  • Create a custom business object on which our MDR will run.
  • Right click on the solution you created and go to ADD -> New Item -> Business Object.
  • Enter the business object name and click on ADD.
  • Add an element dummy with data type “ID”, OpptID, OppEndDate and an action named “SendMail”.
  • Save & Activate the solution.

                          /wp-content/uploads/2016/05/6_954739.png

3.1.2. Create a query

  • In order to design an MDR we need to create a query in which we select the elements of the business object based on who’s the query will run, later these elements are accessed by MDR to run on particular user defined conditions.
  • Right click on the business object and click on “Create Query”.
  • Enter the query name and description.


                    /wp-content/uploads/2016/05/8_954742.png


  • Select the elements based on which the query will run.


                      /wp-content/uploads/2016/05/9_954743.png


  • Select the selection and result parameters.

                            /wp-content/uploads/2016/05/10_954744.png

  • Review & finish.

         

                        /wp-content/uploads/2016/05/11_954750.png


3.1.3. Create Script files

  • Save & Activate, Right click on BO and go to “Create Script Files”.                         
  • Action “SendMail” will be auto selected, click OK.

                                      /wp-content/uploads/2016/05/13_954755.png

  • A new script will get added in solution with the action name.
  • In action we have to search the records of the standard object (Opportunity) and then select only those record which are going to expire in the next 30 days. Then we need to retrieve the selected elements from those record according to the business requirement. Here we need to fetch the Email address, Opportunity Id, and the End date of the particular Opportunity and then we have to send them the mail with the pdf attachment.
  • Below are the steps followed for writing the Action Code:-

         

          1. Fetch the data of Standard Object using query.

          2. Select only those record which are going to expire in next 30 days.

          3. Create an E-mail Instance for those records.

          4. Fetch the respective E-mail ID from the query result.

          5. Create a PDF attachment for E-mail.

          6. Fire E-mail(s).


                                /wp-content/uploads/2016/05/14_955909.png


3.1.4. Create Screen for Custom Object

  • Create the screens for BO.
  • Right click on the business object and click on “Create Screens”.
  • Select object based screens and enter a short id and click ok.

                                      /wp-content/uploads/2016/05/16_954783.png

3.1.5. Creating PDF for Email Attachment

  • Refer below screenshot

                                        /wp-content/uploads/2016/05/17_954791.png

  • Follow the steps given below to add PDF form to the solution.

                                          /wp-content/uploads/2016/05/18_954793.png

                                          /wp-content/uploads/2016/05/19_954798.png

  • Open .xdp file with the help of adobe LiveCycle designer (must be installed on system)
  • Place fields from our object on the form, to show details related to opportunity as shown in below screenshot:

         

                                    /wp-content/uploads/2016/05/20_954799.png


3.1.6. Assigning Solution to Work Centre

  • We need to assign this solution to a business user in the work center via system admin.
  • Open the application in the internet explorer and enter the credentials of system admin.
  • Launch the application in Silverlight.
  • Go to Administrator -> Business Users.
  • Search specific business user to which work center needs to be assigned.


                                        /wp-content/uploads/2016/05/22_954810.png

  • Select Edit -> Access Rights.                                            
  • Click on find and enter the name of your business object.
  • Click on “Locate” to find it.                                         
  • Check the work center and click save.
  • A pop up will appear, Click OK.


                                            /wp-content/uploads/2016/05/25_954826.png


3.1.7. Creation of MDR

  Following are the steps for the creation of the MDR:-


          a. Create MDR.

          b. Create screens for MDR.

          c. Assigning the OWL screen of MDR to the WCF screen of custom object.

          d. Assign MDR to the work center.

          e. Creating a MDR element and scheduling it.

              a.     Create MDR

      • Right click the business object and click on “Create Mass Data Run”.
      • A mass data run wizard will open.


                                             /wp-content/uploads/2016/05/26_954836.png


      • Enter the MDR name, business object and node will be preselected as of the current solution.
      • If you have multiple actions in the business object then select the action which should get triggered when the MDR will run.


                                               /wp-content/uploads/2016/05/27_954839.png


      • On the next screen the elements we selected in the query will appear.
      • Select the elements to include them as conditions in MDR.
      • Select the restriction as user selection so that a custom value can be assigned to it during MDR creation.

    

                                                  /wp-content/uploads/2016/05/28_954840.png

      • Let the control parameters remain as it is, Click Next.


                                                                  /wp-content/uploads/2016/05/29_954841.png

      • Review the MDR and click finish.

                                                                      /wp-content/uploads/2016/05/30_955010.png                                                              

      • Now activate the MDR.


                                                          

     b.    Create screen for MDR

      • Create screens for the MDR.
      • 3 screens will be created for the MDR.


                                                           

     c.    Assigning the OWL screen of MDR to the WCF screen of custom object

      • Now we need to embed the WC_View screen of our MDR to the business object.WCF.uiwoc screen so that the user is able to see the MDR scheduling tab inside our custom object tab.
      • Open the business object.WCF.uiwoc screen in UI Designer.
      • Click on Test View.
      • Go to Configuration Explorer[Your Solution]_MAIN – >SRC – > [your mass data run work center view] _WCView and drag and drop it onto the empty space on the screen.
      • A warning message will appear, Click Yes.
      • Save & Activate and close the UI designer.
      • Double click on _WCF.WCF.uiwoc file of the custom business object.
      • On the Designer tab, the TestView work center view should now have changed its name to the name of your MDR.

    

                                             /wp-content/uploads/2016/05/36_955011.png


d.    Assign MDR to the work center


                                                /wp-content/uploads/2016/05/38_955012.png


e.    Creating a MDR element and scheduling it

      • Create an element of MDR which will be scheduled as per our requirement from OWL Screen of MDR.
      • Create new record in MDR.


                                                  /wp-content/uploads/2016/05/41_955363.png


                                                    /wp-content/uploads/2016/05/42_955403.png


      • Click on ‘Set to Active’ to activate the MDR element. 
      • Click on ‘Schedule’ to schedule the MDR.                                        
      • Schedule job on daily basis by checking the option of ‘Recurrence’.


                                                       /wp-content/uploads/2016/05/46_955405.png


      • Now open the OWL screen of the MDR.
      • Click on refresh to see the recently created MDR element.

                                                        

                                                         /wp-content/uploads/2016/05/48_955406.png

              

      • In order to create an MDR element or to schedule a MDR via UI we have to assign the work center to both business object and MDR to the particular business user like we have previously done in section Assigning Solution to Work Centre.
      • Login into the application via the particular business user and Select the Custom BO tab.
      • Select the MDR work center and then the MDR OWL screen will open where you can schedule a predefined MDR or create a new MDR element.
      • Below are the screenshot for the Email confirmation after scheduling the MDR.



                                                            /wp-content/uploads/2016/05/49_955407.png


                                                            /wp-content/uploads/2016/05/50_955408.png

                                                            /wp-content/uploads/2016/05/51_955413.png

                                                              

                                                               

                                                             /wp-content/uploads/2016/05/52_955419.png        




                                                            

To report this post you need to login first.

4 Comments

You must be Logged on to comment or reply to a post.

Leave a Reply