1. Business Scenario:

Execute a process chain step based on the value of a field from a table.

  1. e.g. If ztable-zflag = ‘X’ then execute step1 else execute step2.

In our case, the table to be referred is ZDECISION. Here, we have 2 fields: Process Chain Name and Flag.

  

     Img1.jpg

Using the Decision Between Multiple Alternatives Process Type, check whether the flag for a particular process chain is checked or no. If it is checked, then execute Step 1, else execute Step 2.

2. Steps to create a Custom Function

     1. Using SE19 create a new implementation of BAdI RSAR_CONNECTOR:

      Img2.jpg

     2. Enter the Implementation Name:

          Img3.jpg

     3. Enter the short text for your Implementation and make a note of the Implementing Class Name in the Interface tab:

          Img4.jpg


     4. Save your implementation. Then using SE24, edit the implementing class:


          Img5.jpg      

          Enter your new method here. This is where you add your ABAP code for the new formula to be used in your process type. The method should be           Static and Public.


     5. Click the Parameter button to enter the parameters of the method. Note that only Importing, Exporting and Returning types are valid. Also, only a single          exporting or returning value is permitted.


          Img6.jpg


     6. Click on the Methods button. Then double click on the method name to enter the ABAP code:


          Img7.jpg


     7. Test, save and activate your method then come back to the main SE24 screen and activate the class.


     8. Using SE19 edit your BAdI implementation


          Img8.jpg


     9. On the Interface tab, double click on the GET method to edit the ABAP code.


          Img9.jpg    

          The code here allows the method that we have created above to be seen in the formula screen (as part of the Functions) in the Decision Between           Multiple Alternatives process type:

          Img10.jpg    

The first part of the code (WHEN ‘  ‘) sets up a new category in the Functions drop down menu called BW Custom Functions.

The second part of the code (WHEN ‘C_BW_CUSTOM’) adds the new method created to the BW Custom Functions.

10. Activate your code then activate the BadI. Note that when it is activated the Runtime Behaviour field will be set to “Implementation will be called”.

     Img11.jpg    

3.     Steps to use the New Function in the Decision Between Multiple Alternatives Process Type:

     1. Create/Modify Process Chain using RSA1 – Add the Decision Between Multiple Alternatives Process Type:

          Img12.jpg

          Img13.jpg

     2. Define your conditions to check the Flag for the respective process chains. The new Function created will be available under ‘BW Custom Functions’:

          Img14.jpg    

          As per the method defined in point 6, the above function will check whether the Flag for the process chain is checked (Value ‘0’ if the Flag is                         checked, else it returns ‘1’).

     3. Go back to the previous screen, where you can define the Event Options in each case. Here, we have defined that If the Flag is checked, then Option 2           (Green) should be triggered, else Option 1 (Red) will be triggered.

          Img15.jpg    

     4. Finally, use this Process Type in your process chain:

          Img16.jpg    

          In this case, If the Flag is checked, then the Program will get triggered, else the Infopackage will trigger.


To report this post you need to login first.

1 Comment

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

Leave a Reply