<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Problems creating background job for program (job open, submit and close) in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/problems-creating-background-job-for-program-job-open-submit-and-close/m-p/4065287#M971693</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Valter, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your reply, but i really need to use the FM BP_START_DATE_EDITOR. This FM shows me the schedule popup, start date windows that appears in SM 36.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It's working fine, i think, but either i give the job to start imediatly, or a schedule date and time to the Job_Close FM it's giving me this error. &lt;/P&gt;&lt;P&gt;I have no idea why... &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Obrigado e Cumprimentos, &lt;/P&gt;&lt;P&gt;João Martins&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 01 Jul 2008 16:46:55 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-07-01T16:46:55Z</dc:date>
    <item>
      <title>Problems creating background job for program (job open, submit and close)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problems-creating-background-job-for-program-job-open-submit-and-close/m-p/4065285#M971691</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi gurus, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;im trying to start a background job using the FM BP_START_DATE_EDITOR to show the start date to the job or if it's imediate. this FM it's working fine, after call it im opening a job, submiting it and call the job close FM and the job close FM creates me the job. &lt;/P&gt;&lt;P&gt;The problem it's when i go to the sm37 to see the job status the job has been canceled, and the job log says that i have to give a start date to the job. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What i dont understand it's either the job is imediate or i choose a date to start the job always gives me this error...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Below goes my code, &lt;/P&gt;&lt;P&gt;any ideas will be rewarded &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
  CLEAR: stdt_modify_type, stdt_output.

  CALL FUNCTION 'BP_START_DATE_EDITOR'
       EXPORTING
            stdt_dialog                    = 'Y'
            stdt_input                     = stdt_input
            stdt_opcode                    = 14
       IMPORTING
            stdt_modify_type               = stdt_modify_type
            stdt_output                    = stdt_output
       EXCEPTIONS
            fcal_id_not_defined            = 1
            incomplete_last_startdate      = 2
            incomplete_startdate           = 3
            invalid_dialog_type            = 4
            invalid_eventid                = 5
            invalid_opcode                 = 6
            invalid_opmode_name            = 7
            invalid_periodbehaviour        = 8
            invalid_predecessor_jobname    = 9
            last_startdate_in_the_past     = 10
            no_period_data_given           = 11
            no_startdate_given             = 12
            period_and_predjob_no_way      = 13
            period_too_small_for_limit     = 14
            predecessor_jobname_not_unique = 15
            startdate_interval_too_large   = 16
            startdate_in_the_past          = 17
            startdate_is_a_holiday         = 18
            startdate_out_of_fcal_range    = 19
            stdt_before_holiday_in_past    = 20
            unknown_fcal_error_occured     = 21
            no_workday_nr_given            = 22
            invalid_workday_countdir       = 23
            invalid_workday_nr             = 24
            notbefore_stdt_missing         = 25
            workday_starttime_missing      = 26
            no_eventid_given               = 27
            OTHERS                         = 28.
  IF sy-subrc &amp;lt;&amp;gt; 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    MOVE 'X' TO gv_flag.
  ENDIF.

  DATA jobname LIKE tbtcjob-jobname.
  DATA jobcount LIKE tbtcjob-jobcount.
  DATA job_release LIKE  btch0000-char1.
  DATA job_imediate TYPE c.

  CLEAR: jobname, jobcount, job_release.
  CONCATENATE 'MAPAEXEC' sy-uname sy-datum
               INTO jobname SEPARATED BY space.

  CALL FUNCTION 'JOB_OPEN'
       EXPORTING
            jobname          = jobname
       IMPORTING
            jobcount         = jobcount
       EXCEPTIONS
            cant_create_job  = 1
            invalid_job_data = 2
            jobname_missing  = 3
            OTHERS           = 4.
  IF sy-subrc &amp;lt;&amp;gt; 0.
    MESSAGE i003(zmapas).
    EXIT.
  ENDIF.


  SUBMIT z_mapa_execucao_orcamental
         VIA JOB jobname NUMBER jobcount
         WITH ano EQ ano
         WITH so_perio IN so_perio
         WITH so_date IN so_date
         WITH so_org EQ so_org
         WITH so_num IN so_num
         AND RETURN.


  IF stdt_output-startdttyp EQ 'I'.
    CLEAR job_imediate.
    job_imediate = 'X'.
  ENDIF.


  CALL FUNCTION 'JOB_CLOSE'
       EXPORTING
            calendar_id                 = stdt_output-calendarid
            event_id                    = stdt_output-eventid
            event_param                 = stdt_output-eventparm
            event_periodic              = stdt_output-periodic  "?
            jobcount                    = jobcount
            jobname                     = jobname
            laststrtdt                  = stdt_output-laststrtdt
            laststrttm                  = stdt_output-laststrttm
            prddays                     = stdt_output-prddays  "??
            prdhours                    = stdt_output-prdhours  "?
            prdmins                     = stdt_output-prdmins  "??
            prdmonths                   = stdt_output-prdmonths
            prdweeks                    = stdt_output-prdweeks  "?
            predjob_checkstat           = stdt_output-checkstat
            pred_jobcount               = stdt_output-predjobcnt
            pred_jobname                = stdt_output-predjob
            sdlstrtdt                   = stdt_output-sdlstrtdt
            sdlstrttm                   = stdt_output-sdlstrttm
            strtimmed                   = job_imediate
            targetsystem                = stdt_output-instname
            start_on_workday_not_before = stdt_output-notbefore
            start_on_workday_nr         = stdt_output-wdayno
            workday_count_direction     = stdt_output-wdaycdir
       IMPORTING
            job_was_released            = job_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
            OTHERS                      = 8.
  IF sy-subrc &amp;lt;&amp;gt; 0.
    MESSAGE i003(zmapas).
    EXIT.
  ELSE.
    MESSAGE i004(zmapas) WITH jobname.
  ENDIF.

.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance, &lt;/P&gt;&lt;P&gt;Best Regards&lt;/P&gt;&lt;P&gt;João Martins&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 Jul 2008 16:30:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problems-creating-background-job-for-program-job-open-submit-and-close/m-p/4065285#M971691</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-01T16:30:49Z</dc:date>
    </item>
    <item>
      <title>Re: Problems creating background job for program (job open, submit and close)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problems-creating-background-job-for-program-job-open-submit-and-close/m-p/4065286#M971692</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello João.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In debug mode, check the value of variables you passed to parameters sdlstrtdt and sdlstrttm. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As aditional info, I usually achieve your goal without FM BP_START_DATE_EDITOR.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check this code:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
CALL FUNCTION 'JOB_OPEN'
      EXPORTING
           jobname          = w_jobname
      IMPORTING
           jobcount         = w_jobcount
      EXCEPTIONS
           cant_create_job  = 1
           invalid_job_data = 2
           jobname_missing  = 3
           OTHERS           = 4.
CHECK sy-subrc = 0.

CLEAR seltab_wa.
MOVE: t_jobs-param TO seltab_wa-selname,
t_processar-line+34 TO seltab_wa-low.
APPEND seltab_wa TO seltab.
seltab_wa-selname = 'P_LOJA'.
seltab_wa-low = t_processar-ficheiro+7(4).
APPEND seltab_wa TO seltab.

*** Submete o programa para o JOB
SUBMIT (t_jobs-repid)
  WITH  SELECTION-TABLE seltab
  USER sy-uname
   VIA JOB w_jobname NUMBER w_jobcount
   AND RETURN.

*** Encerra o JOB
  l_hora = sy-uzeit.
  ADD 60 TO l_hora.

CALL FUNCTION 'JOB_CLOSE'
   EXPORTING
      jobcount           = w_jobcount
      jobname           = w_jobname
      sdlstrtdt            = sy-datum
      sdlstrttm           = l_hora
      targetserver       = w_servidor
   IMPORTING
      job_was_released     = l_liberado
   EXCEPTIONS
      cant_start_immediate = 1
      invalid_startdate    = 2
      jobname_missing      = 3
      job_close_failed     = 4
      job_nosteps          = 5
      job_notex            = 6
      lock_failed          = 7
      OTHERS               = 8.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Regards.&lt;/P&gt;&lt;P&gt;Valter Oliveira.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 Jul 2008 16:38:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problems-creating-background-job-for-program-job-open-submit-and-close/m-p/4065286#M971692</guid>
      <dc:creator>valter_oliveira</dc:creator>
      <dc:date>2008-07-01T16:38:10Z</dc:date>
    </item>
    <item>
      <title>Re: Problems creating background job for program (job open, submit and close)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problems-creating-background-job-for-program-job-open-submit-and-close/m-p/4065287#M971693</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Valter, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your reply, but i really need to use the FM BP_START_DATE_EDITOR. This FM shows me the schedule popup, start date windows that appears in SM 36.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It's working fine, i think, but either i give the job to start imediatly, or a schedule date and time to the Job_Close FM it's giving me this error. &lt;/P&gt;&lt;P&gt;I have no idea why... &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Obrigado e Cumprimentos, &lt;/P&gt;&lt;P&gt;João Martins&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 Jul 2008 16:46:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problems-creating-background-job-for-program-job-open-submit-and-close/m-p/4065287#M971693</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-01T16:46:55Z</dc:date>
    </item>
    <item>
      <title>Re: Problems creating background job for program (job open, submit and close)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problems-creating-background-job-for-program-job-open-submit-and-close/m-p/4065288#M971694</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem is definitly in the FM JOB_CLOSE. In debug mode check the values os structure stdt_output that you import from FM BP_START_DATE_EDITOR.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, don't use all of the parameters in FM JOB_CLOSE. Fill only the necessary ones. The example I posted works perfectly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just give it a try.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;&lt;P&gt;Valter Oliveira.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 Jul 2008 16:54:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problems-creating-background-job-for-program-job-open-submit-and-close/m-p/4065288#M971694</guid>
      <dc:creator>valter_oliveira</dc:creator>
      <dc:date>2008-07-01T16:54:54Z</dc:date>
    </item>
    <item>
      <title>Re: Problems creating background job for program (job open, submit and close)</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problems-creating-background-job-for-program-job-open-submit-and-close/m-p/4065289#M971695</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Valter, &lt;/P&gt;&lt;P&gt;That's it... to many import parameters.... I've just inserted the necessary ones and it's working fine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards, &lt;/P&gt;&lt;P&gt;João Martins&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 01 Jul 2008 17:23:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problems-creating-background-job-for-program-job-open-submit-and-close/m-p/4065289#M971695</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-07-01T17:23:18Z</dc:date>
    </item>
  </channel>
</rss>

