Write to job log

Hi,
   I am running report in background have used job_open,job_close and submit statement.Actally in my scenario 2 report are running so 2 spool number is getting generate

Hi,
Use the following code :
Afterthe SUBMIT stmt, read the joblog of the called program within the calling program and get the spool numbers.
    CALL FUNCTION 'BP_JOBLOG_READ'
      EXPORTING
        client                = sy-mandt
        jobcount              = g_jcount
        jobname               = g_jbname
      TABLES
        joblogtbl             = g_t_joblogtbl
      EXCEPTIONS
        cant_read_joblog      = 1
        jobcount_missing      = 2
        joblog_does_not_exist = 3
        joblog_is_empty       = 4
        joblog_name_missing   = 5
        jobname_missing       = 6
        job_does_not_exist    = 7
        OTHERS                = 8.
    IF sy-subrc EQ 0.
* Looping at the internal table for the joblog the messages are reported
* to build the joblog in calling program
      LOOP AT g_t_joblogtbl INTO g_wa_joblogtbl.
        MESSAGE g_wa_joblogtbl-text TYPE 'I'.
        FIND 'Spool request'(011) IN g_wa_joblogtbl-text.
        IF sy-subrc EQ 0.
* Find for the spool numbers in the joblog table and append the numbers
* in the internal table g_t_spool
          FIND '0' IN g_wa_joblogtbl-text MATCH OFFSET g_moff.
          g_wa_spool-listident = g_wa_joblogtbl-text+g_moff(10).
          APPEND g_wa_spool TO g_t_spool.
        ENDIF.
      ENDLOOP.

Similar Messages

  • How to write in job log

    Hello. I want to write certain information in a background job log of my ABAP. Because the job last several hours, I need to inform the user the step the job is in.
    Does anyone know how to do that?
    TIA

    This is weird. With your solution the Job log registers an event without description.
    Example:
    11.03.2006  23:09:06  Job started                                                                        
    11.03.2006  23:09:06  Step 001 started (program XXXX, variant &0000000000000, user name xxxx)    
    11.03.2006  23:09:06                                                                               
    11.03.2006  23:09:10                                                                               
    11.03.2006  23:09:13                                                                               
    11.03.2006  23:09:16                                                                               
    11.03.2006  23:09:16                                                                               
    11.03.2006  23:09:16                                                                               
    11.03.2006  23:09:18                                                                               
    11.03.2006  23:09:18

  • Write Message in Job Log from FM

    Hi everyone,
    I´m having an issue trying to find the way to write a message in job log.
    I´ve read a lot of solutions but I can't find anyone that describes how to do it from a function module.
    What i'm saying is that all the answers focus on reports and I have to develop this from a function module.
    If anyone can help me with that, I´ll appreciate it.
    Thanks everyone.
    Best regards.
    Pablo.

    Hi Thomas,
    Thanks por replying. MESSAGE statement does not work.
    Regarding the last question, it can´t be done like that .
    Regards.
    Pablo.

  • How to write log information into SM37 batch job log

    Hi,
    I have a report running in batch mode, and I would like to log the start time and end time for some part of the code (different Function modules). I need to write this log information into the batch job log. Therefore I can check the time frame of my FMs.
    After search the SDN, I can only get some information on how to write log into the application log displayed in SLG1, but that's not I want. I want to write batch log information, and check it in SM37.
    If you have some solution or code to share, please. Thanks a lot.
    Best Regards,
    Ben

    Hi Nitin
    Thanks for the reply. Could you explain it with some code ?
    I tried to use the write statement , but it did not wrok. I could not see the result in SM37.
    write : "start of the FM1 processing".
    FM1 code
    write : "end of the FM1 processing".
    but those two statement did not show in SM37..
    1) how to use  a information message  ?
    2) how to use NEW PAGE PRINT ON and PRINT OFF command. ?
    I would appreciate if you can write some code ,that I can use directly.
    Thanks a lot.
    Best Regards,
    Ben

  • Write to AWS job log

    How can I write to the automation server job log file from my EDK AWS? This AWS does more then just return Groups and Users and I need to write to the log file the results of the additional operations.
    Please let me know how to implements this.

    Currently, the protocol between the portal and the remote web services only permits writing custom log messages from a crawler, but not from an authentication service or a profile service.
    We are considering this feature for future releases; in the meantime, you may want to follow the pattern we use for our own products, which use Log4N or Log4J to write a remote log file. In the case of a critical error that the administrator needs to know about, throw an exception with a message; in 5.0.1 this message did not get put in the job log, but in 5.0.2 it does.

  • Write message to Job log with message class and message number

    hi folk,
    When running a background job I'm able to write a message to the job log using the statement - Message "some text..." type 'I'.
    In the Job log I can see the message "some text.." with a "default" message class and message number (but in my report i don't specify any message ID) so I have no idea it comes from.
    Then I try to send a message where I specify the message class/number etc...using message id 'Z1' number 000 with "some text..." In the job log I now can see the "right" message class "Z1" and the number 000, but the message is empty?
    Please advice how to write a message with the message class and message number.
    Best regards
    LinhNg

    Hi Linh,
    How did you provide the text "Some message"? Did you hard code it or used a text element?
    Regards,
    Immanuel.

  • Message with IDOC number, created by LSMW, missing in job log in SM37

    Hi gurus,
    We have a temporary interface which uses LSMW to create IDOCs and update in SAP. It's used for materials, BOMs and document info records. In LSMW we have defined standard message types MATMAS_BAPI, BOMMAT and DOCUMENT_LOAD for the IDOCs. All these have the same problem.
    A background job runs and starts LSMW. In the job log in SM37 I want to see which IDOCs were created. For some reason this is different in my development system and my test system, and as far as I know all settings should be the same. In the test system LSMW creates more message lines in the job log, than it does in the dev system. Message number E0-097 is "IDOC XXXX added", and this is missing in the dev system.
    This is what it looks like in the dev system:
    Data transfer started for object 'MATMAS' (project 'X', subobject 'Y')             /SAPDMC/LSMW   501    I
    Import program executed successfully                                                             /SAPDMC/LSMW   509    I
    File 'XXX.lsmw.read' exists                                                                               /SAPDMC/LSMW   502    I
    Conversion program executed successfully                                                    /SAPDMC/LSMW   513    I
    Data transfer terminated for object 'MATMAS' (project 'X', subproject 'Y')       /SAPDMC/LSMW  516    I
    And this is what it looks like in the test system. More information, which is exactly what I want in dev system too:
    Data transfer started for object 'MATMAS' (project 'X', subobject 'Y')             /SAPDMC/LSMW   501    I
    Import program executed successfully                                                             /SAPDMC/LSMW  509    I
    File 'XXX.lsmw.read' exists                                                                               /SAPDMC/LSMW  502    I
    Conversion program executed successfully                                                    /SAPDMC/LSMW  513    I
    File 'XXX.lsmw.conv' exists                                                                              /SAPDMC/LSMW   502   I
    IDoc '0000000002489289' added                                                                      E0                         097   S
    File 'XXX.lsmw.conv' transferred for IDoc generation                                      /SAPDMC/LSMW   812   I
    Data transfer terminated for object 'MATMAS' (project 'X', subproject 'Y')      /SAPDMC/LSMW   516   I
    In both cases the IDOC is created and update works fine.
    My only issue is that I can't see the IDOC number in the dev system. I know I can get the IDOC number in WE02, but in this case we have program logic which reads the job log to be able to check IDOC status before sending OK message back to the other side of the interface.
    I hope any of you can have an idea how I can update somewhere to get message E0-097 with IDOC number into the log.
    Regards,
    Lisbeth

    Hi Arun,
    If you want to show your messages in the job log you have to use the MESSAGE statement. In case you use WRITE statements an output list be created which can be found in the spool (there is an icon to go to the spool directly).
    Regards,
    John.

  • How to take the cron job log in HP UX?

    Hi,
    How to take the cron job log in HP UX
    I need to run a backup and other stuff everyday. How do I check and start cron service under HP-UX UNIX operating system? How do I write cron jobs?
    A. Cron service is required to run jobs and tasks such as backup.
    You must login as the root to run following commands. Each user that is using the cron service must have a cron configuration file in the /var/spool/cron/crontab directory. Also users are permitted if their name appeared in /var/adm/cron/cron.allow file
    Task: Find out if cron is running under HP-UX
    Type the following command at a shell prompt
    # ps -ef | grep cron
    Open /etc/rc.config.d/cron file
    vi /etc/rc.config.d/cron
    Set control variable to 1 to enable cron: CRON=1
    Set control variable to 0 to disable: CRON=0
    Close and save the file. To start or stop cron you can type the following command:
    # /sbin/init.d/cron start <-- start cron
    # /sbin/init.d/cron stop <-- stop cron
    Task: HP-UX Start cron service
    If cron is not running, simply type:
    # cron
    Task: Edit / create cron jobs
    Type the following command to submit a cron job:
    # crontab -e
    List your cron file:
    # crontab -l
    Backup all your cron jobs:
    # crontab -l > ~/backup.cron.jobs
    Remove ALL cron job:
    # crontab -r
    Task: Crontab file format
    Cron file format is as follows:
    MIN HOUR DATE MONTH DAY /PATH/TO/COMMAND
    0-59 0-23 1-31 1-12 0-6 /root/scripts/backup2tape.shEasy to remember crontab file format:
    * * * * * command to be executed
    | | | | |
    | | | | ----- Day of week (0 - 7) (Sunday=0 or 7)
    | | | ------- Month (1 - 12)
    | | --------- Day of month (1 - 31)
    | ----------- Hour (0 - 23)
    ------------- Minute (0 - 59)To run /root/script/backup at 23:00, every day, enter:
    # crontab -e
    Append following
    0 23 * * * /root/script/backupRun foo job very weekday (MON-Fri) at 6am, enter:
    0 6 * * 1-5 /root/script/backupFor more information refer to cron and crontab man pages.
    Subscribe to our free e-mail newsletter or RSS feed to get all updates. You can Email this page to a friend.
    Related Other Helpful FAQs:
    What is Cron?
    Linux Start and stop the cron or crond service
    Run crontab Every 10 Minutes
    Linux / UNIX Setup and run php script as a cron job
    Stop Ubuntu / Debian Linux From Deleting /tmp Files on Boot
    Discussion on This FAQDavid Says:
    January 15th, 2008 at 12:21 am
    You might note that all files normally found in /etc/init.d, /etc/rc*.d, and others are all in /sbin in HP-UX 10.20 and up.
    Note too that your formatting is off in the description of the /etc/rc.config.d/cron file. Also, if you run /usr/bin/cron instead of /sbin/init.d/cron start, the /etc/rc.config.d/cron file is not used.
    Regards,
    Satya

    I guess it would :)
    btw, how did this piece miss from the contents pasted by the OP ?
    The doc has given all details of CRON and missed where to see the logfiles. :)
    ****Added****
    I tried man crontab in windows, i dont see it.i overlook most of the things, i would have done the same ;)
    Edited by: Bobcatalog on Oct 23, 2008 9:40 AM

  • Error reading job logs of Apps server from Central Instance

    Dear Gurus,
    We have newly installed system with one CI ( cluster environment) and 2 application Instances.
    Systems are recently installed by other team. I am looking into support part after handover.
    We have noticed below error while reading failed background job logs from our CI. If suppose any job is failing, we can read respective job log from that application instance but it throws error while reading job log from CI to either of application instance.
    I checked /sapmnt/SID/global is shared among all 3 servers and i am successfully able to "Touch a" from applications instances.
    Even though i have given "777" permissions to all folders like  /sapmnt/SID , /sapmnt/SID/global , /sapmnt/SID/global/400JOB*
    I am not able to read job log from CI , for same failed job I can read job log from respective application instance.
    Error log :
    Error reading job log JOBLGX00080700X39290
    Message no. BT167
    Diagnosis
    The background processing system was unable to read the job log named in the message.
    This message suggests that there is a problem with the TEMSE storage system of the SAP system.  The TEMSE storage system is a repository for temporary objects, such as job logs and spool requests. Job logs are always stored in the TEMSE as operating system files.
    This error occurs if the TEMSE system is not able to find or access the file that contains the text of the job log that you requested. Possible causes for the loss or unavailability of the job log include the following:
    Someone deleted the required TEMSE file (from the operating system, not from within the SAP system).
    A CRON (or equivalent scheduler) job has deleted the TEMSE file.
    The file system in which the TEMSE stores its files is not mounted or is not accessible (NFS problem, disk failure, or similar problem).
    The TEMSE reorganize or consistency check functions were used within the SAP system and deleted the job log.
    SM21 logs :
    Error 2 for write/read access to a file. File = /usr/sap/SID/SYS/global
    BP_JOBLOG_SHOW: Failed to display jobs. Reason:
    > Error reading job log JOBLGX00080700X39290
    Strange this is I can check failed job log on one application instance frfom other application instance but not from CI.
    Kindly throw some lights where to check.
    Regards,

    Hi Shravan,
    I guess it is related to permission to /sapmnt/SID/global folder. Please ensure owner is sidadm:sapsys in all the systems viz CI, App servers etc.
    Check the mounting options are correctly set with read/write mode.
    Hope this helps.
    Regards,
    Deepak Kori

  • External Operation Job Log

    Hello all,
    I can't seem to find additional information on this. I have written an exteranl operation in c# and I can run it from the portal without any issue. I know that standard error is supposed to be captured in the job log, however I can't seem to figure out how to write to standard error from a c# console application. Console.error doesn't seem to cut it.
    I am using ALUI 6.0 sp1, but I dont' think this has changed much over the years. Has anybody written a c# external operation and been able to write to the job log?
    Thanks,
    Berney

    You could just make it write to stdout and then redirect stdout to stderr like this: "dir 1>&2". I put that in a bat file in the scripts directory and then made the bat an external operation. It wrote to the job logs like this:
    Mar 3, 2009 11:40:55 AM- Starting to run operations (1 total) for job 'stdout dir test ext op Job'. Will stop on errors.
    Mar 3, 2009 11:40:55 AM- *** Job Operation #1 of 1: ExternalOperation [Run as owner 'Administrator']
    Mar 3, 2009 11:40:55 AM- Java Version: 1.5.0_12 from BEA Systems, Inc.
    Mar 3, 2009 11:40:55 AM- OS x86 Windows 2003 5.2 as SYSTEM
    Mar 3, 2009 11:40:55 AM- External Operation Agent for stdout dir test External Operation is starting...
    Mar 3, 2009 11:40:55 AM- Original Script is: "test.bat"
    Mar 3, 2009 11:40:55 AM- Scripts home is: E:\bea\alui\ptportal\10.3.0\scripts
    Mar 3, 2009 11:40:55 AM- Appending E:\bea\alui\ptportal\10.3.0\scripts to test.bat.
    Mar 3, 2009 11:40:55 AM- Full Path to script is: E:\bea\alui\ptportal\10.3.0\scripts\test.bat.
    Mar 3, 2009 11:40:55 AM- Operation has timeout of 0 ms.
    Mar 3, 2009 11:40:55 AM- stdout>
    Mar 3, 2009 11:40:55 AM- stdout>E:\bea\alui\ptportal\10.3.0\scripts>dir 1>&2
    Mar 3, 2009 11:40:55 AM- stderr> Volume in drive E is New Volume
    Mar 3, 2009 11:40:55 AM- stderr> Volume Serial Number is 4CFC-EB07
    Mar 3, 2009 11:40:55 AM- stderr>
    Mar 3, 2009 11:40:55 AM- stderr> Directory of E:\bea\alui\ptportal\10.3.0\scripts
    Mar 3, 2009 11:40:55 AM- stderr>
    Mar 3, 2009 11:40:55 AM- stderr>03/03/2009 11:37 AM <DIR> .
    Mar 3, 2009 11:40:55 AM- stderr>03/03/2009 11:37 AM <DIR> ..
    Mar 3, 2009 11:40:55 AM- stderr>12/18/2008 07:59 AM 5,049 AnalyticsRunJobs.bat
    Mar 3, 2009 11:40:55 AM- stderr>10/08/2008 01:35 PM 2,034 BulkSubscriber.bat
    Mar 3, 2009 11:40:55 AM- stderr>10/08/2008 01:35 PM 3,577 SavedSearchMailer.bat
    Mar 3, 2009 11:40:55 AM- Total Memory = 33554432 bytes, Free Memory = 9573312 bytes, Used Memory = 23981120 bytes.
    Mar 3, 2009 11:40:55 AM- stderr>03/03/2009 11:37 AM 8 test.bat
    Mar 3, 2009 11:40:55 AM- stderr> 4 File(s) 10,668 bytes
    Mar 3, 2009 11:40:55 AM- stderr> 2 Dir(s) 17,469,964,288 bytes free
    Mar 3, 2009 11:40:55 AM- *** Job Operation #1 completed: Process completed successfully; Command line: ""test.bat"".(282609)
    Mar 3, 2009 11:40:55 AM- Done with job operations.
    I don't think much has changed with this in the portal 6.x world, but it looks like stderr is definitely captured in wci 10.3. If there's a problem with an older version, start a support ticket to investigate a possible bug.

  • Writing in SM37 Job Log

    Hi Abappers,
    I have a requirement in which I am displaying all the error messages in an ALV when my program runs in Foreground. But this program runs in background, those error messages must be displayed in the Job Log of SM37.
    I should not raise any error or information messages to come in log automatically as it affects the foreground processing of my program.
    Is there any FM to write in the Job log?? Or can I use the Message statement in such a way that it is not diaplayed in forground?
    Thanks in Advance,

    Hi,
    Try this.
    If you are using ALV grid in the foreground, use the same without without creating the container (basically check the SY-BATCH, before creating a container).  Then the same ALV grid  will create a spool with all the messages during background execution.
    Regards,
    Sharin Varghese

  • Regarding Messages to Job Log

    Hi,
    What is a Job Log.
    i have to write messages to job log.
    how to do this.
    how can i see that messages whether it is written or not.
    how it can be seen to the client/user.
    regards,
    kiran

    Hi Kiran
    Use 'write' to display the message in the job log.
    write : / log_message.
    Place this statement after the block of statements in your program where you want the message to be displayed in the log.
    You can see the job log in SM37 transaction.
    hope this helps you.
    regards
    Message was edited by:
            Sarah Bollavaram
    Message was edited by:
            Sarah Bollavaram

  • How can I mail the Job Log in the form of an excel sheet?

    Daily I have to monitor a Job and I have to retrieve the Job Log in an excel sheet, Format the excel sheet, and then mail the excel sheet and the Job Status(Finished/Cancelled) to Client/Person Incharge.
    I want to automate this entire process. Please guide me, how can I write a program that mails the Job Log, in the form of an excel sheet, to the Client?
    Edited by: Jiten Rajendra Barai on Nov 25, 2008 3:03 PM

    Hi,
    You can use this FM to mail the excel sheet.
    SO_NEW_DOCUMENT_ATT_SEND_API1
    Also have a look at the below thread, it might be very helpful.
    Sending Excel attachment in E-mail
    Cheers...

  • Reporting agent in BW 3.0b- Job log message is-No alert data found

    Hi,
    I am using reporting agent in BW 3.0b to send and alert email to the user.
    There is a query in which I have used one restricted key figure to calculate the exception. I am able to display this in the report. In Bex analyzer I am getting the value.
    But When I schedule the package for Reporting agent I am getting in the job log as " No alert data has been found".
    I searched sdn before posting and did not get proper solution for this.
    Could you please let me know the use of expception in Reporting agent in BW 3.0b. Do I need to write any user exit for this???
    Reards,
    Raghu

    Hi,
    You can define threshold values (exceptions) for a query. Data that varies from these thresholds is highlighted in color or marked with icons. You can use these exceptions to identify deviations from expected results at a glance.
    Defining and Changing Exceptions
    1. In the Exceptions screen area, choose New Exception in the context menu. An entry with the default text Exception <Number> appears and you can edit the description directly.
    2.In the context menu, choose Edit. The exception editor appears; it displays the relevant parts for the definition on tab pages.
    You can also call the exception editor from the Properties screen area by choosing the Edit pushbutton.
    3.      Make the required settings for the definition of the exception. For more information, see Definition of Exceptions.
    4.      Choose OK. You return to the query definition.
    5.      Choose Save Query.
    Removing Exceptions from Queries
           1.      In the Exceptions screen area, select the relevant exception and choose Remove in the context menu.
           2.      Choose Save Query.
    Result
    You have defined or changed an exception for a query. Execute the query. The exception is evaluated online. The cell areas that are affected by the exception appear highlighted in the appropriate color or, where applicable, with icons in Web applications.
    You can display the exception descriptions and activate or deactivate the exceptions you want.
    For more info go through the below link
    http://help.sap.com/saphelp_nw70/helpdata/en/68/253239bd1fa74ee10000000a114084/frameset.htm
    Regards,
    Marasa.

  • Suppress job log messages

    Folks, we have a custom program that calls the BAPI_SALESORDER_CHANGE and it writes a number of information messages (like "Date is in the past", "Not possible to determine a batch", "PO number already exists", so on and so forth) which gets written to the job log. To clarify, when you go to SM37 and select your job and click Job Log, a number of these messages are shown which is generating such a huge log that our job gets cancelled due to its sheer size.  Please note that this is not the SPOOL I am talking about.
    I have tried to call the BAPI in several ways like using "DESTINATION 'NONE'", calling in background task, and also SUBMIT but I still haven't gotten any luck. The huge log is causing problems with one of our jobs and we need it for UAT next week. I have opened a note with OSS and we are running into administrative issues. We do not want to go the Call transaction route.
    Is anybody familiar with this sort of issue? I searched everywhere and could not find anything similar or maybe I am not searching it right. Any help would be greatly appreciated.
    Sridhar

    Thanks Greetson. What you have provided are Sales Order create BAPI's. The RETURN parameters are different from the log messages. Look at my code below. I have no write statements but the BAPI is writing out these. This is an uncommon situation for some. I would appreciate if you can point me to some FM which changes sales order. Thanks a lot.
    report zzsritest2.
    tables vbak.
    parameters: p_vbeln like vbak-vbeln obligatory default '11658'.
    data: l_order like bapivbeln-vbeln,
          l_order_header_inx like bapisdh1x,
          l_bapischdl like bapischdl occurs 0 with header line,
          l_bapischdlx like bapischdlx occurs 0 with header line,
          l_return like bapiret2 occurs 0 with header line.
    start-of-selection.
      move p_vbeln to l_order.
      l_order_header_inx-updateflag = 'U'.
      l_bapischdl-itm_number = l_bapischdlx-itm_number = '00100'.
      l_bapischdl-sched_line = l_bapischdlx-sched_line = '0001'.
      l_bapischdl-req_dlv_bl =  '  '.  " CHANGE HERE
      l_bapischdlx-req_dlv_bl = 'X'.
      l_bapischdlx-updateflag = 'U'.
      append: l_bapischdl, l_bapischdlx.
      call function 'BAPI_SALESORDER_CHANGE'
        exporting
          salesdocument    = l_order
          order_header_inx = l_order_header_inx
        tables
          schedule_lines   = l_bapischdl
          schedule_linesx  = l_bapischdlx
          return           = l_return.
      read table l_return with key type = 'S'
                                   id = 'V1'
                                   number = '311'.
      if sy-subrc eq 0.
        call function 'BAPI_TRANSACTION_COMMIT'
          exporting
            wait = 'X'.
      endif.

Maybe you are looking for

  • Reading from file into an array

    Hello, new to Java and we need to modify a mortgage calculator to read interest rate from a file into an array and not have them hard coded in the program. I have read many post on how to perform this but am lost on where to put the new code and form

  • Can't Update to Adobe Premiere Pro CC 2014.2

    Hello All, I've been trying to update Premiere Pro CC 2014.0 to Adobe Premiere Pro CC 2014.2 on my PC. Adobe Creative Cloud Desktop App is telling me it's up to date, which is incorrect. I followed all of the instructions on the help page entitled "C

  • Calculating roundtime for iviews - Portal performance monitoring

    Dear Gurus, I have a bunch of iviews that need to be monitored. I am running these BI integrated iviews and want to calculate the rountime for them. currently the way I am doing it, is I enter the variable values for each of the iviews and run them,

  • X200 - Windows 7 - Data partition

    I hope this message will be helpful. Our X200 we just bought with Windows 7 (32-bit) had only one C partition for the system, the programs and the data. I wanted to create a new D partition for data. Unfortunately, it was impossible to do it with the

  • Screen saver files inaccessible

    Ok. I've had this iMac for two weeks. Everything was working perfectly out of the box. I love Apple! Anyway. At some point in the last couple of days, my screen savers got nerfed. Not sure how. I initially had it set to "Word of the Day," and when it