ABAP program to run in Background job

Hi,
We have a custumized program (SO Creation) calling some functions (like: WS_QUERY, WS_UPLOAD, WS_DOWNLOAD, CREATE_TEXT and CALL TRANSACTION VA01) and can only run thru dialog process (foreground).  Is it possible to convert it to something that can run thru background job?
Please help.
Thanks.

Hi Deo ,
Unfortunately cl_gui_frontend_services will not work in background.
Please have a look at following information about cl_gui_frontend_services :
The class CL_GUI_FRONTEND_SERVICES contains static methods for the following areas:
File functions
Directory functions
Registry
Environment
Write to / read from clipboard
Upload / download files
Execute programs / open documents
Query functions, such as Windows directory, Windows version, and so on
Standard dialogs (open, save, directory selection)
To Use this, you should be bit familier with OO ABAP Concepts. So I will suggest you to go through with OO concepts of ABAP. It will be of great help to you.
Regards,
Nikhil

Similar Messages

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

  • Regarding email attachement while running a background job

    Dear Experts,
    When i am running a background job for any ALV report (standard or custom report) <b>automatically</b> the output is going to an e-mail address as a HTML file attachment. I want to change it to EXCEL file attachment.
    Please help me on this issue..
    Kind Regards,
    Tom

    Hi Prasanna,
    Thank you for your reply.  I am not using any code for sending the mail to the recipient E-mail address, system is taking care automatically.
    Few settings were done in SCOT transaction from basis, but no where they mentioned file type is .HTM.
    From my end i have done the following steps.
    1. go to SM36, give a job name.
    2. press on step push button , give the ABAP program name ( any ALV program, i mean standard report or Z report), give the variant and save.
    3. Come back . press on Spool list recipient push button give the e-mail address, press copy button on the  pop up window.
    4. press on start condition button , press on Immediate option and save.
    5. again press on Save button in the screen.
    now here job will be scheduled immediately, go to SM37 check your job status, if it is completed, automatically system is sending an e-mail with the ".HTM" attachment file output to the recipient e-mail address.
    i am not doing any coding part here.
    my concern is system should send the e-mail with ".XLS" file output attachment.
    please advise on this.
    Regards,
    Tom.

  • Getting the variant name when the report program is run in background

    Hi All,
    How to get the variant name for the report program when run in background? My requirement is to create an email attachement with the name 'variant.XLS', where variant = selection screen variant, when the report program is run in background. The system field SY-SLSET holds the variant name only when run online.
    Any pointers to this will be highly appreciated.
    Thanks and regards,
    Nilesh.

    Hello Nilesh,
    Please find the algo:
    1. Call the FM: GET_JOB_RUNTIME_INFO to get the background job details.
    2. Select data from TBTCP using these details:
    DATA:
    FP_EVENTID   TYPE BTCEVENTID
    FP_EVTPARM   TYPE BTCEVTPARM
    FP_ACTIVE    TYPE BTCXPGFLAG
    FP_JOBCNT    TYPE BTCJOBCNT
    FP_JOBNM     TYPE BTCJOB
    FP_STEPCNT   TYPE BTCSTEPCNT.
      CALL FUNCTION 'GET_JOB_RUNTIME_INFO'
        IMPORTING
          EVENTID                 = FP_EVENTID
          EVENTPARM               = FP_EVTPARM
          EXTERNAL_PROGRAM_ACTIVE = FP_ACTIVE
          JOBCOUNT                = FP_JOBCNT
          JOBNAME                 = FP_JOBNM
          STEPCOUNT               = FP_STEPCNT
        EXCEPTIONS
          NO_RUNTIME_INFO         = 1
          OTHERS                  = 2.
      IF SY-SUBRC <> 0.
    *   Error calling FM: GET_JOB_RUNTIME_INFO
      ENDIF.
    DATA: FP_VARIANT TYPE BTCVARIANT.
      SELECT JOBNAME JOBCOUNT STEPCOUNT VARIANT
      FROM   TBTCP
      INTO TABLE L_IT_TBTCP
      WHERE  JOBNAME   = FP_JOBNM
      AND    JOBCOUNT  = FP_JOBCNT
      AND    STEPCOUNT = FP_STEPCNT.
      IF SY-SUBRC = 0.
        SORT L_IT_TBTCP BY JOBNM JOBCNT STEPCNT.
        READ TABLE L_IT_TBTCP INTO L_WA_TBTCP INDEX 1.
        IF SY-SUBRC = 0.
          FP_VARIANT = L_WA_TBTCP-VARIANT.
        ENDIF.
      ENDIF.
    Hope this helps.
    BR,
    Suhas

  • Disabling parallel run of background job

    Hi All
    I have an ECC6.0 system in load balancing mode with cluster environment. The problem is that we have a program which runs in background. The same is specified to run on App1 server. However, in case the no. of bkd processes are less in App1 servers, it schedules the remaining jobs on to App Server 2 which is not desired.
    eg
    I have a process which activates 8 bkgd jobs on App1
    App1 only has 5 bkgd processes free
    The remaining 3 jobs will get scheduled on App2, which is not desired.
    Please let me know how can i restrict a background process to run only on a single server.
    Regards
    Lokesh.

    If you define/change a job you can give a background server, however, if you give a fixed instance name and that instance is down the job won´t run at all.
    You may be able to use an external scheduling software for this, e. g. Redwood Cronacle - which is free for Netweaver customers.
    Markus

  • Office intergration - run as background job

    Hi,
      I have a word template merged with data using "Desktop Office Integration".
      Currently word template will be opened before data merging is done.
      Is it possible to run as background job, which word template can merge with data in backend? If possible, how should i work on it?
    Kindly advise.
    Thanks,
    Ginnie

    Hi,
      Thanks for your prompt reply.
      Is there any other methods which i can pull my data from table and merge to a word document?
      Or is it possible to generate PDF in this case?
      I need it to be a backend job.
      Any suggestion? Kindly advise.
    thanks,
    ginnie

  • ABAP PROGRAM to run a process chain

    Hello all,
    What is the ABAP program to run a process chain after a step that has failed but is manually corrected?
    In short a std ABAP program to run a pc.
    Regards,
    NIKEKAB

    Hi.
    Plz see my answer to similar question in [this thread|Re: Manage a message at the end of process chain on Web planning Application].
    Regards.

  • Extract Process Chain ID/Name that an embedded ABAP program is run from?

    Hi all,
    I have created some Process Chains in SAP BW where I have incorporated some ABAP program Process Types that uses the same ABAP program.
    In these embedded ABAP program Process Types I need to extract the name of the Process Chain it runs from (ID, Technical Name, Descirption).
    Is there any way this is possible to do?
    One solutions that is not possible to implement (due to parallell runs of process chains that uses the same ABAP program) is the following:
    search in table RSPCVARIANT for your program as follows
    - field TYPE = "ABAP"
    - field FNAM = "PROGRAM"
    - field LOW = <program name>
    take the value of field VARIANTE and use this in table RSPCPROCESSLOG (enter a date selection for BATCHDATE as well)
    take the most recent entry (should be the one you're actually running at that moment)
    via field LOG_ID, retrieve CHAIN_ID (technical name of your process chain) in table RSPCLOGCHAIN
    So my question here is:
    -Is there any way to extract the Process Chain ID/Name that an embedded ABAP program Process Type is run from?
    Thanks beforhand for your feedback!
    regards
    Oddmar

    Hi Erik,
    I am stuck up with a similar requirement, wherein I have an ABAP program in my process chain and I need the technical name of the process chain in the ABAP program at run-time.
    Did you get a solution or work-around for this scenario?
    Thanks in advance.
    Regards,
    Chetana.

  • Read Error logs after running the background jobs

    Hi,
    How to read the error logs after running the background jobs. In our scenarion we are running the COHV transaction to release the production orders in background. But we are not finding the error logs after background job. We would like to read the error logs and correct for further processing.
    Kindly suggest.
    Thanks & Regards,
    N. Laxman

    Hi
    you can check the  back ground jobs defined by any user in SM37 and where you can see the spool and job logs as well.
    plz check in your case and revert back
    Regards
    Anupam Sharma

  • How can I read the EXCEL file while Program is running in background.

    Hi all Expert,
    How can I read the EXCEL file while Program is running in background.
    Thanks

    you need to place ur excel file on application server and follow this thread: Reading an Excel file from the application server?
    loots of information if you can search forum.. thanks

  • How to set a  Executable ABAP  Program to run as a Background Batch Job

    Hi
    Currently  I had a Executable ABAP  Program which when executed prompts for user to enter selection once entered and executed it will delete user entered selections from a Table.
    Now my requirment is to enhance that program to run it as a BACKGROUND BATCH JOB so that there will be an entry in SM37 when the program is executed
    How can i achieve this

    Hi,
    Please refer this link .
    It has the steps.
    http://sapient.wordpress.com/2007/06/19/how-do-you-set-up-background-jobs-in-sap/
    Regards,
    SuryaD.

  • Can ABAP proxy to consume WSDL file be run as background job for every10min

    Hi all,
    I have a requirement where I need to build an interface which gatheru2019s the purchase order details and send to external third party software in their required format (as an XML file).
    So I should be the first point of contact and should trigger the interface each time a purchase order is generated.
    So I am thinking that I should develop a background job for every 10 minutes which will look for new purchase orders and gathers the information of the purchase orders and send them to external third party software in their required format.
    I have gone through all the SAP forums and e-Learning but still I have confusion in regards to how is it possible technically? Can some one guide me with some information on the same.
    I have a little bit of confusion and want to know few things.
    1)     Should I create a web service or should I consume a web service?
    2)     If I need to consume a web service, then can I write an ABAP proxy to be run in background fro evry 10 minutes? I mean can we run ABAP proxy as a batch job in the background?
    3)     Is there a difference between consuming an XML file and WSDL File?
    Any Help will be highly appreciated.
    Regards,
    Jessica.

    There are two options (as I know) to generate XML file.
    1. Use XML TRANSFORMATION to get the XML string based your TRANSFORMATION. You can input your data and get back the XML string. Download this string to a file
    Test XML generation program is:
    types: begin of ty_data,
           num   type i,
           end   of ty_data.
    DATA: itab TYPE standard table of ty_Data,
          la_data like line of itab,
          xmlstr TYPE string.
    DO 3 TIMES.
      la_data-num = sy-index.
      APPEND la_data TO itab.
    ENDDO.
    CALL TRANSFORMATION ztest_np1
      SOURCE table = itab
      RESULT XML xmlstr.
    CALL FUNCTION 'DISPLAY_XML_STRING'
      EXPORTING xml_string = xmlstr.
    My ZTEST_NP1 transformation. To create a transformation, click on the transformation in the "CALL TRANSFORMATION ztest_np1" statement. Select Simple transformation type.
    <?sap.transform simple?>
    <tt:transform xmlns:tt="http://www.sap.com/transformation-templates">
      <tt:root name="table"/>
      <tt:template>
        <table>
          <tt:loop ref=".table">
            <item>
              <tt:value ref="NUM"/>
            </item>
          </tt:loop>
        </table>
      </tt:template>
    </tt:transform>
    XML string is like:
      <?xml version="1.0" encoding="utf-8" ?>
      <table>
      <item>1</item>
      <item>2</item>
      <item>3</item>
      </table>
    To use this option, you have to create a transformation and than use it to generate the XML string.
    Check this SAP Help
    http://help.sap.com/saphelp_nw04s/helpdata/en/e3/7d4719ca581441b6841f1054ff1326/frameset.htm
    2. You can concatenate and create an XML string and download that string into a file.
    Regards,
    Naimesh Patel

  • How to Prevent the Executing a Program but Allow to Run as Background Job?

    Hi All,
    I have an ABAB List Program. I need to restrict this program from executing. This has to always run as a Background Job. How do I check this condition in the program?
    Thanks,
    Kishan

    Check for the system variable SY-BATCH. If this field is 'X', then allow the execution of the program. If not then exit. Do this coding in the initialization event or start of selection.
    INITIALIZATION.
    IF sy-batch IS INITIAL.
      STOP.
    ENDIF.
    Manoj

  • ALV List export to Excel when program is run in background

    Hello,
    I am running into an issue with a custom ALV report which contains an export to Excel option on the input screen. However, when I attempt to run the report in background due to high volume of records/expected performance constraints, the job fails to produce a spool when the "export to Excel" option is selected. When I deselect that option, the background job successfully generates a spool, which I can then export to Excel (albeit the formatting will not look the same).
    Is the above an accurate statement or does anyone know of a way where either;
    1) The background job can create and store the Excel output into a cached directory?
    2) The spool generated, when exported to Excel, can match the format of the foreground Excel output?
    Thanks in advancce.

    Check out the sample program of the provided link ..
    http://www.sap-img.com/abap/download-in-background-in-excel-format.htm

  • Scheduling ABAP Program to run Daily

    Hi,
    In my current scenario, i require my ABAP program(ZMYPROGAM) to run periodically (say every 1 hour/ 1 Day). Is it possible to schedule it so?
    kindly let me know how to go about.
    Regards,
    Siva Maranani.

    Hi Siva,
    You can schedule your program as a background Job SM36. Please check the transaction. You will have to set your ABAP program as the job STEP (if you probably have selection screen for your report then you will also need a variant for your report).
    Do schedule your program as a 'Periodic Job' and your personal period (daily/hourly).
    After you save your settings you can also monitor your job (ABAP Program) from the same transaction or even from CCMS if you like.
    hope this helps,
    ZAM

Maybe you are looking for