SGEN – The SAP Load Generator
The SAP Load Generator is executed through transacion code SGEN. SGEN may be required to be executed after a large upgrade or release of functionality in a system. If you don’t run SGEN and try to access specific objects the programs may start to be compiled as they are individually accessed.
Quick Overview
- SGEN is used to “compile” ABAP programs.
- It can be used to re-generate all the SAP programs after you change version of your SAP kernel, upgrade your SAP system or apply support packages.
- It is best to execute it during a period of time with very low user activity.
- SGEN is a client independent transaction.
- SGEN can also be used to re-generate objects within a Transport Request from SGEN menu–>Regenerate Existing Load
- If you want to regenerate loads, make sure that there is enough space available in the database. The space required can be several hundred MB. Generation over all components requires around 2 GB of free space.
- The runtime depends on the type of hardware configuration and number of objects being generated. (It would not be uncommon for this to take 5 hours.)
- You can limit the components to be generated, in order to reduce the runtime.
- You can schedule RSGENINVLAS to automatically regenerate invalidated loads. (Note this report has no selection screen)
Use
1. Select the generation task.
On the initial screen of transaction SGEN you can select the task that suits the purpose of the generation:
Generate all Objects of Selected Software Components
Choose this strategy if you want to generate the loads of all objects of certain software components. This may be the case, for example, if your system has been reinstalled. Here, the loads that are required for operation are not yet available and must be regenerated.
After selecting this task, the Selection of the Generation Set by Software Components screen appears. Here, you can restrict the amount of objects to be generated by selecting software components. Use the pushbuttons to select the software components you require.
Regenerate After an SAP System Upgrade
After an upgrade, you have to regenerate the ABAP object load in the system.
Regenerate the Objects of the Last Run
This task is suitable, for example, in the following cases:
- The generation of objects of the generation set that was used in the previous run was terminated and you want to regenerate the remaining objects.
- You want to regenerate all objects of the generation set that was used in the previous run.
After selecting this task, the following two options are available to you:
- Restart
The generation set that was used in the previous run in transaction SGEN is used. Only those objects that were not generated in the previous run or whose generation was terminated due to a system error, are generated.
- Generation:
All objects of the generation set used in the previous run of transaction SGEN are generated.
Regenerate Existing Loads
This task allows you to regenerate all ABAP loads and invalidated loads that exist in your system, and to generate loads for objects of a Support Package queue. You have the following options:
- Generate all Objects with Existing Load
- Generate Objects with Invalidated Load Only
An object load is invalidated if, since the time the load was generated, activated changes were made to the object or to objects used by this object, such as includes or tables. This may occur by importing a Support Package (SPAM) or a kernel patch.
If you want to generate loads for objects from a Support Package queue, start the task after importing the queue. The task determines the generation set using the invalidated loads in the system. Unlike the Generate objects of a transport request task, this task also takes into account ABAP loads that were invalidated by modified Dictionary objects.
Note: You can also periodically schedule an automatic regeneration of invalidated loads (every night, or at other times when the system load is low, for example). To do this, schedule the RSGENINVLAS report for the relevant time and period. The report then determines the invalidated loads for every type of host in your system at the specified time, and regenerates them.
Generate Objects from a Transport Request
You can use this generation task to regenerate the ABAP load for all objects in a transport request that can be generated. However, this task does not take into consideration ABAP loads that were invalidated by modified Dictionary objects. To include these loads, choose Regenerate Existing Loads -> Generate Objects with Invalidated Load Only.
After choosing this task, a screen appears that allows you to search for the name of the transport request using the selection button, or to specify it directly.
Generation of BSP Applications
This task enables you to generate BSP applications of selected software components.
Each Business Server Page is realized technically by an ABAP object class. When BSP applications are generated, these classes and their ABAP loads are generated. BSP applications are not included in the generation sets of the Generate All Objects of Selected Software Components, Regenerate After an SAP System Upgrade and Regenerate All Existing Loads tasks, since they are optional. You can use this task to deal with these.
After selecting this task, the Selection of the Generation Set by Software Components screen appears. Here you can restrict the amount of BSP applications to be generated by selecting software components. Use the pushbuttons to select the software components you require.
If you quit the generation of BSP applications before it has finished, or if the system terminates generation, the Regenerate the Objects of the Last Run task allows you to resume the generation.
2. Select the servers for parallel generation.
The generation is based on a method where the generation set is divided into small subsets that are processed by parallel processes. Depending on resources, available servers are included in the parallel processing, whereby multiple parallel processes run on one server.
From the Selection of Servers for Parallel Generation screen, you can select the servers that are to be used in the parallel processing. Note that loads depend on the machine type (MT) of a host. This means that it only makes sense to parallel process the generation set of servers of the same machine type.
The default selection uses the server that you are logged on to. It corresponds to your logon server and all servers on your system that have the same machine type. If you want to use the default selection, choose Continue.
If you want to exclude individual servers from the generation, or if you want to generate the load for a particular machine type that is different to that of the logon server, then use the pushbutton to select the corresponding servers and choose Continue.
Note: The parallel servers are depicted via the logon groups in transaction RZ12. For transaction SGEN, logon group ‘parallel_generators‘ is created. Do not use this group for your own purposes, as transaction SGEN uses and continually redefines this group.
After you have selected the servers, the system starts to define the generation set dynamically, and stores it in the database (database table GENSETC). This can take several minutes.
Job Monitor Pushbutton
This function allows you to call the job process control directly, without redefining the generation set. By choosing Job Monitor -> Job Overview -> Spool or Job Log, you can display logs from previous generation jobs.
Transport of Copies
Issue: Imagine you create and release a few transports before setting up the target system and Landscape. Because of this, the transports can be released without target clients. How do you fix this problem?
Fix: Fix is done using Transport of Copies Method:
- Execute transaction SE10
- Select the create icon.
- Select “Transport of Copies”
- Enter short description and save, this will create your transport number.
- Now follow the menu path to place your objects into this transport copy:
- Request Type–>Object List–>Include Objects
- Select “Object List from Request” and enter your old transport number.
Thats it! Your new transport is a copy of your old transport with all associated objects.
———-
Post contributed by: Sundar Raghuraman
Contact: sundar.raghuraman@gmail.com
Compare ABAP objects across systems
So you know how to use OY19 to see and compare cross system customising objects and you know how to use SE39 to see and compare an ABAP program across systems. But do you know how to search and compare all ABAP objects across a system?
For example you have made a system copy and want to compare all Z* and Y* programs?
You can do this with Transaction Code – SREPO - Repository Comparison.
1) Select the RFC destination (you can use SM59 to do this).
2) Select “Customer Objects and Modified SAP objects”
Then follow the wizard.
SAP Tips – View Table Change Logs
If the IMG change log has been activated you are able to analyse the changes with the following programs: Read more 
SAP Tips – Generate Routines Automatically in each target client
SAP Tips – SE10 – Transport Organiser Search for Requests
You may want to search for a specific Transport you can do the following:
Transaction SE10
Select Goto–>Transport Organizer Tools
Select “Search for Objects in Requests Tasks” Read more 
Compare Configuration across clients
You can save yourself a lot of time trying to determine what configuration entries are different across clients by comparing the configurations for an project or SAP reference IMG node.
You can compare customising entries across clients by using transaction OY19 or SCU0.
What configuration is missing between clients?
Q – How do I see what configuration is missing between clients?
A – Use transaction OY19. (There are a few methods to do this, this is an example) Create a comparison run ID. Then select for example “SAP Reference IMG”. Then select Create, then navigate to the node in the IMG you wish to compare, select it and then press the select node Icon, then select the transfer icon. (the area you selected in the IMG should now be yellow). Now enter a description. Select a client connection you wish to compare against and select Total Comparison or Total Comparison in background. You will then be given a list of objects/tables with values that are the same or different.
Table contents transport
Q – How do I delete table values from a client. For example I have 969 values in client 2 and 966 values in client 1. I want to move all 966 values to client 2, and therefore delete the surplus values in client 2.
Answer – This is easily done by using a asterix in the key in the transport. Create a transport for the table, eg: R3TR TABU and the key of the from client with a * in the next field of the key. The result will be the target client will have the values of the table deleted and all the values of the source client copied into the target client.
Dont forget to test you can use SCC1, between your development client and a sandbox/test client.




