Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

When pushbutton pressed execute the form in background

Former Member
0 Likes
1,471

Hi Experts,

I have a selection screen, wherein there's a pushbutton. If i press the pushbutton it should execute the form(procedure) in background. I tried out with this code but it's not working. But when i used a checkbox instead of this pushbutton it works, what could be the problem. Are there any limitations in selection screen for pushbutton. Any help will be of great help.

My requirement is when i press the pushbutton it must call the form and execute it in background. How do i achieve this.

Any help on this will be very great.

Thanks,

Prabhu.

Message was edited by: Prabhakaran Paramasivan

1 ACCEPTED SOLUTION
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
1,206

Post your program code.

Regards,

Rich Heilman

10 REPLIES 10
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
1,207

Post your program code.

Regards,

Rich Heilman

Read only

0 Likes
1,206

Hi Rich,

Here's the code.

SELECTION-SCREEN PUSHBUTTON 79(22) text-B03 USER-COMMAND ucom2.

INITIALIZATION.

AT SELECTION-SCREEN.

CASE sscrfields-ucomm.

WHEN 'ucom2'.

PERFORM DCS_STATISTICS.

endcase.

FORM DCS_STATISTICS.

PERFORM DCS_RUN.

ENDFORM.

Read only

0 Likes
1,206

Try making your fcode uppercase.

Change this...



    when 'ucom2'.

to this....



    when 'UCOM2'.

Also, please change this post to a question and award points accordingly. Thanks.

Regards,

Rich Heilman

Read only

0 Likes
1,206

Hi Rich,

Thanks a lot, it worked, but how do i run or execute the form in background. so that my program executes faster.

To award points i don't see the radio buttons in the messages to do it. if so how do i award points.

thanks,

Prabhu.

Read only

0 Likes
1,206

You have to mark your post as a question.

There should be something that says, "Mark this post as a question".

Regards,

Rich Heilman

Read only

0 Likes
1,206

Duplicate Post.

Message was edited by: Rich Heilman

Read only

0 Likes
1,206

I don't think that there is away to kick off a "Form" in the background, you will need to put your logic in a function module and kick the function module off in background.

Working on a sample.......

Regards,

Rich Heilman

Read only

0 Likes
1,206

Here is a sample..... Make sure that you make your function module RFC enabled.



report zrich_0001 .

selection-screen begin of block b1 with frame title text-001.
selection-screen pushbutton 30(30) go user-command go.
selection-screen end of block b1.

at selection-screen .
  case sy-ucomm.
    when 'GO'.
      perform execute_background.
  endcase.

start-of-selection.


at selection-screen output.

* Write pushbutton text
  go = 'Execute In Background'.

*---------------------------------------------------------------------*
*       FORM execute_background                                       *
*---------------------------------------------------------------------*
form execute_background.

  call function 'Z_RICH_TEST'
                 in background task.

  call function 'START_OF_BACKGROUNDTASK'
       exporting
            startdate = sy-datum
            starttime = sy-uzeit
       exceptions
            others    = 1.

  if sy-subrc = 1.
    exit.
  endif.

  commit work.

endform.

Regards,

Rich Heilman

Read only

0 Likes
1,206

Hi Rich,

Thanks once again, it works, so now I have place all my code which is in the form into a function module and call this. or can i just specify it like this as how u have told.

call function 'Z_RICH_TEST' in background task.

thanks,

Prabhu

Read only

0 Likes
1,206

You can do it like this to.........you don't need the form. You <b>do</b> need all of the code inside the form though.



report zrich_0001 .
 
selection-screen begin of block b1 with frame title text-001.
selection-screen pushbutton 30(30) go user-command go.
selection-screen end of block b1.
 
at selection-screen .
  case sy-ucomm.
    when 'GO'.

 
  call function 'Z_RICH_TEST'
                 in background task.
 
  call function 'START_OF_BACKGROUNDTASK'
       exporting
            startdate = sy-datum
            starttime = sy-uzeit
       exceptions
            others    = 1.
 
  if sy-subrc = 1.
    exit.
  endif.
 
  commit work.

  endcase.
 
start-of-selection.
 
 
at selection-screen output.
 
* Write pushbutton text
  go = 'Execute In Background'.
 

I just think it makes it a little neater to have specific functionality in its own form.

Regards,

Rich Heilman