Check background job

Hi,
Is there any function module in ABAP to check if a specific background job is already running?
Thanks,
Morten

Hi Morten
Please check Function Group: BTCH. We can find usefule function modules.
Kind Regards
Eswar

Similar Messages

  • Background Jobs scheduled through ABAP Editor

    Dear SRMer's
    System Info : SRM 5.0
    Can you please let me know what is the tcode to check Background jobs scheduled through the ABAP Editor(SE 38) or through SA38 tocdes in SRM.
    Points will be rewarded for answers.
    Thanks in advance,
    Bobby

    Hi Bobby,
    Try this steps...
    1.  Log on to the appropriate SAP instance and client as either the user ID owning the job or an administrator ID.
    2.  Go to transaction SM37.
    3.  On the Simple Job Selection screen, fill in the Job name field or use any of the screens filtering options to produce a list from which you can see the job you want to view.  In order for all occurances of a job to be viewed, all statuses of the job should be checked “on”.  Click on the Execute button.
    Regards
    Rajesh.

  • To Check whether Background Job ran or no

    How can we programatically check in a program whether a background job ran or not for a particular output type of invoice ?? Pls help me out

    Hi,
      This will probably work.
    report zkiran_0001 .
    data: xtbtco type   tbtco .
    parameters: p_job type tbtco-jobname.
    start-of-selection.
      clear xtbtco.
      select single  * from tbtco
              into xtbtco
                         where jobname = p_job
                           and status = 'R'.  " running
      if sy-subrc = 0.
        write:/ 'Job', p_job, ' is currently running'.
      endif.
    Statuses....
    Status of background job
    The following statuses are possible:
    <b>Scheduled:</b> Job defined, but not yet eligible to run even if the start condition has been fulfilled.
    <b>Released:</b> Job eligible to be started as soon as the start condition with which it was scheduled is fulfilled.
    <b>Ready:</b> Job waiting to start. The job has been released and the job's start condition has been fulfilled.
    <b>Active:</b> Job is currently running and can no longer be deleted or reset to scheduled.
    <b>Finished:</b> Job has been successfully completed. All job steps completed successfully.
    Note: the background processing system cannot always determine whether an external job step was successfully completed. In this case, the system assumes successful completion.
    <b>Terminated:</b> Job was ended abnormally either through user action or through an error in running a job step.
    Internal codes for these are as follows.
      btc_running       LIKE tbtco-status VALUE 'R',
      btc_ready         LIKE tbtco-status VALUE 'Y',
      btc_scheduled     LIKE tbtco-status VALUE 'P',
      btc_released      LIKE tbtco-status VALUE 'S',
      btc_aborted       LIKE tbtco-status VALUE 'A',
      btc_finished      LIKE tbtco-status VALUE 'F',
      btc_put_active    LIKE tbtco-status VALUE 'Z',
      btc_unknown_state LIKE tbtco-status VALUE 'X'.
    refer
    https://forums.sdn.sap.com/click.jspa?searchID=4369376&messageID=1681128
    Regards
    Message was edited by:
            Kiran Sure(skk)

  • FM for Background Job Check

    Hi,
    is there a function module that will check the background job status and will wait for it to finish before returning to the calling program?
    I have developed a program that triggers a background job at runtime, but i also need to make sure the job is finished, successful or not, before the output of the program. i'm currently doing a query in a job table inside a do enddo loop, but i believe this is not efficient.
    Any ideas?
    thanks.
    tyken

    I am not having the sample Code with me right now...
    But i'll help you to build the logic...
    after Write report.
    Use the Function module I told u...
    then...
    write a select query on  table tbtcp with job info you will get from FM.
    What is your objective after getting the Background Job details..?

  • Background job failing with license check error

    Hi Experts
    In our ERP 6.0 system ,all the background jobs are failing with license check error.
    Have checked the license in SLICENSE and the license is fine.
    There is no warning while users are loggign in ,but when any background job is runing its failing with error
    Job started
    Logon not possible (error in license check)
    Job cancelled after system exception ERROR_MESSAGE
    Also performed the license test which is failing
    F:\usr\sap\XX1\SYS\exe\uc\NTAMD64>saplicense -test pf=F:\usr\sap\XX1\SYS\profile
    \XX1_DVEBMGS00_host_xx
    Protocol saplicense test:
    Read sapsytem name
           ok, sapsytem name = XX1
    Read message server host
           ok, host = hostname
    Read message server service port
           ok, service port = sapmsXX1
    Connect to message server
           ok, connect done
    Read hardware key from message server
           ok, got hardware key
    Detach from message server
           ok, detached
    Check hardware key
           ok, hardware key = T0343073854
    Connect to database
           ok, connected
    Check license
           ok, check done
    Disconnect database
           ok, database disconnected
    test result: license test failed
    LICENSE system: XX1 hardware key: T0343073854 expiration_date:
            installation no:  key:
            userlimit: 0 productid: R3_BASIS
            system-nr:
    license expired ***
    Please suggest how to troubleshoot.
    Regards
    Ajay

    @Michael
    In SLICENSe the Hardware key field is not BLUE or BLACK and its showing the exact hardware key which i can see at OS level with saplicense -get command.
    @Jagadish
    Note is good refrence, i reiinstalled the Digitally signed license with saplikey command and it was successful.
    But still the license test is failing at OS Level..below is the command prompt output.
    ===================================================================
    F:\usr\sap\XX1\SYS\exe\uc\NTAMD64>saplikey -install C:\license_script_XX.txt pf
    =F:\usr\sap\XX\SYS\profile\XX_DVEBMGS00_mngsez148079
    SAP License Key Administration  -  Copyright (C) 2003 SAP AG
    2 SAP license key(s) successfully installed.
    F:\usr\sap\XX\SYS\exe\uc\NTAMD64>saplicense -test pf=F:\usr\sap\XX1\SYS\profile
    \MD1_DVEBMGS00_mngsez148079
    Protocol saplicense test:
    Read sapsytem name
           ok, sapsytem name = XX1
    Read message server host
           ok, host = host
    Read message server service port
           ok, service port = sapmsXX1
    Connect to message server
           ok, connect done
    Read hardware key from message server
           ok, got hardware key
    Detach from message server
           ok, detached
    Check hardware key
           ok, hardware key = T0343073854
    Connect to database
           ok, connected
    Check license
           ok, check done
    Disconnect database
           ok, database disconnected
    test result: license test failed
    LICENSE system: XX1 hardware key: T0343073854 expiration_date:
            installation no:  key:
            userlimit: 0 productid: R3_BASIS
            system-nr:
    license expired ***
    ============================================================
    @Juan
    The hardware key was changed and we requested a new license with new hardware key,system was runing fine for couple of weeks with all background jiobs for SPAM./SAINT Ok .We performed EHP4 on this system.
    But now this issue is here,so i guess we should troubleshoot.
    Please let me know any other pointers.
    Regards
    Ajay
    PS In SLICENSE new installed license is fine and all users can login.

  • To check the status of a step inside a background jobs

    Hi All,
    i have a requirement where i have to check the status of a step(program)
    inside a background job.
    I tried with table TBTCP, but this will give the program status as P(scheduled)
    always.
    i know to find the status of a background job as whole, but how will we
    find out the status of a program inside a job.
    Could anyone please help?

    Use function module BP_JOBLOG_READ, result is an internal table of structure TBTC5,
    Analyze this internal table, looking for message S550(00) at the beginning of a step.
    Regards

  • How to check the ALV output for the background job

    Hi Guru,
    We are having a cutomized report which will display the result like a ALV report.
    We configured it as an background job, after the completion of the background job, it will send the result to the SPOOL, and we can use SP02 to check the output,
    But it is not easy for user to directly check the result easily, is there an method we can save it as an spreadsheet and send the output to a specific location or mailbox and then user can check it easily
    thanks,

    In SM37 ,select the Job > Spool > Select Spool No > Display Contents > Here it will show you the Output of the Report.Now select Ctrl +Shift + F12 , it will ask you to save the Spread sheet in specified location.
    Best Regards,
    Ankur

  • 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.

  • Scheduling one background job inside another

    Hi All,
    Is it possible to Scheduling one background job inside another.? i.e In my Z program I am calling job_open, job_submit, job_close and to execute one standard report in background. And after that I am executing my Z program itself  from SE38 as Program->Execute->Background->Execute Immediately. Is this logically correct? I am asking this because I am not getting the desired result
    Thanks & Regards,
    Neethu.

    HI,
    Check the job steps in SM36.
    First schedule the Standard job and in the job steps schedule the z report.
    Schedule job in chain

  • Check The Job Status

    Hi SAPsimhas,
    My requirement is as below.
    I will loop through an internal table and create some files with background processing method.(JOB_OPEN,SUBMIT & JOB_CLOSE)
    Now once this job is triggered I need to check the status for that job after maximum 10 mins. Its not neccessary that each job will take 10 mins. only,It can be finished in 2 mins also.
    Once the job is finished then I will XCOM that file.
    So my question is how to code such timer which will check the job status for that job? I have a FM BP_JOB_READ which returns the job status.
    Reply is highly appriciated.

    Try this way
      do.
        call function 'SHOW_JOBSTATE'
          exporting
            jobcount         = p_jobc
            jobname          = p_jobn
          importing
            aborted          = v_aborted
            finished         = v_finished
            ready            = v_ready
            running          = v_running
            scheduled        = v_scheduled
          exceptions
            jobcount_missing = 1
            jobname_missing  = 2
            job_notex        = 3
            others           = 4.
        if v_aborted eq 'X'.
          exit.
        endif.
        if v_finished eq 'X'.
          select single * from tbtcp into wa_tbtcp1
                     where jobname eq p_jobn
                       and jobcount eq p_jobc.
          if sy-subrc eq 0.
            move wa_tbtcp1-listident to p_spono.
          endif.
          exit.
        endif.
        if v_count le 10.
          call function 'ENQUE_SLEEP'
            exporting
              seconds = 60.
          v_count = v_count + 1.
        endif.
      enddo.

  • Submit RSEOUT00 as background job

    Hi all,
    Here is my requirement.There is a Z program from which RSEOUT00 program has to be called , so that it will change the Idoc status to '03'. I tried using Submit RSEOUT00..and return and also tried JOB_open and then SUBMIT rseout00 WITH docnum EQ p_idocno  user sy-uname  via  job jobname number jobcount and return and then JOB_CLOSE .I checked SM37 also where i can see this job as finished..
    I tried COMMIT WORK statement and also WAIT statement .
    But still the idoc status wont change to '03' .
    Can anyone plase advise on how to correct this .
    Regards,
    Sudheer

    Hi,
    I have created background job for RSEOUT00 and written the below code. It worked.
    DATA: w_number           TYPE tbtcjob-jobcount,
               w_name              TYPE tbtcjob-jobname VALUE 'ZTEST_JOB'.
       CALL FUNCTION 'JOB_OPEN'
         EXPORTING
           jobname          = w_name
         IMPORTING
           jobcount         = w_number
         EXCEPTIONS
           cant_create_job  = 1
           invalid_job_data = 2
           jobname_missing  = 3
           OTHERS           = 4.
       IF sy-subrc = 0.
         SUBMIT rseout00  VIA JOB w_name NUMBER w_number AND RETURN.
         IF sy-subrc = 0.
           CALL FUNCTION 'JOB_CLOSE'
             EXPORTING
               jobcount             = w_number
               jobname              = w_name
               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.
           ENDIF.
         ENDIF.
       ENDIF.
    Thanks,
    Appanaboina

  • Internal error occurs in background job scheduling

    Hi Experts,
    We are facing an error message "Internal error occurs in background job scheduling" while trying to execute a custom report(Z report) in background in SA38.
    Please find the following observation on our side on this message.
    1) This message is not coming for only one report not for others.
    2) SU53 screen shot shows that SE38 check is failed, but the weird thing is not happening for other report.
    3) Persons having SE38 auhtorization are able to run this report.
    Please advise.
    Thanks in advance,
    Viven

    What is the message ID and number? Have you tried OSS search and debugging?
    What does this program do, in a nutshell?

  • BWREMOTE background job canceled in sap r/3 system

    Hi my friends,
    Thanks for your help ahead.
    Today I checked the background job in SAP R/3 created by BWREMOTE via SM37. It showed me some jobs had been canceled.
    I displayed its log, the detail message is:
    ==========================================
    Step 001 started (program SBIE0001, variant &0000000083494, user name BWREMOTE)
    DATASOURCE = ZQM_NOT_SHFGRP
    Call up of customer enhancement BW_BTE_CALL_BW204010_E (BTE) with 1,593 records
    Result of customer enhancement: 1,593 records
    Call up of customer enhancement EXIT_SAPLRSAP_001 (CMOD) with 1,593 records
    ABAP/4 processor: SAPSQL_INVALID_FIELDNAME
    Job cancelled
    ==========================================
    Then I displayed the "Long Text" of the job log. It is
    One of the field names in the SELECT clause was not recognized.
    Error analysis
    The SELECT clause was specified in an internal table at runtime.
    It contains the field name "TPR00", but this does not occur in any of
    the database tables listed in the FROM clause.
    Information on where termination occurred
    The termination occurred in the ABAP/4 program "SAPLXRSA " in
    "EXIT_SAPLRSAP_001".
    The main program was "SBIE0001 ".
    Source code extract
    008840 concatenate 'TPR'
    008850 day_temp+6(2)
    008860 ' = '
    008870 ' ''' zshift '''' into
    008880 cond .
    008890 append cond to itab .
    008900 select schkz into i_not_shfgrp-zzschkz from t552a
    008910 where zeity = '2'
    008920 and mofid = 'CN'
    008930 and mosid = '28'
    008940 and ( schkz = 'SFTA' or
    008950 schkz = 'SFTB' or
    008960 schkz = 'SFTC' or
    008970 schkz = 'SFTD' )
    008980 and kjahr = day_temp+0(4)
    008990 and monat = day_temp+4(2)
    > and (itab) .
    009010 endselect.
    I guess that there is not a field named TPR00 in table t552a.
    Next, I opened the 'project management of sap enhancement' via CMOD, entering the project name and chosing 'Display'.
    Then Double click the Components 'EXIT_SAPLRSAP_001', we can see the function module 'EXIT_SAPLRSAP_001'. In the source codes, there is an include program, it is 'INCLUDE ZXRSAU01.'.
    Then, I double clicked the Include program and find the position program terminated. The source codes are:
    ZQM_NOT_SHFGRP *
    when 'ZQM_NOT_SHFGRP'.
    loop at c_t_data into i_not_shfgrp .
    l_tabix = sy-tabix .
    clear :mbatch ,zshift,cond ,zfield, zcharg, day_temp .
    refresh itab.
    if i_not_shfgrp-ausvn is initial.
    else.
    aa = '080000'.
    bb = '160000'.
    cc = '235959'.
    day_temp = i_not_shfgrp-ausvn.
    if i_not_shfgrp-auztv ge aa and
    i_not_shfgrp-auztv lt bb .
    zshift = 'MSHF' .
    elseif i_not_shfgrp-auztv ge bb and
    i_not_shfgrp-auztv le cc .
    zshift = 'LSHF'.
    else .
    zshift = 'NSHF'.
    day_temp = i_not_shfgrp-ausvn - 1.
    endif.
    concatenate 'TPR'
    day_temp+6(2)
    ' = '
    ' ''' zshift '''' into
    cond .
    append cond to itab .
    select schkz into i_not_shfgrp-zzschkz from t552a
    where zeity = '2'
    and mofid = 'CN'
    and mosid = '28'
    and ( schkz = 'SFTA' or
    schkz = 'SFTB' or
    schkz = 'SFTC' or
    schkz = 'SFTD' )
    and kjahr = day_temp+0(4)
    and monat = day_temp+4(2)
    and (itab) .
    endselect.
    endif.
    I found that we got a TPR00 during concatenation. In other words, day_temp+6(2) = 00. But I think it is impossible. I can not explain this.
    Any ideas, my friends. Many thanks.

    select schkz into i_not_shfgrp-zzschkz from t552a
    where zeity = '2'
    and mofid = 'CN'
    and mosid = '28'
    and ( schkz = 'SFTA' or
    schkz = 'SFTB' or
    schkz = 'SFTC' or
    schkz = 'SFTD' )
    and kjahr = day_temp+0(4)
    and monat = day_temp+4(2)
    <b>and (itab) .</b>  => doesn't make sense?!
    endselect.
    endif.
    it seems something got deleted between 'and' and '(itab)'... so, you'll have to recheck the requirements for your select to fill the 'and' statement further.
    so, it should look like
    and monat = day_temp+4(2)
    and <b><some kind of condition that needs to be fulfilled></b>.
    endselect.
    <b><some logic to fill a line in your internal table></b>.
    append cond to itab.
    endif.
    obviously <some kind of condition that needs to be fulfilled> needs to be replaced by a real condition
    and <some logic to fill a line in your internal table> needs to be replaced by some kind of formula
    I assume something like (otherwise it would be really weird to select that field):
    cond = i_not_shfgrp-zzschkz.
    or a formula using the i_not_shfgrp-zzschkz field.
    It would also be a lot better to replace your select ... endselect by a select single as you'll be selecting 1 record only anyways.
    Message was edited by:
            RafB

  • Alv show in report but when see in spool (after run background job) there i

    my program have some error when i run result alv show in report but when see in spool (after run background job) there is no data, (other program can see result in spool)
    Please help
    here is some example of my program
    ********************************declare internal table*****************************
    internal table output for BDC
    data : begin of t_output occurs 0,
    bukrs type anla-bukrs,
    anln1 type anla-anln1,
    anln2 type anla-anln2,
    zugdt type anla-zugdt,
    result(70) type c,
    end of t_output.
    *****get data from loop********************************
      loop at t_anla.
        CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
             EXPORTING
                  INPUT  = t_anla-anln1
             IMPORTING
                  OUTPUT = t_anla-anln1.
        CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
             EXPORTING
                  INPUT  = t_anla-anln2
             IMPORTING
                  OUTPUT = t_anla-anln2.
    check record is correct or not
        select single bukrs anln1 anln2 zugdt
        into w_output
        from anla
        where bukrs = t_anla-bukrs and
        anln1 = t_anla-anln1 and
        anln2 = t_anla-anln2
       zugdt = '00000000'
    if record is correct
        if sy-subrc = 0 and w_output-zugdt = '00000000'.
          w_output-bukrs = t_anla-bukrs.
          w_output-anln1 = t_anla-anln1.
          w_output-anln2 = t_anla-anln2.
          w_output-result = 'Yes : this asset can delete'.
          append w_output to t_output.
    if record is not correct
        elseif sy-subrc = 0 and w_output-zugdt <> '00000000'.
    there is error record  this asset have value already
          v_have_error = 'X'.
          w_output-bukrs = t_anla-bukrs.
          w_output-anln1 = t_anla-anln1.
          w_output-anln2 = t_anla-anln2.
          w_output-result = 'Error : this asset have value already'.
          append w_output to t_output.
        else.
    there is error record this asset donot exist in table anla
          v_have_error = 'X'.
          w_output-bukrs = t_anla-bukrs.
          w_output-anln1 = t_anla-anln1.
          w_output-anln2 = t_anla-anln2.
          w_output-result = 'Error : this asset doest not exist'.
          append w_output to t_output.
        endif.
    *end of check record is correct or not
        clear w_output.
      endloop.
    ******************************show data in ALV***************************************************
    show data from file in ALV
      perform display_report_ALV.
    *&      Form  display_report_ALV
    form display_report_ALV.
      DATA: LT_FIELD_CAT TYPE SLIS_T_FIELDCAT_ALV,
          LT_EVENTS TYPE SLIS_T_EVENT,
          LV_REPID LIKE SY-REPID.
      PERFORM ALV_DEFINE_FIELD_CAT USING LT_FIELD_CAT.
      PERFORM ALV_HEADER_BUILD USING T_LIST_TOP_OF_PAGE[].
      PERFORM ALV_EVENTTAB_BUILD USING LT_EVENTS[].
      LV_REPID = SY-REPID.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
           EXPORTING
                I_CALLBACK_PROGRAM = LV_REPID
                IT_FIELDCAT        = LT_FIELD_CAT
                I_SAVE             = 'A'
                IT_EVENTS          = LT_EVENTS[]
           TABLES
                T_OUTTAB           = t_output
           EXCEPTIONS
                PROGRAM_ERROR      = 1
                OTHERS             = 2.
      IF SY-SUBRC NE 0.
        WRITE: / 'Return Code : ', SY-SUBRC,
          'from FUNCTION REUSE_ALV_GRID_DISPLAY'.
      ENDIF.
    endform.
    *&      Form  alv_define_field_cat
          text
         -->P_LT_FIELD_CAT  text
    FORM ALV_DEFINE_FIELD_CAT USING  TB_FCAT TYPE SLIS_T_FIELDCAT_ALV.
      DATA: WA_FIELDCAT LIKE LINE OF TB_FCAT,
        LV_COL_POS TYPE I.
      DEFINE FIELD_CAT.
        CLEAR WA_FIELDCAT.
        ADD 1 TO LV_COL_POS.
        WA_FIELDCAT-FIELDNAME = &1.
        WA_FIELDCAT-REF_TABNAME = &2.
        WA_FIELDCAT-COL_POS = LV_COL_POS.
        WA_FIELDCAT-KEY = &3.
        WA_FIELDCAT-NO_OUT = &4.
        WA_FIELDCAT-REF_FIELDNAME = &5.
        WA_FIELDCAT-DDICTXT = 'M'.
        IF NOT &6 IS INITIAL.
          WA_FIELDCAT-SELTEXT_L = &6.
          WA_FIELDCAT-SELTEXT_M = &6.
          WA_FIELDCAT-SELTEXT_S = &6.
        ENDIF.
        WA_FIELDCAT-DO_SUM = &7.
        WA_FIELDCAT-OUTPUTLEN = &8.
        APPEND WA_FIELDCAT TO TB_FCAT.
      END-OF-DEFINITION.
      FIELD_CAT  'BUKRS'  'ANLA'     'X' '' 'BUKRS' 'Company Code' '' ''.
      FIELD_CAT  'ANLN1'  'ANLA'     'X' '' 'ANLN1' 'Asset Number' '' ''.
      FIELD_CAT  'ANLN2'  'ANLA'     'X' '' 'ANLN2' 'Asset Sub Number' '' ''.
    FIELD_CAT  'ATEXT'   'T5EAE'     'X' '' 'ATEXT' 'Result' '' ''.
      FIELD_CAT  'RESULT'  ''     'X' '' 'RESULT' 'RESULT' '' ''.
    ENDFORM.                    " alv_define_field_cat

    Hi,
    Check this code..
    FORM display_report_alv.
      DATA: lt_field_cat TYPE slis_t_fieldcat_alv,
      lt_events TYPE slis_t_event,
      lv_repid LIKE sy-repid.
      PERFORM alv_define_field_cat USING lt_field_cat.
      PERFORM alv_header_build USING t_list_top_of_page[].
      PERFORM alv_eventtab_build USING lt_events[].
      lv_repid = sy-repid.
      IF sy-batch EQ 'X'.  ----> " System Field for Backgroud..if Background use list display
        CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
          EXPORTING
            i_callback_program = lv_repid
            it_fieldcat        = lt_field_cat
            i_save             = 'A'
            it_events          = lt_events[]
          TABLES
            t_outtab           = t_output
          EXCEPTIONS
            program_error      = 1
            OTHERS             = 2.
      ELSE.
        CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
          EXPORTING
            i_callback_program = lv_repid
            it_fieldcat        = lt_field_cat
            i_save             = 'A'
            it_events          = lt_events[]
          TABLES
            t_outtab           = t_output
          EXCEPTIONS
            program_error      = 1
            OTHERS             = 2.
      ENDIF.
      IF sy-subrc NE 0.
        WRITE: / 'Return Code : ', sy-subrc,
        'from FUNCTION REUSE_ALV_GRID_DISPLAY'.
      ENDIF.
    ENDFORM.                    "display_report_ALV

  • It has an error when run a program in background job

    Dear Expert,
    we have a program
    when run it in background,it has a error "Error during import of clipboard contents" but when run it normally(run in front workbench se38 or run the t-code),everything is ok.i've used typingJDBG in the command box to debuge the background job,there has no error.
    whould you like to tell me what had happen? thanks a lot!
    addition: the program used a function ALSM_EXCEL_TO_INTERNAL_TABLE
    Thanks & Regards,
    Kerry
    Edited by: Kerry Wang on Aug 24, 2009 2:12 PM
    Edited by: Kerry Wang on Aug 24, 2009 2:14 PM
    Edited by: Kerry Wang on Aug 24, 2009 2:14 PM

    Hi,
      You cannot use FMs to get data directly from the presentation server when program is executed in the backgroud.
    Check the thread : GUI_DOWNLOAD
    Regards,
    Himanshu

Maybe you are looking for

  • Actions in PSE 8

    I read that PSE 8 now has a funtion for actions but can't find it anywhere in the programme (mac version). Can anybody help me?

  • How to use airplay with pandora on macbook

    I'm trying to use airplay to play a browser based player over airplay speakers. I can do this with my iPhone but i can't figure out how to do it on Macbook. Please help

  • Getting SOAPFaultException while Calling the web service

    Hi All, I am using jdev 11g 1.5. I am calling OID process , for which i have created web service proxy. On command button, i hv calling Action Listener and inside that method,i am fetching some data with three view object and setting that value to OD

  • Vetnam character display problem

    Dear All, I have created database in vetnam. but i am facing problem of displaying veitnam characters are displaying like ??????. i have created database with veitnam caharacterset VN8MSWIN1258 we are using client server application server applicatio

  • Accounts Payables Workflows (Payment Authorisation)

    Good Afternoon, Does anyone know if there is a seeded workflow within accounts payable for the authorisation of payments? We are currently running 11.5.10 and following a re-structure we have a desire to print cheques, that are signed in the template