How to log the messages in program scheduled background

Hi all,
I have a program and it is to be scheduled to run in the background.
I want to log the messages within the program while running.
What could I do?
(The standard job log is not what I want)
Thanks.

Ignore my previous post. It is good that you posted this question, as I learnt something new. Try the code below.
Regarding help for why you require and why to go for application logs, refer this SAP Help
http://help.sap.com/saphelp_47x200/helpdata/en/2a/fa0223493111d182b70000e829fbfe/frameset.htm
DATA: ls_log  TYPE bal_s_log.
DATA: p_log_handle TYPE balloghndl.
ls_log-extnumber = 'YMYTEST'.
ls_log-alprog = sy-repid.
CALL FUNCTION 'BAL_LOG_CREATE'
  EXPORTING
    I_S_LOG                 = ls_log
  IMPORTING
    E_LOG_HANDLE            = p_log_handle
  EXCEPTIONS
    LOG_HEADER_INCONSISTENT = 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.
data: l_s_msg TYPE bal_s_msg.
data: E_MSG_WAS_DISPLAYED type boolean.
data: E_MSG_WAS_LOGGED type boolean.
data: E_S_MSG_HANDLE type BALMSGHNDL.
l_s_msg-msgid = '00'.
l_s_msg-msgty = 'E'.
l_s_msg-msgno = '001'.
l_s_msg-msgv1 = 'This is a test message from 20130810'.
CALL FUNCTION 'BAL_LOG_MSG_ADD'
  EXPORTING
    I_LOG_HANDLE              = p_log_handle
    I_S_MSG                   = l_s_msg
IMPORTING
   E_S_MSG_HANDLE            = E_S_MSG_HANDLE
   E_MSG_WAS_LOGGED          = E_MSG_WAS_LOGGED
   E_MSG_WAS_DISPLAYED       = E_MSG_WAS_DISPLAYED
EXCEPTIONS
   LOG_NOT_FOUND             = 1
   MSG_INCONSISTENT          = 2
   LOG_IS_FULL               = 3
   OTHERS                    = 4
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
data: I_T_LOG_HANDLE type BAL_T_LOGH.
append p_log_handle to i_t_log_handle.
CALL FUNCTION 'BAL_DSP_LOG_DISPLAY'
EXPORTING
*   I_S_DISPLAY_PROFILE          =
    I_T_LOG_HANDLE               = i_t_log_handle
*   I_T_MSG_HANDLE               =
*   I_S_LOG_FILTER               =
*   I_S_MSG_FILTER               =
*   I_T_LOG_CONTEXT_FILTER       =
*   I_T_MSG_CONTEXT_FILTER       =
*   I_AMODAL                     = ' '
* IMPORTING
*   E_S_EXIT_COMMAND             =
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.
Regards,
Subramanian V.

Similar Messages

  • How to execute the messages in status 'scheduled' automatically?

    Hi.
    I find some messages every day which have status 'scheduled' for a long time - more then several hours. These messages use http adapter. When http server is not working, the messages scheduled, but not executed after http server become working. How to execute the messages automatically?

    http://help.sap.com/saphelp_nw70/helpdata/en/96/8412417301ee6fe10000000a1550b0/content.htm
    Is yours a EOIO scenario?

  • How to log the messages in an internal table n display

    Hello guys,
    This is my first post in SDN.
    I am uploading some data from application server. I am doing lot of varifications, based on that I have to display the messages.
    So I asked not to use the write statements to display the messages but asked me to create an internal table and display the messages afterwards..
    like I am using some BAPI to upload after the bapi call i have to log the result for each record into an internal table and show...
    can anyone guide me how to do it?

    Thanks for your info Azad,
    here I am posting my code... can u go through it once and lemme me whether i am in right track or not?
    FORM FORM_POST_DATA.
      IF X_POST = 'X'.
        CALL FUNCTION 'BAPI_ACC_BILLING_POST'
          EXPORTING
            DOCUMENTHEADER          = WA_DOCUMENTHEADER
           CUSTOMERCPD             = WA_CUSTOMERCPD
    IMPORTING
      OBJ_TYPE                =
      OBJ_KEY                 =
      OBJ_SYS                 =
          TABLES
            ACCOUNTRECEIVABLE       = IT_ACCOUNTRECEIVABLE
            ACCOUNTGL               = IT_ACCOUNTGL
            ACCOUNTTAX              = IT_ACCOUNTTAX
      CRITERIA                =
      VALUEFIELD              =
            CURRENCYAMOUNT          = IT_CURRENCYAMOUNT
            RETURN                  = IT_RETURN
      SALESORDER              =
      SALESAMOUNT             =
           EXTENSION1              = IT_EXTENSION1
        LOOP AT IT_RETURN.
          MOVE-CORRESPONDING IT_RETURN TO IT_MESSAGES.
        ENDLOOP.
      ENDIF.
    WRITE: / 'Result of Post:'.
      WRITE : / REF_TYPE,REF_KEY,REF_SYS.
      PERFORM FORM_SHOW_MESSAGES.
    ENDFORM.              "FORM_POST_DATA
    FORM FORM_SHOW_MESSAGES.
      IF IT_RETURN[] IS INITIAL.
        WRITE: / 'no messages'.
      ELSE.
        SKIP 1.
        LOOP AT IT_RETURN.
          WRITE: /    IT_RETURN-TYPE,
                 (2)  IT_RETURN-ID,
                      IT_RETURN-NUMBER,
                 (80) IT_RETURN-MESSAGE,
                    IT_RETURN-LOG_NO
                    IT_RETURN-LOG_MSG_NO
                    IT_RETURN-MESSAGE_V1
                    IT_RETURN-MESSAGE_V2
                    IT_RETURN-MESSAGE_V3
                    IT_RETURN-MESSAGE_V4
                 (20) IT_RETURN-PARAMETER,
                 (3)  IT_RETURN-ROW,
                      IT_RETURN-FIELD.
                    IT_RETURN-SYSTEM
        ENDLOOP.
      ENDIF.
      ULINE.
    ENDFORM.                               " Show_messages
    Nisha...

  • How to log the exception using Log action in Oracle Service Bus

    Hi,
    Whenever an exception is raised how to log the exception using Log action in oracle service bus.After logging where I have to find the logged message.

    It would be in the log file for the managed server which ran the request. If you are logging the message at a lower level than your app server, however, you won't see it. You should be logging the exception at Error level.

  • How to delete the messages from sxmb_moni with status cancelled

    Hi ,
    how to delete the messages from sxmb_moni with status cancelled
    Is there any report for this
    Regards
    Suman

    I think just for deleting the jobs you can do this only
    Scheduling Delete Jobs
    To schedule delete jobs, proceed as follows:
           1.      In the Integration Engine -
    > Administration menu, choose Schedule Delete Jobs.
           2.      Select the job(s) to be scheduled.
           3.      Specify the start time and date.
           4.      Specify the period you want to use and choose Schedule.
    For an overview of all jobs, choose Jobs.

  • Developing the Wrapper class to log the message in XI server

    Hi All,
    We are trying to develop  wrapper class on the SAP Logging API, in that I am unable to log the message in the log file(whose path is mentioned in the properties file).
    We use this for storing when exception raised during message transformation due to certain error conditions...
    Procedure:
    My Wrapper class will take the parameters from Property file and store/log the message in the specified location,
    This is working outside of XI environment
    Please suggest how to make to work in XI environment
    Also suggest do I need to do any configurations in SAP web As
    Thanks,
    venu.

    HI,
    With the above blog ref by Michal , see the below links also,
    /people/alessandro.guarneri/blog/2006/03/27/sap-xi-lookup-api-the-killer
    /people/amjad-ali.khoja/blog/2005/12/16/slaw-a-new-logging-tracing-framework-for-xi
    /people/amjad-ali.khoja/blog/2006/02/07/using-dom4j-in-xi--a-more-sophisticated-option-for-xml-processing-than-sap-xml-toolkit
    Also my be useful..
    /people/community.user/blog/2007/01/09/enterprise-soa-explorations-reflections-on-database-integration
    /people/anne.tarnoruder/blog/2006/10/26/reusing-code-with-pdk-for-net
    /people/piers.harding/blog/2006/05/18/ruby-on-rails-with-ajax
    Regards
    Chilla

  • How to log Synchornous Messages in XI

    Hi,
    how to log Synchornous Messages in XI ?

    Michal has explained it clearly .....with screen shots
    Check the below blog
    The specified item was not found.
    Thanks,
    Karthik

  • How to Fix ''The messaging interface has returned an unknown error. If the problem persists, restart Outlook.' Error

    How to Fix ''The messaging interface has returned an unknown error. If the problem persists, restart Outlook.' Error, user has outlook 2007 connected to exchange 2010 server , I tried scan pst, configuring new profile but no luck so far. Please suggest !
    Aditya Mediratta

    Hi,
    Please try the steps mentioned below and check if it helps:
    Open Computer > Local Disk C > Program Files > Microsoft Office > Office 12 > Outlook.exe.
    Right click on outlook.exe and click on Properties and then click on
    Compatibility tab. Uncheck the box ‘run this program in compatibility mode for’ under compatibility mode, click on Apply and OK.
    Note: If you are using 64 bit computer then the file location of the file will be
    Computer>Local Disk C>Program Files (x86) >Microsoft Office>Office 12>Outlook.exe
    Similar thread:
    https://social.technet.microsoft.com/Forums/en-US/aa396c9e-0ce5-4de5-99e3-4f0d771b07e0/exchange-2007-messaging-interface-has-returned-an-unknown-error
    Best Regards.

  • How to delete the Unwanted Z-programs

    Hi all,
    How to delete the unwanted Z-program from $TMP development class.
    Thanks,
    Govindarajan Umadevi.

    Hi,
    YOu can go transaction SE80, Choose package $TMP.
    And click Display.
    Here you will find all your Z programs. Just right click and delete them.
    If you are using Latest versions(I think from SAP 4.7D), you can even select all by pressing mouse key and right click and can able to delete multiple items at single time.
    BUt becareful, it contains other develper objects also as it is a common place.
    Thanks,
    Ramakrishna
    Message was edited by: Ramakrishna Prasad Ramisetti

  • What does the message "Another program has control of HP imaging device mean"?  I get this when I am trying to scan.

    What does the message "another program ha control of HP imaging mean when I am trying to scan something. How do i correct it?

    You may need to ask HP. I had the same issue with a networked (via ethernet) home HP multi-function. Sometimes the only way to get it to scan was to completely disconnect it from the network and connect it to only one Mac with a USB cable. Even that did not alwatys work.
    Eventually, Apple started pushing out HP printer updates via Software Update. One of those finally made that error message to go away.
    So run Software Update and see it there are new drivers that Apple made avaialble.

  • How to delete the messages in the purges folder?

    if the mailbox is enabled the single item recovery, then the messages would move from deletion folder to the purges folder After running the following script,
    Search-Mailbox dave -searchdumpsteronly
    -deletecontent
    so my question is how to delete the messages in the purges folder with some script or retention policy?
    Please click the Mark as Answer button if a post solves your problem!

    Thank you all,
    As the mailbox is enabled single item recovery.
    I just want to make the items neither in deletion folder, nor in purges folder.
    So I think there are two ways to achieve this.
    Method 1,disabled the single item recovery. then delete the items in deletion folder ,so it wouldn't enter to the purges folder, it just deleted permanently. then enable the single item recovery
    Method 2,delete the items in deletion folder,then the messages move to the purges folder, then delete the messages in purges folder.
    the Method 1 is not so good ,as it need to disable the single item recovery firstly, then enable  single item recovery .
    So I want to use the Method 2
    Please click the Mark as Answer button if a post solves your problem!

  • How to print the message in 2 lines?

    How to print the message in 2 lines?
    Here i am having it like this... MESSAGE i000(zm) WITH lv_uname.
    here I want to print lv_uname in 2 lines because it lengthy one.
    Thanks,
    Sridhar.

    No man, itas not comming..I am using the below logic to print my message:
        CONCATENATE text-I01 lv_printdate1 text-I02 INTO lv_printname
    SEPARATED BY space.
        MESSAGE i002(zm) WITH lv_printname.
    its printing in a single line...

  • How to Customize the Message "No Row Returned" from a Report

    Hi,
    I've been trying to customize the Message "No Row Returned" from a Report.
    First i followed the instructions in Note:183131.1 -
    How to Customize the Message "No Row Returned" from a Report
    But of course the OWA_UTIL.REDIRECT_URL in this solution did not work (in a portlet) and i found the metalink document 228620.1 which described how to fix it.
    So i followed the "fix" in the document above and now my output is,..
    "Portlet 38,70711 responded with content-type text/plain when the client was requesting content-type text/html"
    So i search in Metalink for the above and come up with,...
    Bug 3548276 PORTLET X,Y RESPONDED WITH CONTENT-TYPE TEXT/PLAIN INSTEAD OF TEXT/HTML
    And i've read it and read it and read it and read it and can't make heads or tails of what it's saying.
    Every "solution" seems to cause another problem that i have to fix. And all i want to do is customize the Message "No Row Returned" from a Report. Please,...does anyone know how to do this?

    My guess is that it only shows the number of rows it has retrieved. I believe the defailt is for it to only retrieve 50 rows and as you page through your report it retrieves more. So this would just tell you how many rows was retireved, but probably not how many rows the report would contain if you pages to the end. Oracle doesn't really have a notion of total number of rows until the whole result set has been materialized.

  • How to get the Deliver Quantity against Schedule Line Quantity

    Hi,
    I have specific requirement for a report where we need to determine the delivery qty against the schedule line qty for a sales order. In sales order in schedule line tab system shows the delivery qty. The field is VBEPD-VSMNG. VBEPD is a structure and I could not find the table in which this is actually stored. Does anybody know how to get the delivery qty for schedule line?

    Hi,
    U can check the following tables:
    VBEP (Sales ScheduleLines) VBEP-VBELN =VBAP-VBELN and VBAP-POSNR = VBEP-POSNR
    LIPS (SalesDoc:Delivery Items) LIPS-VGBEL =VBAP-VBELN and LIPS-VGPOS =
    VBAP-POSNR
    VBEH (Schedule LineHistory) VBELN POSNR ETENR
    Regards
    Kannaiah

  • How to check the messages in solution manager?

    hai experts !
    how to check the messages in solution manager?
    in which transaction do we see them?

    Hi Kiran,
    From what I gather from your brief question, you are perhaps looking for CRM_DNO_MONITOR that would display all queries created from Satellite/SolMan system itself, as support messages.
    If you are looking for Notifications underlying those messages, please look for DNOTIFWL.
    For more specific answers, please provide more description of what you are looking for.
    Trust this helps.
    Regards,
    Srini

Maybe you are looking for