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

Doubt in background job parallel- processing

Former Member
0 Likes
551

Hi Experts,

I have basic doubt regarding background processing.

I have a requirement of processing 2 million records, if I go with just back ground job scheduling it is taking too much time, they wanted to finish the job with in 2 hrs.

The solution is <u><b>background job parallel- processing</b></u>. I get into so many threads, I find the solutions in 2 ways. Please clarify my doubts

<u><b>First way solution:</b></u> I observed that as per the suggestion in threads for back ground just call the remote FMs in a New task.

<b>Doubt 1:</b> Is this process works in background mode. ?

<b>Doubt 2:</b> Suppose if the FM is calling more than 6 time, is it lead to dump, I mean to say we are creating more than 6 sessions in back ground by calling FMs in a New task..

<b>Doubt 3:</b> can we write submit program in that FM.

<u><b>2nd way solution:</b></u> Opening a job, submitting job and closing job.

<b>Doubt 1:</b> Suppose I split the 2 million records into 4 files each having 5 lacks. I opened job for first file and submitted to program using submit and return and close the job.

Once the first job is finished I will open 2nd job and do the same process above.

I feel this solution looks like serial processing, Please clarify my doubts, I need to implement the logic based on your suggestions?

Thanks in advance,

Basha

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
465

Hi,

First way solution:

Doubt 1: The process will not be a background one. It will be of foreground and the time_out parameters will be applied. Your process might end with a time_out runtime error. I had this problem and don't if there is a way to set this parallel process as of type background.

Doubt 2: I am not sure but my guess is you can call more than 6 time.

Doubt 3: Yes. You can have a submit inside that FM.

2nd way solution:

Doubt 1: I don't think this will provide you with lot of improvements, time wise. It is an option worth trying and you will definitly have improvements in resource usage like memory.

Hope this helps.

Sumant.

3 REPLIES 3
Read only

Jelena_Perfiljeva
Active Contributor
0 Likes
465

What exactly do you mean by "processing 2 million records"? What is it that your program does?

Regarding the first solution I'd suggest to read ABAP help on CALL FUNCTION ... STARTING NEW TASK and CALL FUNCTION ... IN BACKGROUND TASK to answer your questions.

Initiating several instances of the same program might speed up things and might not (or not significantly), depending on what does the program do. Again, you need to be more specific.

Read only

Former Member
0 Likes
466

Hi,

First way solution:

Doubt 1: The process will not be a background one. It will be of foreground and the time_out parameters will be applied. Your process might end with a time_out runtime error. I had this problem and don't if there is a way to set this parallel process as of type background.

Doubt 2: I am not sure but my guess is you can call more than 6 time.

Doubt 3: Yes. You can have a submit inside that FM.

2nd way solution:

Doubt 1: I don't think this will provide you with lot of improvements, time wise. It is an option worth trying and you will definitly have improvements in resource usage like memory.

Hope this helps.

Sumant.

Read only

0 Likes
465

Hi Guys,

Thanks for your responses. Sumanth thanks for your info.

I tested the 2nd solution working beautifully, in back ground

<b><u>Program1:</u></b>

&----


*& Report ZTEST_BACKGROUND

*&

&----


*&

*&

&----


REPORT ZTEST_BACKGROUND.

data: gv_job_name TYPE tbtcjob-jobname,

gv_jobnum TYPE tbtcjob-jobcount,

lv_counter(5) type c.

do 2 times.

lv_counter = sy-index.

gv_job_name = 'chandjob'.

concatenate gv_job_name lv_counter into gv_job_name .

CALL FUNCTION 'JOB_OPEN'

EXPORTING

jobgroup = 'INVEXTRACT '

jobname = gv_job_name

IMPORTING

jobcount = gv_jobnum

EXCEPTIONS

cant_create_job = 1

invalid_job_data = 2

jobname_missing = 3

OTHERS = 4.

SUBMIT ZTEST_PARALLEL

VIA JOB gv_job_name NUMBER gv_jobnum AND RETURN.

CALL FUNCTION 'JOB_CLOSE'

EXPORTING

jobcount = gv_jobnum

jobname = gv_job_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

invalid_target = 8

OTHERS = 9. .

IF SY-SUBRC <> 0.

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

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

ENDIF.

clear gv_job_name .

enddo.

<u><b>Program 2:</b></u>

&----


*& Report ZTEST_PARALLEL

*&

&----


*&

*&

&----


REPORT ZTEST_PARALLEL.

do 5 times.

wait up to 10 seconds.

write:/ sy-index.

enddo.

once u execute the first program we can in sm37 2 jobs started in 2 different workprocess, finished at the same time.

Thanks,

Shaik Chand Basha