Cancelamento no Job.

Pessoal,
Boa tarde!
está e a minha 1° vez aqui no forum, e gostaria da ajuda de vocês.
Trabalho no módulo PP e estou tendo um problema com um job.
Aqui na empresa, trabalhamos com Mensagens de Processo. Temos um Job chamado: Z_Send_Process_Mesage_02 que fica enviando as mensagens de processo. O mesmo está configurado para rodar de 5 em 5 minutos. Quando este tempo estoura, o job seguinte acaba sendo cancelado. No log, ele informa que o job anterior ainda erstá em execução. Ao cancelar o job, um email é disparado para outra equipe, e com isso, acaba gerando uma analise desnecessária.
O Abap daqui da empresa, criou um programa que trabalha em paralelo com este job, para que se houver um atraso e o job seguinte tentar executar, ele irá dar como concluido e irá gerar um log informando que o processo está em andamento. só que o problema ainda continua. O processo está sendo cancelado.
Estou postando o código Abap do programa criado:
*& Report  ZATUALIZAJOB
REPORT  ZATUALIZAJOB.
**TYPES: BEGIN OF ls_jobstate_type,
**         aborted TYPE tbtcv-abort,
**         finished TYPE tbtcv-fin,
**         preliminary TYPE tbtcv-prelim,
**         ready TYPE tbtcv-ready,
**         running TYPE tbtcv-run,
**         scheduled TYPE tbtcv-sched,
**       END OF ls_jobstate_type.
DATA:
*      ls_jobstate TYPE ls_jobstate_type,
      t_ZTBJOB TYPE TABLE OF ZTBJOB WITH HEADER LINE,
      v_status type c,
      V_JA_EXECUTANDO type c.
DATA: seltab type table of rsparams,
      seltab_wa like line of seltab.
***      ZIT_JOB_DETAILS type /OSP/TT_REPORT_JOB_LIST,
***      ES_JOB_DETAILS type  /OSP/S_REPORT_JOB_LIST.
*data: newstate like msqexport-retcode.
parameters: plant LIKE comh-werk OBLIGATORY VALUE CHECK.
SELECT * INTO table t_ZTBJOB FROM ZTBJOB WHERE jobname = 'Z_SEND_PROCESS_MESSAGES_WA' or jobname = 'Z_SEND_PROCESS_MESSAGES_02'.
**SELECT * INTO t_TBTCO FROM TBTCO WHERE jobname = 'Z_SEND_PROCESS_MESSAGES_WA' or jobname = 'Z_SEND_PROCESS_MESSAGES_02'. ENDSELECT.
WRITE:/ SY-SUBRC.
IF SY-SUBRC IS INITIAL.
  write:/ 'Job já está em execução!'.
  exit.
else.
  CLEAR: t_ZTBJOB ,t_ZTBJOB[].
  t_ZTBJOB-jobname = 'Z_SEND_PROCESS_MESSAGES_WA'.
  INSERT ZTBJOB from t_ZTBJOB.
**  commit WORK.
ENDIF.
***LOOP AT t_TBTCO.
***  CALL FUNCTION 'BDL_READ_JOB_STATUS'
***   EXPORTING
***     JOBNAME             = t_TBTCO-jobname
***     JOBNUMBER           = t_TBTCO-jobcount
***     SESSIONNR           = '0000000000'
***     EXTENSION           = '000'
***   IMPORTING
****   JOBNAME_OUT         =
****   JOBNUMBER_OUT       =
***     JOBSTATUS           = v_status
***   EXCEPTIONS
***     JOB_NOT_FOUND       = 1
***     OTHERS              = 2
***  IF SY-SUBRC <> 0.
***    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
***            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
***  ELSEIF SY-SUBRC IS INITIAL.
***    IF V_STATUS = 'R'.
***      V_JA_EXECUTANDO = 'X'.
***      EXIT.
***    ENDIF.
***  ENDIF.
***ENDLOOP.
***IF V_JA_EXECUTANDO IS NOT INITIAL.
***  write:/ 'Job já está em execução!'.
***else.
data: jobname like tbtcjob-jobname value
                           'Z_SEND_PROCESS_MESSAGES_02'.
data: jobcount like tbtcjob-jobcount,
      host like msxxlist-host.
data: begin of starttime.
        include structure tbtcstrt.
data: end of starttime.
data: starttimeimmediate like btch0000-char1 value 'X'.
* Job open
call function 'JOB_OPEN'
  EXPORTING
    delanfrep        = ' '
    jobgroup         = ' '
    jobname          = jobname
    sdlstrtdt        = sy-datum
    sdlstrttm        = sy-uzeit
  IMPORTING
    jobcount         = jobcount
  EXCEPTIONS
    cant_create_job  = 01
    invalid_job_data = 02
    jobname_missing  = 03.
if sy-subrc ne 0.
  "error processing
endif.
* Insert process into job
SUBMIT RCOCB004 USING SELECTION-SET 'SAP&MESS_PLANT' user sy-uname VIA JOB jobname NUMBER jobcount AND RETURN.
****  BREAK-POINT.
if sy-subrc > 0.
  "error processing
** IMPLEMENTADO EM UMA ENHANCEMENT DENTRO DO PROGRAMA RCOCB004
**else.
**  DELETE FROM ZTBJOB WHERE jobname = 'Z_SEND_PROCESS_MESSAGES_WA'.
**  commit WORK.
endif.
* Close job
starttime-sdlstrtdt = sy-datum + 1.
starttime-sdlstrttm = '220000'.
call function 'JOB_CLOSE'
  EXPORTING
    jobcount             = jobcount
    jobname              = jobname
    strtimmed            = starttimeimmediate
  EXCEPTIONS
    cant_start_immediate = 01
    invalid_startdate    = 02
    jobname_missing      = 03
    job_close_failed     = 04
    job_nosteps          = 05
    job_notex            = 06
    lock_failed          = 07
    others               = 99.
if sy-subrc eq 0.
  "error processing
endif.
Vocês poderiam me auxiliar nesta questão?
Agradeço a ajuda de todos.
Att,
Renato Rosario
Edited by: Fernando Ros on May 7, 2011 9:06 PM ajustando visual

Olá Renato,
quanto à performance do job, vc pode verificar os runtimes na SE30, se o maior runtime é em ABAP ou banco.
Quanto ao cancelamento, por favor coloque aqui o log gerado pelo mesno, que pode ser entrontrado na SM37. Aliás, já poste o conteúdo do dev_w* do work process que o job rodou, para ver os detalhes do erro.
Desse modo, podermos ajudá-lo melhor ainda
Abrassssosssssss,
Tomas Black

Similar Messages

  • Processo de cancelamento de Nota Fiscal

    Pessoal , bom dia!
    Mais uma vez estou aqui solicitando um help.
    Estamos em produção e nos deparamos com uma situação inusitada de processo de negócio.
    Emitimos 2 notas fiscais de serviços e uma ORB indevidamente.
    As duas notas de serviço passaram para o GRC e foram enviadas para o SEFAZ por que faltava a configuração no ECC que proibe notas de serviços de serem enviadas ao GRC. Já corrigimos isso.
    A ORB foi enviada com caracteres especiais e consequentemente foi recusado o XML pelo SEFAZ.
    Nossos usuários solicitaram o cancelamento da Nota porém o GRC não atualizou o Status do ECC.
    Descobrimos que estava faltando autorização para o usuário que atualiza o ECC (pela RFC na SM59) e já corrigimos também.
    Porém antes de corrigirmos as autorizações o usuário cancelou a fatura (manualmente no ECC) da ORB e agora o JOB UPDATE_ERP_STATUS não está atualizando o ECC. Porém no GRC esta já está com o Status 102 e verde.
    Além disso, para as notas de serviço o JOB também não está atualizando o ECC, porém estas não tiveram suas faturas canceladas e já estão com o status 101 ou 102 e verde no GRC.
    Agradeço a ajuda desde Já..... Obrigado
    Suzano

    Bom dia Thiago,
    É possível que precise de notas no R/3 ou até desenvolvimento, não conheço bem o processo de negócio neste ponto.
    Você pode fazer o seguinte, pelo que você disse, os registros com 102 devem estar na tabela /xnfe/backstatus pois o job /xnfe/update_erp_status não está conseguindo processar com sucesso.
    Este ponto de retorno de cancelamento tem estes pontos de atenção:
    - idioma do usuário na SM59 do GRC deve estar manualmente setado para o que se loga no dialog do R/3 (ex.: PT)
    - direitos deste usuário no R/3 (pode varias conforme processo MM, SD, FI, IS....)
    - notas ausentes no R/3 (procure por notas c/ J_1BNFE_CANCEL no market place)
    - pré-requisitos de cancelamento (período fechado, sem saldo...)
    - standard sem suporte para o tipo de cancelamento
    Verifique no GRC na transação RSRFCTRC se tem alguma informação referente a execução da função J_1B_NFE_XML_IN_TAB
    Vá eliminando todas estas etapas e por fim, se nada mais funcionar, pegue os dados da /xnfe/backstatus e debug a função J_1B_NFE_XML_IN diretamente no R/3, o ponto de atenção deve estar no call transaction que ele irá executar para cancelar.
    Atenciosamente,
    Fernando Da Ró

  • Need help with Sharepoint foundation web application stuck on "STOPPING" error job-service-instance-GUID Number already exists

    Hi All,
         I cant get to stop SharePoint foundation web app service. Its stuck on status stopping
    I have tried the following:
    reset IIS
    restarted the Timer Service
    When I try to use powershell command to stop I get the following error:
    Can anyone who went through this help PLEASE
    Stop-SPServiceInstance : An object of the type
    Microsoft.SharePoint.Administration.SPServiceInstanceJobDefinition named
    "job-service-instance-1ff39eb2-12d2-457d-a749-265e350eb1b1" already exists
    under the parent Microsoft.SharePoint.Administration.SPTimerService named
    "SPTimerV4". Rename your object or delete the existing object.
    At line:1 char:127
    + ... pplication"} | Stop-SPServiceInstance
    + ~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidData: (Microsoft.Share...ServiceInstance:
    SPCmdletStopServiceInstance) [Stop-SPServiceInstance], SPDuplicateObjectEx
    ception
    + FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletStopServ
    iceInstance

    Hi,
    It seems that the issue is in the timer job definition for executing this operation.
    My suggestion is to start the service again and delete the job definition from the error and again try to stop it.
    This might be helpful:
    http://sharepoint.stackexchange.com/questions/22368/is-there-a-powershell-cmdlet-to-delete-a-timer-job 
    I had a lot of issues in the past when try to stop this instance after the Web apps are provisioned.
    As general rule now If I have multi-server Farm topology that has servers that should not serve Web App requests I turn off the service prior to provisioning any Web Apps in the Farm. 
    BR,
    Ivan

  • Report program when run in background job getting cancelled immediately

    Hi
    When i run a program in foreground i am able to see the output. But when run in background not able to run the job successfully. The job is getting cancelled immediately.
    I am using the below function module for output display. Should i need to pass any parameters in the below function module so that i can run the program in background  successfully.
      CALL METHOD DETAIL_GRID->SET_TABLE_FOR_FIRST_DISPLAY     
          EXPORTING                                            
            IS_LAYOUT         = IS_LAYOUT                    
            I_SAVE            = 'A'                        
            IS_VARIANT        = GS_VARIANT                   
          CHANGING                                           
            IT_FIELDCATALOG   = IT_FIELDCATALOG               
            IT_OUTTAB         = BLOCKED_STOCK_TAB_ALV[].     
    Please suggest.
    Thanks and regards
    Rajani Yeluri

    Hi Rajani.
      ALV require the DRYPOR(screen) for display but incase you run in back ground which have to write to spool but in spool we can only write in format of LIST REPORT not inter-active report like ALV. That why
    system cancelled your process immediately.
    Hope it helps.
    Sayan.

  • Report Job was cancelled upon user request???

    Hi,
    My reports take more than 10 minutes to complete, most times I get
    "Report Job was cancelled upon user request".
    error, how to fix this problem? Is there any time limit inside the report I can set.
    Thanks

    hi ,
    There is no limit on the report run time. The most probable reason why you are getting the 'Report cancelled upon user request' message is the users might have hit the "cancel Report" button which is displayed when it is running in 'SYNCHRONOUS MODE'. do not hit that button as it will terminate the report. to increase the speed of returning the results by the report, try improving the sql that you use in the report, or if you have DBA rights try adding in INDEXES on the columns of the tables used by the report.
    Hope this helps
    Manoj

  • Report for cancelled jobs

    Hi ,
    I have a requirement in which I have to create a report that should pickup all the cancelled CRM marketing jobs (due to whatever reason) based on on job name, copy them and restart them.
    In your selection screen, you will give the cancelled job name (wildcard acceptable..like ZE00*) and a radio button to show the cancelled job list and copy the jobs.
    Could anyone guide me on how to go ahead with this report?
    Regards,
    Mohit

    Hi,
    in table TBTCO and TBTCP you have all jobs with current status. You can search them by name.
    Selected jobs you can "popup_with_table" FM. Then you need to use fm to submit job in ackground;
    'JOB_OPEN', 'JOB_SUBMIT' and 'JOB_CLOSE'.
    Good luck !

  • I need help to find and open a job app that I exported, was able to fill out and sign and saved and now can't open it? What did I do wrong?

    I need help to find and open a job app that I exported, was able to fill out and sign and saved and now can't open it? What did I do wrong?

    What file format did you export it to?

  • How To Handle With Back Ground JOB From WEBUI When Click On "Appove"

    Hi
    How To Scheduled A Job Through ABAP Report In back end  Of CRM when i click on "Approve" Button in WEBUI  From result list.
    As per My requirement I have a Search View and Result View
    In Search View I have  Below Fields
    ITC Vendor ID    
    Claim Status
    User status (date status changed)
    Model
    Serial Number
    Date completed of Service Completion
    Based on Search Criteria I will get Result In Result View.(Suppose 10 Records I got In Result View)
    In the Result View I need to Add one Button As "Approve"
    When i Click On Approve button One Pop up Message Need to Open And In that popup window I need to Display Below Text
    "Approve  Claim Job Has Started In Background  
    Note: Only Claims Which are in Submitted  Status  Will be  Approved. you May Close This Window"
    In SAP CRM System  Back Ground Job Need To Start When Click On "Approve" Button In WEBUI .
    In the Back Ground ABAP Report which will validate based on Result List Records"
    In the Result List we may have all types of Claims which are status in "Submitted" "Pending" "Rejected" "Approve".
    I need to collect all records from Result list and validate Those Records who's Status in "Submitted
    1)Sort all the claims based on ITC Vendor ID.
    2)Grouped all the submitted claims against each ITC Vendor ID from the search result
    3)Change the status of the selected submitted claims to Approved.
    4)Displays information messages as mentioned whenever a claim is approved, the same message will be captured in the job log.
    ‘Claims <ClaimID 1>,…<ClaimID N> now approved for ITC Vendor ID’.
    5)Sending Email to each IRC.
    6)Capture all the approved claims in the below format (Format Attached "Screen Shot Attachment")
    7)Store the file in the Application Server AL11 in .csv format
    Please Find Attachement For Reference.
    1)ITC Claim Screen Shot
    2)Screen Shot For Attachment
    Thanks
    Raj

    Hi,
    You can add the following code in on approve method to show popup to the user,
    IF req_edit IS NOT BOUND. " gloabl attribute in impl class of the view
        REFRESH lt_buttons.
        lss_button-id  = 'btnyes'.
        lss_button-text = 'YES'.
        lss_button-on_click = 'YES'.
        APPEND lss_button TO lt_buttons.
        CLEAR lss_button.
        lss_button-id  = 'btnno'.
        lss_button-text = 'NO'.
        lss_button-on_click = 'NO'.
        APPEND lss_button TO lt_buttons.
        CLEAR lss_button.
        CALL METHOD comp_controller->window_manager->create_popup_2_confirm
          EXPORTING
            iv_title          = 'ATTENTION'
            iv_text           = 'Are you sure you want to edit this document?'
            iv_btncombination = '99'
            iv_custombuttons  = lt_buttons
          RECEIVING
            rv_result         = req_edit.
        req_edit->set_on_close_event( iv_event_name = 'EDIT' iv_view = me ). "#EC NOTEXT
        req_edit->open( ).
        RETURN.
      ELSE.
        lr_node ?= req_edit->get_context_node( 'OUTPUTNODE' ).
        lv_outbound = lr_node->get_event_name( ).
    *  CLEAR ptc_pricing_status.
    *    lv_outbound = req_edit->get_fired_outbound_plug( ).
        IF lv_outbound = 'YES'.
    you can use the submit report code here and you can al the validations here
        ELSE. " No
    if user clicks no nothing to do..
        ENDIF.
        CLEAR req_edit.
      ENDIF.
    Best Regards,
    Dharmakasi.

  • Schedule jobs witj job open, submit and close

    Hi gurus,
    I need to know if there is any way to schedule various jobs using the FM job_open job_submit and job_close. Like schedule the first job for a date and a hour and schedule others jobs to run after the first job sequential.
    Its this possible?
    Thk in advance

    Hi
    see the sample code for the Job scheduling using the fun modules
      IF p_bjob = 'X'.
        CONCATENATE sy-cprog sy-datum sy-uzeit
                    INTO jobname SEPARATED BY '_'.
        CALL FUNCTION 'JOB_OPEN'
          EXPORTING
            jobname          = jobname
          IMPORTING
            jobcount         = jobcount
          EXCEPTIONS
            cant_create_job  = 1
            invalid_job_data = 2
            jobname_missing  = 3
            OTHERS           = 4.
        CALL FUNCTION 'GET_PRINT_PARAMETERS'
          IMPORTING
            out_archive_parameters = arc_params
            out_parameters         = print_params
            valid                  = valid
          EXCEPTIONS
            archive_info_not_found = 1
            invalid_print_params   = 2
            invalid_archive_params = 3
            OTHERS                 = 4.
        IF valid = chk.
          SUBMIT yREP  WITH s_kunnr IN s_cust
                          AND RETURN
                          USER               sy-uname
                          VIA JOB            jobname
                          NUMBER             jobcount
                          TO SAP-SPOOL
                          SPOOL PARAMETERS   print_params
                          ARCHIVE PARAMETERS arc_params
                          WITHOUT SPOOL DYNPRO.
          CALL FUNCTION 'JOB_CLOSE'
            EXPORTING
              jobcount             = jobcount
              jobname              = jobname
              strtimmed            = 'X'
            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.
          ELSE.
            MESSAGE i029 WITH jobname.
          ENDIF.
        ELSE.
          MESSAGE s000 WITH text-003.
          STOP.
        ENDIF.
      ENDIF.
    Regards
    anji

  • Problems creating background job for program (job open, submit and close)

    Hi gurus,
    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.
    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.
    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...
    Below goes my code,
    any ideas will be rewarded
      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 <> 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 <> 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 <> 0.
        MESSAGE i003(zmapas).
        EXIT.
      ELSE.
        MESSAGE i004(zmapas) WITH jobname.
      ENDIF.
    Thanks in advance,
    Best Regards
    João Martins

    Hello João.
    In debug mode, check the value of variables you passed to parameters sdlstrtdt and sdlstrttm.
    As aditional info, I usually achieve your goal without FM BP_START_DATE_EDITOR.
    Check this code:
    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.
    Regards.
    Valter Oliveira.

  • Jobs with a startevent and starttime

    hello,
    I'd like to plan a job in an abap program which is started when an event is raised or a certain timespan
    has passed.
    When planing the job by using the functionmodules job_open, job_submit and and job_close I can supply an event and a startdate but the implementation of the functionmodules ignores the event when the startdate parameter is supplied.
    Is there a workaround to enable event triggered jobs with a startdate which is used if the event is not raised within a certain timespan or do I really hav to use 2 jobs?
    thanks
    Roman

    Hello Roman
    I think you have to use 2 jobs, but if you use 2 jobs with the same program the program may run twice.
    You could create 1 job with your program that is started by event and 1 job with a startdate/time that runs a program that raise the event.
    best regards
    Thomas Madsen Nielsen

  • Batch job

    Hi I am working on batch job .
    my program is printing invoice as well as downloading and I have run this program in batch,
    I am using the FM job_open , job_submit and job_close.
    but it is failing in job_submit with sy-subrc eq 1 .
    giving me error bad print parameter , I haven;t done this before.
    I think it should be option.
    CALL FUNCTION 'JOB_SUBMIT'
        EXPORTING
          authcknam = SY-UNAME  "tbtcjob-authcknam
          jobcount  = tbtcjob-jobcount
          jobname   = p_jobnam
          language  = sy-langu
           report    = c_reprot
          variant   = pvariant
        EXCEPTIONS
          OTHERS    = 01.
    could anybody pls guide me why it is so???
    Regards.
    Kusum.

    you can below code
    OPEN DATASET gv_file FOR INPUT IN TEXT MODE ENCODING DEFAULT
                                WITH SMART LINEFEED.
        IF sy-subrc EQ 0.
          WHILE sy-subrc IS INITIAL.
            READ DATASET gv_file INTO gwa_header_file.
            IF sy-subrc NE 0.
              EXIT.
            ELSE.
              APPEND gwa_header_file TO gt_header_file.
            ENDIF.
          ENDWHILE.
          CLOSE DATASET gv_file.
        ENDIF.
      ENDIF.

  • Job Scheduling error

    Hi Experts,
    I have a critical requirement. I need to kick off 3 interfaces from 1 report each of which will update the Oracle database.
    I've used JOB_OPEN and JOB_CLOSE function modules and using SUBMIT <report> VIA JOB <jobname> NUMBER<jobnumber> AND RETURN. My problem is that these 3 reports are not getting executed, means they are not updating the Oracle database when they are kicked-off from the new program.
    But if i run each of them individually with same test data, it runs perfectly and updates the Oracle database. I tried to debug, it returns before going into START-OF-SELECTION event.
    Any help will be appreciated
    Thanks
    Prateek

    The VIA JOB addition also loads the program accessed in a separate internal mode when the SUBMIT statement is executed and the system performs all the steps specified before START-OF-SELECTION. This means the events LOAD-OF-PROGRAM and INITIALIZATION are triggered and selection screen processing is performed. If the selection screen is not processed in the background when VIA SELECTION-SCREEN is specified, the user of the calling program can eidit it and schedule the program accessed in the background request using the function Place in Job. If the user cancels selection screen processing, the program is not scheduled in the background job. In both cases, execution of the program executed is completed after selection screen processing and the system returns to the calling program due to the AND RETURN addition.
    Hope you got it.

  • Background jobs

    Hi,
            We can schedule the programs or transactions in background through SM36 and we can see the status through SM37.Then what is the use of FM's JOb_open,Job_submit and Job_close.When we will use these FM's.
    Can anybody tell me the difference between these two methods for scheduling the jobs in background....with sample code if possible
    Thanks & Regards,
    Rakesh.

    hi,
    chk this,
    call funcatio.
    ****Open a job to submit the Post Program into
    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 0.
    raise job_open_failed.
    endif.
    submit zefu_currency_load_callbak_ack
    via job jobname
    number jobcount
    with com_num = com_num
    with relay_nu = relay_num
    and return.
    if sy-subrc 0.
    raise job_step_failed.
    endif.
    ****Close the Job and start it immediately
    call function 'JOB_CLOSE'
    exporting
    jobcount = jobcount
    jobname = jobname
    strtimmed = 'X'
    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 0.
    raise job_close_failed.
    endif.
    Also,
    Create a Variant for the Program and
    Schedule JOB in background:
    Go to SM36 create a Job
    enter Program and Variant for that program in STEP..
    click on Start Condition
    Click on DATE and TIME enter date scheduled Start and END times
    click on Period Values
    Click on HOURLY/WEEKLY etc
    CLick on RESTRICTIONS also to use further criteria.
    so your job will be scheduled and run as per your requirement.
    and in SM37 Transaction check the status of that JOB
    Check this link for scheduling jobs..
    http://help.sap.com/saphelp_nw2004s/helpdata/en/c4/3a7f87505211d189550000e829fbbd/content.htm
    You can also use the fun modules JOB_OPEN,JOB_CLOSE etc for job
    scheduling.
    hope this helps.
    regs,
    hema.

  • How to schedule a job in another system.

    Hi,
    Now i have an ABAP program, which run in system ABC, client 001. i want to schedule a job in the program, with the function modules JOB_OPEN, JOB_SUBMIT, and JOB_CLOSE. But this job should run in ABC/002.
    How to write code?
    Who can help me on the requirement, or provide me another new solution except event trigger?
    Thanks & Best Regards,
    Johnney

    Here is the code. It works fine..
    FUNCTION Z_F_TRIGGER_REPORT.
    ""Local Interface:
    *"  IMPORTING
    *"     VALUE(I_PROG) TYPE  D010SINF-PROG
    *"     VALUE(I_VARIANT) TYPE  VARIS-VARIANT
    *"     VALUE(I_MODE) TYPE  CHAR01
    *"  EXPORTING
    *"     VALUE(E_SUBRC) TYPE  SYST-SUBRC
    *"     VALUE(E_MSG) TYPE  CHAR80
    Functio ID :  Z_F_TRIGGER_REPORT
    TITLE      :  Report Trigger Tool
    Create Date:  15.03.2004
    Author     :  Denis Vieira
    Ownership : For the exclusive use of the Procter & Gamble Company
    Description:
    The purpose of this function module is to trigger programs
    requested remotely.
    AUTHORIZATION CHECKS
    OBJECT               AUTHORITY FIELDS         ABAP FIELDS
                     |                       |
    CHANGE HISTORY                                                      *
      DATE      |  Name  | Description                       | Reference *
    29.Jun.2006 | BA4513 | Unicode conversion and upgrade    | SPK290606
                |        | to My SAP ERP                     |
    **eject.
    Check if selected program exists in the destination file
      SELECT SINGLE  SUBC
             FROM    D010SINF
             INTO    D010SINF-SUBC
             WHERE   PROG    EQ  I_PROG
             AND     R3STATE EQ  C_A.
      IF SY-SUBRC NE C_0.
        MOVE  C_2                                               TO E_SUBRC.
        MOVE 'Report does not exist in destination system'(M01) TO E_MSG.
        EXIT.
      ENDIF.
    Check if program request is an executable program
      IF D010SINF-SUBC NE C_1.
        MOVE  C_2                                               TO E_SUBRC.
        MOVE 'Report is not an executable program'(M02)         TO E_MSG.
        EXIT.
      ENDIF.
    Check if selected variant exists in the destination file
      SELECT COUNT( * )
           FROM  VARIS
           INTO  W_COUNT
           WHERE REPORT  EQ I_PROG
           AND   VARIANT EQ I_VARIANT
           AND   DYNNR   EQ C_1000.
      IF W_COUNT EQ C_0.
        MOVE  C_2                                                TO E_SUBRC.
        MOVE 'Variant does not exist in destination system'(M03) TO E_MSG.
        EXIT.
      ENDIF.
      IF I_MODE EQ C_B.
        PERFORM 0100_BACKGROUND USING     I_PROG I_VARIANT
                                CHANGING  E_MSG  E_SUBRC.
      ELSE.
        PERFORM 0200_FOREGROUND USING     I_PROG I_VARIANT
                                CHANGING  E_MSG  E_SUBRC.
      ENDIF.
    ENDFUNCTION.
    *eject
    *&      Form  0100_background
    Executes Selected program in BackGround Mode VIA JOB
    *Block commented from here SPK290606
    *FORM 0100_BACKGROUND USING     L_PROG L_VARIANT
                        CHANGING  L_MSG  L_SUBRC.
    *Block commented till here SPK290606
    *Block added from here SPK290606
    FORM 0100_BACKGROUND USING    L_PROG    LIKE D010SINF-PROG
                                  L_VARIANT LIKE VARIS-VARIANT
                         CHANGING L_MSG     TYPE  CHAR80
                                  L_SUBRC   TYPE  SYST-SUBRC.
    *Block added till here SPK290606
      CONCATENATE C_AREA
                  C_UND
                  L_PROG
                  C_UND
                  SY-DATUM
                  C_UND
                  SY-UZEIT
                  INTO W_JOBNAME.
    Create a JOB and Get the Number for further execution
      CALL FUNCTION 'JOB_OPEN'
           EXPORTING
                JOBNAME  = W_JOBNAME
           IMPORTING
                JOBCOUNT = W_JOBCOUNT.
      IF SY-SUBRC NE C_0.
        MOVE  C_2                       TO L_SUBRC.
        MOVE 'Error opening job'(M07)   TO L_MSG.
        EXIT.
      ENDIF.
    Submit program
      SUBMIT (L_PROG)
        USING SELECTION-SET L_VARIANT
        VIA JOB W_JOBNAME NUMBER W_JOBCOUNT
        AND RETURN.
      IF SY-SUBRC NE C_0.
        MOVE  C_2                        TO L_SUBRC.
        MOVE 'Error Submitting Job'(M06) TO L_MSG.
        EXIT.
      ENDIF.
    Closes job to start its processing
      CALL FUNCTION 'JOB_CLOSE'
           EXPORTING
                JOBCOUNT  = W_JOBCOUNT
                JOBNAME   = W_JOBNAME
                STRTIMMED = 'X'.
      IF SY-SUBRC NE C_0.
        MOVE  C_2                       TO L_SUBRC.
        MOVE 'Error closing job'(M08)   TO L_MSG.
        EXIT.
      ENDIF.
      MOVE  C_0                                          TO L_SUBRC.
      MOVE 'Program Submitted in Background Mode'(M09)   TO L_MSG.
    ENDFORM.
    *eject
    *&      Form  0200_foreground
    Executes Selected program in ForeGround Mode VIA Submit
    *Block commented from here SPK290606
    *FORM 0200_FOREGROUND USING     L_PROG L_VARIANT
                        CHANGING  L_MSG  L_SUBRC.
    *Block commented till here SPK290606
    *Block added from here SPK290606
    FORM 0200_FOREGROUND USING    L_PROG    LIKE D010SINF-PROG
                                  L_VARIANT LIKE VARIS-VARIANT
                         CHANGING L_MSG     TYPE  CHAR80
                                  L_SUBRC   TYPE  SYST-SUBRC.
    *Block added till here SPK290606
      SUBMIT (L_PROG) USING SELECTION-SET L_VARIANT
             EXPORTING LIST TO MEMORY AND RETURN.
      IF SY-SUBRC EQ C_0.
        MOVE  C_0                                 TO L_SUBRC.
        MOVE 'Report submitted successfully'(M04) TO L_MSG.
      ELSE.
        MOVE  C_2                                 TO L_SUBRC.
        MOVE 'Error submitting report'(M05)       TO L_MSG.
      ENDIF.
    ENDFORM.

Maybe you are looking for

  • Safari 5.1.7 (6534.57.2) is taking a long time to open

    For the past week or so, I've been having difficulties with my Safari browser opening in a timely manner.  It takes at least 30 seconds to one minute to load.  I've looked on different forums and people mention deleting com.apple.Safari.plist or upda

  • I Cant connect to Localhost after installing sql Server 2012 r2 Sp2

    Hi, I can't connect to localhost after installing ssms. Also, I can't find SQL on Services. Do you have any ideal? Thanks!

  • Multiple files in a zip file

    Hi Experts, I have a scenario where I have to unzip mutiple files at the PI level using file adapter and process according to source and target structures in mapping.Also for example the files will be having the some seconds interval in processing on

  • Subinventory Transfer script .

    Hi All, i have developed the following script to bulk sub inventory transfer ,please correct if i done any thing wrong and give me some valuable suggestions . create or replace PROCEDURE XX_SUB_INV_TRN (errbuf OUT varchar2, retcode OUT number,P_SUB_I

  • Transaction Variant for BD87 ? possible

    Hi all, I have the requirement to get a user access to BD87 but only for specific message types and status. I created a selection screen variant with the correct values. Then I tried to create a transaction in SE80 for the report + selection screen v