Read current background job name

Hello,
I would like to know if there exists a way to find out the name of the background job where your ABAP program is currenctly running in.
Does there exist a function that I can call ?
Best Regards,
Erwin

I agree with Rich. I use the same function module and works very well.
call function 'GET_JOB_RUNTIME_INFO'       
    importing                              
*         EVENTID                 =        
*         EVENTPARM               =        
*         EXTERNAL_PROGRAM_ACTIVE =        
*         JOBCOUNT                =        
         jobname                 = jobname 
*         STEPCOUNT               =        
    exceptions                             
         no_runtime_info         = 1       
         others                  = 2       
Regards,
Subramanian V.

Similar Messages

  • How to get Current Background Job name and Job Count programmically?

    Hi all,
            I have a requirement wherein I need to get the Current Background Job name and Job Count in the program and store it in a custom table. In other words, whenever I schedule a particular program ( This is a Std program) in background, I need to update this table with the Job Name and Job Count. This will be used by another program later to read the Job Information from table TBTCO. TBTCO has key fields Job Name and Job ID. The sheduled program will be a SAP standard program and I'll be writing the logic to get the info in an Implicit Enhancement Spot.
    Is there anyway I can do this? Any FM to get this information?
    Thanks,
    Mahesh.

    Hey Adrian,
                             Thanks a lot. This is what exactly i was looking for. Appreciate it.
    Mahesh.

  • How to get the Background job name

    Hi,
    I am executing a report in background and i want to get the background job name in the same report program. How can i get the same.
    Regards,
    Rajgopal Dara.

    Hi,
    for this fm is used 148 times in our system, I made a check program and it works:
    report  zsbatchfm.
                                                                                    data: xv_jobcn type btcjobcnt.
    data: xv_jobnm type btcjob.
    data: xv_stepc type btcstepcnt.
                                                                                    call function 'GET_JOB_RUNTIME_INFO'
      importing
    *   EVENTID                       =
    *   EVENTPARM                     =
    *   EXTERNAL_PROGRAM_ACTIVE       =
        jobcount                      = xv_jobcn
        jobname                       = xv_jobnm
        stepcount                     = xv_stepc
      exceptions
        no_runtime_info               = 1
        others                        = 2.
                                                                                    if sy-subrc <> 0.
      write:  /1 'SY-SUBRC = ', sy-subrc.
    else.
      write:  /1 'JOBCOUNT  = ', xv_jobcn.
      write:  /1 'JOBNAME   = ', xv_jobnm.
      write:  /1 'STEPCOUNT = ', xv_stepc.
    endif.
                                                                                    commit work.
    In online mode you get a SUBRC = 1, in batch mode you get the informations (here: in SPOOL)
    Please check it on your system!
    Regards,
    Klaus

  • Background job name

    Hi All,
    Background job related info. not getting retrieved when using function module 'SAPWL_READ_STATISTIC_FILES' (version SAP ECC 5.0 compatible) in our SAP ECC 6.0 whereas if I use 'SWNC_STAD_READ_STATRECS' I'm getting the required info.
    Can anyone let me know why FM 'SAPWL_READ_STATISTIC_FILES' doesn't give the required info. in SAP ECC 6.0?
    Thank you.
    Gandhi Subramani

    Hi,
    It would help you ,
    Make your report automatically processed in background when it is being executed using JOB_OPEN, SUBMIT and JOB_CLOSE like following[example code],
    DATA: d_jobcount LIKE TBTCJOB-JOBCOUNT,
               d_jobname LIKE TBTCJOB-JOBNAME.
    03
    04 d_jobname = 'JOB1'. " Here you may give the job name what ever you insist.05
    06 CALL FUNCTION 'JOB_OPEN'
    07 EXPORTING
    08 jobname = d_jobname
    09 IMPORTING
    10 jobcount = d_jobcount
    11 EXCEPTIONS
    12 cant_create_job = 1
    13 invalid_job_data = 2
    14 jobname_missing = 3
    15 OTHERS = 4.
    16
    17 IF sy-subrc NE 0.
    18 MESSAGE s368(00) WITH 'Error Creating Job'
    19 sy-subrc.
    20 EXIT.
    21 ENDIF.
    22
    23 SUBMIT <REPORT_NAME>" call the same program in Background with different job names 24
    VIA JOB d_jobname
    25 NUMBER d_jobcount
    26 AND RETURN.
    27
    28 CALL FUNCTION 'JOB_CLOSE'
    29 EXPORTING
    30 jobcount = d_jobcount
    31 jobname = d_jobname
    32 strtimmed = 'X' " Immediate
    33 EXCEPTIONS
    34 invalid_startdate = 1
    35 jobname_missing = 2
    36 job_close_failed = 3
    37 job_nosteps = 4
    38 job_notex = 5
    39 lock_failed = 6
    40 OTHERS = 7.
    41
    42 IF sy-subrc > 0.
    43 MESSAGE s368(00) WITH 'Closing Job Failed'
    44 sy-subrc.
    45 EXIT.
    46 ENDIF.

  • HOw to find out a report name when you know only the name of background job

    Hi experts ,
    my question is i need to find out teh report name for which i knew only the background job name of the report .
    thanx
    Venky.

    Go to tcode SM37->Give job name and execute->choose tool bar button STEPS (Disply Steps list) ->Then you will get program or command

  • How to find Spool number for a 2 steps background job.

    Hi All,
    How to find spool number (and also the background job name ) for a 2 steps background job.
    in the table TBTCO i can see step numbers but i dont get the spool number. Is there any link between TBTCO and TSP01.
    Also after getting the spool number i need to drill down on ALV report. I hard coded the spool number and was able to drill down using BDC and call transaction but when i press back button it is not returning to the ALV report.
    Thanks,
    Shiva.

    Which one creates the spool? (first one I guess)
    What kind of spool? (WRITE, sapscript, smartform, pdf...)
    Do you use special statements like NEW-PAGE, or other things?
    Are you sure that the spools are generated by these jobs? (did you compare the spool generation times and job run dates to be sure...)

  • Thru MEB4 the Tax amount and Tax percenatage not trigger in Background Job

    Hi,
              When I am executing the T.Code- MEB4 (Rebate Settlement) thru Foreground the Vendor Rebate Amount and Tax are showing.
                                      When I am executing in Background job the Tax amount and Tax Percentage are not triggering (Only the Rebate amount only showing) after execution of Background job in when viewing the job display.
                       Background Job Name: RWMBON01.
       Please suggest.

    Shankar,
    Thanks for reply.
    If I don't put amount in the basic data tab( MIRO) then it does not allow to "simulate" or "Post". But here I can simulate and Post
    I check every thing in WHT Config but I could't found the solution.
    I want to tell another thing, we recently went to patch upgrade from Version 4.7 E  SP 22   to 4.7 E  SP30.
    My question, Is the pacth upgrade affects in anyway???
    If any suitable answer appreciatable.
    Thanks once again for your reply.

  • WHICH TABLE STORES SPOOL REQUEST GENERATED BY BACKGROUND JOB ?

    Background job is generating multiple request.
    i am not able to find the table which stores all the spool request for a particular background job.

    i know the table for spool request :  TSP01
    But how should i link it to background job name ?
    i want the link between background job name and spool request generated by it......
    TBTCPV is the view but it stores only one spool request.....rather than multiple spoolreq generated by background job..

  • How to setup background job for QI06

    Dear all,
    We have massive QIR to create and the volumn is extremely big to run in foreground in QI06.
    Can you show me the steps to setup QI06 to run in background, and how to view if the background job is complete, etc.
    Appreciate millions.
    Tuffy

    Hello,
    Just enter all the details in QI06. like:
    Complete list of Materials in Material field +plant+ vendor. ( if you have one plant then its ok and if you have same material with different plant and vendor combination then better to set variants plant wise)
    ENter rlease until, model inspection type ( if you have any )
    Now. goto Program and there is an option for EXECUTE in BCKGRND. clcik on it .
    Provide background job name and time for its job start and period ( If you want periodic job like monthly, weekly or daily etc.)
    then execute it.
    and monitor the job via SM37.
    Regards

  • Table for background job spool list ?

    i know the table for spool request : TSP01
    But how should i link it to background job name ?
    i want the link between background job name and spool request.
    TBTCPV is the view but it stores only one spool request.....rather than multiple spoolreq generated by background job..

    Hi,
    Table TBTCP has the Spool Request field PLIST field as well as Jobname JOBNAME field in it. Youc an link them together.
    Regards,
    Anji

  • Background Job Monitoring

    Hi everbody,
    Please tell how to get the program name  which r scheduled in the background jobs  in SM36,37 if we know the background job name.
    Thanx and regards,
    Rajvinder Sahni

    Hi Rajvinder,
                Just look into table <b>TBTCP</b>. It will gives you about Background Job Step Overview.
    Give background job name in field <b>JOBNAME</b> then it will you report name in field <b>PROGNAME</b>.
    In addition to this there is another table which gives about Job Status is <b>TBTCO.</b>
    Thanks,
    Vinay
    Note: Reward points to all helpful answers
    Message was edited by: Vinaykumar Gorrela

  • Background Job with User Name

    I am trying to submit report program in background job. I want to submit it with specific user name so I am submitting with user name as 'ABC'  as below
    data: user type sy-uname.
    user = 'ABC'.
    SUBMIT z_program AND RETURN
                 WITH matnr = matnr
                 WITH werks = werks
                 USER user
                 VIA JOB jobname
                 NUMBER jobcount
    But it creates job with current user(sy-uname) running the program and  not 'ABC'. How I can change it for specified user?

    SUBMIT z_program AND RETURN
    WITH matnr = matnr
    WITH werks = werks
    USER user
    VIA JOB jobname
    NUMBER jobcount
    AND RETURN.    "you forgot to return back
    Of course the user should be the one existing in the system. I guess there is no such ABC. Find the one which exists (use i.e. su01).

  • Background job in APO does not start because of invalid user name

    Hello,
    I have a macro in a planning book and the /sapapo/cons_check program which a triggered via a background job. Now, I have problems with the start of the job:
    At the time the job was created inside SAP, an error occured. The job contains invalid values.
    The user name within the job does not exist any more.
    Now, I try to change the user name of the job (via step in sm37), but the error occured again.
    I have the possibility to create the invalid user name once again in su01.
    But I want to change the user name of the job - does somebody know how to do it?
    Thanks for your help!
    Kind regards
    Heinz

    Hello Heinz, this looks surprising.
    It's quite easy to change the user name in the SM37 job step, and we haven't faced issues with this.
    Could you check how many jobs are in either "scheduled" or in "released" status, and change steps for all of them? May be you changed the scheduled job, but the released job wasn't changed.
    Use your job name and give a search date as 1-2 years in the past, and around 1 month in the future. With this time horizon, you should most likely be able to capture all the relevant jobs having the same name that you are using.
    Now change the user name in step for all the jobs received above to be fully sure.
    One more trial could be to copy the current scheduled job to another job, modify the user name in this newly created job and then delete the old one.
    One of the above trials might possibly help you in some way, else its very tough to understand/explain your situation.
    Thanks - Pawan

  • Actual Varaint Name used in the Background Job

    Hi,
    When a program is executed in Background made the selection screen variant selected is not the one that is shown in the Background Job Step information. There we see variant as &0000000000044.
    I want to find the actual variant that was selected at the time of running the program in background mode.
    Thanks.

    Hi,
    I also faced the same issue and after my R&D i found a workaround for this. Check this out.
    Create a selection screen parameter and hide it.
    PARAMETERS: po_varnt TYPE sy-slset NO-DISPLAY.
    Now place below code in AT SELECTIO-SCREEN OUTPUT event.
    AT SELECTION-SCREEN OUTPUT.
        CHECK sy-batch IS INITIAL.
        CLEAR po_varnt.
        MOVE sy-slset TO po_varnt.
    If you are running in background by pressing F9 from selection screen, Use your hided parameter po_varnt for the variant name instead of sy-slset.
    If you are running the report in foreground or through SM36 then you can use sy-slset to know the variant name.
    Thanks,
    Vinod.

  • How to schedule the background job using current selection screen field val

    Hello Friends,
    How to schedule the background job using current selection screen field values.
    after completion of the job the spool should be sent as a mail to SAP Inbox.
    Is there any way to create the variant dynamically by reading the current selection screen values.
    Thanks,
    Ravi

    Hi,
    To get the variant details you can use teh following FM.
    'RS_VARIANT_CONTENTS'.
    Regards,
    Ankur Parab

Maybe you are looking for

  • URGENT: SSO for multiple Applications

    I have integrated 4 different applications in a single domain with OAM for SSO. Individually all apps are working fine (for SSO). Now I want to Apply only single login for all the applications. So what changes need to be done in OAM side? Continuing

  • Can't get a text field to atuo populate based upon a dropdown selection

    I have a drop down box with 3 values that can be selected: Dropdown2 = 101-3 subd.A                       101-3 subd.B                       101-3 subd.C I am trying to get a text field to auto populate based upon the selection: if Dropdown2 = 101-3

  • Spry tabbed panel widget

    I am inserting the sprytabbed panels2 from adobe exchange.  I can't figure out how to change the width of the boxes above the tabbed panel content.  The default is extremely large and takes up too much space. 

  • Files not updating in testing server OS X10.6 Snow LEOPARD CS 4

    I have a site that I developed previous and moving to CS 4.  I set up the testing server and it appears to work when ever I create a new file.  It does not work when I change a file.  It does not copy the new file over the old. Mac OSX 10.6 running a

  • Redirect based on URL content

    Hi, I have received a request to forward traffic based on http header; specifically if the header contains www.sample.co.uk it should go to its regular serverfarm, if it contains www.sample.co.uk/wordpress it should go to a different serverfarm, prob