Open navigation

SAP Variants

Modified on Tue, 15 Aug, 2023 at 10:27 AM

Info: Please note we are not SAP specialists. The examples given are from our SAP environment, but yours might differ. If you have any questions relating to your SAP environment, please contact your SAP Support Team.

The next two articles will share tips and tricks related to setting up variants in SAP which can then be read into Aico.

This first article will show you how to successfully set up a variant in SAP that can be read by the SAP program task type in Aico.

The second SAP variants article will focus on more advanced topics and some special case behaviour that we have experienced in SAP.

It is critical to understand that Aico uses a combination of the settings from the variant together with any overrides that are set in the Aico task template itself. This can be by smart tags that you have set or by entering values such as account numbers directly in the task template itself. Anything that does not have an Aico override will use the current SAP variant value. Therefore if anyone changes the variant in SAP, Aico will use this changed value. 

1. Start by going to the program or transaction in SAP itself e.g., FBL3N, FAGLL03

Enter a set of parameters that you know will return data. 

In the example below, we have set a single GL account, a single company code, the open item date (and radio button) and the layout we want to use.

Tip: The layout is best maintained in SAP.

Run the report in SAP to double-check that your starting set of parameters returns data.

2. Then go back (F3) to the parameter page in order to be able to save the variant itself by clicking on the Save icon.

3. Now you must give the variant a name (maximum 14 characters) and a description (1) and then you can Save (2) the variant.

Note: We strongly recommend that you use purpose-built variants to be called by Aico and not re-use other users' variants.

4. In its simplest form the variant is now available to Aico.

5. You can now follow the steps in Set up an SAP Program task to configure smart tags and other parameters to run the program from Aico. This article will continue to focus on the more advanced settings that are available in SAP itself.

6. In the image above you will notice that we did not set any of the protect, hide or save fields without values etc. that are available in the variant. These can have a significant impact on how Aico behaves and should be understood carefully.

The 2 key settings explained:

1. Only for background processing - Aico only calls programs as a background process so you can set this to true. However, it will prevent other users from running the variant (other than as a background job) directly in the SAP GUI. This might be useful if you know that this particular variant calls a lot of data and don't want users running it from the GUI. There is no advantage either way for Aico.

2. Protect variant - This is quite a useful one. Aico can still run the program even if the variant is protected, and it will prevent other users from changing the variant in SAP without fully understanding how it is being used by Aico.

The significant downside here is that, once protected, the variant can only be changed by the user who created it or was the last person to change it (and who then added the protection). If that user leaves the company the protection must be removed, which is often only possible by an SAP user with higher system admin rights. SAP offers a program RSVARENT which can be used to unprotect the variants. It takes the report name (not T-code) and variant name as the input. This report is used to cancel variant protection. You may or may not have the right to run this program depending on your SAP authorisation and Aico cannot help with this.

Objects for selection screen section

In the "Objects for selection screen" section, you can protect, hide etc. at a field name level.

Protect field - this mainly affects the SAP GUI and even if the field is protected, it can still be overridden from Aico. In the example below, the SAP variant is set as GL account 159100 (1). It is protected, but it can still be overridden by setting the value in the task template (2).

Hide field and Hide field 'BIS' - hiding fields in the SAP variant will also hide them in the Aico task template. However, if they have a value saved in the variant which is then hidden, Aico will still use that value. This means you cannot override the hidden value in the task template as it will simply not appear.

Info: the Hide field 'BIS' hides the "to" value entry box in the SAP GUI, but this has no effect in Aico.

Save without values - this setting will affect Aico if it is set, as it will have the effect of clearing any value set in the SAP GUI when the variant is saved. The value will look like it is there in the GUI and is remembered by the GUI, but it is not saved in the variant which Aico reads.
This value can still be set directly in Aico by setting a value on the task template in Aico. However, if no override value is set, Aico will see the value as empty.

Required field - this does not affect Aico. For example, if you make a field required in the variant, Aico will not enforce this and will run the program without a value.

Dynamic and Free selections

This can be a very confusing area when using these additional selections from the SAP variant. SAP has two different types of selections with overlapping terminology based on different technical approaches. Ultimately both end on a screen called dynamic selections which is where the confusion comes in. You can tell the difference based on the different UIs in SAP.

Dynamic selections - this is the original way in which additional selections are made in SAP and can be stored in the variant.

When Aico reads in the variant, it can show only the dynamic selections that you have set. You can override these in the task template if required.

Custom selections - this is the newer approach that SAP uses in programs like FAGLL03. On the face of the program, these are called custom selections but as you go into them you can see both the terms Free selection and Dynamic selections. 

Aico will use these custom selection values saved in the variant, but it cannot display them or allow you to override them in the task template. Therefore, to use these in Aico they must be saved in the SAP variant.

Setting ranges and more complex combinations of values.

Where you want to use complex combinations of values, then these may be better set and maintained in the SAP variant itself. SAP allows you to set multiple selections (single values, ranges with includes and excludes etc.). 

Aico will use these when executing the program if these are saved in the variant.

On the task template, Aico can only support simple ranges of values and/or a CSV list of values.

For example, you could set a CSV list of GL Accounts (1) and/or a single range (2) but nothing more complicated. Where you set a range, both ends of this range must either be in the SAP variant or in Aico, but not a mixture.

SAP report layouts

A number of SAP programs offer report layouts (list outputs) where you can define which fields are displayed in the report, save these into a layout and then use this layout in a variant. When using a report together with an import template, it is very important that the field positions do not change as the Excel formula logic is relying on data found in the specific layout.

1. Start by executing your chosen report without a list output set and you will be taken to the SAP default layout for that report.

2. From this report you can change the layout using the Change layout button.

3. Once in the dialog you can remove selected fields (1) and add new fields (2) by selecting them from the respective sides and pressing the appropriate add or remove arrows. The double arrows remove or add all available fields.

4. The Position/sort order (Pos.) takes more time. As you add fields they are always added to the end of the report. 

You can manually change the sort order by simply overwriting it if you change an individual value then all the other fields are moved up or down accordingly. Sometimes it is easier to simply remove all fields and then re-add them in your chosen order.

5. Once you have made your changes, press the Copy button and you will see the results.

6. Next you Save the layout using the Save Layout button. You are asked to name the layout (use a /in front of the name) and do not make it user specific as the technical user in Aico is not your own user ID.

7. Once saved, go back to the parameter screen and set your new layout name in the List Output parameter (1) and re-save your whole variant to include this new layout (2).


Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article