FM JOB_CLOSE doesn't wait for pred job even when pred_jobname/jobcount set

Dear experts,
I need to call in sequential order two batch jobs when there is a special condition. It's not always the case, which means when there is no successor task, then the job should be executed immediately. But when there is another waiting in the queue, then
I set the parameters pred_jobcount/pred_jobname so that the next job is executed when the previous is finished.
I tried with the combination of several parameters, read lots of help and checked example programs, but the problem I've got: either both jobs are launched at the same time (so it does';t really wait for the predecessor to be completed sucessfully even if predjob_checkstat is set to X), or the second job is never launched at all! Here is the call of JOB_CLOSE:
AS_PRED contains the correct information of the predecessor job (I verified against SM37 and no problem there). For the first job to be launched, I have no issue at all. However the successor is not launched at all!
(Just to play around and to test some other parameter combination, I called the FM with strtimmed always set to X but then both jobs are launched at the same time, which is not convenient for me!).
IF as_pred IS INITIAL.
    lv_strt_immed = 'X'.
  ELSE.
    lv_strt_immed = space..
    lv_checkstat = 'X'.
  ENDIF.
* Plan job with direct start after predecessor job (if available)
  CALL FUNCTION 'JOB_CLOSE'
    EXPORTING
      jobcount             = me->job_count
      jobname              = me->job_name
      pred_jobcount        = as_pred-predjobcnt
      pred_jobname         = as_pred-predjob
      predjob_checkstat    = lv_checkstat
      strtimmed            = lv_strt_immed
    IMPORTING
      job_was_released     = lp_job_released
    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.
Do you have any hint what might be wrong with the function call above?
Many thanks for you help, best regards
Ebru

BP_JOB_CREATE can be used to create dependent jobs. The below sample program creates a chain of jobs. Prerequisite: the report program YTEST should exist.
++++++++++++++++++++++
REPORT  yjob_chain.
DATA cntr(3) TYPE n.
PARAMETERS:
  job_str(10) TYPE c DEFAULT 'ABC', "default jobname template
  p_njobs TYPE i. "number of nodes in chain
DATA jobname LIKE tbtcjob-jobname.
DATA jobcount LIKE tbtcjob-jobcount.
DATA pred_jobname LIKE tbtcjob-jobname.
DATA pred_jobcount LIKE tbtcjob-jobcount.
DATA flg_1stjob TYPE c.
START-OF-SELECTION.
  CLEAR flg_1stjob.
  DO p_njobs TIMES.
    PERFORM create_job.
  ENDDO.
*&      Form  create_job
*       text
FORM create_job.
  DATA global_job01 TYPE tbtcjob.
  DATA global_job02 TYPE tbtcjob.
  DATA steplist TYPE STANDARD TABLE OF tbtcstep.
  DATA stepline TYPE tbtcstep.
  stepline-program = 'YTEST'.
  stepline-typ = 'A'.
  stepline-authcknam = sy-uname.
  APPEND stepline TO steplist.
  cntr = cntr + 1.
  CONCATENATE job_str '-' cntr INTO jobname.
  global_job01-jobname = jobname.
  global_job01-jobclass = 'C'.
  IF flg_1stjob IS NOT INITIAL.
    global_job01-eventid = 'SAP_END_OF_JOB'.
    global_job01-eventparm = pred_jobname.
    global_job01-eventcount = pred_jobcount.
  ELSE.
    global_job01-reldate = sy-datum.
    global_job01-reltime = sy-timlo.
    global_job01-strtdate = sy-datum + 1.
    global_job01-strttime = '010000'.
  ENDIF.
  CALL FUNCTION 'BP_JOB_CREATE'
    EXPORTING
      job_cr_dialog       = 'N'
      job_cr_head_inp     = global_job01
    IMPORTING
      job_cr_head_out     = global_job02
    TABLES
      job_cr_steplist     = steplist
    EXCEPTIONS
      cant_create_job     = 1
      invalid_dialog_type = 2
      invalid_job_data    = 3
      job_create_canceled = 4
      OTHERS              = 5.
  IF sy-subrc = 0.
    pred_jobname = jobname.
    pred_jobcount = global_job02-jobcount.
    flg_1stjob = 'X'.
    WRITE:/ 'Created Job- ', 'Name: ', global_job02-jobname, 'Number: ', global_job02-jobcount.
  ELSE.
    WRITE:/ 'Error creating job'.
  ENDIF.
ENDFORM.                    "create_job

Similar Messages

  • What should I do if the iphoto keeps on saying that "Plz wait for import to complete" when i click the close button but it is not importing photos? How can I close the iPhoto? I try to switch my mac off but it doesn't work. Thanks.

    What should I do if the iphoto keeps on saying that "Plz wait for import to complete" when i click the close button but it is not importing photos? How can I close the iPhoto? I try to switch my mac off but it doesn't work. Thanks.

    You should be able to select Force Quit from the menu beneath the Apple icon in Finder
    and choose to Quit iPhoto from there, without messing up the Mac OS X in the process.
    OS X - Support
    Not sure if rebuilding the iPhoto library would help this issue. However if you had to
    turn off the computer without the correct method (unplug, etc; instead of menu choice)
    the system may have accrued damages and should be checked, maybe repaired by
    use of the Disk Utility in the system. Or restart the computer in Safe Boot mode, then
    run 'repair disk permissions' while it is running in that reduced mode; then restart after.
    •Understanding Safe Mode - tuts+ computer skills tutorial:
    http://computers.tutsplus.com/tutorials/understanding-safe-mode--mac-59897
    •OS X: What is Safe Boot, Safe Mode?
    Suggestions on how to use Safe Mode in article, to resolve issues, may be helpful.
    There likely are other means to rectify troublesome applications, including reinstall.
    Be sure to backup your music, image, video, and other work on an external drive
    or suitable device as a precaution against loss should there be a hard drive failure.
    iPhoto - Mac Apps - Apple Support
    There should be some tips and help information using iPhoto via this tiny Support link.
    Good luck & happy computing!

  • Delete Record Behavior doesn't wait for Submit button

    I have master / detail page set.  From the detail set there are links to delete or update a record.  When I click the link to delete the record, it goes to the   confirmation page with the correct record.  Now, when I add the delete record server behavior and a submit button, this is what happens.  As soon as I click the link to go to the delete confirm page, the record deletes and the page redirects to the page I put in the server behavior.  It doesn't show the confirm page and doesn't wait for me to hit the confirm button.  The page runs and successfully deletes the page from the DB.
    How do I get it to wait until I hit the submit button?

    You need to surround your delete query with an "If" statement that checks for a confirmation variable of some sort, then when the user clicks the confirmation link you can pass the necessary variable and the ID of the record the delete query is expecting.
    As an alternative you could use a JS alert fuction to ask the user if they are sure they want to delete the record and then allwo the delet to run after confirmation. To do this you could use code like this...
    <input type="submit" name="DELETE" value="DELETE"
       onclick="return confirm('Are you SURE you want to DELETE this record?')">
    Lawrence   *Adobe Community Expert*
    www.Cartweaver.com
    Complete Shopping Cart Application for
    Dreamweaver, available in ASP, PHP and CF
    www.twitter.com/LawrenceCramer

  • Waiting for scheduling job to complete. Job ID...and it never completes

    I have created my first Publication. It's a pretty basic single source document, single Dynamic Recipients list publication.
    When I run it in Test mode (I haven't tried it in non-Test mode yet), the document(s) are never delivered.
    When I view the Log File, everything looks fine. The second and last entry in the log says
    "- The global delivery rule for this publication was met; publication processing will now begin."
    The Status Message I see in the Publication History is:
    "Waiting for scheduling job to complete. Job ID:3,879, name:Unviewed Invoices Report (Copy), kind:CrystalReport in Pending state (FBE 60509) [0 recipients processed.] "  and it never changes. I've tried this several times, creating new publications with the same source documents, and the same thing always happens.
    Any help would be appreciated.

    All of the servers were configured correctly.
    It turned out to be my source document, a report, had some field in it that BOE didn't like.
    I removed a bunch of fields and added them back, one by one, and couldn't make the error occur again.
    Go figure.

  • My iCloud keeps asking me for a password even when I enter it, it still keeps asking. I have tried turning it off but it doesn't work.

    My iCloud keeps asking me for a password even when I enter it, it still keeps asking. I have tried turning it off but it doesn't work. It is really annoying!!
    Please help me!! (The same thing happened on this device and when I reset it, it worked....why isn't my iPad 3rd gen. Working...?)

    Try reset iPad
    Hold down the Sleep/Wake button and the Home button at the same time for at least ten seconds, until the Apple logo appears
    Note: Data will not be affected.

  • TS4268 i'm having a waiting for activation error but when I try to sign in under imessage and facetime, I get a check your network connection and try again error.  connection is fine because i upgraded my wifes phone and everything works fine.  How do I f

    How do I fix phone.  I'm getting waiting for activation error.  When I try to sign in under imessage or facetime, I get a check network connection error.  My connection is great because i'm using my wife's phone which upgraded with no problem.  Please help someone??

    wifi is fine, apple servers r to busy to effectively use facetime and imessages right now is all. and activation error is due to high server traffic as well. keep trying or wait, thats it

  • Windows 8.1, iOS 8.1.3, Itunes 12.1 64 bit, constantly get 'waiting for changes to apply' when trying to sync my new ipod touch

    Windows 8.1, iOS 8.1.3, Itunes 12.1 64 bit, constantly get 'waiting for changes to apply' when trying to sync my new ipod touch. Downloaded latest version f itunes, and ipod software up to date. Really frustrated I can't sync my music! Please can someone help me

    Im having huge issues after updating to 12.1 on Win 8.1  x64. Choppy playback and so on.
    Try this since it helps in most situtation :
    Remove itunes but keep library files. Then download it again and install it.
    Also most likely you will have to restore ipod touch. I restored my iPhone 5 to remove waiting for changes to apply and Error 54.
    my iPad air still isnt restored (cant do it now) and it sometimes does same like iPhone waiting for changes to apply. And gives error 54 but sync DOES GET COMPLETED.
    Also may sound stupid but try to use USB 2.0 Ports. Not 3.0. I have troubles when using 3.0

  • TS4062 I'm stuck on "waiting for items to copy" when I try to sync my laptop and iPod touch. What can I do about this?

    I'm stuck on "waiting for items to copy" when I try to sync my laptop and iPod touch. It was fine until the latest update. It's very frustrating. What can I do about this?

    Hi maasailand giraffe,
    Welcome to the Support Communities!
    First of all, thanks for the detailed notes of the troubleshooting steps you've already tried.  It's hard to pinpoint exactly what is going on in your specific case, but I do have a few more ideas for you to try.
    Starting with just one of your iPads, when you get stuck on the "waiting for items to copy" step, just disconnect your iPhone.  There are probably some orphaned or corrupt files that need to be addressed.  I would suggest closing all of your open apps and then backing your iPad up to iCloud.  Then review the articles below to move or delete any big files on your device.  These can include Voice Memos (iPhone), music, photos on your camera roll, photos or videos that are attached to your Messages, email attachments, etc.
    iPhone, iPad, and iPod: Understanding capacity
    http://support.apple.com/kb/HT1867
    iOS: "Not enough free space" alert when trying to sync
    http://support.apple.com/kb/TS1503?viewlocale=en_US
    iOS: Import personal photos and videos from iOS devices to your computer
    http://support.apple.com/kb/ht4083
    How to delete content you've downloaded from the iTunes Store, App Store, iBooks Store, or Mac App Store
    http://support.apple.com/kb/HT5772
    Remember that you can download any content you have purchased directly to your iPad.
    Downloading past purchases from the iTunes Store, App Store, and iBooks Store
    http://support.apple.com/kb/HT2519
    If you need to sync from iTunes, check your settings in the Summary tab to be sure you are only syncing items you have placed a checkmark in front of.
    iOS: Syncing with iTunes
    http://support.apple.com/kb/HT1386
    Give this a try on one of your iPads, and hopefully these steps will work for your other devices as well.
    Cheers,
    Judy

  • TS1363 My iPod doesn't turn on anymore. Even when I plug it into the computer or a charger, nothing happens. What's wrong with my iPod?

    My iPod doesn't turn on anymore. Even when I plug it into the computer or a charger, nothing happens. What's wrong with my iPod?

    If you get an network timed out error, try disabling the security software on your computer.

  • Ever since I got the new update 5.1 my iPod's been dying faster. It used to last for at least 3 hours, now it won't even last one hour and dies for no reason(even when it's in sleep mode, and not in use) What's wrong with it? Is it the update? lagging too

    Ever since I got the new update 5.1 my iPod's been dying faster, even after I charge it. It used to last for at least 3 hours, now it won't even last one hour and dies for no reason (even when it's in sleep mode, and not in use) What's wrong with it? Is it the update? It's lagging as well..

    Some Users have Reported that a  Restore as New  has helped Resolve issues...
    Backup and Set Up as New Device
    http://support.apple.com/kb/HT4137

  • I pad asks for a user passcode when i havent set any?

    My new i pad asks for a pass code when I havent set any?

    Did you create an Exchange account that is provided by your employer?
    If so, your employer requires the passcode lock feature being enabled.

  • System hangs mounting encrypted lvm, doesn't wait for password

    I have a system with two hard drives, each that has a separate encrypted lvm. The drive with my / parition mounts fine, using the grub command line cryptdevice paramater.
    But the second encrypted partition on the second hard drive, defined in crypttab, causes the system to hang during boot. I get a message: "a start job is running for cryptography setup" and a little moving asterick while the system waits. At the same time there is a second similar message with moving asterick: "a start job is running for" and the name of the lvm device to be started. And if I define all the volumes on the lvm to be mounted in fstab, I get yet more "a start job is running" messages and hangs for them, all simultaneously.
    It seems like the system is not stopping and waiting for the password, before trying to start the lvm and then hanging. I've found that I actually can type in the password while the system is stuck like this (though the screen doesn't really register that I'm typing a password) and then the system will continue and start the lvm and mount volumes properly as defined in fstab.
    I don't really know much about how all this stuff works, but gather from reading around that perhaps systemd is not waiting for the password, before tying to automatically start the lvm? And tha'ts causing the hang. (I have LMDE installed with a separate /boot parition on the same number 1 drive and it boots as expected, I'm assuming this is because it's not using systemd.)
    The only post that I could find that remotely seemed similar to my problem is this: https://bbs.archlinux.org/viewtopic.php?id=153811
    But I don't really follow what's being said in that thread or the solution, regard the .service file. Where is is? What would I edit in it? Is that what I want to do?
    Thanks to anyone for any help on this.

    Well I just figured out that I put the wrong UUID in /etc/fstab. /dev/sdb1 (the disk being unlocked) != /dev/mapper/crypt2 (the unlocked partition). Now everything works as it should.
    Last edited by houron102 (2012-09-14 01:19:47)

  • Waiting for a Job to Complete

    Hi,
    How would people suggest waiting for a background process (a job submitted using APEX_PLSQL_JOB) to complete.
    I'm thinking of having an On Demand that can query the job status and then calling this from a piece of JavaScript which polls periodically (e.g. every 30 seconds using the setTimeout function).
    Does anyone have any pointers to something more elegant?
    Many thanks,
    Gareth.

    Hi
    Interesting one this, check out this link [http://www.oraclequirks.com/]
    Half way down the page on the left there's a link titled 'Yocoya's Flash Progress Bar Indicator Live Demo' that you might find useful.
    Cheers
    Ben

  • P965 platinum SATA issues (doesn't wait for disk spinup!!!!!!!!)

    Hi
    I've recently migrated from a 2-HD setup (seagate & hitachi) that worked just fine to a single hd setup (western digital WD3200AAKS).
    Now when I turn on the pc, the BIOS goes too fast and doesn't wait enough time for the disk to spin up (since the WD disk has a considerably longer spinup time), and for the first boot, there's no HD detected. It simply hangs.
    In fact, i can see the line "Detecting SATA PORT 2..." for a while, but then it writes "not detected" and goes ahead.
    Then if I ctrl-alt-del, it works just fine.
    How can I solve this? Possibly without disabling fast booting!...
    thanks in advance
    bye bye

    Quote from: jsmartin22 on 28-June-07, 13:41:50
    This is note the solution wanted to hear, but it is reasonable:  Why not dump the WD and get a new drive?   For ~$100 you can get a new 500 GB SATA drive and for the price of a little more than $100, you will have your system integrity; and you can probably sell the WD drive or use it with another MB/computer.    Something to think about maybe?  Good luck. 
    I've just changed it! It's a 320gb drive but it has all the bells&whistles of its 500gb big brothers! Perpendicular recording, ncq, and etc...
    In fact, apart from that spin-up issue, is blazing fast, even faster than Seagates!

  • Automator doesn't wait for app to finish launching.

    During "watch me do" actions that lauch an app Automator does not wait for the app to launch. This seems like a bug since Automator does infact know it is launching an app, this shouldn't be something that should require a sleep every time.

    Did you try one these actions?

Maybe you are looking for