BAL Application Log

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 .

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

Similar Messages

  • Write to application log in user exit

    Hi all,
    I want to write a collection messages to the application log in user exit EBIA0003, user exit for transaction EA00, but I only can write one if I just use
    message eYYY(x) with lv_msgv1
                                      lv_msgv2
                                      lv_msgv3
                                      lv_msgv4.
    It will be placed in the log after the exit.
    I've already tried with the BAL functions, but it doesn't seem to work or maybe I'm doing something wrong. Is there a way to write a collection of messages in to the application log in this user exit?
    greetz Pieter

    Hi Pieter,
    you can do using BAL functions if the lop is already opened. Try to find out what parameters the transaction uses for LOG access (handle!). Do the calls in the exit accordingly.
    We append messages to the current log using FUNCTION 'BAL_LOG_MSG_ADD'. If the log handle is not available, you might access it using dynamic assign like
      ASSIGN ('(<program>)<field>') TO <field> .
    Regards,
    Clemens

  • Application Log - error in header

    Hi,
    I have created application log using BAL* FM's.
    Now in header part i am filing below columns:
    as_log-context-tabname = 'YCONTEXT'.
    as_log-context-value = ls_extnumber.
    When log is displayed, in header i am getting information:
    Interface type(custom field), Numb, date, Time, User, Tran, Program,Mode, Log number.
    Below Inrterface type there is a folder 'Inbound'(again name is as per requiernment).  Now this folder is a tree like structure.
    When this tree is expanded, fields Bumb, date,time,User.. gets there values.
    Now the problem is:
    below folder 'Inbound', there is a symbol indicating error messages. I want with this error message, some text should also come.
    How to do this?
    If someone can provide his/her email id, i can send the screen shots, which will be easier to understand.
    regards,
    Ashish

    Hi Sai,
    Is there any recent Kernal upgrade has happened in your project? the issue is happening in the VMC call as per the dump detail. I would suggest just ask the basis guys to check the VMC server wether it is up or down and also in case of any upgrade happen basis need to restart the VMC server may be they have forgotten to do so.please check the same and revert with your finding.
    Thanks
    Prem

  • Custom error message in SAP application log

    Is there a way to add a custom error message to the SAP application log without passing the message variables MSGV1, MSGV2, MSGV3, MSGV4 and the Message class and number. 
    We want to pass a custom message from the BAPIRET2-MESSAGE without giving it a Message class and number.  The reason for this is that  we are using class based exceptions instead of the traditional message class with errors.  When we catch the class based exception, we take the error text of the exception and put in in the BAPIRET2-message and set the BAPIRET2-TYPE as 'E'.  Now we want to add this to the SAP application log.
    The call to 'BAL_LOG_MSG_ADD' takes a structure BAL_S_MSG which is just like BAPIRET2.  However this function builds the entry to the application log use the message variables MSGV1, MSGV2, MSGV3, MSGV4.  There is no provision to pass in the BAPIRET2 message.
    Add message to application log
      CALL FUNCTION 'BAL_LOG_MSG_ADD'
        EXPORTING
         i_log_handle              = app_log_handle
         i_s_msg                   = log_message
    Thanks,
    Jay

    Hi Jay,
    Did you see <b>BAL_LOG_EXCEPTION_ADD</b>?
    This FM is represented by the structure <b>BAL_S_EXC</b>. This can have various versions as described below:
    <b>Data of BAL_S_EXC Structure  /     Use</b>
    <b>EXCEPTION</b>  /                              Exception class from which an exception text 
                                                       is added to the log. This field must be filled.
    <b>MSGTY</b>  /                                     Message type (MSGTY) of a T100 message.
                                                       This field must also be filled for exceptions.
    <b>PROBCLASS,
    DETLEVEL,
    ALSORT, TIME_STMP</b>  /                Message or exception attributes, such as
                                                        problem class (PROBCLASS, for
                                                        example, "very important"), level of detail
                                                        (DETLEVEL, from 1 to 9), sort criterion
                                                        (ALSORT, unrestricted) and timestamp
                                                        (TIME_STMP). These fields can be displayed
                                                        in the log (except TIME_STMP).
    <b>MSG_COUNT</b>   /                            This attribute is not used for exceptions.
    Follow the link below for more details:
    <a href="http://help.sap.com/saphelp_nw04/helpdata/en/d6/5d7f38f52f923ae10000009b38f8cf/frameset.htm">SAP Help DOc</a>
    Hope this helps.
    Thanks
    Sanjeev

  • Had this error msg in my application log:

    Had this error msg in my application log:
    [21/Feb/2002 10:16:20:7] info: REQ-012: thread add
    [21/Feb/2002 10:16:20:7] info: REQ-012: thread add
    [21/Feb/2002 10:16:20:7] info: ENGINE-ready: ready: 10820
    BASEURL: https://ssunp03.company.com:8081
    strURL: https://ssunp03.company.com:8081/cgi-bin/gx.cgi/AppLogic+EventServerManager
    EventServerHttpInvocation > java.net.MalformedURLException: unknown protocol: https
    **Out of memory, exiting**
    ld.so.1: /pimcreg5/imc/nas/40sp3/nas/usr/java/bin/sparc/native_threads/jre: fatal: /pimcreg5/imc/nas/40sp3/nas/us
    r/java/lib/sparc/native_threads/libjava.so: mprotect failed: Resource temporarily unavailable
    Killed
    Connected to LDAP server on ssunp03.company.com port 1390
    [21/Feb/2002 02:42:49:1] info: ENGINE-class_loader_created: New class loader com.kivasoft.engine.EngineClassLoade
    rNonVersionable@1c14d67f has just been created
    Can anyone share with me his experience about ld.so.1?? What is it and why does it cause my apps server to reboot?

    It looks like you might simply have run out of memory. It just looks like the JRE tried to adjust its memory map and run out space. When mprotect fails the problem probably isn't with the .so itself.
    What are the memory characteristics of your machine? Including the heap and stack space that you allocate for your JVM, as well as the actual physical and swap space available on the server.

  • Any guidelines using RSAL_LOG_WRITE to post message in the application log

    Hi SDN!
    I've programmed a rather complex extractor. As most you will know, the real test is when the extractor goes live in productions;-) So in order to be able to check if everything works as designed - I've customized the extractor in order to post more or less entries in the application logs - This setting can be alterered in the uses system directly.
    I've tested the functionality using RSA3 and the application log is filled as expected. The Application log object is RSFH and everything shows up fine. When tring to use it from BW - The application log gets no entries under object RSAP (Where they normally will end up).
    I'm using the function module RSAL_LOG_WRITE to add entries to the same log as the macroes LOG_WRITE uses.
    Does anybody have any experiance adding entries to the standard application log in the source system when extracting data into BW?
    Best Regards
    Søren Hansen

    Sorry Arkesh,
    I to don't know that how to install the jar files, actually thats the role of BASIS guys.
    Watch the below threads for which jar files we need to deploy and how to deploy the jar files
    Re: Required jar files for using jdbc adapter
    Re: Error in JDBC adapter

  • Error Message in portal application.log

    Hi all,
    There are error messages continually been written to application.log.
    Here is the path.
    $ORACLE_HOME/j2ee/OC4J_Portal/application-deployments/portal/OC4J_Portal_default_island_1/application.log
    We couldn't find out what's wrong.
    Portal Version is 10.1.2.2.0.
    application.log
    07/01/31 16:54:54 portal: [module=RepositoryServlet, ecid=103102642203,1] ERROR: Repository Gateway error: Request Processing Error:
    maxlength.htc: PROCEDURE DOESN'T EXIST
    07/01/31 17:23:44 portal: [module=RepositoryServlet, ecid=133169185626,1] ERROR: Repository Gateway error: Request Processing Error:
    maxlength.htc: PROCEDURE DOESN'T EXIST
    07/01/31 17:23:58 portal: Broken pipe
    07/01/31 17:23:58 portal: Broken pipe
    07/01/31 17:23:58 portal: id=146054097151,1 Exception processing portlet response
    java.lang.ArrayIndexOutOfBoundsException
         at java.lang.System.arraycopy(Native Method)
         at com.evermind.server.http.EvermindServletOutputStream.write(EvermindServletOutputStream.java:216)
         at com.evermind.server.http.EvermindServletOutputStream.write(EvermindServletOutputStream.java:151)
         at oracle.webdb.repository.service.RepositoryHttpResponseWrapper$RepositoryOutputStreamWrapper.write(Unknown Source)
         at oracle.webdb.page.CharConvertingOutputStream.write(Unknown Source)
         at oracle.webdb.page.v2.BaseDataProcessor.addToOutputStream(Unknown Source)
         at oracle.webdb.page.v2.BaseDataProcessor.includePortlet(Unknown Source)
         at oracle.webdb.page.v2.BaseDataProcessor.parseLayout(Unknown Source)
         at oracle.webdb.page.v2.BaseDataProcessor.assemblePage(Unknown Source)
         at oracle.webdb.page.v2.BaseDataProcessor.process(Unknown Source)
         at oracle.webdb.page.PageBuilder.process(Unknown Source)
         at oracle.webdb.page.Main.doRequest(Unknown Source)
         at oracle.webdb.page.ParallelServlet.doGet(Unknown Source)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:834)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:340)
         at com.evermind.server.http.ServletRequestDispatcher.forward(ServletRequestDispatcher.java:260)
         at oracle.webdb.portal.servlet.PortalServlet.doGet(Unknown Source)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:834)
         at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:340)
         at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:830)
         at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:228)
         at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:133)
         at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192)
         at java.lang.Thread.run(Thread.java:534)
    ----------------------

    $ORACLE_HOME/j2ee/OC4J_Portal/application-deployments/portal/OC4J_Portal_default_island_1/application.log
    os the log of the "parent application". This is rather high level in the container. The message in the logfiles tells you that a procedure doesn't exist.
    This can mean 3 things:
    1. The procedure really doesn't exist
    2. The procedure expects different parameters then passed
    3. In the procedure a specific array member is called (but not found). (don't know how to explain this better in English, sorry for that).
    It has been a while since I touched portal. In the past portal used a DAD (located in your HTTP-Server configuration). By changing the error style of the dad, you might find a more comprohensive error message.

  • How to add custom error message in standard application log of change doc.

    Hi,
    While saving chnage document I need to add raise an error on specific condition. As Error messages is being shown in application log I added custom message in include LCRM_1O_UIF15 by using BAL_LOG_MSG_ADD FM however it is not showing in the screen. What could be the reason? Can anybody please explain?
    Rgds
    Sudhanshu

    Muhammed,
    Have you tried throwing a JboException in your AM code?
    John

  • Log messages for 'auditing' are different in 'general'  and'application log

    Hi,
    From UI, When I audit a file using a profile which comprises of user-defined 'rules/categories/analyzers', I will get log messages at ''File-name(Application) log window' and 'Messages' log window, which are located at bottom of Jdev UI page. One common message in both the log windows is
    " <n1> violations, <n2> exceptions, <n3> documents, <n4> seconds>.
    But here the 'n1,n2,...' numbers are dfferent in two windows though the log output is for a same file. In this the 'file-name' log shows the correct
    Example:-
    In 'file-name' log window ,it shows as:
    3 documents, 8 violations, no exceptions
    In messages window, it shows as
    "Audit starting on EFC.jpr (Default)
    Audit completed: no violations, no exceptions, 3 documents, 1 second"
    If I use the 'pre-existed'(Jdev's) rules profile, I will get similar output in both log windows.
    From this I concluded that there is something missing to register for a new 'rule/category/analyzer'.
    Could you suggest me in this case. Do I forgot anything to do in any files of '<rule-implementation.java>', 'audit.properties', <add-in launcher>.java, extension.xml.
    Actually, I want to use 'ojaudit' executable from command line to my project files. Here I observed that the output of the 'ojaudit' is similar to the above explained 'Message' log window in JDeveloper UI. But where the 'Message' log window output is not correct for user-defined rules.
    Regards
    Madhu

    Romano,
    In the upcoming production release (planned to be released next week), we added caching of authorized roles and permissions in JhsAuthorizationProxy class.
    I suggest you wait for this relase, if the problem persists, it is most likely an ADF issue (as is the logging)
    Steven Davelaar,
    JHeadstart team.

  • Doubt in creating program to display application logs

    Hi,
    I have doubt in creating a program to display application logs.
    The standard transaction code SLG1 has been used to display Application logs till now by the user.
    They came up with the new requirement on this.
    <u>The requirements were:</u>
    1)New custom program shoud be created like SLG1 with limited selection fields( data from, date to, Program name and User)
    2) Detail list should be displyed immediately when this program is executed because SLG1 gives Basic list,Detailed list which is getting displayed when 'Detail view' is selected in the first list.
    I have created one program with limited selection fields as per the requirement using the below function modules .
    BAL_FILTER_CREATE
    BAL_DB_SEARCH
    BAL_DB_LOAD
    and BAL_DSP_LOG_DISPLAY
    <u>Issue :</u> still I am getting the firt list.
    both Basic and Detailled lists are getting triggered at the FM BAL_DSP_LOG_DISPLAY.
    Is it only the way to copy and modify this FM.
    Could you please suggest me?
    Thans in advace,
    babu.
    Message was edited by:
            babu v
    Message was edited by:
            babu v

    Hello All,
    Thanks for your valuable suggitions.
    I have seen most of the demo programs.
    I found one fm'BAL_DSP_PROFILE_NO_TREE_GET' which avoids the tree list which is getting listed above the profile list.
    I have been searching alot to omit the Profile list. I searched alot to find any function modules realted to that.
    The requirement was only the Detail list should only be listed.
    Could you please suggest me to avopid that profile list also?
    Thanks in advance,
    babu
    Message was edited by:
            babu v

  • How to write to application log at BBP_CREATE_BE_PO_NEW

    Dear all,
    I am running in a strange problem. I want to log to application log (SLG1) in BADI BBP_CREATE_BE_PO_NEW. As soon as I call a function from there I get an error at the shopping cart position. Changing values in the given data does work without any problems. In EBP 3.5 we used the BADI BBP_CREATE_PO_BACK and this worked with logging without any problems.
    Thanks for support.
    Regards
    Roman

    Hello , there is an example of application logging usage in report SBAL_DEMO_01.
    You need an application log instance to be created before you can add messages that will be displayed using tx SLG1. Maybe its because you dont have a logging object instance in your badi.
    Hope it helps.
    Regards, Luciano.

  • Exporting and Importing Data of Application Log

    Hello,
    We do migrate an application from SAP System A to SAP System B.
    Despite the application logic, we do need to migrate some data, too.
    For this we do write an export report in System A that writes the data of some tables to  files on the app server..
    Another report in system B takes the files and fills the respecting tables.
    So far so good:
    One table (which reports certain actions)  contains the handle to the application log, which was created for this action.
    I do want to extract this application log and later import this log in the other system, but do not know how this can be done in the best way.
    Do you have any suggestion ?
    Best regards
    Michael

    In my experience, it's an unrealistic expectation.
    SAP doesn't provide a straight path to migrate logs the way you plan to do. It's kept in a combination of tables and index files on the system. So even if you were to successfully extract it, when you load the data into system B you will lose the date and time stamp. When you create a log entry, it picks up system date and time. That's what an auditor would look for.
    An alternate solution would be to read the application log and store it in a new custom table in system B.
    Any reporting should be done off that as of a specific date.

  • How do you clear system and application logs in a server?

    Hello all,
    How do you clear system and application logs in a server?
    thanks,
    mike

    go to start button,all programs,assosories, System tools T event viewer. now select application & rt click & clear & do not save.similarly do for sytem too.

  • Warning message into Application log of Service request

    Hi Experts,
    I have a requirement where I am using Event handlers(CRMV_EVENT) to redetermine partners of a service request whenever certain values are changed in the transaction CRMD_ORDER.
    Partners will be retrieved from a custom table.
    In any circumstances, if the partners cannot be determined then we need to push a WARNING message stating that "Partners can not be determined, pls maintain the values in the custom table'.
    For this purpose I am using the function module CRM_MESSAGE_COLLECT with the following parameters, but still I am not able to see the same into the Application log of the Service request that is going to be created.
    CALL FUNCTION 'CRM_MESSAGE_COLLECT'
      EXPORTING
        iv_caller_name         = 'ORDERADM_H'
        IV_REF_OBJECT          = iv_header_guid
        IV_REF_KIND            = 'A'
       IV_LOGICAL_KEY         = '0001'
        IV_MSGNO               = '001'
        IV_MSGID               = 'ZSP'
        IV_MSGTY               = 'W'
      IV_MSGV1               = SY-MSGV1
      IV_MSGV2               = SY-MSGV2
      IV_MSGV3               = SY-MSGV3
      IV_MSGV4               = SY-MSGV4
        IV_MSGLEVEL            = '1'
      IV_FIELDNAME           =
      IV_ACTION              =
        IV_LOG_HANDLE          = lv_log_handle
        IV_CUMULATE            = 'X'
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    Do I missed in passing of any additional parameters?
    Can any one of you have encountered the same problem and solved this, pls through some light on me too(if possible with block of code).
    Thanks in advance.

    Hi,
    Here is the block of code that I used to push a message in to Application log.
    Push your message into a variable called dummy and then call the below mentioned function module.
    DATA:        lv_dummy(254)    TYPE  c,            "#EC NEEDED
              MESSAGE w052(sppf_media) WITH text-001
                                            text-002
                                        INTO lv_dummy.
              CALL FUNCTION 'CRM_MESSAGE_COLLECT'
                EXPORTING
                  iv_caller_name = 'ORDERADM_H'
                  iv_ref_object  = iv_header_guid
                  iv_ref_kind    = lc_ref_kind_a
                  iv_msgno       = sy-msgno
                  iv_msgid       = sy-msgid
                  iv_msgty       = sy-msgty
                  iv_cumulate    = lc_x
                IMPORTING
                  ev_msgty       = lv_msgtyp
                  es_msg_handle  = gv_msghandle
                EXCEPTIONS
                  not_found      = 1
                  appl_log_error = 2
                  OTHERS         = 3.
              IF sy-subrc <> 0.
                MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                       WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
              ENDIF.
            ENDIF.
    Hope this helps to resolve your issue.
    Regards,
    Usha.

  • Domain user no longer exists but getting errors in application log

    Hi,
    We had a domin user with which SQL service and SQL agent is configured to start. But this account does not have access to that server in which SQL is installed now. I can see the follwing message in application log:
    Log Name:      Application
    Source:        MSSQLSERVER
    Date:          3/10/2014 2:00:00 PM
    Event ID:      18456
    Task Category: Logon
    Level:         Information
    Keywords:      Classic,Audit Failure
    User:          Domain \username
    Computer:      XXXX
    Description:
    Login failed for user 'Domain \username'. Reason: Failed to open the explicitly specified database. [CLIENT: <local machine>]
    Event Xml:
    <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
      <System>
        <Provider Name="MSSQLSERVER" />
        <EventID Qualifiers="49152">18456</EventID>
        <Level>0</Level>
        <Task>4</Task>
        <Keywords>0x90000000000000</Keywords>
        <TimeCreated SystemTime="2014-10-03T04:00:00.000000000Z" />
        <EventRecordID>20420597</EventRecordID>
        <Channel>Application</Channel>
        <Computer>XXXXXXX</Computer>
        <Security UserID="S-1-5-21-2091904384-3689332406-323980668-6522" />
      </System>
      <EventData>
        <Data>domain\usernamer</Data>
        <Data> Reason: Failed to open the explicitly specified database.</Data>
        <Data> [CLIENT: &lt;local machine&gt;]</Data>
        <Binary>184800000E000000100000004100550030003400550041005000300036003800510041004E00380032000000070000006D00610073007400650072000000</Binary>
      </EventData>
    </Event>
    How come this message is coming in the application log, since no one has tried to log in to the application?

    Hi Both are 2008R2 version. My doubt is I can see that login failed message in application log but how to find out which process is trying to use that login?
    First observe that this is something that runs on the same machine as SQL Server. (The error message says "CLIENT: <local machine>".) That may be a clue enough.
    If not, set up a includes Audit: Login Failed and no other event. Of interest are the columns ApplicationNmae and the the column ClientProcessID. ApplicationName may be sufficient, but if not you can use ClientProcessID and match this against the PIDs you
    see in Task Manager or Process Explorer. There is a risk it is a short-lived process and then you will have to look at Process Explorer and Profiler in parallel.
    Erland Sommarskog, SQL Server MVP, [email protected]

Maybe you are looking for