Procedure documentationLog Display

 

Function module

Use

BAL_DSP_LOG_DISPLAY

Display messages in memory

Types

Use

BAL_S_PROF

Display profile

BAL_S_LFIL

Log header data filter criteria

BAL_S_MFIL

Message data filter criteria

BAL_T_CFIL

Context data filter criteria

BAL_T_LOGH

Log handle table

BAL_T_MSGH

Message handle table

Procedure

Which information can be displayed?

You could imagine the set of messages in memory as an extremely wide table with a large number of fields (the data is not saved in this form in memory). The possible fields in this table are:

  • Message line (MSGTY, MSGID, MSGNO, MSGV1, EXCLS, etc.)

  • Message attributes (PROBCLASS, DETLEVEL, etc.)

  • Message context fields

  • Message texts

    1. formatted message line

    2. Field long texts ("Very serious" for problem class 1, etc.)

  • Data of the log header to which this message belongs:

    1. Log header data (EXTNUMBER, USER, DATUM, etc.)

    2. Log header context fields

    3. Log header texts (field long texts)

  • External data, e.g. material short text, added by user in a callback routine

The displayable fields are listed in the structure BAL_S_SHOW. This structure does not contain the context fields or the external data which Application Log cannot know a priori.

How is the data formatted?

This large dataset must be presented appropriately to the user. The data formatting can be controlled by specifying a profile. This profile is a caller-defined complex data type (structure BAL_S_PROF) which is passed to the output module BAL_DSP_LOG_DISPLAY, not an end-user-defined display variant.

The format is based on certain assumptions:

  • The messages are displayed in a list. The list contains a subset of the displayed fields. This subset can be specified in a field catalog in the display profile BAL_S_PROF (as in ABAP List Viewer).

  • Detail information can be called for each message:

    1. Message long text

    2. Eetended long text or CALLBACK routine

    3. Technical information about a message (message type, work area, message number, etc.)

  • You can search for and filter the message set with ABAP List Viewer functions. You can also conveniently restrict the dataset by message type (A, E; W; I/S) in the list header. You can show or hide the I and S messages by clicking on an icon.

  • You can add a hierarchy tree for navigation in what can be a long and confusing list. The tree provides a table of contents for the message set. You can display the messages in a chapter in the list by clicking on a node or pushbutton. You can specify the tree structure in the display profile.

Function module BAL_DSP_LOG_DISPLAY

The transaction SLG1 displays database Application Logs in a standard format. It displays the logs in a standard form.

The log display must often be different, depending on the application, and you may need to display logs which have not been saved.

Assume that a set of logs containing messages, which were either collected or loaded from the database (BAL_DB_LOAD), is in memory.

The data can be displayed by calling the function module BAL_DSP_LOG_DISPLAY. It is a display generator which you tell:

  • I_S_LOG_FILTER to I_T_MSG_HANDLE what is to be displayed (filter criteria BAL_TP_FILTERS)

  • I_S_DISPLAY_PROFILE how the data is to be displayed (display profile BAL_S_PROF)

  • I_AMODAL whether to display in a new session.

Note Note

If you display in a new session, you lose control of the program. You cannot refresh the log display.

End of the note.

Example Example

Program SBAL_DEMO_04 demonstrates several log display possibilities.

End of the example.
What is to be displayed?

The data set to display is specified in the importing parameters:

  • Log filter criteria

    1. I_S_LOG_FILTER: Log header field ranges

    2. I_S_LOG_CONTEXT_FILTER: Log header context field ranges

    3. I_T_LOG_HANDLE: Log handle table

  • Message filter criteria

    1. I_S_MSG_FILTER: Message field ranges

    2. I_S_MSG_CONTEXT_FILTER: Message context field ranges

    3. I_T_MSG_HANDLE: Message handle table

The filters are the same data types as are used to search for messages and logs. If filtering is not sufficient, you can specify the set of data to be displayed by a set of log and message handles which you selected by criteria.

If you specify several parameters, they are linked by a logical AND. Only those messages are displayed which satisfy all conditions. If none of these parameters are specified, all messages in memory are displayed.

How is the data to be displayed?

The display profile (structure BAL_S_PROF) specifies how the log is to appear. It contains the field catalog, which describes which fields are in the list and in the various chapter levels of the navigation tree.

Application Log provides display profiles which you can get with function modules (starting with BAL_DSP_PROFILE_...). You can also create your own display profiles. If no display profile is specified, the standard display profile of transaction SLG1 is chosen.

The most important display profile fields (all fields except MESS_FCAT are optional) are:

General Parameters

Field

Use

TITLE

Screen title

MESS_FCAT

Message list field catalog. This field catalog contains the table name and field name (REF_TABLE, REF_FIELD) and e.g. the column in which the field is to appear (COL_POS) and its length (OUTPUTLEN).

MESS_SORT

Message sort sequence table. Contains table and field name, serial number and sort ascending or descending flag. Fields mentioned here must have been previously mentioned in MESS_FCAT.

Navigation tree parameters

Field

Use

LEV1_FCAT, ..., LEV9_FCAT

You can create a navigation tree next to (or above) the message list. This tree sorts the message set by specified criteria (e.g. document and item number). You must specify the sort criteria in the field catalogs for navigation tree levels 1 to maximum 9 (e.g. document number for level 1 and item number for level 2). Several fields can be combined into one sort criterion at one level (e.g. shipping point/loading point at level 1), so you can specify a field catalog and not just one field for each level. The field catalog has the same structure as MESS_FCAT.

LEV1_SORT, ..., LEV9_SORT

Chapter level sort sequence table.

Callback routines

You can use callback routines (FORM routines or function modules) at certain events in the log display. The events are:

Field

Use

CLBK_READ

Read external display data (e.g. material short text)

CLBK_UCOM

Read external display data (e.g. material short text)

CLBK_UCOM

Perform user commands

CLBK_UCBF

Called before performing a user command

CLBK_UCAF

Called after performing a user command

CLBK_PBO

Display PBO (e.g. to set a user status)

User pushbuttons

Field

Use

EXT_PUSH1, ..., EXT_PUSH4

These components put user pushbuttons in the menu, without having to define a GUI status. When you choose a User command at PAI, "%EXT_PUSH1", ..., "%EXT_PUSH4", to which you can react in a callback routine (see CLBK_UCOM), is called.