Generate Scripts and Comments Using AI-Assisted Data Actions
When working in the Scripts tab of an advanced formulas step from a data action, you can generate AI-assisted scripts and comments. An AI-assisted data action makes the script writing process more efficient and simplifies the process of adding comments to document scripts.
Prerequisites: As well as AI-assisted features being enabled by your administrator, you must have the Execute permission for the Generative AI privilege to use the AI-assisted data action functionality.
AI-assisted data action script generation:
To generate a script:
- Select a comment either enclosed by /* and */ or prefixed by // or write a new comment and select it.
- Select the Generate Script button to generate an advanced formulas script.
- Verify the results.
- Select Accept or Reject.
When you select Accept, the generated script becomes part of the whole script and is no longer highlighted. The comment Created with AI. Verify results before use. is kept. You can leave it in the script or delete it.
When you select Reject, both the generated script that is highlighted and the comment Created with AI. Verify results before use. are removed from the script editor.
When you are generating script, pay attention to the following:
- If you refer to a specific member in the comment, the AI service will try to find the member whose description most closely matches your reference.
- If you want to refer to a specific member in the comment using its ID, we recommend enclosing the ID with double quotes .
- When you refer to a member in the comment, you don't need to explicitly mention the corresponding dimension the member belongs to. The AI service will find the corresponding dimension based on how the member is referred to in the comment. However, if multiple members across different dimensions share the same ID or description, we recommend including the dimension information in the comment to ensure that the AI service will pinpoint the correct dimension.
- We don't recommend using the generated comment as the basis for generating a script. The generated comment is intended to explain what the selected script does, but it may not cover all technical details like filters, calculations, and definitions. Therefore, trying to recreate the original script from the generated comment may result in a different script.
AI-assisted data action comment generation:
To generate a comment:
- Select an advanced formula script.
- Select the Generate Comment button to generate a textual description of the script.
- Verify the results.
- Select Accept or Reject. Comments are added or removed in the same way as the script generation.
When you select Accept, the generated comment becomes part of the whole script and is no longer highlighted. The comment Created with AI. Verify results before use. is kept. You can leave it in the script or delete it.
When you select Reject, both the generated comment that is highlighted and the comment Created with AI. Verify results before use. are removed from the script editor.
When you select a single line of script, the generated comment provides detailed insights, including specific filters and actions associated with the functions. However, if this line is part of a larger selection, the portion of the comment explaining it will be more condensed compared to when it's the sole focus of the comment generation. As the script selection grows in size and complexity, the generated comment tends to be more abstract. This approach allows you to understand the overall logic and intentions of complex scripts without being overwhelmed by details, which are likely clear or implied in the context.
In the SAP Help Portal, you can see examples of generated scripts from comments.
Note
When you select both comment and script, comment generation is prioritized, and the generation button is shown as Generate Comment. The comment part of the selection is not used and only the script part is used to generate a comment.