SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

Журнал приложений: различные виды сбора сообщений



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Programming Techniques | Приемы программирования -> Arch & Logs
View previous topic :: View next topic  
Author Message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1636

PostPosted: Sat Apr 12, 2008 12:57 pm    Post subject: Журнал приложений: различные виды сбора сообщений Reply with quote

Code:
REPORT sbal_demo_02 .
***********************************************************************
***********************************************************************
*                   REPORT SBAL_DEMO_02
*
* This report shows a some examples how messages can be sent to the
* application log.
* For this purpose this reports simulates the check of a flight
* (specified by carrier, connection ID and flight date).

* A log is created with BAL_LOG_CREATE (see FORM log_create).
*
* Messages are sent to the application log with different information
* and different function modules:
*  - a simple T100-message with some attributes (like problem class)
*        (function module BAL_LOG_MSG_ADD,
*         see form msg_add)
*  - a message with an extended longtext
*        (function module BAL_LOG_MSG_ADD,
*         see FORM msg_add_with_extended_longtext)
*  - a message with application specific data ( = context)
*        (function module BAL_LOG_MSG_ADD,
*         see FORM msg_add_with_context)
*  - a message with a self-defined callback routine
*        (function module BAL_LOG_MSG_ADD,
*         see FORM msg_add_with_callback)
*  - the last message sent to the application log
*    is replaced by another
*        (function module BAL_LOG_MSG_REPLACE
*         see FORM msg_replace)
*  - for all following messages defaults are set;
*    in this case context information
*        (function module BAL_GLB_MSG_DEFAULTS_GET
*                     and BAL_GLB_MSG_DEFAULTS_SET
*         see FORM passenger_check)
*  - a certain message which occurs very often is only cumulated,
*    not added
*        (function module BAL_LOG_MSG_CUMULATE
*         see FORM msg_cumulate)
*
* Finally the log is displayed with BAL_DSP_LOG_DISPLAY.
* Here the output profile is slightly modified to make
* the passenger id appear on the list of messages
* (see FORM log_display)
*
***********************************************************************
***********************************************************************


***********************************************************************
******************** SELECTION SCREEN *********************************
***********************************************************************
SELECTION-SCREEN BEGIN OF BLOCK B01 WITH FRAME TITLE text-001.
PARAMETERS:
  p_carrid TYPE bal_carrid DEFAULT 'SF',
  p_connid TYPE bal_connid DEFAULT '0003',
  p_fldate TYPE bal_fldate DEFAULT sy-datum.
SELECTION-SCREEN END OF BLOCK B01.


***********************************************************************
******************** CONSTANTS, TYPES, DATA ***************************
***********************************************************************
SET EXTENDED CHECK OFF.
INCLUDE sbal_constants.
SET EXTENDED CHECK ON.
DATA:
  g_retcode   TYPE i,
  g_passenger TYPE bal_custmr,
  g_dummy     TYPE c.                  "#EC NEEDED


***********************************************************************
******************** MAIN PROGRAM *************************************
***********************************************************************
END-OF-SELECTION.

****************************************************************
* create a log where all message should be added to
****************************************************************
  PERFORM log_create.

***********************************************************************
* Add information that this is a check for passenger flights
***********************************************************************
* this informnation can be added as a free text
  PERFORM msg_add_free_text USING text-002.


****************************************************************
* do something to check if there are too many passengers
****************************************************************
* ... result is negative:
* 302(BL): 'Flight is overbooked'
  MESSAGE e302(bl) INTO g_dummy.
* add a simple message to log
  PERFORM msg_add USING probclass_high.


*****************************************************************
* do something to check if flight is allowed
*****************************************************************
* ... result is negative:
* 305(BL): 'Flight allowance does not exist'
  MESSAGE e305(bl) INTO g_dummy.
* This message needs an extensive explanation.
* The normal longtext of a message is not sufficient since
* there are a lot of parameters in the text which should
* be replaced with data of this program.
* We therefore add a message with an extended longtext.
* (The extended longtext can be maintained in transaction SE61,
*  Document class: 'Text in dialog')
  PERFORM msg_add_with_extended_longtext
              USING probclass_very_high
                    p_carrid p_connid p_fldate.


***********************************************************************
* do something to check if weight is OK
***********************************************************************
* do something ... result might be negative:
* 301(BL): 'Maximum weigth is exceeded'
  MESSAGE e301(bl) INTO g_dummy.
* This message only makes sense when we also add the information
* wheich flight is meant. We therefore add a message
* with context information (i.e. carrier, connection and flight)
  PERFORM msg_add_with_context
            USING probclass_very_high
                  p_carrid p_connid p_fldate.


***********************************************************************
* is airplane available ?
***********************************************************************
* ... result is negative:
*   Airplane is not available.
*   An alternative airplane needs at least 200 seats !
* 314(BL): 'Airplane is not available. Another needs at least &1 seats'
  MESSAGE e314(bl) WITH '200' INTO g_dummy.
* Also this message needs an extensive explanation. But neither
* the message longtext or an extended longtext is sufficient.
* We want to show our own callback, in this case
* a popup showing all plane types which have more than 200 seats.
  PERFORM msg_add_with_callback
            USING probclass_high 200.


***********************************************************************
* is there enough time to sleep for the crew ?
***********************************************************************
* a routine is called which itself adds a message to the log when
* the result is negative
  PERFORM deadlines_check
            CHANGING
              g_retcode.
  IF g_retcode NE 0.
*   the message of this subroutine is rather technical
*   we therefore replace this message with a better one:
*   309(BL): 'Relax phases for the crew are too short'
    MESSAGE e309(bl) INTO g_dummy.
    PERFORM msg_replace USING probclass_high.
  ENDIF.


***********************************************************************
* check passenger list
***********************************************************************
* passenger by passenger of this flight will now be checked
  DO 60 TIMES.
    g_passenger = sy-index.

    PERFORM passenger_check
              USING
                g_passenger.

  ENDDO.


***********************************************************************
* display log file
***********************************************************************
  PERFORM log_display.


***********************************************************************
************************** FORMS **************************************
***********************************************************************
*--------------------------------------------------------------------
* FORM deadlines_check
*--------------------------------------------------------------------
FORM deadlines_check
       CHANGING
         c_retcode TYPE i.

* do something to check if the deadlines for the crew are OK
* ... result: deadlines are not OK
  c_retcode = 1.
* 313(BL): 'Deadline function: (Time zone &1, Start &2, End &3):
*           Return code &4'
  MESSAGE w313(bl) WITH 'MEZ' '19980722' '19980723' '4' INTO g_dummy.
  PERFORM msg_add USING probclass_medium.

ENDFORM.
*--------------------------------------------------------------------
* FORM passenger_check
*--------------------------------------------------------------------
FORM passenger_check
       USING
         value(i_passenger) TYPE bal_custmr.

  DATA:
    l_context            TYPE bal_s_ex01,
    l_s_msg_defaults     TYPE bal_s_mdef,
    l_value              TYPE i,
    l_everything_ok(1)   TYPE c.


*********************************************************************
* add passenger to context
*********************************************************************
* read current defaults
  CALL FUNCTION 'BAL_GLB_MSG_DEFAULTS_GET'
       IMPORTING
            e_s_msg_defaults = l_s_msg_defaults
       EXCEPTIONS
            OTHERS           = 0.
* set default context
  l_context-id = i_passenger.
  l_s_msg_defaults-context-value   = l_context.
  l_s_msg_defaults-context-tabname = 'BAL_S_EX01'.
* set current defaults
  CALL FUNCTION 'BAL_GLB_MSG_DEFAULTS_SET'
       EXPORTING
            i_s_msg_defaults = l_s_msg_defaults
       EXCEPTIONS
            OTHERS           = 0.

* assumption: everything is OK for this passenger
  l_everything_ok = 'X'.


***************************************************************
*   non-smoker seat available ?
***************************************************************
*   ... for some passengers a non-smoker seat is not available:
  IF i_passenger = 22 OR i_passenger = 34 OR i_passenger = 66.
*     310(BL): 'Passenger &1 can only be booked on smoker seat'
    MESSAGE e310(bl) WITH i_passenger INTO g_dummy.
    PERFORM msg_add USING probclass_medium.
    l_everything_ok = ' '.
  ENDIF.


***************************************************************
*   is payment checked ?
***************************************************************
*   ... for some passengers payment is not yet checked:
  l_value = sy-index MOD 16.
  IF l_value = 0.
*     304(BL): 'Payment for passenger &1 is not yet checked'
    MESSAGE w304(bl) WITH i_passenger INTO g_dummy.
    PERFORM msg_add USING probclass_medium.
    l_everything_ok = ' '.
  ELSE.
*     306(BL): 'Payment for passenger &1 is done'
    MESSAGE s306(bl) WITH i_passenger INTO g_dummy.
    PERFORM msg_add USING probclass_medium.
  ENDIF.


***************************************************************
*   did passenger cancel his flight ?
***************************************************************
*   ... some passnegers have cancelled their flight:
  l_value = sy-index MOD 26.
  IF l_value = 0.
*     307(BL): 'Flight for passenger &1 was cancelled'
    MESSAGE s307(bl) WITH i_passenger INTO g_dummy.
    PERFORM msg_add USING probclass_medium.
    l_everything_ok = ' '.
  ENDIF.


*********************************************************************
*   Everything is OK
*********************************************************************
  IF l_everything_ok = 'X'.
*   312(BL): 'Booked flight is checked and OK'
    MESSAGE s312(bl) INTO g_dummy.
*   this message occurs very often and adds no value
*   we therefore only cumulate this information
    PERFORM msg_cumulate USING probclass_low.
  ENDIF.

ENDFORM.
*--------------------------------------------------------------------
* FORM LOG_CREATE
*--------------------------------------------------------------------
FORM log_create.
  DATA:
    l_s_log TYPE bal_s_log.

* define some header data of this log
  l_s_log-extnumber = 'Application Log Demo'.             "#EC NOTEXT
  l_s_log-aluser    = sy-uname.
  l_s_log-alprog    = sy-repid.
* ...

* create a log
  CALL FUNCTION 'BAL_LOG_CREATE'
       EXPORTING
            i_s_log = l_s_log
       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.

ENDFORM.
*--------------------------------------------------------------------
* FORM LOG_DISPLAY
*--------------------------------------------------------------------
FORM log_display.
  DATA:
    l_s_display_profile TYPE bal_s_prof,
    l_s_fcat            TYPE bal_s_fcat.

* get standard display profile
  CALL FUNCTION 'BAL_DSP_PROFILE_SINGLE_LOG_GET'
       IMPORTING
            e_s_display_profile = l_s_display_profile
       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 passenger ID to message table
  l_s_fcat-ref_table = 'BAL_S_EX01'.
  l_s_fcat-ref_field = 'ID'.
  l_s_fcat-col_pos   = 100.
  APPEND l_s_fcat TO l_s_display_profile-mess_fcat.

* for display variants add report id
  l_s_display_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:
  l_s_display_profile-disvariant-handle = 'LOG'.

* show log file with modified output profile
* - we specify the display profile since we created our own
* - we do not specify any filter (like I_S_LOG_FILTER, ...,
*   I_T_MSG_HANDLE) since we want to display all messages available
  CALL FUNCTION 'BAL_DSP_LOG_DISPLAY'
       EXPORTING
*           I_S_LOG_FILTER         =
*           I_T_LOG_CONTEXT_FILTER =
*           I_S_MSG_FILTER         =
*           I_T_MSG_CONTEXT_FILTER =
*           I_T_LOG_HANDLE         =
*           I_T_MSG_HANDLE         =
            i_s_display_profile    = l_s_display_profile
       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.

ENDFORM.

*--------------------------------------------------------------------
* FORM MSG_CUMULATE
*--------------------------------------------------------------------
FORM msg_cumulate USING value(i_probclass) TYPE bal_s_msg-probclass.
  DATA:
    l_s_msg TYPE bal_s_msg.

* define data of message for Application Log
  l_s_msg-msgty     = sy-msgty.
  l_s_msg-msgid     = sy-msgid.
  l_s_msg-msgno     = sy-msgno.
  l_s_msg-msgv1     = sy-msgv1.
  l_s_msg-msgv2     = sy-msgv2.
  l_s_msg-msgv3     = sy-msgv3.
  l_s_msg-msgv4     = sy-msgv4.
  l_s_msg-probclass = i_probclass.

* add this message to log file
* (I_LOG_HANDLE is not specified, we want to add to the default log.
*  If it does not exist we do not care =>EXCEPTIONS log_not_found = 0)
  CALL FUNCTION 'BAL_LOG_MSG_CUMULATE'
       EXPORTING
*           I_LOG_HANDLE  =
            i_s_msg       = l_s_msg
       EXCEPTIONS
            LOG_NOT_FOUND = 0
            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.

ENDFORM.
*--------------------------------------------------------------------
* FORM MSG_ADD_WITH_CONTEXT
*--------------------------------------------------------------------
FORM msg_add_with_context
       USING
         value(i_probclass) TYPE bal_s_msg-probclass
         value(i_carrid)    TYPE bal_carrid
         value(i_connid)    TYPE bal_connid
         value(i_fldate)    TYPE bal_fldate.

  DATA:
    l_s_msg   TYPE bal_s_msg,
    l_context TYPE bal_s_ex01.

* define data of message for Application Log
  l_s_msg-msgty     = sy-msgty.
  l_s_msg-msgid     = sy-msgid.
  l_s_msg-msgno     = sy-msgno.
  l_s_msg-msgv1     = sy-msgv1.
  l_s_msg-msgv2     = sy-msgv2.
  l_s_msg-msgv3     = sy-msgv3.
  l_s_msg-msgv4     = sy-msgv4.
  l_s_msg-probclass = i_probclass.

* define context information
  l_context-carrid = i_carrid.
  l_context-connid = i_connid.
  l_context-fldate = i_fldate.
  l_s_msg-context-tabname = 'BAL_S_EX01'.
  l_s_msg-context-value   = l_context.

* add this message to log file
* (I_LOG_HANDLE is not specified, we want to add to the default log.
*  If it does not exist we do not care =>EXCEPTIONS log_not_found = 0)
  CALL FUNCTION 'BAL_LOG_MSG_ADD'
       EXPORTING
*           I_LOG_HANDLE =
            i_s_msg      = l_s_msg
       EXCEPTIONS
            LOG_NOT_FOUND = 0
            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.

ENDFORM.
*--------------------------------------------------------------------
* FORM MSG_ADD_WITH_EXTENDED_LONGTEXT
*--------------------------------------------------------------------
FORM msg_add_with_extended_longtext
       USING
         value(i_probclass)      TYPE bal_s_msg-probclass
         value(i_carrid)         TYPE bal_carrid
         value(i_connid)         TYPE bal_connid
         value(i_date)           TYPE bal_fldate.

  DATA:
    l_s_msg              TYPE bal_s_msg,
    l_s_par              TYPE bal_s_par,
    l_date_end           TYPE bal_fldate.

* define data of message for Application Log
  l_s_msg-msgty     = sy-msgty.
  l_s_msg-msgid     = sy-msgid.
  l_s_msg-msgno     = sy-msgno.
  l_s_msg-msgv1     = sy-msgv1.
  l_s_msg-msgv2     = sy-msgv2.
  l_s_msg-msgv3     = sy-msgv3.
  l_s_msg-msgv4     = sy-msgv4.
  l_s_msg-probclass = i_probclass.

* prepare variables for extended longtext:
* ... carrier id
  l_s_par-parname  = 'CARRID'.         "#EC NOTEXT
  l_s_par-parvalue = i_carrid.
  APPEND l_s_par TO l_s_msg-params-t_par.
* ... name of carrier
  l_s_par-parname  = 'NAME'.           "#EC NOTEXT
  l_s_par-parvalue = 'SAPFlight'.      "#EC NOTEXT
  APPEND l_s_par TO l_s_msg-params-t_par.
* ... id of connection
  l_s_par-parname  = 'CONNID'.         "#EC NOTEXT
  l_s_par-parvalue = i_connid.
  APPEND l_s_par TO l_s_msg-params-t_par.
* ... departure location
  l_s_par-parname  = 'DEP'.            "#EC NOTEXT
  l_s_par-parvalue = 'Walldorf'.       "#EC NOTEXT
  APPEND l_s_par TO l_s_msg-params-t_par.
* ... destination location
  l_s_par-parname  = 'DES'.            "#EC NOTEXT
  l_s_par-parvalue = 'Toronto'.        "#EC NOTEXT
  APPEND l_s_par TO l_s_msg-params-t_par.
* ... flight date
  l_s_par-parname  = 'FLDATE'.         "#EC NOTEXT
  WRITE i_date TO l_s_par-parvalue.
  APPEND l_s_par TO l_s_msg-params-t_par.
* ... last date
  l_s_par-parname  = 'DATE_END'.       "#EC NOTEXT
  l_date_end = i_date - 10.
  WRITE l_date_end TO l_s_par-parvalue.
  APPEND l_s_par TO l_s_msg-params-t_par.
* ... plane type
  l_s_par-parname  = 'PL_TYPE'.        "#EC NOTEXT
  l_s_par-parvalue = '747-400'.        "#EC NOTEXT
  APPEND l_s_par TO l_s_msg-params-t_par.

* define name of SAPSCRIPT text
* (Can be maintained in transaction SE61,
*  Document class: 'Text in dialog')
  l_s_msg-params-altext = 'SBAL_EXAMPLE_TEXT_01'.           "#EC NOTEXT

* add this message to log file
* (I_LOG_HANDLE is not specified, we want to add to the default log.
*  If it does not exist we do not care =>EXCEPTIONS log_not_found = 0)
  CALL FUNCTION 'BAL_LOG_MSG_ADD'
       EXPORTING
*           I_LOG_HANDLE  =
            i_s_msg       = l_s_msg
       EXCEPTIONS
            LOG_NOT_FOUND = 0
            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.

ENDFORM.
*--------------------------------------------------------------------
* FORM CALLBACK_SHOW_PLANES
*--------------------------------------------------------------------
FORM callback_show_planes              "#EC CALLED
       TABLES
         i_params  STRUCTURE spar.

  DATA:
    l_seats        TYPE i.

* read entry from parameter table where the number of seats is denoted
  READ TABLE i_params WITH KEY param = 'SEATS'.
  CHECK sy-subrc = 0.
  l_seats = i_params-value.

* find out all planes which have enough seats
* ... result: nothing found
* 316(BL): 'There are no alternative plane types available with more
*           than &1 seats'
  MESSAGE i316(bl) WITH l_seats.

ENDFORM.
*--------------------------------------------------------------------
* FORM MSG_ADD_WITH_CALLBACK
*--------------------------------------------------------------------
FORM msg_add_with_callback
       USING
         value(i_probclass)      TYPE bal_s_msg-probclass
         value(i_seats)          TYPE i.

  DATA:
    l_s_par   TYPE bal_s_par,
    l_s_msg   TYPE bal_s_msg.

* define data of message for Application Log
  l_s_msg-msgty     = sy-msgty.
  l_s_msg-msgid     = sy-msgid.
  l_s_msg-msgno     = sy-msgno.
  l_s_msg-msgv1     = sy-msgv1.
  l_s_msg-msgv2     = sy-msgv2.
  l_s_msg-msgv3     = sy-msgv3.
  l_s_msg-msgv4     = sy-msgv4.
  l_s_msg-probclass = i_probclass.

* define callback routine
  l_s_msg-params-callback-userexitp = sy-repid.
  l_s_msg-params-callback-userexitf = 'CALLBACK_SHOW_PLANES'.

* define some data needed in this callback routine
* e.g. the number of seats we need
  l_s_par-parname  = 'SEATS'.
  l_s_par-parvalue = i_seats.
  APPEND l_s_par TO l_s_msg-params-t_par.

* add this message to log file
* (I_LOG_HANDLE is not specified, we want to add to the default log.
*  If it does not exist we do not care =>EXCEPTIONS log_not_found = 0)
  CALL FUNCTION 'BAL_LOG_MSG_ADD'
       EXPORTING
*           I_LOG_HANDLE  =
            i_s_msg       = l_s_msg
       EXCEPTIONS
            LOG_NOT_FOUND = 0
            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.

ENDFORM.
*--------------------------------------------------------------------
* FORM MSG_REPLACE
*--------------------------------------------------------------------
FORM msg_replace USING value(i_probclass) TYPE bal_s_msg-probclass.
  DATA:
    l_s_msg TYPE bal_s_msg.

* define data of message for Application Log
  l_s_msg-msgty     = sy-msgty.
  l_s_msg-msgid     = sy-msgid.
  l_s_msg-msgno     = sy-msgno.
  l_s_msg-msgv1     = sy-msgv1.
  l_s_msg-msgv2     = sy-msgv2.
  l_s_msg-msgv3     = sy-msgv3.
  l_s_msg-msgv4     = sy-msgv4.
  l_s_msg-probclass = i_probclass.

* add this message to log file
* (I_LOG_HANDLE is not specified, we want to add to the default log.
*  If it does not exist we do not care =>EXCEPTIONS log_not_found = 0)
  CALL FUNCTION 'BAL_LOG_MSG_REPLACE'
       EXPORTING
*           I_LOG_HANDLE  =
            i_s_msg       = l_s_msg
       EXCEPTIONS
            LOG_NOT_FOUND = 0
            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.

ENDFORM.
*--------------------------------------------------------------------
* FORM MSG_ADD
*--------------------------------------------------------------------
FORM msg_add USING value(i_probclass) TYPE bal_s_msg-probclass.
  DATA:
    l_s_msg TYPE bal_s_msg.

* define data of message for Application Log
  l_s_msg-msgty     = sy-msgty.
  l_s_msg-msgid     = sy-msgid.
  l_s_msg-msgno     = sy-msgno.
  l_s_msg-msgv1     = sy-msgv1.
  l_s_msg-msgv2     = sy-msgv2.
  l_s_msg-msgv3     = sy-msgv3.
  l_s_msg-msgv4     = sy-msgv4.
  l_s_msg-probclass = i_probclass.

* add this message to log file
* (I_LOG_HANDLE is not specified, we want to add to the default log.
*  If it does not exist we do not care =>EXCEPTIONS log_not_found = 0)
  CALL FUNCTION 'BAL_LOG_MSG_ADD'
       EXPORTING
*           I_LOG_HANDLE  =
            i_s_msg       = l_s_msg
       EXCEPTIONS
            LOG_NOT_FOUND = 0
            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.

ENDFORM.
*--------------------------------------------------------------------
* FORM MSG_ADD_FREE_TEXT
*--------------------------------------------------------------------
FORM msg_add_free_text USING value(i_text) TYPE c.

* add this message to log file
* (I_LOG_HANDLE is not specified, we want to add to the default log.
*  If it does not exist we do not care =>EXCEPTIONS log_not_found = 0)
  CALL FUNCTION 'BAL_LOG_MSG_ADD_FREE_TEXT'
       EXPORTING
*           I_LOG_HANDLE  =
            i_msgty       = 'S'
            i_text        = i_text
       EXCEPTIONS
            LOG_NOT_FOUND = 0
            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.

ENDFORM.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Programming Techniques | Приемы программирования -> Arch & Logs All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG.
Every effort is made to ensure content integrity. Use information on this site at your own risk.