Using ABAP enhancement for copy of process chain
Hi all,
I often copy process chains, for example an existing chain for european data to a new chain with changed infopackages or different source System infopackages for asia.
In BW 7.3 or later systems one option to coyp a chain is to use the wizard. With the wizard you can choose which DTP, InfoPackages should be changed in the copied chain. Here you can also define a new start process. The wizard will create a new start process for the copied chain. If you check and activate the chain, everything is fine.
If you choose “simple copy”, the chain is copied 1:1. All steps are copied to the new chain, also the start process. But each process chain needs to have a unique start process. Check or activation of the new chain will fail in this case. So you delete manually the copied start process in the new chain and insert a new start process.Then you connect it to the other process types as before. If you save and check the process chain, process chain will be green. This blog describes, how you can enhance the method for copying process chain. This enhancement will create a new start process of type ‘TRIGGER’ with technical Name “<technical Name of process chain>_START”.
I investigated how copy of process chain is implemented. Fortunately it is implemented in class ‘CL_RSPC_CHAIN’ in private instance method ‘_copy’.
Now you can use ABAP enhancements. How to crete an ABAP enhancement you can find in the excellent blog series Enhancement framework in ABAP by Karthikeyan B.
First create an enhancement of class ‘CL_RSPC_CHAIN’..
Then you put the cursor in the method ‘_copy’ and insert post-method.
Insert following code in the post-exit method:
DATA: l_trigger TYPE rspc_variant,
l_trigger_text TYPE rstxtlg,
ls_chain TYPE rspc_s_chain.
LOOP AT core_object->p_t_chain INTO ls_chain WHERE type = ‘TRIGGER’.
CONCATENATE ls_chain-chain_id ‘_START’ INTO l_trigger.
CALL FUNCTION ‘RSPC_TRIGGER_DELETE’ EXPORTING i_variant = l_trigger
* I_NO_TRANSPORT =
* EXCEPTIONS
* FAILED = 1
* OTHERS = 2
.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
CALL FUNCTION ‘RSPC_TRIGGER_MAINTAIN’
EXPORTING i_variant = l_trigger
IMPORTING
e_variant = l_trigger
e_variant_text = l_trigger_text.
ls_chain-variante = l_trigger.
MODIFY core_object->p_t_chain FROM ls_chain.
ENDLOOP.
Check, save and activate the method. This post-exit method will create a new start process named <technical name of process chain>_START.
Now you can copy your process chain and it will create a new unique start process variant for each new process chain.
But please make sure that no one is creating or changing process chains, when you activate this enhancement. With activation a recompilation of the whole Transaction RSPC is necessary and user may wonder about some sudden dumps!
If you like this idea, you can also promote my idea on SAP Idea place: Copy of process chain creates new start process also
Maybe the simplest solution in BW 7.3 or later systems is to hide / disable the button “simple copy”. Then you’re forced to use the wizard and there you can define a newstart process.Hopefully this very small feature can be implemented with one of the next service packs.
I hope you like this blog. Feel free to comment.
Juergen great idea, just voted for your idea... I only wish ideas would be implemented into standard BW support packages quicker.
cheers
m./
HI Jürgen,
on which release of BW do you work.
I think in BW 7.3 a logic to copy a process is already included.
1.) Select chain you want to copy.
2.) Select copy and chos with wizard
3.) Following window appears.
On the following steps you can
- select number of copes
- change source systems
- change datasources
...
On step other processes you can do in detail what you like to do.
Here you can create a new start process using the existing one as template.
Here you can change technical name and/or description.
After doing this your process turns from red into green and you can complete your copy without getting an error.
I think this is really what you are looking for.
Regards
Timo
Hi Timo,
thanks for that hint. I usually make simple copies and don't click through the wizard. And my expectation is to have a newstart process for simple copies also. In this case the enhancement does the replacement of the start process.
Regards,
Juergen
Hu Jürgen,
I understand. But when I read your sceanrio that you make copies of process chains to havethe same workflow on a new connected system using the wizard will also be nice and usefull.
Here you can also change DTPs,Datasource and other processes using the original one as template for example.
I think this work you have to do manually after simple process chain copy.
Regards
Timo
Hi Timo,
thanks again for your comment.
I updated my blog to state the difference between copy with wizard and simpel copy. Maybe just to hide the button "simple copy" is the simplest solution for future service packs.
Regards,
Jürgen
Thank you for the mention. Jürgen Noe