ABAP training: Data Dictionary: Domains

In the SAP data dictionary the lowest level re-usable element is the Domain. The Domain is used to build a Data Element in a database table.

Create a domain

To create a domain start transaction SE11, and choose the option Domain, enter your name and press Create:

In the next screen give the Domain a proper name and set the Date Type:

In this case we have chosen for a CHAR data type with length 50:

Note here that for text you can choose to make it case sensitive or not.

If you are happy, press the Save button and store the Domain in the proper package.

Then press the Check button to see if all is ok, and Activate button to activate the domain.

Possible data domains

The characteristics of a domain depend on the chosen Data Type.

For example a number will show different options:

There are domains for date, time, currency, quantity, etc…

Domain with own defined value set

The nicest feature of a domain is that you can define a value set. This value set can be used to restrict field choices to a limited set.

Example: first define a Domain;

Now go to the tab Value Range to set the restrictions:

In this case only the values FUTURE, PAST and PRESENT are allowed for this domain (and the Data Elements using it in tables).

Expert information

Be careful updating a domain later on (this includes adding a value in the value range). Any domain change will trigger a recompilation of:

  • The domain itself
  • Every Data Type using it (data type can be data element, structure and/or table type)
  • Every table using the data type
  • Every program using the table

This can be a lot!

Use the Where-Used button to see which tables are impacted. When it is a lot, check with your basis team when to import your transport in subsequent systems. Choose a time if possible where no users are working.

Domain Field length reduction and extension

Reducing domain field length can lead to data loss. Check and double check twice before executing a domain field length reduction.

Domain field length extensions are possible, but will trigger database table adjustments for the tables in which the data elements are using the impacted domain.

Use the Where-Used button to see which tables are impacted. Check with your basis team when to import your transport in subsequent systems. Choose a time if possible where no users are working.

Solving generic SM30 and SE16 access with dedicated transactions

In a high secure environment data access to SE16 and SM30 needs to be restricted. In many cases either IT or business still needs to maintain data via SM30 mechanism or some support people still need to see certain table data.

This blog will explain a more dedicated approach to create a dedicated transaction for each table. The generic SM30 and SE16 access can be revoked and replaced with targeted authorizations for the specific table and transaction.

Setup transaction to call SM30 for single table

Start transaction SE93 and enter the transaction you want to created and push the Create button:

On the next screen provide a description and choose the option Transaction with Parameters:

Now fill out the transaction detail:

The text is free of choice. In the transaction put SM30 (we will create a parameterized version) and select to skip initial screen. You can inherit the GUI attributes. In the default values put VIEWNAME and in the value the table you want to update. Add the second value for UPDATE with value X.

Save your work and test the transaction.

By entering the transaction code you now jump to the maintenance of the table (in our case the ZTESTTABLE as specified).

Setup transaction to call SE16 for single table

For SE16 repeat the above steps:

The text is free of choice. In the transaction put SE16 (we will create a parameterized version) and select to skip initial screen. You can inherit the GUI attributes. In the default values put DATABROWSE-TABLENAME and in the value the table you want to update.

Authorization team work

The authorization team can now remove SM30, SE16 and generic table access. Only table maintenance for this specific table is required along with access the newly created Z transaction.

SAP systems running on RISE

In the past there was HEC (HANA Enterprise Cloud). Now we have RISE, which is HEC on Azure combined with a lot of marketing.

This blog will provide you with hints and fact for SAP RISE and the corresponding ECS (enterprise cloud services).

This blog is not intended to provide an opinion on RISE (you can find this for example in this LinkedIn post).

Nor is this blog a buying guide or whatsoever. There are many on the internet. For anything you procure from SAP (including RISE) the normal Caveat Emptor (know and inspect what you buy).

This blog contains background notes relevant for both basis and security teams working and/or planning to work with RISE.

List of relevant OSS notes for ECS and RISE

List:

Related OSS notes:

Secondary indexes on HANA database

The in-memory HANA database uses primarily column store. In most cases the performance is excellent and the need for a secondary index is no longer needed. But there are exceptions to this rule.

In very specific cases the setup of a secondary index on HANA will help to improve performance.

In some cases after migration when you started with a lot of extra indexes, you might want to validate if the extra indexes are needed, since to do consume memory.

Analysis program

ABAP program SHDB_INDEX_ANALYZE can be used to analyze need for secondary indexes, or advice to delete indexes that are no longer in use. OSS note 1794297 – Secondary Indexes for S/4HANA and the business suite on HANA describes all the detailed steps.

Below is the summary:

In SE38 start program SHDB_INDEX_ANALYZE:

Program can be online or in batch. Best to run in batch. Before you run in batch mode, set the output to Text Only:

Let the program run.

In the output spool you will find 2 outputs: one for the error and warning messages and a second spool with the advices:

This is output is from a development system and not representative. Real run you must do on a productive system.

Don’t follow the advices blindly. First check with the application owner if the index on the table column makes sense business wise.

Background OSS notes and blogs

Background blogs:

Background OSS notes:

Bug fix OSS notes:

Performance measurement transaction STATS

Performance issues in the system can be analyzed with transaction STATS.

When you start the transaction fill out the timeframe and user ID and if wanted a specific transaction code:

Result list:

Double click on a line to get the popup with all the detailed information:

The detailed information can give a hint towards the root cause of any performance issue.

OSS notes

Relevant OSS notes:

Program variants

Program variants is a very powerful way for end users to save selection screen data that they need. And share the same input criteria with other users as well.

This blog contains technical tips and tricks for developers and system administrators on variants.

Transport of variants

Variants can be put in a transport with program RSTRANSP.

OSS notes:

Overview of all variants and mass deletion

In SE38 go to the program. Now select the subobject variants:

On the next screen select the button Catalog:

This will show a list of all variants. You can select multiple and delete.

Technical hints for program variants

Function modules:

  • RS_CREATE_VARIANT
  • RS_VARIANT_DISPLAY
  • RS_VARIANT_ADMIN_DATA

Tables:

  • VARI: main variant data
  • VARIT: text for variant

The data is stored in table VARI. But this is in unreadable format. Use function module RS_VARIANT_ADMIN_DATA to read the data. Input is program name. Output is all variant detailed admin data. The data you are looking for is in output table VARIANT_INFO.

TVARV

TVARV is needed in some cases. But best to avoid. In case you still need it: table TVARV can be maintained with transaction STVARV.

Authorization

Apply note 3603592 – Enable authority-check for selection variants for all reports to enhance authorization on program variants. See also note 3170317 – Low level customizing for selection variants on how to activate this.

Variant protection

A variant can be protected by the user. Or as admin you can set and unset the protection with program RSVARENT. OSS note: 2946937 – Improve RSVARENT to protect / unprotect report variants.

OSS notes

2696001 – View Change / Deletion logs for user specific Program Variants – SAP ERP & SAP S/4 HANA : variants have no change log. So you cannot see who deleted a variant.

2952867 – Documentation about new tools (RSVCHECK_NEW, RSVARDOC_NEW) for selection variants

  • RSVCHECK_NEW – Check selected variants. Results are displayed in an interactive work list.
  • RSVARDOC_NEW – Adjust selected variants.
  • RS_VARIANT_UPLOAD_DOWNLOAD – Transfer variants via file.
  • RS_VARIANT_CONVERSION_TYPES – Configure DDIC datatypes to be used during adjustment.
  • SVAR_VARIANTS_PARAM_OVERVIEW – Display parameters for variants with a detailed overview of the parameter values and attributes 
  • (Internal) RS_VARIANT_INSPECT – Analyze a variant regarding its consistency, comparing stored parameter properties against the current version in the corresponding report.

Known issues and solutions

Reading content from batch job variants: read this blog.

Variant SAP_PROD is protected; only user SAP can make changes: If you have the required authorization, you can remove the protection on the variant yourself explicitly by running the report RSVARENT.

Webdynpro tips & tricks

SAP web dynpro is still in use and is a good way for ABAP devevloper to create web screens for end users.

Tips and tricks for basis

Transactions:

  • SICF: activation or de-activation of web dynpro services (see blog for all SICF tips and tricks)
  • SICF_SESSIONS: Enable HTTP security session management at backend(ABAP) system
  • SMGW: gateway monitor
  • SMICM: HTTPs settings

General:

SAP help documentation on WebDynpro can be found here (very extensive).

Unified rendering

Web dynpro uses the unified rendering framework. This needs regular patching. See this blog for more information.

SCOV coverage analyzer

The SAP coverage analyze can be used in testing custom code to make sure all testing covers all code and all branches.

The coverage analyzer has quite an in-depth analysis capability that is meant for non-productive systems. Don’t run it on productive systems.

Starting the coverage analyzer

On your test system start transaction SCOV and go to the on/off section in the Administration branch:

When switched on it will take at least 1 hour before the first results are visible.

Analyzing the results

During the testing you can view the test coverage results in the Display/Details section. Select there the Z* for all the custom code (you might need to increase the Maximum Number of Objects in the Settings tab):

Wait for the result list and sort by Coverage:

Double clicking on one of the lines gives the coverage per program:

If you select any line you jump to the code lines:

In this case (yellow one), you can see that the normal flow is done, but the exceptions are not reached yet. If the exceptions are important for your business scenario, you know you have to create and fire a test case. Once done, the coverage should increase.

Overall view

In the overall view you can see trend analysis over time:

To refresh the analysis or to set up first time push the Update Analysis button in the middle section (it is a bit hidden).

References

Standard SAP reference for Coverage analyzer: link.

OSS notes:

Financial document archiving: check document archiving

When you are archiving FICO documents you will not be able to archive all of them. With the FICO archiving transaction FB99 you can investigate why.

FB99 will simulate what will happen with data archiving of a document and shows you what is blocking a document from being archived.

After start of transaction FB99 enter company code, document number and reference number (usually today’s date):

Press enter and the results screen will show the reasons for not being to archive (or indicate archiving is possible):

With the buttons above you can see the document, line items and settings for type life.

More on FICO document archiving can be found in OSS note 1290219 – FAQ: Archiving in Finance.