Ansicht
Dokumentation

BAL_CH_CALLBACK -

BAL_CH_CALLBACK -

ROGBILLS - Synchronize billing plans   PERFORM Short Reference  
This documentation is copyright by SAP AG.
SAP E-Book

|---------------------------------------------------------------------|
| Application Log Callback Routine Overview |
|---------------------------------------------------------------------|


======================================================================

The following information is listed:

  • Purpose and Event
    What does the callback routine do and when is it called?
  • Definition
    How is the callback routine set?
  • Parameters
  • ==>Note

An Application Log callback routine can be realized in two ways:
as a FORM routine or as a function module
The following fields must be specified to setup a callback routine:
USEREXITT: Routine type (' ' = FORM, 'F' = function module)
USEREXITP: Program containing the routine (only for FORM)
USEREXITF: Routine name (form routine or function module name)
A function module must be parameterized like a form routine (USING is replaced by IMPORTING). The same parameter names must be used.

Example program and template
SBAL_CALLBACK
==>SBAL_CALLBACK ==>SBAL_CALLBACK Coding

BAL_CALLBACK_DISPLAY
======================================================================

Purpose and event
You can specify the appearance of a message when it is created.
For example, all messages (or some) are in an amodal window, to provide constant information about the progress of the program (this is not yet possible).

Definition
In the I_S_CONFIGURATION parameter of the function module BAL_GLB_CONFIG_SET in the I_S_CONFIGURATION-DISPLAY-CALLBACK field.

Parameterization
FORM bal_callback_display
       USING
         i_s_msg TYPE bal_s_msg.
...
ENDFORM.

Example program
The program SBAL_CALLBACK is an example and template.
You can e.g. select BAL_CALLBACK_DISPLAY in the selection screen of this program. You go to the debugger if:
- this callback routine is defined
- this callback routine is processed
You can also search for the string "BAL_CALLBACK_DISPLAY" in the program coding.

BAL_CALLBACK_DETAIL_LOG
======================================================================

Purpose and event
This callback routine can display user log header detail information. It is called when the cursor is positioned on a log header row and ‘Detail’ is chosen, in the log display.

Definition
The callback routine is set for each log header when a log is created by BAL_LOG_CREATE. The I_S_LOG-PARAMS-CALLBACK field must be set in the transfer structure I_S_LOG (structure BAL_S_LOG).

Parameterization
FORM bal_callback_detail_log
       TABLES
         i_t_params  STRUCTURE spar.
...
ENDFORM.

The internal table I_t_params contains the fields:
PARAM,,(CHAR10),,Parameter name
VALUE,,(CHAR75),,Parameter contents.
I_t_params contains the parameters created under BAL_S_LOG-PARAMS-T_PAR for a log.
The table also contains the log number under the name '%LOGNUMBER'.

If this information is insufficient, you can get the data which describes the currently selected objects in the log display, with the function module BAL_DSP_USER_COMMAND_DATA_GET.
This data includes the handle of the current log (E_S_USER_COMMAND_DATA-TREE_LOGH).
You can use this value to get more log data (e.g. with the function module BAL_LOG_HDR_READ).

Example program
The program SBAL_CALLBACK is an example and template.
You can e.g. select BAL_CALLBACK_DETAIL_LOG in the selection screen of this program. You go to the debugger if:
- this callback routine is defined
- this callback routine is processed
You can also search for the string "BAL_CALLBACK_DETAIL_LOG" in the program coding.

BAL_CALLBACK_DETAIL_MSG
======================================================================

Purpose and event
This callback routine can display user message detail information. It is called when the cursor is positioned on a message row and ‘Detail’ is chosen, or the detail icon next to the message is chosen.

Definition
The callback routine is set for each message when it is sent by BAL_LOG_MSG_ADD. The I_S_MSG-PARAMS-CALLBACK field must be set in the importing parameter I_S_MSG (structure BAL_S_MSG).

Parameterization
FORM bal_callback_detail_msg
       TABLES
         i_t_params  STRUCTURE spar.
...
ENDFORM.

The internal table I_t_params contains the fields:
PARAM,,(CHAR10),,Parameter name
VALUE,,(CHAR75),,Parameter contents.
I_t_params contains the parameters created under BAL_S_MSG-PARAMS-T_PAR for a message (e.g. using BAL_LOG_MSG_ADD).
The table also contains the log number under the name '%LOGNUMBER', and the four message variables ('V1' to 'V4').

If this information is insufficient, you can get the data which describes the currently selected objects in the log display, with the function module BAL_DSP_USER_COMMAND_DATA_GET.
This data includes the handle of the current message (E_S_USER_COMMAND_DATA-LIST_MSGH).
You can use this value to get more log data (e.g. with the function module BAL_LOG_MSG_READ).

Example program
The program SBAL_CALLBACK is an example and template.
You can e.g. select BAL_CALLBACK_DETAIL_MSG in the selection screen of this program. You go to the debugger if:
- this callback routine is defined
- this callback routine is processed
You can also search for the string "BAL_CALLBACK_DETAIL_MSG" in the program coding.

BAL_CALLBACK_READ
======================================================================

Purpose and event
This callback routine reads log display data, e.g. material short text. The routine is called for each message and field defined as external in the field catalog. Read the data buffered to avoid performance problems. You cannot prefetch or read the table of data to be read in one go because it is dynamic.

Definition
The display profile I_S_DISPLAY_PROFILE (structure BAL_S_PROF) is passed in the log display (e.g. called with BAL_DSP_LOG_DISPLAY). The callback routine is defined in the field I_S_DISPLAY_PROFILE-CLBK_READ. It is called for all fields which have the attribute IS_EXTERN = ‘X’ in the field catalogs LEV1_FCAT, ..., LEV9_FCAT or MESS_FCAT.

Parameterization
FORM bal_callback_read
       USING
         i_s_info            TYPE bal_s_cbrd
       CHANGING
         c_display_data      TYPE bal_s_show
         c_context_header    TYPE bal_s_cont
         c_context_message   TYPE bal_s_cont
         c_field             TYPE any.
...
ENDFORM.
The structure i_s_info specifies the field for which the callback routine was called (REF_TABLE and REF_FIELD). Put the contents of the field in c_field.

You need the other message data (e.g. material number to get material short text ), to fill c_field.
It is in c_display_data (contains displayable message and log header data), c_context_header (log header context) and c_context_message (message context).

==>Note
This CALLBACK routine is called at two events, which of them is in the field I_S_INFO-IS_MESSAGE:
1. I_S_INFO-IS_MESSAGE = ' ' ==> at tree creation
2. I_S_INFO-IS_MESSAGE = 'X' ==> when creating message list

The events are (normally) chronologically distinct: the tree is created when the log display appears, the message list when the user selects a set of messages in the tree.

This fact is used to optimize performance: only those fields in the structure c_display_data are filled which are needed at this event.

  • ==>Example
    When the tree is created, you do not need the message text. This would waste time. The message text is fetched when the user has selected e.g. 100 of perhaps 1.000 messages from the tree.

This affects the data in the structure c_display_data:
_S_INFO-IS_MESSAGE = ' '
When called from the tree, only those fields in c_display_data are sure to be filled which are in the field catalogs LEV1_FCAT to LEV9_FCAT.
I_S_INFO-IS_MESSAGE = 'X'
When called for the list, only those fields in c_display_data are sure to be filled which are in MESS_FCAT.

Bear this in mind when you use this callback routine.

Example program
The program SBAL_CALLBACK is an example and template.
You can e.g. select BAL_CALLBACK_READ in the selection screen of this program. You go to the debugger if:
- this callback routine is defined
- this callback routine is processed
You can also search for the string "BAL_CALLBACK_READ" in the program coding.

BAL_CALLBACK_PBO
======================================================================

Purpose and event
This routine sets a user log display menu to integrate other application-specific elements in the log display. It is called at log display PBO.

Definition
In the Display profile CLBK_PBO field.

Parameterization
FORM bal_callback_pbo
       USING
         i_t_extab TYPE slis_t_extab.
...
ENDFORM.

I_t_extab contains the inactive Fcodes. Pass this table if you want to setup a user menu in this routine:
SET PF-STATUS 'MY_STATUS' EXCLUDING i_t_extab.

==>Note
You normally create a user menu by copying and modifying an Application Log menu. This has the disadvantage that you are cutoff from future Application Log standard menu changes.
If you only want to put some pushbuttons in the log display, use the component EXT_PUSH1 bis EXT_PUSH4 in the Display profile.

Example program
The program SBAL_CALLBACK is an example and template.
You can e.g. select BAL_CALLBACK_PBO in the selection screen of this program. You go to the debugger if:
- this callback routine is defined
- this callback routine is processed
You can also search for the string "BAL_CALLBACK_PBO" in the program coding.

BAL_CALLBACK_TOOLBAR
======================================================================

Purpose and time
If you display with ALV Grid Control (parameter USE_GRID = 'X' in display profil), you can modify the toolbar above the ALV grid with this routine.
You can put additional application-specific elements in the log display.
This routine is called when:

  • the toolbar is created
  • a button with sub-items is selected in the toolbar.

Definition
In display profile, field CLBK_TOOLB.

Parameterization
FORM bal_callback_toolbar
       USING
         c_s_toolbar_info TYPE bal_s_tbi

* when toolbar is filled, the whole toolbar can be modified:
  IF NOT c_t_toolbar_info-toolbar IS INITIAL.
*   add a simple button
    CLEAR l_s_toolbar.
    l_s_toolbar-butn_type = 0.         "normal button
    l_s_toolbar-function  = 'MY_BUTTON'.
    l_s_toolbar-icon      = icon_ws_rail.
    l_s_toolbar-quickinfo = 'New button'(nbt).
    INSERT l_s_toolbar INTO c_t_toolbar_info-toolbar->mt_toolbar
                       INDEX 2.
*   add a button with submenu
    CLEAR l_s_toolbar.
    l_s_toolbar-butn_type = 1.         "button with submenu
    l_s_toolbar-function  = 'MY_MENU'.
    l_s_toolbar-icon      = icon_ws_ship.
    l_s_toolbar-quickinfo = 'New menu'(nmn).
    INSERT l_s_toolbar INTO c_t_toolbar_info-toolbar->mt_toolbar
                       INDEX 3.
  ENDIF.

* when menu is filled, we can add entries to submenu:
  IF NOT c_t_toolbar_info-menu IS INITIAL.
    IF c_t_toolbar_info-ucomm = 'MY_MENU'.
      CALL METHOD c_t_toolbar_info-menu->add_function
                  EXPORTING fcode   = 'MY_SUBMENU_1'
                            text    = text-ms1.
      CALL METHOD c_t_toolbar_info-menu->add_function
                  EXPORTING fcode   = 'MY_SUBMENU_2'
                            text    = text-ms2.
    ENDIF.
  ENDIF.

ENDFORM.

BAL_CALLBACK_UCOMM, BAL_CALLBACK_BEFORE_UCOMM, BAL_CALLBACK_AFTER_UCOMM
======================================================================

Purpose and event
o BAL_CALLBACK_UCOMM is called when a non-Application Log command is issued at PAI.
o BAL_CALLBACK_BEFORE_UCOMM is called for such commands and before performing some standard commands.
o BAL_CALLBACK_AFTER_UCOMM: is called for such commands and after performing some standard commands.

..._BEFORE_... and ..._AFTER_... are performed for the following standard commands:
o %LONGTEXT,,,,Long text
o %DETAIL,,,,Detailed message/log header information
o %TECHDET,,,,Message/log header technical details
o &IC1,,,,,,Double-click on message or tree element
o %EXT_PUSH1,,Externally-defined pushbutton 1
o %EXT_PUSH2,,Externally-defined pushbutton 2
o %EXT_PUSH3,,Externally-defined pushbutton 3
o %EXT_PUSH4,,Externally-defined pushbutton 4

Definition
o BAL_CALLBACK_UCOMM: in the Display profile, field CLBK_UCOM
o BAL_CALLBACK_BEFORE_UCOMM: in the display profile, field CLBK_UCBF
o BAL_CALLBACK_AFTER_UCOMM: in the display profile, field CLBK_UCAF

Parameterization
FORM bal_callback_ucomm
       CHANGING
         c_s_user_command_data TYPE bal_s_cbuc.
...
ENDFORM.

Example program
The program SBAL_CALLBACK is an example and template.
You can e.g. select BAL_CALLBACK_UCOMM in the selection screen of this program. You go to the debugger if:
- this callback routine is defined
- this callback routine is processed
You can also search for the string "BAL_CALLBACK_UCOMM" in the program coding.

Analogously for the other two CALLBACKs.

Data in the callback routines
======================================================================

BAL_S_CBUC parameterizes callback routines which are called by pressing a button in the Application Log log display.

The structure contains current display status information (what has been selected, the cursor position, etc.), and some fields which can be changed in the callback routine (refresh or end display)

The fields are:

  • General fields
  • UCOMM
    Fcode selected

  • Fields which can be changed in the callback routine
  • UCOMM_EXEC
    'X': command successfully processed.
    ' ': command not processed.
    UCOMM_EXEC can be used when BAL_CALLBACK_CBBF is used and you want to react to a standard command here and not perform the standard.
    CALLBACK_AFTER_UCOMM is always called whether a command was processed or not.

  • EXIT
    Leave log display.

  • REFRESH
    Refresh log display.
    This can be useful when the underlying messages in the memory have changed (e.g. by BAL_LOG_MSG_CHANGE) or been deleted (BAL_LOG_MSG_DELETE).
    The refresh displays the messages which satisfy the filter criteria specified in the original call (e.g. all messages in a log => new messages will now also be displayed ).
    You can display a different set of messages (e.g. another log) with the function module BAL_DSP_OUTPUT_SET_DATA (the REFRESH flag should not be setz or the display will be constructed twice).
    Caution: Refresh gets all message data (e.g. their texts) again, so it takes as long as the original display and should be used sparingly for large numbers of messages.

  • MARKS_DEL
    Delete message selections. This flag is only meaningful if the message selection option (I_S_DISPLAY_PROFILE-MESS_MARK = 'X') was chosen in the log display.

  • MSGTY, MSGID, MSGNO, MSGV1, MSGV2, MSGV3, MSGV4
    Message to be output. This can be useful for example to tell the user to select a message for this function.
    Messages (e.g: 'Select a message') are not normally output directly in Application Log processing routines, they are put in the structure c_s_user_command_data, because other processing routines can overwrite them.

  • Navigation tree information
  • TREE_CLICK
    The user double-clicked on the tree.

  • TREE_LEVEL
    Tree level selected

  • TREE_TABLE, TREE_FIELD, TREE_VALUE
    Table name, field name and field contents selected (if only one field was selected)

  • TREE_SELF
    Table selected with field names and contents selected (if several fields were selected, e.g. 'User/Date/Time').

  • TREE_LOGH
    Handle of log selected in the tree (if one log was selected). This is e.g. the case if one log was selected in the standard log display (transaction SLG1) at the highest tree level.

  • TREE_MSGH
    Handle of the message selected in the tree.
    This field is only filled if messages are displayed in the tree.
    This is the case if the display was called with I_S_DISPLAY_PROFILE-BYDETLEVEL = 'X', e.g. with the standard profile from function module BAL_DSP_PROFILE_DETLEVEL_GET.

  • Message list information
  • LIST_MSGH
    Message selected in the list (by positioning the cursor)

  • LIST_TMSGH
    Set of messages selected.
    This field is only filled if the select several messages option (I_S_DISPLAY_PROFILE-MESS_MARK = 'X') was chosen in the display profile.

  • LIST_TABLE, LIST_FIELD, LIST_VALUE
    Table name, field name and field contents selected in the display.

  • Internal fields
  • LIST_SEL, LIST_COL, LIST_ROW, LIST_TABIX, TREE_NODE, TREE_ITEM, LIST_REFR

CALLBACK_DB_DELETE
======================================================================

Purpose and event
This routine is called when logs are deleted from the database.
It can delete data which you put in your own database tables for the log (e.g. index tables).

Definition
The definition is a little unusual in that the callback routine can only be a function module which obeys the naming convention:
If ABC is the name of the Application Log object defined in the transaction SLG0, the function module BAL_DBDEL_ABC is called when a log which has the object ABC in its log header is deleted in the database. The subobject is not relevant.

Parameterization
FUNCTION BAL_DBDEL_...
*"----------------------------------------------------------------
*"*"Local interface:
*"       IMPORTING
*"             REFERENCE(I_T_LOGS_TO_DELETE)   TYPE  BALHDR_T
*"             REFERENCE(I_IN_UPDATE_TASK)     TYPE  BOOLEAN
*"----------------------------------------------------------------
...
ENDFUNCTION.

I_T_LOGS_TO_DELETE is the table of log headers to be deleted
If I_IN_UPDATE_TASK = 'X' the deletion is performed in the update task






CL_GUI_FRONTEND_SERVICES - Frontend Services   Vendor Master (General Section)  
This documentation is copyright by SAP AG.

Length: 26759 Date: 20240510 Time: 202936     sap01-206 ( 230 ms )