Skip to content

Posts from the ‘Custom ABAP’ Category

14
May
SAP Tricks

BADI’s in 5 Minutes

Generally if you are a developer you know all about BADI’s, if you are a functional person you possibly only know that they exist. This is what every functional person, at least needs to know about them:

A BADI is similar to a user exit.

It stands for Business Add In.

BADIs  are object orientated.

You do not need to register the code change in SAP SSCR. (SAP Software change registration).

In ECC the transaction code to display/change/create a BADI definition is SE18.

In SE18 you can also see detailed descriptions of the use and examples of standard SAP BADI’s for example use: ME_DEFINE_CALCTYPE - To reset the calculation type in a purchase order.

In ECC you can see the business implementation that calls the BADI in transaction SE19.

  • In the definition, SE18 you create an enhancement that is called from the application code
  • In the implementation, SE19  you save the code for the functions for the enhancement

How do you find a BADI:

Go to the transaction code you wish to check, for example MM02. Click on a field, select help, select technical details. (F1-F9), then double click on the program name.

  1. Search in the program for the string CL_EXITHANDLER you should find the string “CALL METHOD CL_EXITHANDLER=>GET_INSTANCE” where you will find the relevant BADI.
  2. Alternatively you can find out the BADI name by following this post: http://saptricks.com/2438/find-a-badi
3
Apr
SAP Tricks

EDI IDOC Tables

Requirement: You wish to investigate the contents of an IDoc. Or you need to locate a specific IDoc based upon a specific IDoc segment value.

Solution: The best solution is not to use tables, but instead to use the standard SAP transaction WE09. (The IDoc search for business content.) Here you can locate for example, all Sales Order IDocs that were for a specific product. (You search for a value (material) in a field (IDTNR) within a segment for example (E1EDP19) for a Basic Type for example (ORDERS05).

In some instances you may wish to use the tables in which case there are 3 main reference tables:

  • Control Record Table = EDIDC
  • Data Record Table = EDID4
  • Status Record Table = EDIDS
23
Nov
SAP Tricks

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.

21
Sep
SAP Tricks

How to Scan ABAP Sources for Specific Strings

It is simple to locate a string within a program but have you ever wondered how to find all programs where a specific ”string”, or line of text, or object name, is used.

There is a wonderful report which is I use to find ABAP programs related to specific search terms.

  • The Report name is – RPR_ABAP_SOURCE_SCAN 
  • You can execute it from transaction SA38 or SE38.

Some useful benefits of this report are:

You can limit the search range of the programs for example to your custom built developments only for example all programs starting with Y* or Z*.

Tip - Another similar program is RKCTSEAR.

23
Aug
SAP Tricks

ABAP Code Inspector

Do you need to easily check the performance of an ABAP program or do some analysis on its code?

 You can use the transaction SCI.

This is a very powerful transaction code, which can do more than a performance check.

However here is an example of one of the more simpler uses:

 From transaction SCI.

-Enter Person responsible

-Enter A name and version and select the “Create” Icon.

From the new screen

-Select the “Single” radio button

-From the drop down select “PROG Program”

-Enter the program/report you wish to analyse in the adjacent field.

-Under the check variant section enter “PERFORMANCE_CHECKLIST” (If this value does not work simply select the value from the F4 match-code selection list).

-Select Execute

From the next screen select the “Results” Icon (Shift + F6).

22
Jun
SAP Tricks

ABAP System Fields – Use of structure SYST

Often one needs to use the values of the system structure SYST. Here is an alphabetical list of the different fields followed by a few sentences on the usage of their values.

Alphabetical List

Name Type Length Use Description
ABCDE CHAR 26 Constants Alphabet (A,B,C,…)
APPLI RAW 2 Obsolete
BATCH CHAR 1 Background processing Program runs in the background
BATZD CHAR 1 Obsolete
BATZM CHAR 1 Obsolete
BATZO CHAR 1 Obsolete
BATZS CHAR 1 Obsolete
BATZW CHAR 1 Obsolete
BINPT CHAR 1 Batch input Program runs under batch input
BREP4 CHAR 4 Obsolete
BSPLD CHAR 1 Obsolete
CALLD CHAR 1 ABAP Program Call mode of ABAP program
CALLR CHAR 8 Printing Lists ID for print dialog function
CCURS DEC 9 Obsolete
CCURT DEC 9 Obsolete
CDATE DATS 8 Obsolete
CFWAE CUKY 5 Internal
CHWAE CUKY 5 Internal
COLNO INT4 10 Creating Lists Current column in the list
CPAGE INT4 10 List processing Current page number
CPROG CHAR 40 ABAP Program External procedure call
CTABL CHAR 4 Obsolete
CTYPE CHAR 1 Obsolete
CUCOL INT4 10 Screens Horizontal cursor position at PAI
CUROW INT4 10 Screens Vertical cursor position at PAI
DATAR CHAR 1 Screens Displays user input
DATLO DATS 8 Date and time Local date of user
DATUM DATS 8 Date and time Current (application server) date
DAYST CHAR 1 Date and time Daylight saving time flag
DBCNT INT4 10 Database accesses Number of processed table rows
DBNAM CHAR 20 ABAP Program Linked logical database
DBSYS CHAR 10 R/3 System Name of central database system
DCSYS CHAR 4 Obsolete
DEBUG CHAR 1 Internal
DSNAM CHAR 8 Internal
DYNGR CHAR 4 ABAP Program Screen group of current screen
DYNNR CHAR 4 ABAP Program Number of current screen
ENTRY CHAR 72 Internal
FDAYW INT1 3 Date and time Factory calendar weekday
FDPOS INT4 10 Character strings Offset in character strings
FFILE CHAR 8 Internal
FLENG INT4 10 Internal
FMKEY CHAR 3 Obsolete
FODEC INT4 10 Internal
FOLEN INT4 10 Internal
FTYPE CHAR 1 Internal
GROUP CHAR 1 Internal
HOST CHAR 8 R/3 System Name of application server
INDEX INT4 10 Loops Current loop pass
INPUT CHAR 1 Internal
LANGU LANG 1 R/3 System Current language
LDBPG CHAR 40 ABAP Program Program of logical database
LILLI INT4 10 List processing Selected list row
LINCT INT4 10 Creating Lists Page length of list
LINNO INT4 10 Creating Lists Current row
LINSZ INT4 10 Creating Lists Column width of list
LISEL CHAR 255 List processing Content of selected row
LISTI INT4 10 List processing Index of selected list
LOCDB CHAR 1 Obsolete
LOCOP CHAR 1 Obsolete
LOOPC INT4 10 Screens Number of rows visible in table
LPASS CHAR 4 Internal
LSIND INT4 10 List processing Index of detail list
LSTAT CHAR 16 List processing ID for list levels
MACDB CHAR 4 Obsolete
MACOL INT4 10 Printing Lists Columns from SET MARGIN statement
MANDT CLNT 3 R/3 System Client number from logon
MARKY CHAR 1 Obsolete
MAROW INT4 10 Printing Lists Rows from SET MARGIN statement
MODNO CHAR 1 R/3 System Index of external modes
MSGID CHAR 20 Messages Message class
MSGLI CHAR 60 Messages Message line
MSGNO NUMC 3 Messages Message number
MSGTY CHAR 1 Messages Message type
MSGV1 CHAR 50 Messages Message variable
MSGV2 CHAR 50 Messages Message variable
MSGV3 CHAR 50 Messages Message variable
MSGV4 CHAR 50 Messages Message variable
NEWPA CHAR 1 Internal
NRPAG CHAR 1 Internal
ONCOM CHAR 1 Internal
OPSYS CHAR 10 R/3 System Operating system of application server
PAART CHAR 16 Print parameters Print formatting
PAGCT INT4 10 Obsolete
PAGNO INT4 10 Creating Lists Current page:
PAUTH NUMC 2 Internal
PDEST CHAR 4 Print parameters Output device
PEXPI NUMC 1 Print parameters Retention period
PFKEY CHAR 20 Screens Current GUI status
PLAYO CHAR 5 Internal
PLAYP CHAR 1 Internal
PLIST CHAR 12 Print parameters Name of spool request
PNWPA CHAR 1 Internal
PRABT CHAR 12 Print parameters 

 

Part of cover sheet
PRBIG CHAR 1 Print parameters Selection cover page
PRCOP NUMC 3 Print parameters Number of copies
PRDSN CHAR 6 Print parameters Name of spool dataset
PREFX CHAR 3 Obsolete
PRI40 CHAR 1 Internal
PRIMM CHAR 1 Print parameters Print immediately
PRINI NUMC 1 Internal
PRLOG CHAR 1 Internal
PRNEW CHAR 1 Print parameters New spool request
PRREC CHAR 12 Print parameters Recipient
PRREL CHAR 1 Print parameters Delete after print
PRTXT CHAR 68 Print parameters Text for cover sheet
REPI2 CHAR 40 Internal
REPID CHAR 40 ABAP Program Current main program
RSTRT CHAR 1 Internal
RTITL CHAR 70 Print parameters Title of printing program
SAPRL CHAR 4 R/3 System Release status R/3 System
SCOLS INT4 10 Screens Number of columns
SFNAM CHAR 30 Obsolete
SFOFF INT4 10 Internal
SLSET CHAR 14 Selection screens Name of variant
SPONO NUMC 10 Printing Lists Spool number
SPONR NUMC 10 Obsolete
SROWS INT4 10 Screens Number of rows
STACO INT4 10 List processing First displayed column
STARO INT4 10 List processing Uppermost displayed row
STEPL INT4 10 Screens Index of current table row
SUBCS CHAR 1 Internal
SUBRC INT4 10 Return value Return value after ABAP statement
SUBTY RAW 1 Internal
SYSID CHAR 8 R/3 System Name of R/3 System
TABID CHAR 8 Internal
TABIX INT4 10 Internal Tables Current row index
TCODE CHAR 20 ABAP Program Current transaction code
TFDSN CHAR 8 Obsolete
TFILL INT4 10 Internal Tables Current number of rows
TIMLO TIMS 6 Date and time Local time of user
TITLE CHAR 70 Screens Text in header line
TLENG INT4 10 Internal Tables Row size
TLOPC INT4 10 Internal
TMAXL INT4 10 Obsolete
TNAME CHAR 30 Obsolete
TOCCU INT4 10 Obsolete
TPAGI INT4 10 Obsolete
TSTIS INT4 10 Internal
TTABC INT4 10 Obsolete
TTABI INT4 10 Obsolete
TVAR0 CHAR 20 Creating Lists Text variable for headers
TVAR1 CHAR 20 Creating Lists Text variable for headers
TVAR2 CHAR 20 Creating Lists Text variable for headers
TVAR3 CHAR 20 Creating Lists Text variable for headers
TVAR4 CHAR 20 Creating Lists Text variable for headers
TVAR5 CHAR 20 Creating Lists Text variable for headers
TVAR6 CHAR 20 Creating Lists Text variable for headers
TVAR7 CHAR 20 Creating Lists Text variable for headers
TVAR8 CHAR 20 Creating Lists Text variable for headers
TVAR9 CHAR 20 Creating Lists Text variable for headers
TZONE INT4 10 Date and time Time difference to Greenwich Mean Time
UCOMM CHAR 70 Screens Function code that triggered PAI
ULINE CHAR 255 Constants Horizontal line with length 255
UNAME CHAR 12 R/3 System Logon name of user
UZEIT TIMS 6 Date and time Current (application server) time
VLINE CHAR 1 Constants Vertical line
WAERS CUKY 5 Obsolete
WILLI INT4 10 Obsolete
WINCO INT4 10 Obsolete
WINDI INT4 10 Obsolete
WINRO INT4 10 Obsolete
WINSL CHAR 79 Obsolete
WINX1 INT4 10 Obsolete
WINX2 INT4 10 Obsolete
WINY1 INT4 10 Obsolete
WINY2 INT4 10 Obsolete
WTITL CHAR 1 Creating Lists Flag for standard page header
XCODE CHAR 70 Internal
XFORM CHAR 30 Internal
XPROG CHAR 40 Internal
ZONLO CHAR 6 Date and time Time zone of user

 

Thematic Overview

The following is a thematic summary of the system fields with notes on their use:

Read more »

2
May
SAP Tricks

Background Job Variants

You may know how to check the parameter values of a variant in SM37 by checking the variant name associated with the program being executed. But what do you do if the variant was created ad-hoc and has not been saved. That is it was a temporary variant with a name similar to SAP&0001.

You can see the values used in temporary variants by doing the following:

From the job overview within SM37:

  1. Select the Job that was run/is running.
  2. Select the “Step” button (Ctrl+Shift+F9)
  3. Select the program name.
  4. Then select the menu path Goto–>Variant

Also – A tip is changing the defaulted Job Overview screen Layout to add the “Executing server” to the display. Do this from within the Job Overview of SM37 by selecting (Ctrl+F7).

26
Apr
SAP Tricks

SM12 – Lock Entries Tips

If you check SM12 you may find some lock entries – this is not a problem. Locked entries are required in standard SAP processing. In most instances the entry will remain in SM12 for a few seconds milliseconds, however they could remain in SM12 for a lot longer depending on the logical unit of work.

Factors which can impact the entry in SM12:

  • Sizing and performance of the enqueue server.
  • Sizing and performance of the application server/number of available processing sessions. (indirectly related)
  • Program logic being executed on the application server.

What you may not know is that there is a hidden menu path for SM12 analysis. To activate this menu path you can do the following:

Run SM12, then enter OK code “test”. You will now see the top menu path has included a new Menu Option labelled “Error Handling”.

This menu option has many parameters and test functions which you can use to analyse the enqueue and dequeue processes.

If you require advice on how to use this new functionality you can refer to OSS note 5424 which is the SM12 FAQ! Success!

14
Feb
SAP Tricks

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.