Automate

 View Only
  • 1.  Tip of the Week – Script Chaining or Linking

    Employee
    Posted 06-02-2025 11:58
    Edited by Maria Ebner 06-02-2025 11:58

    Hi Automate Community!

    Chaining or linking scripts is used to automate an SAP process that requires running multiple scripts. For example, if you need to create a material, extend it, create a BOM and routing, etc., you can chain all those scripts together. Once the scripts are chained, click the run button on the first script and it will automatically run all the scripts in that chain. This can save a lot of time if you need to run multiple scripts and there is no limit to the number of scripts you can link. I was impressed to find out that Columbia Sportswear chained together 148 scripts to automate SAP testing!

    I want to share several tips about chaining. If you're interested to learn the process of chaining, please review the documentation here: https://help.precisely.com/r/t/1016755894/2023-12-31/Automate-Studio/Connect/Latest/en-US/Automate-Studio-with-Studio-Administrator-User-Guide/Link-Scripts

    Here is a screenshot showing 3 chained scripts:

    Before chaining scripts, I recommend the following:

    1. Test each script individually to make sure it works as expected.
    2. Check the run settings for each script. For example, if the start row should be 2, make sure it's 2. I've seen where the start or end row was changed while testing and they need to be changed back before chaining. I've done this to myself many times!
    3. Create a copy of each script and add the word chain or something that indicates it's in a chain. You can also add a number to each script so you can easily see where it is in the chain. Once a script is in a chain, it will always run the chain. You won't be able to run it individually.

    While chaining scripts, I recommend the following:

    1. Choose the appropriate run settings for the scripts. You can choose "All from first script", "All from individual scripts", or "Custom". For the screenshot below, custom was chosen because I wanted to use the SAP logon (ALC) from the first script and the sheet and start row from the individual scripts. Click the settings button next to custom to make changes to the custom run settings.
    2. Check the run settings for each script by clicking the settings button on each script. This isn't needed if you choose "All from first script".

    After chaining scripts, I recommend the following:

    1. Run the chained scripts to ensure every script runs as expected.
    2. Publish the chained scripts to the Excel file to make it easier for end users (runners). If you've already published and need to make changes to any of the scripts in the chain, remove the published scripts in the Excel add-in, make the necessary script changes, and publish the chained scripts again. If you're using Studio Manager or Evolve, you will need to submit the chained scripts instead of publishing.

    Other tips and notes:

    1. If there is a Transaction script in a chain you might not want to run because of an error or maybe it's not needed for that row of data, add an if condition in the mapper to the entire script.
    2. You have the ability to cross-link meaning you can chain or link Transaction scripts and Query scripts ("All from individual scripts" is the only run setting): https://help.precisely.com/r/t/1016755855/2023-12-31/Automate-Studio/Connect/Latest/en-US/Automate-Studio-with-Studio-Administrator-User-Guide/Cross-link-Scripts?tocId=IuTR69OioBJfNoGCCKKjWw
    3. Chaining scripts for web forms/workflows in Evolve is done in Composer, not in Studio.
    4. Chaining will run all the rows for the first script, then all the rows for the second script, etc.

    I'm sure this doesn't cover every tip, so please share any tips or stories you have about chaining. Perhaps you've chained more than 148 scripts?



    ------------------------------
    Maria Ebner
    Precisely Software Inc.
    ------------------------------



  • 2.  RE: Tip of the Week – Script Chaining or Linking

    Posted 5 days ago

    Hi Maria,

    I have a question on a specific scenario. This is about chained Journal entry scripts: 1. to post JE using BAPI, and 2. post attachment using FB03

    What is the best settings to use to make sure when some JEs creation fail, User can correct the data and chose "Run Only Error Rows"...this should then post the JEs and then post the attachments as part of the chain.

    I tried both "Run from Individual Scripts" and "Run all from First script" options in the chain...but we see cases where when user Runs only on error rows, it reruns and creates JEs successfully....but it does not post attachment for those rows.

    The only workaround I have is to use start and end row ranges instead of "Run Only Error rows", but please let me know if I am missing a setting in chain.

    Thanks

    Ocal



    ------------------------------
    Ocal Yilmaz
    e.l.f. Cosmetics, Inc.
    ------------------------------



  • 3.  RE: Tip of the Week – Script Chaining or Linking

    Employee
    Posted 2 days ago

    Hi @Ocal Yilmaz

    I would use an IF condition around the FB03 to only run it if the JE posted - put an IF around everything in that script except the log messages. The IF can be whatever works for your use case.

    Then I would use the Run Unprocessed and Error rows

    • That posts the JEs that had errors
    • The attachments would not have run yet because of the IF statement, so the unprocessed rows handles doing this step

    Does that help?

    Best Regards

    Sigrid



    ------------------------------
    Sigrid Kok
    *Precisely Software Inc.
    ------------------------------



  • 4.  RE: Tip of the Week – Script Chaining or Linking

    Posted 2 days ago

    Thanks @Sigrid Kok - this should work. I will add IF condition on FB03 script.

    just to confirm - in this case, it is best to keep chain setting as "Run all from First script"?



    ------------------------------
    Ocal Yilmaz
    e.l.f. Cosmetics, Inc.
    ------------------------------