Batch jobs and deleting one time variants

Hi,
I have a need to generate a background job with up to
21 steps each step needing a different variant determined
at creation.
I have written an abap that will create the job, steps
and variants for the batch stream. This works fine.
  My problem is trying to delete the variants I created
  at the end of the batch stream. I have tried setting
  up another step to delete the variant but that fails
  as RS_DELETE_VARIANT gives an error if the variant
  exists in a current batch job, which it does in this
  case as the variants are used in previous steps.
  Ideally I would like to create variants as SAP itself
  does when you dynamically submit a job to batch.
  How can I get around this problem elegantly ?
Allan

Dear Allan
  Welcome to SDN.
  One solution that i can propose is:
  With the ABAP Program that submits the job, do the following:
  Step 1: Open the job using FM: JOB_OPEN.
  Step 2: Submit all programs using SUBMIT statements and values for parameter with reference to the job-id and job counter.( I guess if we use JOB_SUBMIT here we will be specifying the variant name which already exists).
  Step 3: Close the job using FM: JOB_CLOSE.
  Using the above procedure the variants created will be temporary and no need to delete.
Below is an example which can help you understand the same:
PERFORM JOB_OPEN USING SY-REPID CHANGING L_JOBCNT.
SUBMIT Y00_SD_F2_003 WITH P_BUKRS = P_BUKRS
                     WITH P_FILE1 = P_OFILE
                     WITH P_RUN = P_RUN
                     VIA JOB SY-REPID NUMBER L_JOBCNT
                     TO SAP-SPOOL WITHOUT SPOOL DYNPRO
                     WITH DESTINATION = 'HPMISPRT'
                     WITH IMMEDIATELY = SPACE
                     WITH KEEP_IN_SPOOL = 'X'
                     AND RETURN.
PERFORM JOB_CLOSE USING L_JOBCNT SY-REPID.
*&      Form  JOB_OPEN
FORM JOB_OPEN  USING    P_REPID
               CHANGING P_JOBCNT LIKE TBTCJOB-JOBCOUNT.
DATA: L_REPID  LIKE TBTCJOB-JOBNAME.
   L_REPID = SY-REPID.
   CALL FUNCTION 'JOB_OPEN'
     EXPORTING
       JOBNAME                = L_REPID
    IMPORTING
      JOBCOUNT               = P_JOBCNT
    EXCEPTIONS
      CANT_CREATE_JOB        = 1
      INVALID_JOB_DATA       = 2
      JOBNAME_MISSING        = 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.
ENDFORM.                    " JOB_OPEN
*&      Form  JOB_CLOSE
FORM JOB_CLOSE  USING    P_JOBCNT LIKE TBTCJOB-JOBCOUNT
                         P_REPID.
DATA: L_RELEASE(1) TYPE c,           "Job released
      L_REPID  LIKE TBTCJOB-JOBNAME.
   L_REPID = SY-REPID.
   CALL FUNCTION 'JOB_CLOSE'
     EXPORTING
       JOBCOUNT                          = P_JOBCNT
       JOBNAME                           = L_REPID
       STRTIMMED                         = 'X'
    IMPORTING
      JOB_WAS_RELEASED                  = L_RELEASE
    EXCEPTIONS
      CANT_START_IMMEDIATE              = 1
      INVALID_STARTDATE                 = 2
      JOBNAME_MISSING                   = 3
      JOB_CLOSE_FAILED                  = 4
      JOB_NOSTEPS                       = 5
      JOB_NOTEX                         = 6
      LOCK_FAILED                       = 7
      INVALID_TARGET                    = 8
      OTHERS                            = 9.
   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.                    " JOB_CLOSE
   Hope the above info lead you in solving your problem.
Kind Regards
Eswar

Similar Messages

  • Difference between batch job and Background Job

    Hi Forum,
    Can anyone distinguish between batch job and background job for me please ?
    SK

    Hi,
    Batch Job:
    A batch job is a process that runs in the background, often deferred and unattended, to process data in groups (batch) rather than by individual transactions (e.g. a monthly phone bill rather than a bill for each individual phone call). A batch job executes a sequence of programs and technical instructions that are stored in a command file. Progress and error messages are output to a log file allowing users to determine, at any time, if the batch job completed successfully or identify the cause of the problem. Because batch jobs run in the background they are less visible to the end user.
    In a business-computing context, batch job scheduling implies the automatic execution of background tasks (batch jobs) at pre-determined points in time (e.g. every day at 8pm, midday on Wednesday).
    3 types of batch job scheduling can be distinguished: native, basic and advanced batch job scheduling.
    Most operating systems and some business solutions software come equipped with native batch job scheduling tools that provide a limited service (e.g. Windows Scheduled Tasks, UNIX crontab, SAP CCMS) locally to each installation. However, business processes may span multiple platforms, applications, countries and companies. Their complexity may require much more functional power as provided by basic batch job scheduling including national and regional variations in the working calendar, sequence variations according to the day of the month, triggering of jobs by the successful completion of preceding jobs, elimination of gaps and reduced batch windows. Major benefits of basic batch job scheduling are enhanced productivity, operations reliability and cost-reduction. For e-business applications that require real-time processing, the distance between interactive individual processing and batch processing tends to decrease. Advanced batch job scheduling can handle these advanced requirements: event-driven scheduling for a real-time synchronization with interactive processing, just-in-time scheduling to run operations as soon as possible, cross-platform and cross application services for the entire IT landscape, real-time overall monitoring to track background operations for all applications on all servers.
    The standard benefits of batch job scheduling are drastically amplified when job schedulers can handle the end-to-end automation and monitoring requirements for all background operations.
    To schedule a back ground job follow the below steps:
    1. Use Transaction SM36.
    2. Assign a job name.
    3. Set the job’s priority, or “Job Class”:
    High --- Class A
    Medium --- Class B
    Low ---Class C
    4. Here you can specify,when the job is to start by choosing Start Condition. If you want the job to repeat, or be periodic, check the box at the bottom.
    Else click on the immediate and save this.
    5. Now,define the job’s steps by choosing Step.
    Here you need to give the ABAP program that has been used and the name of the variant thats being used.
    6. Save the fully defined job to submit it to the background processing system.(You need to click save button on the main screen i.e SM36)
    7. When you need to modify, reschedule, or otherwise manipulate a job after you've scheduled it the first time, you'll manage jobs from the Job Overview.
    8. Release the job so that it can run.
    The job, even those scheduled for immediate processing, can not run without first being released.So,do remember to release.
    Hope this helps you.
    Regards,
    Rakesh

  • Transaction CJI3 AND  - batch job and output in excel format

    We are trying to schedule a batch job and would like to have the output in an excel file.  Is there a way to enhance CJI3 and FMEDDW to have the output in a excel file.  I've looked at the Layout for creating the disvariant and I know you can have the output in excel format in the foreground, but I'm looking to put an excel file on the SAP DIRECTORY.
    Has anyone done this?
    Thank you.
    Linda

    Talking about Enhancement Options, I believe you can achieve it using Enhancement Implementation. There must be one towards the end of the program just before the ALV is displayed. You can create an implementation of the implicit enhacement spot and output the file to a location maintained in some VAR (to keep the output location dynamic as we don't have it on the select screen).
    My reply is not to the point but I hope you find a way using enhancement spots.
    Should you need any help with enhancement implementation, following blog is good enough:
    Blog - [Enhancement Framework|http://www.sdn.sap.com/irj/scn/weblogs;jsessionid=%28J2EE3417800%29ID1759109750DB10206591421434314571End?blog=/pub/wlg/3595]
    or you can ask back here.
    regards,
    Aabhas
    Edited by: Aabhas K Vishnoi on Sep 24, 2009 10:40 AM

  • CIF Batch jobs and LUW

    Hi Experts,
    Can anyone tell me about CIF Batch jobs and LUW please. Explain these two in detail whether they are the same or any difference and any relationship between both.
    Thanks in advance
    Suvecha

    Hi
    LUW stands for Logical Unit of work.
    Its a way of binding data together(multiple CIF queues under a single entity)
    It is useful to maintain the atomicity of data.
    For ex :- Say u have 5 materials under a single TLB order and u have sent that order to R3 for recieving number.If any of those materials is having master data which doesn't satisfy the filter criteria for Integration Model then the whole LUW will be blocked.
    Signifies the entire data set will be passed on as a single LUW.
    For CIF batch Jobs could you please explain what exactly you want to know.
    Thanks
    Amulya

  • Batch job and background job

    Hi
    what is the difference between a batch job and backgroun job ??
    thanks
    kumar

    hi kumar,
    As far as I know
    Batch job are the jobs created with sessions. You can process those sessions in SM35. These are not direct update methods.
    Where as the background jobs are the jobs running in the background with out user interaction. Once you schedule the job for the background job it will run with out user interaction according to the given schedule.
    You can run the batch jobs also in background.

  • Difference between extraction as a batch job and BADI

    Hello
    Please can somoene explain me what does this mean:
    The extractor is based on the running of a BADI when tickets are saved rather than extraction as a batch job
    thanks

    Hi Tom,
    Batch Job and BAdi's are two different things but their purpose is somewhat similar i.e. background processing.
    BAdi's are SAP enhancmenents where in you can attach your own code to SAP code which is getting executed so that along with std code to ger our job is done.
    Background jobs are scheduled to run in system periodically. Here we can code like it will check for certain things and then if required it will execute some code.
    Thanks and Regards,
    Vaibhav Pendse

  • PL/SQL batch jobs and error reports handling

    Has anyone ever had to write exception and statistics reports from a PL/SQL batch job and how have those been handled? I have 3 options below not but sure what is best (or is there another) way to do this.
    I have a series of batch jobs that are written in PL/SQL. A unix script will invoke a SQL*Plus script that calls a stored procedure. The stored procedure may call other procedures and functions. I'd like to collect all the errors and write them out a report that the user can review. I was thinking of just writing a message using DBMS_OUTPUT and spool that to a file in my script, but I have concerns that other message in the buffer may end up in the report. The other thought was to use UTL_FILE but then I would have to make sure the file handle got passed thru all the procedures and functions appropriate. The last thought was to write to a table ( a temporary PL/SQL table) , and then read that table and write to a file using UTL_FILE (don't have to pass file handles that way) - but I'm not sure if a called function or procedure can access that table.
    null

    <BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by mirp:
    Has anyone ever had to write exception and statistics reports from a PL/SQL batch job and how have those been handled? I have 3 options below not but sure what is best (or is there another) way to do this.
    I have a series of batch jobs that are written in PL/SQL. A unix script will invoke a SQL*Plus script that calls a stored procedure. The stored procedure may call other procedures and functions. I'd like to collect all the errors and write them out a report that the user can review. I was thinking of just writing a message using DBMS_OUTPUT and spool that to a file in my script, but I have concerns that other message in the buffer may end up in the report. The other thought was to use UTL_FILE but then I would have to make sure the file handle got passed thru all the procedures and functions appropriate. The last thought was to write to a table ( a temporary PL/SQL table) , and then read that table and write to a file using UTL_FILE (don't have to pass file handles that way) - but I'm not sure if a called function or procedure can access that table.
    <HR></BLOCKQUOTE>
    Just a thought
    If You use utl_file, You can write all opeations with files in a separate package with public variables of file handles and so on. Not necessary to pass all variables to each procedure and function

  • Difference between Batch jobs and background jobs...

    hi APO Gurus ....
    This may sound a very silly question. What is  the exact difference between a batch run and executing a background job ?

    If i understand correctly  your question is  executing a program (for example) in background and running in a batch jobs.  You can execute a program in background while you are online, go to menu program->execute in background and enter print parameter, schedule parameter. System creates and starts job dynamically. You can check in SM37.  Batchjob is you create job using   SM36 (with program and Variant) define run frequency. System automatically run job in specified frequency.  I my experience, technically both are same, system behaves exactly same. One dynamically creates job other one runs on predefined freq.
    Thanks,
    Niranjan

  • Binding in graphics and deleting one

    Hi guys,
    i got a question.
    I insert graphics into my Page. After I did that, i try to delete one. It works fine, but the result is, that all my graphics are gone and I need to insert them all again.
    So here is my Question:
    How can I solve that problem?

    Hi
    I am trying to understand your problem but I am not clear whether you are talking about design time problems or run time problems with database.
    1. Are you placing image components on to a page and trying to delete one image component by hitting delete key ?
    2. Are you talking about the deletion of images from database ?
    For (1) .. there is no problem in deleting image components from a page.
    For (2).. I need to look into your code to see whats going wrong when you delete image from database.
    Please let me know if you are having problems other than these two.
    Thanks
    Runa.

  • CS4 Media Encoder batch jobs, and .avi ffdhshow

    I have two distinct, but slightly related questions to ask.
    First I should point out: I've used Premiere and After Effects for creative purposes before, but today I am using Adobe software for a more practical purpose: some engineering research work. Essentially, I have thousands of hours of video to process, I have all the firepower needed to perform it, I am currently limited by the ammount of time I am stuck clicking away at the computer.
    Essentially my job right now is to convert and concatonate 1 minute segments into larger cohesive files. I say convert because the supplied files are encoded as .avi with an obscure proprietary surveillance video format (Mavix, for those of you familiar, doubt it though, even a google search won't bring up anything). It's okay, I have the VFW installed and so far I've been doing fine (if not slowly) pre-converting to NTSC DV default with AME CS4 and then importing into VDub (handy because of it's automatic file appending feature) at which point I compress with ffdshow (gave me the best performance considering quality, compression and processing perfromance). Vdub is also handy because I can take better advantage of multi-cores (8 per machine) by running Vdub jobs and AME jobs simultaneously. I am still amazed how mult-tasking on these machines gets me absolutly no performance hits.
    Why is it that I am using AME? It seems to be the only thing that can decode these Mavix files (I've tried them all). And only a direct convert through AME... if I open it up in premiere first, then export it, the video glitches.
    Question 1:
    Right now, the biggest challenge is batch converting videos. I can drag up to 70-75 videos (regardless of hardware) into AME before it starts rejecting files. I would like for it to pre-process thousands of them at a time automatically. Any ideas how the queue size can be increased or how I can properly batch convert thousands of files at a time? Checking back at a computer every 20 minutes for a week is a real waist of time when I could leave it sit over the weekend in a corner and do it's thing.
    Question 2:
    I wanted to reuse the concatenated files that Vdub spat out (.avi ffdshow H.264 -> no comments please, I have a good reason for doing this) for some other work. I just want to know if it is possible to get Premiere to work from these files directly or if I have to reconvert them to somethign else first. So far, importing them yields black video.

    Hi,
    I have absolutely no experience with this...but as to question number 2... I did a google search on ---avi ffdshow h264 cs4 ----and found this info
    As you probaby know a lot of people using premiere are adament about NOT loading codec packs, and in particular ffdshow and k-lite...but you probably know that or you might not have said " no comments please "....etc.
    That said, there is a part of the following stuff that says something about using cs4 with ffdshow with h264 enabled in the video and something enabled in the sound.. and then the reference to K-lite...but that k-lite post was using ( at that point ) a different editor I think...so take this with a grain of salt and maybe check the ffdshow enabled setting so you can see your video in PP...
    Good luck  ....and I hope your computer doesnt explode  or anything bad happens...which might mean a total reformat and reinstall etc...
    http://forum.videohelp.com/threads/302604-Creative-Vado-HD-AVI-%28H-264%29-Editing
    ·  I also own a Vado HD.
    May I know which editor is compatible with it?
    Quote
    · 13th Apr 2009 09:36 #7
    poisondeathray
    View Profile
    View Forum Posts
    Private Message
    Member
    Join Date: Sep 2007
    Location: Canada
    For simple edits, you can use vdub (see above)
    If you need a NLE, Vegas Pro 8 will work, if you have ffdshow (h.264 enabled) or x264vfw, but it won't see the audio. So you can open it in vdub and save the audio as wav then import into Vegas
    Premiere Pro CS4 will work, but you need ffdshow (h.264 enabled in the video configuration and MSADPCM enabled in the audio configuration)
    Cheers
    Quote
    · 10th May 2009 23:15 #8
    rogerconnery
    View Profile
    View Forum Posts
    Private Message
    Member
    Join Date: Sep 2006
    Location: United States
    Hi, I just bought a Creative Vado HD and I have 3 clips I just want to paste together.
    I downloaded Virtualdub, downloaded x264vfw, downloaded ffdshow (h.264 enabled) and installed all three. I still can't open any of the Vado HD clips into Virtualdub. I get an error message. Is there another step I am missing?
    Thanks in advance!
    Quote
    · 10th May 2009 23:21 #9
    poisondeathray
    View Profile
    View Forum Posts
    Private Message
    Member
    Join Date: Sep 2007
    Location: Canada
    do you have this version installed?
    http://sourceforge.net/projects/x264vfw/
    if that doesn't work for you , enable h.264 in the ffdshow vfw decoder interface (yellow icon, not red icon), because vdub relies on vfw , not directshow    ( ROBODOG2 NOTE ----GRAPHIC BELONGS HERE.....SEE BELOW )
    Quote
    · 11th May 2009 12:16 #10
    rogerconnery
    View Profile
    View Forum Posts
    Private Message
    Member
    Join Date: Sep 2006
    Location: United States
    @poisondeathray - yes that helped! thank you!!!
    Now that I am able to "edit" my Creative Vado HD videos in Virtualdub, I notice something very strange. Each video clip is approx 30 seconds long. The total combined/merged clips should be approx 2:30 long. However, windows media player (as well as right clicking for properties) says the video is WAY longer than it should be (like 11 min long)!!!
    Anyone else notice this? Is this a virtualdub mistake or human error on my part?
    Quote
    · 11th May 2009 12:49 #11
    poisondeathray
    View Profile
    View Forum Posts
    Private Message
    Member
    Join Date: Sep 2007
    Location: Canada
    Did you do any editing or just append the clips? If you edited portions did you cut on keyframes?
    Did you set "direct stream copy" for video & audio?
    What do other media players (e.g. vlc, kmplayer, smplayer) and mediainfo say about the joined clip ?
    Quote
    · 26th Jul 2009 15:54 #12
    cybereality
    View Profile
    View Forum Posts
    Private Message
    Member
    Join Date: Jul 2009
    Location: United States
    Has anyone found a solution to this issue yet? I can't believe Creative would release a product like this with almost no 3rd-party support. I really wanted to get this camera, but this is a deal-breaker. I managed to get a few raw files from the Vado HD to test. They work fine just for playing in WMP, but I cannot edit the videos in any program I tried. Adobe Premiere CS4 doesn't work. You see the audio but no video. If you try to do basically anything it crashes. Sony Vegas 9 doesn't work either. Same deal, audio with no video. Same issue in VirtualDub. I have ffdshow installed and H.264 is enabled (libavcodec). Do I have any other options here?
    Quote
    · 26th Jul 2009 17:34 #13
    Xpenguin17
    View Profile
    View Forum Posts
    Private Message
    Member
    Join Date: Jul 2009
    Location: United States
    Download and install K-Lite mega codec pack. The ffdshow configuration will be pretty streamlined so you likely won't have to screw around with it after the install.
    Quote
    · 26th Jul 2009 22:56 #14
    cybereality
    View Profile
    View Forum Posts
    Private Message
    Member
    Join Date: Jul 2009
    Location: United States
    Thanks Xpenguin17. I installed the K-lite mega pack and now I can import the Vado HD raw avi files into Premiere. So far everything looks good. Thanks a lot.

  • Can U set breakpoint within a batch job and look at variables?

    Hello friends,
    I am trying to solve a problem that occurs within a program / transaction which can only be executed in background. The transaction in question is FPCOPARA and apparently this program cannot be executed in foreground.
    If I understand well, we cannot set breakpoints within a background job and as a result we cannot inspect variable etc. during job execution. So the question is how to achieve the same goal within a batch job? How did you do it? As this is a standard SAP transacrtion, no program modification can be applied.
    Your help is greatly appreciated.

    Hi......
    After u have executed ur batch job..
    go to sm37 >>select ur job using checkbox>>enter 'JDBG' in transaction box and press enter
    now debugger will start ..initial it will go through system code..after after a while the debugger will reach to your code and den you can debug the remaining report....
    all the best
    regards
    vivek

  • How to view ALL batch job details at one glance using function module

    Hi Experts,
    i need to see all batch jobs details, the information required includes the job name, client number, job frequency .. etc.
    but i need to do it with only FUNCTION MODULE.....
    SINCE THE INFORMATION IS CAPTURED BY THIRD PARTY SYSTEM.......i am looking for any function module
    could you please suggest me any FM's where i can get this information.................
    thanks and regards
    SAM

    Hi,
    You can explore these functional module for SM37 desired details:
    With function module BP_JOB_MAINTENANCE (transaction SM37), you can call the full job maintenance system of the background processing system, starting with the job selection screen.
    Since many users are not familiar with job maintenance and have no desire to search for their jobs, you can use the function modules BP_JOB_SELECT and BP_JOBLIST_PROCESSOR to select and display a list of jobs for the users of your program.
    Use BP_JOB_SELECT to generate an internal table of jobs. Then, with BP_JOBLIST_PROCESSOR, you can display the selected jobs in the list format used by the job maintenance system.
    You can also use BP_FIND_JOBS_WITH_PROGRAM to select jobs that run a particular program. Use this function module with BP_JOBLIST_PROCESSOR to display a job list to your users. Like BP_JOBLIST_SELECT; BP_FIND_JOBS_WITH_PROGRAM offers interactive and silent modes.
    Regards,
    Ashutosh

  • Submit batch job and return control to the user

    Hi
    Have a situation where we need to submit a batch report and then return control to the user of the application before the report is finished. What is the best way to do this? The old application is written using Java and the application is using threads to do this. However, the application is being re-written in App Ex.
    Any ideas would be appreciated.
    Thanks

    You need to use package APEX_PLSQL_JOB.
    You can use the APEX_PLSQL_JOB package to run PL/SQL code in the background of
    your application. This is an effective approach for managing long running operations
    that do not need to complete for a user to continue working with your application.
    Just look for it in the help.

  • Mac Book Pro only lets me type one letter at a time and delete one letter at a time without the quick speed..

    When I hole o e ketter down it will frezze at that one letter.  I can't hold a character down and have it repeat.
    The same with the delete button.  I have to manually delete each letter, one at a time.  I can't have it in "speed mode" where you hole it don and it just keeps going.

    Have you checked the settings for repeat rate and delay in System Preferences > Keyboard > keyboard tab?

  • Scanning batches of photos as one time

    Is there an easy way to scan a batch of photos on the flatbed of a scanner and have the software recognize them as distinct images?  And then save them that way?

    Hello mijcar.
    So we can properly address your question, please tell us what Canon scanner or All-in-One printer you have.  Once we have this information we will try to assist you further.
    This didn't answer your question or issue? Find more help at Contact Us.
    Did this answer your question? Please click the Accept as Solution button so that others may find the answer as well.

Maybe you are looking for

  • How to get sub totals in alv list

    Hi all, i have a data in internal table which need to display by alv lis display, but i need to display sub totals, like sub total by customer, subtotal by state, and complete total amount. In alv we have standard function buttons , by i need by defa

  • Can't reinstall/uninstall Spotify on Windows 7 64-bit

    Because of the problem reported in this topic http://community.spotify.com/t5/Desktop-Windows/Freeze-when-changing-tracks/m-p/4285 I'm trying to uninstall and reinstall Spotify. First problem: uninstalling through Control Panel, Programs and Features

  • Xcode 5 doesn't work with Bots or Jenkins

    I have Mac Mini i5 4G RAM, running OS X 10.9.1 , Server 3.0.1 & Xcode 5.0.2 I created new Bots from Xcode for applications that I build successfully several times from Xcode directly, but when the build comes through xcode Bot it gives the following

  • Column to row conversion using script

    Hello, I am in need of a script to convert a file having 1 column to rows. e.g File is having entries like below 1 2 3 4 5 And I want to convert them like below. 1 2 3 4 5 Can any body help me on this ? Thank you Regards, ~Anoop

  • Why does my sound when watching a movie in itunes fall behind?

    Im running Windows 7 64bit and when I watch movies in iTunes, the sound starts running slow.  It gets so bad that it starts cutting out.  If I pause it and hit play again, it goes right for a minute and then starts over again.  Thoughts?