Skip to Content

Many BI developers have faced the need to automate the execution of process chains, which can be easily done within BI. However, sometimes we face the challenge to have BW process chains executed once specific ECC jobs complete successfully.

This document will walk through having an ECC job(s) trigger a BW process chain, and illustrate that it’s not really that challenging as it seems.

SCENARIO

We have two ECC jobs which once completed, should trigger the corresponding BW process chain. In this example, the ECC jobs can be run in parallel, and only when both complete, the BW process chain is triggered.

BW Changes

1. In RSPC create the process chain that will be triggered from ECC:

/wp-content/uploads/2015/04/1_676198.png

2. In SM64, create an event that will be used to trigger the process chain from step 1. For simplicity, use the same technical name of the process chain.

/wp-content/uploads/2015/04/1_676198.png

Click on new, provide the technical ID of the event and a description, and save the event.

/wp-content/uploads/2015/04/2_676215.png


The Event is what will be passed from ECC through the remote function call to BW. The process chain will have a start condition that will be after the event has been called. Details on step 3



3. Go back to the process chain, into the start variant, make sure you’re in change mode, under Scheduling Options, select Direct Scheduling, click on Change Selections:

/wp-content/uploads/2015/04/3_676216.png

In the selection options, chose After Event, and in the event section, chose the event that was defined in step 2, which should be the exact same technical ID as the process chain.

Ensure Periodic Job is selected, as this will enable the job to be scheduled and run periodically, as opposed to a single run. Check and Save, then save again.

/wp-content/uploads/2015/04/4_676217.png

4. In BW, we need to create a remote enabled Function Module, that will be called from ECC with the Event ID, and that will pass that Event ID and raise the event (fancy words for executing the event).


Go to SE37 and create a FM with ID ZFM_TRIGGER_EVENT

/wp-content/uploads/2015/04/5_676218.png


Ensure that Remote-Enabled Module is selected, as we want this FM to be triggered from ECC

/wp-content/uploads/2015/04/6_676219.png

Under Import, add the Event parameter details as shown below:

/wp-content/uploads/2015/04/7_676235.png

All other tabs can be left AS-IS.


Under Source Code, add the code below:

/wp-content/uploads/2015/04/8_676236.png


Here’s the actual code to copy paste:


CALL FUNCTION ‘BP_EVENT_RAISE’

   EXPORTING

     EVENTID                           = event

*   EVENTPARM                    = ‘ ‘

*   TARGET_INSTANCE       = ‘ ‘

*   TARGET_MODE               = ‘ ‘

  EXCEPTIONS

    BAD_EVENTID                            = 1

    EVENTID_DOES_NOT_EXIST   = 2

    EVENTID_MISSING                    = 3

    RAISE_FAILED                           = 4

    OTHERS                                      = 5.

IF SYSUBRC <> 0.

* Implement suitable error handling here

ENDIF.


Save and activate your function module.


ECC Changes

1. Firstly, we’ll need to create a program that will take the user/developer’s input as to which process chain will be executed, and in which system. In reality, the input for the process chain is really the EVENT that we setup in the BW step 2, but since we’re using the same technical ID for the event and process chain, that will not be an issue.


The advantage of creating a program with open input, is that we don’t hard code the BW system and process chain, and it can be re utilized for other process chains. We also have the advantage of being able to use this program in each BW environment in the stack (Dev, Quality, Prod) without changing code.


Go to SE80 and create a program ZBW_TRIGGER_EVENT:

/wp-content/uploads/2015/04/9_676237.png

Create three includes below:

ZBW_TRIGGER_001

ZBW_TRIGGER_I01

ZBW_TRIGGER_F01

/wp-content/uploads/2015/04/10_676244.png


Include ZBW_TRIGGER_001

This will be the definition of the layout of the program:

/wp-content/uploads/2015/04/11_676245.png

P_LS will be the selection option for the logical system

P_PC will be the selection option for the process chain


Below is the code to copy/paste.


  SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text002.

     SELECTION-SCREEN: SKIP.

     PARAMETERS: p_ls TYPE rsdslogsys.

     PARAMETERS: p_pc TYPE rspcchainchain_id.

  SELECTION-SCREEN END OF BLOCK b1.



Include ZBW_TRIGGER_I01

This will validate the selection input by the user

/wp-content/uploads/2015/04/12_676246.png

We do not want the program to execute if any of the selection options are blank


Below is the code to copy/paste:

INITIALIZATION.

   sytitle = text001.

  START-OF-SELECTION.

     IF p_ls IS INITIAL.

       WRITE:/ ‘Please enter BW System ID’.

       EXIT.

     ELSEIF p_pc IS INITIAL.

       WRITE:/ ‘Please enter Process Chain Technical Name’.

       EXIT.

     ENDIF.

     PERFORM select_1.



Include ZBW_TRIGGER_F01

This will trigger the Function Module ZFM_TRIGGER_EVENT that we created in BW in step 4, passing the process chain (event) and the logical system

/wp-content/uploads/2015/04/13_676253.png


Below is the code to copy/paste:

FORM select_1.

   CALL FUNCTION ‘ZFM_TRIGGER_EVENT’ DESTINATION p_ls

     EXPORTING

       event = p_pc.

ENDFORM.



We now need to maintain the text elements for our program. Go to GOTO -> Text Elements -> Selection Texts

/wp-content/uploads/2015/04/14_676254.png


Maintain the texts for the symbols that were used:

/wp-content/uploads/2015/04/15_676255.png

Maintain the selection texts for the variables that we’re using:

/wp-content/uploads/2015/04/16_676256.png

Save and activate the program.



2. Now that the main program has been created, we need to create a variant for it, with our logical system and process chain.

Go to SE38 and execute program ZBW_TRIGGER_EVENT. Enter your BW system and process chain.

/wp-content/uploads/2015/04/17_676307.png

Hit the save button to create a variant:

/wp-content/uploads/2015/04/18_676308.png


The program is now ready to be scheduled.


3. Now we will schedule the jobs that we want to run periodically in ECC, that will trigger the BW process chains. One job will be to execute the ABAP program that will be scheduled on a regular basis. The second job will only be executed after the first job completes, and will trigger the ZBW_TRIGGER_EVENT program created above.


Go to SM36 and create your periodic job. Once you defined the name, hit enter

/wp-content/uploads/2015/04/19_676309.png

Create the step, which is the ABAP program you wish that job to execute. In my case, I will be using my dummy ZBWTEST program.

Variants for the program to be executed are required, so make sure to create one ahead of time.

/wp-content/uploads/2015/04/20_676316.png

Check and save. You have successfully added the program to that job to be scheduled.

/wp-content/uploads/2015/04/21_676317.png

To add a second or multiple programs to that single job, simply click the new button, to add additional steps, and following the same process above.


Hit the back button to take you to the main job screen. Select the Start Condition button to define the start time/frequency, then save.

/wp-content/uploads/2015/04/22_676322.png

Once you’re back in the main job screen, make sure to save again. Only then you will get a message on the bottom bar that the job was released:

/wp-content/uploads/2015/04/24_676323.png

Go to SM37 and check that the job ran and has finished:

/wp-content/uploads/2015/04/25_676324.png


We now need to copy this job and keep it in status scheduled. This is required for the second job that we will create that will be triggered once Z_JOB completes. Copy Z_JOB and keep the same name and do not release it. Leave it as scheduled:

/wp-content/uploads/2015/04/26_676325.png

Step 4. Now we will create the second job that will kick off after Z_JOB completes, and that will trigger the ZBW_TRIGGER_EVENT program.

Go to SM36, create a new job Z_BW_TRIGGER and hit enter
/wp-content/uploads/2015/04/27_676326.png

Select the ZBW_TRIGGER_EVENT as the program, and the variant that you created then check and save

/wp-content/uploads/2015/04/28_676327.png

The step will be created under that job. Go back one page.

/wp-content/uploads/2015/04/29_676334.png

Under Selection Criteria, chose After Job, and enter Z_JOB as the job name, and check Start Status-Dependent. This will ensure this job only starts if the previous one completes successfully.

Check and save.

/wp-content/uploads/2015/04/30_676335.png

Save again in the main page, and you will get the message at the bottom that it was saved and is in status released.

Go to SM37 and ensure all options are selected. In order to see the Z_BW_TRIGGER job, select the Extended Job Selection button. Under the start conditions tab, in the OR start after job row, enter the predecessor job Z_JOB, and then execute

/wp-content/uploads/2015/04/31_676336.png

You should now see both jobs in the scheduler.

/wp-content/uploads/2015/04/32_676337.png

Your development is complete. You can now schedule the Z_JOB to run in ECC and watch the jobs kick off the process chain in BW.

Hope this was helpful. Good luck!

To report this post you need to login first.

4 Comments

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

    1. Marcelo Berger Post author

      Hi Dogboy. I had not heard of that option. Would you mind providing more information or even a how to guide for that? The community would greatly benefit from that knowledge 🙂

      Thanks for your comment.

      Marcelo

      (0) 
  1. Privacy Privacy

    Marcelo,

    There is not much to tell.  Remote process chain execution is standard functionality under Netweaver. In an ECC sandbox, execute transaction RSPC.  Building a process chain is mostly graphical, and somewhat intuitive; using drag-and-drop. Just add a ‘remote process chain’ step to your ECC process chain; you can find this process under the category ‘General Services’..No ABAP coding required.

    Capture.JPG

    Capture2.JPG

    If you get stuck, ask one of your local BW people to give you hints.  They use process chains extensively in BW. 

    Best Regards,

    DB49

    .

    (0) 
    1. Marcelo Berger Post author

      Hi Dogboy,

      Thanks again. I was able to execute my custom programs by creating a process chain in ECC, and triggering it through my BW process chain via the remote chain, as you mentioned, and it worked like a charm.

      Thanks for pointing that out. I’ll put together a another blog explaining how to do that.

      Thanks again for bringing that up! Great tip.

      Marcelo

      (0) 

Leave a Reply