Skip to Content
author's profile photo Former Member
Former Member

How to Execuate Dialog program in backgroud

Hi,

I am doing with dialog program which going to save values in database using bapi, there is two buttons available in my program one is save and another one is background, when the user clicks save, values will be saved in online, suppose if the user clicks background, my dialog program should be run in background to store the values in database.

I appreciate if experts provide tips to overcome this issue.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Sep 22, 2007 at 02:29 AM

    hi,

    normally in reports after checking i usually press F9 which takes care for background processing..Dont know abt dialog program how it works just have a try..

    regards,

    praveen

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 22, 2007 at 02:43 AM

    Hi ,

    user PAI will be something like

    when 'SAVE' .
    
             perform online 
    
    when 'BGRN'.
            perform background.
           
    form background.
    
    Submit Zxxx using ....
    and return . 
    
    endform. 

    say now u hit hte background button .

    function code calls BGRN option and here my idea would be to call a report by submitting the data what you have in bapi.

    use submit statement passing the content to this report so that a job is created and processed .

    here the ZXXX report will be coded as

    call function 'BAPI_********'

    Hope this helps ..

    regards,

    vijay.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Sep 22, 2007 at 02:45 AM

    Hello,

    Submit the same program in background mode and pass all the required parameters

    *part for background processing
    DATA: lv_job_name         LIKE tbtco-jobname,
    lv_job_nr           LIKE tbtco-jobcount,
    lv_job_released     TYPE c,
    lv_job_start_sofort TYPE c,
    lv_print_parameters TYPE pri_params.
    lv_job_name = 'ZPGM_NAME'. " your pgm name goes here
    
    * used to avoid spaces in the display
    DATA: lv_job_name_string TYPE string.
    lv_job_name_string = lv_job_name.
    
      CALL FUNCTION 'JOB_OPEN'
        EXPORTING
          jobname          = lv_job_name
        IMPORTING
          jobcount         = lv_job_nr
        EXCEPTIONS
          cant_create_job  = 1
          invalid_job_data = 2
          jobname_missing  = 3
          OTHERS           = 4.
      IF syst-subrc = 0.
    *submit job with all the selection screen params...
        SUBMIT (lv_job_name)
            WITH applfile = applfile  " parameters start here
            WITH p_lines = p_lines
            WITH rfc_dest = rfcdest
            WITH p_selmtd = lv_selmtd
            WITH px_shsim = px_shsim
            WITH px_sherr = px_sherr " parameters end here
            USER syst-uname
           VIA JOB lv_job_name NUMBER lv_job_nr AND RETURN.
        IF sy-subrc = 0.
          CALL FUNCTION 'JOB_CLOSE'
            EXPORTING
              jobcount             = lv_job_nr
              jobname              = lv_job_name
              strtimmed            = 'X'
            IMPORTING
              job_was_released     = lv_job_released
            EXCEPTIONS
              cant_start_immediate = 1
              invalid_startdate    = 2
              jobname_missing      = 3
              job_close_failed     = 4
              job_nosteps          = 5
              job_notex            = 6
              lock_failed          = 7
              OTHERS               = 8.
          IF syst-subrc <> 0.
            MESSAGE i162(00) WITH
            'An error occured while closing the background job.'.
            STOP.
          ENDIF.
        ENDIF.
      ENDIF.
      SKIP 1.
      WRITE: / 'Background process', lv_job_name_string , 'called successfully' NO-GAP.
      WRITE: / 'You can check the job in transaction SM37'.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.