Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

BAL Application Log

Former Member
0 Kudos

Hi experts ,

I am creating a module pool.

It is having 1st selection-screen .

Then based on selection i am displaying data in ALV.

Based on data in this ALV i have to perform certain operation such as copy/delete bom .

Before performing any operations , i m supposed to check the selected row .

If any errors are there then i have to store in BAL application log .

If i click on some button then i have to display Application Log .

Even if somebody changes records in ALV then i have to check it ( if errors exist then save to application log )

I dont want to save this log in database , only in memory .

Please help me , i am not aware of BAL application log .

Please let me know if any extra objects to be created in database .

Regards ,

Manoj .

1 ACCEPTED SOLUTION

Pawan_Kesari
Active Contributor
0 Kudos

Refer programs SBAL_DEMO* to understand the functionality of BAL Application

5 REPLIES 5

Pawan_Kesari
Active Contributor
0 Kudos

Refer programs SBAL_DEMO* to understand the functionality of BAL Application

Former Member
0 Kudos

Hi,

please check out the link below it might help you

http://help.sap.com/saphelp_nw04/helpdata/en/bb/6811f980ae11d3966f00a0c930660b/content.htm

http://help.sap.com/saphelp_nw04s/helpdata/en/d6/5d7f38f52f923ae10000009b38f8cf/frameset.htm

***************please reward points if the information is helpful to you***************

sharat_chandra
Advisor
Advisor
0 Kudos

Hi ,

Please refer to the programs in the package SZAL for application log usage. There are quite comprehensive scenarios described in the programs.

Regards,

Sharat

Former Member
0 Kudos

Hi,

try this

See BAL_LOG FMs,

Look at Dev class SBAL. Lots of examples

1. create a log instance using BAL_LOG_CREATE.

2. create an internal table it_messages which will have my error messages, loop through this and call BAL_LOG_MSG_ADD for each message

3. Then call BAL_DSP_LOG_DISPLAY.

Check out function module APPL_LOG_DISPLAY for showing the display (as in transaction SLG1).

BAL_FILTER_CREATE,

BAL_DB_SEARCH

<b>Reward points</b>

Regards

uwe_schieferstein
Active Contributor
0 Kudos

Hello Manoj

In order to create <i>application logs</i> and store them you require an (application) <b>object </b>and a <b>sub-object</b> (transaction <b>SLG0</b>). Please note that this is cross-client customizing.

Having defined your object and sub-object you can use the following sample coding in order to collect your messages and store them as application log.

For more details please refer to my posting <b>Message Handling - Finding the Needle in the Haystack</b> in the <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/wiki">Wiki</a>

*&---------------------------------------------------------------------*
*& Report  ZUS_SDN_MSG_HANDLER
*&
*&---------------------------------------------------------------------*
*& Message Handling using interface IF_RECA_MESSAGE_LIST
*&
*& For more details please refer to:
*& 
*&---------------------------------------------------------------------*

REPORT  zus_sdn_msg_handler.




DATA:
  gs_msg          TYPE recamsg,
  go_msglist      TYPE REF TO if_reca_message_list.


" Macro for adding freely defined messages (<> SYST messages)
DEFINE mac_build_msg.
  clear: gs_msg.
  gs_msg-msgty = &5.
  gs_msg-msgid = '00'.
  gs_msg-msgno = '398'.
  gs_msg-msgv1 = &1.
  gs_msg-msgv2 = &2.
  gs_msg-msgv3 = &3.
  gs_msg-msgv4 = &4.
  gs_msg-detlevel = &6.

  go_msglist->add( is_message = gs_msg ).
END-OF-DEFINITION.



PARAMETERS:
  p_opt1   RADIOBUTTON GROUP radi DEFAULT 'X',
  p_opt2   RADIOBUTTON GROUP radi,
  p_opt3   RADIOBUTTON GROUP radi.


START-OF-SELECTION.

  " Create message handler
  CALL METHOD cf_reca_message_list=>create
*    EXPORTING
*      ID_OBJECT    = 'RECA'   " <= set your object here     (SLG0)
*      ID_SUBOBJECT = 'MISC'   " <= set your sub-object here (SLG0)
*      ID_EXTNUMBER =          " <= set your own external number
    RECEIVING
      ro_instance  = go_msglist.


  " ...Here starts your checking procedures
  mac_build_msg 'Application Log'
                 syst-uname syst-datum syst-uzeit 'I' '1'.

  mac_build_msg 'Check changes in row'
                 '1' space space 'I' '2'.  " 2nd hierarchy level

  mac_build_msg 'Value xyz removed'
                 '->' 'ok' space 'I' '3'.  " 3rd hierarchy level

  mac_build_msg 'Value abc changed'
                 '->' 'not ok' space 'E' '3'.

  mac_build_msg 'Value 123 modified'
                 '->' 'check' space 'W' '3'.

  mac_build_msg 'Check changes in row'
                 '2' space space 'I' '2'.


  PERFORM display_log.

  EXIT.
  CALL METHOD go_msglist->set_extnumber
    EXPORTING
      id_extnumber = '<your own external identifier'.

  CALL METHOD go_msglist->store
*    EXPORTING
*      IF_IN_UPDATE_TASK = ABAP_TRUE
*    EXCEPTIONS
*      ERROR             = 1
*      others            = 2
          .
  IF sy-subrc <> 0.
*   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.


END-OF-SELECTION.


*&---------------------------------------------------------------------*
*&      Form  DISPLAY_LOG
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
FORM display_log .
* define local data
  DATA:
    ld_handle           TYPE balloghndl,
    lt_log_handles      TYPE bal_t_logh,
    ls_profile          TYPE bal_s_prof.


  " Get log handle of collected message list
  ld_handle = go_msglist->get_handle( ).
  APPEND ld_handle TO lt_log_handles.


  IF ( p_opt1 = 'X' ).
    " GET a display profile which describes how to display messages
    CALL FUNCTION 'BAL_DSP_PROFILE_DETLEVEL_GET'
      IMPORTING
        e_s_display_profile = ls_profile.  " tree & ALV list

  ELSEIF ( p_opt2 = 'X' ).
    " GET standard profile to display one log
    CALL FUNCTION 'BAL_DSP_PROFILE_SINGLE_LOG_GET'
      IMPORTING
        e_s_display_profile = ls_profile.

  ELSE.  " p_opt3 = 'X'.
    CALL FUNCTION 'BAL_DSP_PROFILE_NO_TREE_GET'
      IMPORTING
        e_s_display_profile = ls_profile.
  ENDIF.


* set report to allow saving of variants
  ls_profile-disvariant-report = sy-repid.
*   when you use also other ALV lists in your report,
*   please specify a handle to distinguish between the display
*   variants of these different lists, e.g:
  ls_profile-disvariant-handle = 'LOG'.


  CALL FUNCTION 'BAL_DSP_LOG_DISPLAY'
    EXPORTING
      i_s_display_profile  = ls_profile
      i_t_log_handle       = lt_log_handles
    EXCEPTIONS
      profile_inconsistent = 1
      internal_error       = 2
      no_data_available    = 3
      no_authority         = 4
      OTHERS               = 5.
  IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.

ENDFORM.                    " DISPLAY_LOG

Regards

Uwe