Application Development and Automation 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: 
Read only

activate window controls for 'BAL_CNTL_CREATE'

Former Member
0 Likes
603

I have coded a solution to do my own logging/display logs from a custom report within transaction MPD.

the logging part works and my 'on button click' calls the logs and displays the messages using BAL_CNTL_CREATE.

however the pop up window i get, i do not get the to use the "window" control to close the popup...

i am sure i have missed off a parameter, but not having done this before, i am unsure which parameter controls the pop up window.

if i exit out of the transaction the window closes, however i want to be able to close the window and click another button to display my log....

my code so far:


*       create dialogbox container
  CREATE OBJECT g_container
    EXPORTING
      width  = 650
      height = 100
      top    = 150
      left   = 500
    EXCEPTIONS
      OTHERS = 1.
  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.

*       create a new log header
  CLEAR g_s_log.
  g_s_log-extnumber = 'CONSISTENCY LOG'.
  CALL FUNCTION 'BAL_LOG_CREATE'
    EXPORTING
      i_s_log      = g_s_log
    IMPORTING
      e_log_handle = g_log_handle
    EXCEPTIONS
      OTHERS       = 1.
  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.

*       add some messages
  LOOP AT output_message INTO ls_message.
    CLEAR g_s_msg.
    g_s_msg-msgty = ls_message-msgty.
    g_s_msg-msgid = ls_message-msgid.
    g_s_msg-msgno = ls_message-msgno.
    CALL FUNCTION 'BAL_LOG_MSG_ADD'
      EXPORTING
        i_log_handle = g_log_handle
        i_s_msg      = g_s_msg
      EXCEPTIONS
        OTHERS       = 1.
    IF sy-subrc <> 0.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
  ENDLOOP.

*       get a display profile which describes how to display messages
  CALL FUNCTION 'BAL_DSP_PROFILE_NO_TREE_GET'
    IMPORTING
      e_s_display_profile = g_s_display_profile.

  g_s_display_profile-title     = 'Display Logs'.
  g_s_display_profile-pop_adjst = 'X'.

*       define amount of data to be displayed
  INSERT g_log_handle INTO TABLE g_t_log_handle.

*       create control to display data
  CALL FUNCTION 'BAL_CNTL_CREATE'
    EXPORTING
      i_container         = g_container
      i_s_display_profile = g_s_display_profile
      i_t_log_handle      = g_t_log_handle
    IMPORTING
      e_control_handle    = g_control_handle
    EXCEPTIONS
      OTHERS              = 1.
  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.

I have coded a solution to do my own logging/display logs from a custom report within transaction MPD.

the logging part works and my 'on button click' calls the logs and displays the messages using BAL_CNTL_CREATE.

however the pop up window i get, i do not get the to use the "window" control to close the popup...

i am sure i have missed off a parameter, but not having done this before, i am unsure which parameter controls the pop up window.

if i exit out of the transaction the window closes, however i want to be able to close the window and click another button to display my log....

my code so far:


*       create dialogbox container
  CREATE OBJECT g_container
    EXPORTING
      width  = 650
      height = 100
      top    = 150
      left   = 500
    EXCEPTIONS
      OTHERS = 1.
  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.

*       create a new log header
  CLEAR g_s_log.
  g_s_log-extnumber = 'CONSISTENCY LOG'.
  CALL FUNCTION 'BAL_LOG_CREATE'
    EXPORTING
      i_s_log      = g_s_log
    IMPORTING
      e_log_handle = g_log_handle
    EXCEPTIONS
      OTHERS       = 1.
  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.

*       add some messages
  LOOP AT output_message INTO ls_message.
    CLEAR g_s_msg.
    g_s_msg-msgty = ls_message-msgty.
    g_s_msg-msgid = ls_message-msgid.
    g_s_msg-msgno = ls_message-msgno.
    CALL FUNCTION 'BAL_LOG_MSG_ADD'
      EXPORTING
        i_log_handle = g_log_handle
        i_s_msg      = g_s_msg
      EXCEPTIONS
        OTHERS       = 1.
    IF sy-subrc <> 0.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
  ENDLOOP.

*       get a display profile which describes how to display messages
  CALL FUNCTION 'BAL_DSP_PROFILE_NO_TREE_GET'
    IMPORTING
      e_s_display_profile = g_s_display_profile.

  g_s_display_profile-title     = 'Display Logs'.
  g_s_display_profile-pop_adjst = 'X'.

*       define amount of data to be displayed
  INSERT g_log_handle INTO TABLE g_t_log_handle.

*       create control to display data
  CALL FUNCTION 'BAL_CNTL_CREATE'
    EXPORTING
      i_container         = g_container
      i_s_display_profile = g_s_display_profile
      i_t_log_handle      = g_t_log_handle
    IMPORTING
      e_control_handle    = g_control_handle
    EXCEPTIONS
      OTHERS              = 1.
  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.

1 REPLY 1
Read only

Former Member
0 Likes
450

added this code to my method above:


SET HANDLER on_dialogbox_close FOR g_container.

and created a new method:


METHOD on_dialogbox_close.

  CALL METHOD sender->free
    EXCEPTIONS
      cntl_error        = 1
      cntl_system_error = 2
      OTHERS            = 3.
  IF sy-subrc <> 0.

  ENDIF.

all working for me!

ENDMETHOD.