How to Copy Steps from one workflow to another workflow template
Being my first blog, it might not look very good but I hope atleast few of my friends on SCN will find it useful for them. Sole purpose is to share knowledge 🙂
Why I wrote it ? :
Few days back I was looking for some answer, in pursuit of which, I found this question if it is possible to copy steps from one workflow to another workflow. Someone had replied NO 😯 to that post that NO prompted me 😈 to correct. The discussion was very old so one of my friend asked me to write a blog on it so that for others it can be easier to search for such a basic question which many beginners(like me 😉 ) wonder. Although it seems to be silly to ask such a question but (being self-learner) I had been through this phase so I can understand sometimes learning even very basic point looks as if you have won a Big battle .
Target Audience : SAP Workflow Developers (Beginners)
Terminology Used:
- Target Template: Workflow template(WS99900327) in which block needs to be copied
- Source Template: Workflow Template(WS9990086) in which block needs to be copied.
Steps :
Go to Transaction PFTC
Open the Target template.
➕ We can access the Source template directly as well to skip few of the mentioned steps. I would suggest to try once you are done with blog
Target Template is open and in Active and Saved state.
Now in Information Area, enter the Source template number and Click ‘ENTER’.
Below screen shot has Source template which is opened in same session. The structure of this workflow is very complex but divided into 3 parts. We can copy everything in target template without using Copy-Paste but that could consume a day or two in copying all steps depending upon availability of time and familiarization with SAP Workflow development. Anyways, never go for manually copying every step if you can copy entire block within minutes with just few clicks.
Here, I will copy 2nd block of workflow to Target Template.
Navigate to the block and at the beginning step of block, do right click and copy/cut the template. Alternatively you can click on step and use copy/cut button marked in below screenshot to copy/cut entire block.
ℹ Use ‘CUT BLOCK’ only if that block is supposed to be removed from Source template.
Once block is copied a message will appear at Left-bottom of screen ‘Selected entries were copied to clipboard’.
Now in Information Area, enter target template number and Click ‘ENTER’.
In Target Template, Right click at the place where block is to be copied and click on ‘Paste block’.
In the below screenshot, copied block appears in the Target template. The state of workflow template will change to ‘Revised , Not saved’.
The entire block is copied but newly added steps also brought new bindings to target Template. To be sure we have all the required workflow container elements used in new bindings in Workflow, perform Syntax check
Here, we have 113 errors in Target template which all appeared due to bindings in new steps. I picked just one step(Step 417) to explain how to quickly identify missing container elements. Check ‘Result of Syntax Check’ section at the bottom and scroll down to any error and check the missing container elements.
Check data type of missing container elements from Source template and declare all missing workflow container elements. I have declared only 1 element ‘ZNAME1’ just to show the change in results of Syntax check.
After declaring container elements again perform syntax check to check if all errors are resolved or not. Since here I declared only 1 workflow container element so error count changes from 113 to 110. Reason is ZNAME1 was used at 3 different steps/bindings so only those 3 got corrected rest still needs to be corrected.
Now try to experiment few things on your own. If you have any question, feel free to put in comments I will try to respond ASAP with best of my knowledge. 🙂 Suggestions & Comments are welcome.
Good Luck!
Good tip. Had given up thinking SAP hadn't thought this through.
Thanks Salil !!! 🙂
Nice blog.
One piece of advice though, if you are developing with several workflow consultants then sometimes weird things will happen if you use this method liberally.
If this happens then synching the buffers will help a bit ( /$sync and /$tab )
Cheers, Rob
Nice Document 🙂
Awsome document man. Keep posting such misc content.
Very helpful one. Thanks buddy !!
Hi,
Nice blog/document; I didn't know you could do that.
But I wonder if copying large blocks is advisable.. sometimes a loop or subworkflow on an existing block could achieve the same result with less mess and fuss (and binding errors..)
For example, that first (source) workflow looks like an absolute nightmare, and it appears (from this distance 😀 ) to be made of 3 almost identical blocks. I'm guessing it was created using this cut'n'paste method? Pity the workflow consultant who has to read/understand/support that..!
I think simplicity should be one of the most important goals in workflow design. It is very underrated.
Thanks for sharing and keep on blogging!
cheers
Paul
Hi Paul,
Thanks for the feedback!
Even I won't advise copying large blocks as that could easily be achieved by using subworkflow. I just shared something which I learnt while I had to deal with copy-paste scenario.
To answer your question, though all blocks in source template looks same but they are performing different tasks based on few conditions and I am that unfortunate person 🙁 who is supporting it. I completely agree, developer should have looked for better alternative. Few weeks back, I realized that it could be simplified, now working on new design proposal 🙂 .
Regards,
Vishesh
Hi Vishesh
Good Document......
Did we try the download and upload of XML (Import/Export) option? That too can help in quick copy.
Regards,
Modak
Hi Modak,
Thanks for the input!
I tried export and import of XML as you suggested to find its use. This, I believe is good option to transport complete workflow template from one system to another system or to copy entire workflow template from one template to another. Please correct me if my understanding is incorrect.
What I explained in the article is a workaround to copy a particular node of workflow template from one template to another in the same system.
Please let me know if you have any other input/doubt which could help us in exploring other option(s)
Regards,
Vishesh
Hi Vishesh
Yes, you are right.....XML option is for entire Workflow.
XML option doesnt work for complex workflows where it has loop untill, block etc.
Good One !!
Nice Document it's really very helpful to me.
Regards,
Murari Shah