This blog will explain the steps need to make the SAP workflow engine to work. If you have to set up the SAP workflow engine in S4HANA, please read this dedicated blog. Questions that will be answered are:
How to execute the automatic workflow configuration?
What are common issues with workflow configuration?
How to test the automatic workflow configuration?
What other settings are to be done for custom workflow building?
Automatic workflow configuration
To setup workflow configuration start transaction SWU3. This brings you to the Automatic Workflow Customizing screen. If the system is new then you see most of the icons are red. Hit the Automatic Customizing button. Depending on your version all actions might be completed. In this step in the background the user WF-BATCH is created along with the RFC connection WORKFLOW_LOCAL_<CLIENT>. In the newer versions of SAP netweaver this automatic step might end up with this status: Zooming in on the RFC connection issue: You will see as analysis that the user WF-BATCH is not yet created. In the newer SAP versions SAP expects you to create WF-BATCH first, before you run the automatic workflow configuration. If you have done the auto configuration and get this message, just create WF-BATCH user in SU01. Then restart SWU3 and repeat the step for automatic customizing. It will be correct:
Testing the workflow setup
On the SWU3 screen hit the Start Verification Workflow button (if needed accept the event linkage activation). Be patient now for at least 5 minutes, since in the background normally a lot of code is compiling. Then go to the inbox to check if you validation workflow was properly launched. In S4HANA the button is no longer there on the SWU3 screen to jump to the inbox. You still can use the inbox button on the SAP start screen or use transaction code SBWP. In the inbox you should see an item. Open it and make a decision: This will end the verification.
Most common issue is to execute the automatic customizing without sufficient authorizations.
Best practice from SAP basis: execute SWU3 directly after installation with SAP_ALL still attached to your user ID. Then only hand over the system to the authorization team. After activation, you can remove SAP_ALL and provide the authorizations as explained in OSS note 1574002 - WF-BATCH and SAP_WFRT Authorizations.
For custom workflow development you need to execute one additional step in SWU3 to maintain the Prefix Numbers: In the number range screen add the 900 series for custom developed workflows: This setting will be transported, so you only execute this action on development system.
For workflow tips and tricks: read this blog. Setup of FIORI my workflow inbox: read this blog. For deletion and archiving of workflow: read this blog.
There are many static code analysis tools. Long list can be found on Wikipedia. At some point in time a manager or developer might come to you with one of these tools like “hey, at my previous customer we used SonarABAP for code measurements”.
This blog will explain the ABAP code metric tool built into netweaver. Together with the ATC tool the code metric tool covers most of the functions that such tools deliver.
Questions that will be answered in this blog are:
How can I count the amount of lines of Z code in my SAP system?
How to run ABAP code metric tool?
What output will the ABAP code metric tool deliver?
Use cases of the ABAP code metric tool?
The test the code metric tool write a small ABAP program like this:
This program has nested IF statements (3 levels deep), one ELSE statement and a nested DO.
Code metric tool
Start the custom code analysis tools with transaction /SDF/CD_CCA:
The code metric tool is the tool on the bottom of the screen.
On the start screen select the package and extra checks (selecting more packages and checks will increase the runtime of the tool):
Result for our test program:
The output is giving:
LoC: lines of code
NoS: number of statements
NoC: number of comments
COM: complexity of conditions
TOTAL DD: complexity weighted by decision depth
IF: 3 (this was in our test program)
etc like amount of loops, selects, updates, deletes, modifies, case statements.
Use cases of Code Metric Tool
Use case 1: complex programs
Complex programs are normally source of most productive issues. You can use the code tool to check if the program is not too overly complex (like many nested if and case statements).
Use case 2: the procedural versus OO discussion
Sometimes you have managers wanting you to count the amount of Z objects. If you have switched from procedural coding to OO coding you will find the amount of objects to have increased. The code metric tool can help you here by counting the amount of statements and complexity. The amount of objects in OO is typically higher, but due to re-use and better setup, the total amount of statements and the total complexity decision depth should be smaller.
Use case 3: count the amount of Z code lines in your SAP system
Every now and then there is discussion on Z code. Sometimes the question will popup: “How many lines of Z code do we have in our SAP system?”. This question you can answer as well with the code metric tool explained above.
For reference: SAP standard has 238 million lines of code (source is this SAP blog).
This blog will explain the use of SAP clone finder.
Questions that will be answered in the blog are:
What are clones?
How to run the clone finder tool?
How to analyze the difference between the original and the clone?
What are clones?
Standard SAP offers lot of out-of-the-box functions and reports. But in many cases the standard report only offers 95%. What to do? In many cases developers copy the standard SAP program to Z copy and add the needed 5%. When upgrading the system to higher version or when applying support packages or OSS notes, the Z clone will not be upgraded to latest version. Maybe the clone needs updates as well, or can be deleted now after upgrade (if SAP added the missing 5%).
The clone finder tool is able to find the clones made in the past.
When you are doing a S4HANA conversion project (see blog) you will have to look again at these clones if they are still relevant or not.
Running the clone finder tool
The clone finder is part of the Custom Code Analysis workbench. Start the workbench with transaction /SDF/CD_CCA or transaction CCAPPS:
Clone finder is on top of the list.
Start screen of clone finder:
Pending on the size of your system you can run online or in batch.
Test result of standard SAP copy made as example:
As example program RSUSR003 and its includes were copied to Z programs. 3 are shown as identical copies. 1 is altered.
In the function link column you can hit the Version Compare button to see the differences:
Differences: the name of program and includes are different. And the authorization check was removed.
How to use changes in operation mode during runtime issues?
Operation modes explanation
In SM50 you can see the overview of work processes (in SM66 for all servers if you have more). The work processes are divided into online DIA, background BTC, update UPD, etc. The number of work processes is limited. During a working day normally more dialog processes are need for end-user usage. During the night typically more background batches are running.
This is where the operation modes come into the picture: you can setup these different modes and assign them to a timetable. The system will then have for example less dialog and more batch processes available during the night.
Operation modes setup
Start transaction code RZ04 for setting up the operation modes screen. Hit the create operation mode button:
Give a short key name and description for the operation mode. In our example we will set up simple DAY and NIGHT.
The initial screen after creation is empty:
You now need to maintain the instance data and assign the created operation modes:
It is import to check if this is active or not. When in doubt select the menu Instance and entry Set to active.
Also in these screens: press the save button locally and on the top of the screen.
Later on you can always change the work process distribution:
Put the cursor on the type (example Background) and use the plus and minus to increase or decrease the amount.
Make sure both DAY and NIGHT are properly setup now. Check in RZ04 start screen.
Amount of DIA versus non-DIA processes
To avoid issues, make sure the amount of DIA work processes is always greater than the amount of non-DIA work processes. See point 4 of the SAP OSS note 1970757 – Outbound qRFC scheduler with status RES_LACK. This note explain issues you can get in your system if you don’t apply this rule.
Time table assignment
Now that we have the two operation modes DAY and NIGHT, we need to tell the system when to use which one.
In the RZ04 main screen choose menu Operation Mode and then Timetable (or transaction SM63 directly). You reach the initial time table screen:
Choose the normal operation. Here you assign the operation mode to the time table:
This UI is bit unfriendly: double click on first time, then on last time, then assign operation mode. When done save the input.
Result in RZ04:
Activation of operation mode
Now this is done, you might check in SM50 to see nothing has changed. This is because the operation mode is defined, but not activated yet to run.
Go to transaction RZ03 and choose the operation mode you want to go to by selecting the Choose operation mode button.
In the menu select Control, Switch Operation Mode, All servers. Confirm the switch.
Now if you check in SM50 you see the switch is almost immediately effective.
Change of operation mode during system issues
During system issues you might want to use the switch in operation mode or change the work process distribution.
Use case 1: project team needs to do conversion on the fly in the system and did not notify basis team. All batch processes are filled up. Temporary quick solution: switch to NIGHT profile.
Use case 2: somehow the update processing is slow and you see bottleneck in UPD processing. Temporary quick solution: change the DAY profile to have 1 or 2 more UPD processes and less of something else. Save DAY profile and goto RZ03 to activate. After issue is resolved, don’t forget to revert back to normal. In this case it might be due to growth that anyhow more UPD processes were needed in the system.
Bug fix OSS notes
Please check following bug fix notes in case of issues: