cancel
Showing results for 
Search instead for 
Did you mean: 

How to execute report in Background from Dialog process?

mike_brown2
Discoverer
0 Kudos

How, or what is the best way, to lauch an executable program (report) into the background from a dialog program (dynpro)?

<b>Example:</b> The SUBMIT...AND RETURN still executes the called program before it returns control to the calling program. I just want the report to be kicked off and the dialog to continue as normal. I do not want the report execution time to affect the dialog process.

Thanks in advance for your time.

Accepted Solutions (0)

Answers (6)

Answers (6)

Former Member
0 Kudos

Hi,

You may try the option of submitting the report to spool ( Syntax : submit report(reportname) to SAP-spool ), and continue with the dialog execution.

Regards,

SN

martin_jonsson
Participant
0 Kudos

Hi again,

My intention is to reproduce the FM test tool making it user fiendly and reduce the number of options to the user. All this for a custom extraction tool.

The dynamic SELECT-OPTIONS works if you don't know the type at design time BUT know the name and how many of the SELECT-OPTIONS. But say that I don't even know that...

The ideal would be a collection object as in VB, Java C++

but I guess I have to stick to regenerate the selection screen at every run.

Thanks for your answers!

Former Member
0 Kudos

Are you familiar with events?...raise_event is a std SAP FM you use and you trigger an event from your dialog...and in sm36 you have your background-job that kicks your report on raise of this event.,..!every time!

I have done this and it works!

-Let me know if this helped!...

Thanks-Shankar.T.S.

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Yes, I've heard of this too, now you have a third option.

Regards,

Rich Heilman

Former Member
0 Kudos

This works for me:

CALL FUNCTION 'JOB_SUBMIT'

etc

etc

mike_brown2
Discoverer
0 Kudos

Thank you all for your time.

I guess I have two options:

1) CALL TRANSACTION... IN BACKGROUND TASK with the function module actually submitting the report OR

2) SUBMIT report... VIA JOB.. AND RETURN with use of the JOB_OPEN and JOB_CLOSE function modules

Once again, I appreciate the time.

Thanks

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

In your previous post, (1) should be "Call Function" not "transaction".

I would try both, see which one you like better.

Good Luck,

Rich Heilman

nablan_umar
Active Contributor
0 Kudos

Hi Michael,

It is not CALL TRANSACTION but CALL FUNCTION.

brad_bohn
Active Contributor
0 Kudos

Have a look at the SUBMIT command again, specifically the 'VIA JOB' and 'TO SAP-SPOOL' extensions. Use the function modules 'JOB_OPEN' and 'JOB_CLOSE' before and after the call, respectively.

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Well...maybe you could try to put your submit inside a function module and call that function module with the extension "IN BACKGROUND TASK". Give it a try.

Regards,

Rich Heilmans

mike_brown2
Discoverer
0 Kudos

Unfortunately, the called ABAP must be an executable report and not a function module.

Any other suggestions?

Thanks again for your time.

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

To clarify, you need to "kick off" an ABAP report program using the SUBMIT statement from a dialog program. This submitted program goes off and does its own thing and then ends. Correct?

If so, then in you dialog program, call a function module "IN BACKGROUND TASK" which executes this "SUBMIT" statement.

Or am I missing something, here?

Regards,

Rich Heilman

nablan_umar
Active Contributor
0 Kudos

You have to call a function module in order to do parallel. Unless you want to submit that program in background job. Look at Help on Submit for background job.

But my recommendation is to create a simple function module that will call that report. Then call the function module in background task.

Former Member
0 Kudos

Hi Nablan, I'm also trying to do parallel processing and created a function module that kicks of another report program.

However, the process doesn't seem to work. The Main program runs from start to finish but the called program in the function module doesn't seem to run. When I used the option STARTING NEW TASK task name the code ran but in the foreground. I don't want to use this option as it runs in the foreground and SAP limits one to six sessions. Is there something I'm missing in the attributes of the function module I created. Currently the attributes are: Processing type Remote enable module and it's set to start immediately. I had used Normal function module initially but this did not work with the STARTING NEW TASK task name option.

Below are the codes segements I used.

In my main program I have the following code segement

CALL FUNCTION 'Z_CA_PROG_CALL'

IN BACKGROUND TASK

EXPORTING

zprogram = 'ZCA_TEST1'

EXCEPTIONS

program_call_failed = 1

invalid = 2

OTHERS = 3.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

COMMIT WORK.

In the function module I have the following code.

FUNCTION z_ca_prog_call.

*"----


""Local interface:

*" IMPORTING

*" VALUE(ZPROGRAM) LIKE ZCA_INTERFPROG-ZPROGRAM

*" EXCEPTIONS

*" PROGRAM_CALL_FAILED

*" INVALID

*"----


SUBMIT (zprogram).

IF sy-subrc <> 0.

CASE sy-subrc.

WHEN 1.

RAISE program_call_failed.

WHEN OTHERS.

RAISE invalid.

ENDCASE.

ENDIF.

ENDFUNCTION.

Former Member
0 Kudos

Sorry for the inconvenience but the code segment actually works very well. I left out some minor details in the program that was called in the function module.

Thanks and I apologize again.