Application Development 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: 

start new task for select statements

Former Member
0 Kudos

Hi,

I have question,

I am trying to select documents from BKPF depending on selection screen,

selection-screen:

s_bukrs ____

s_budat ____ ____

s_monat ____ ____

s_gjahr ____ ____

for a particular CC for one month there are huge no or records, because of that its taking hrs and hrs to run. I am following the Indices and fields order , no into corresponding fields ...everything...its just because of no of records its taking time.. for those no of records I need to select item data from BSEG table which is more time consuming.....

my question is

I want to divide the 1 mon period into 4 weeks and select 4 times at a time in background task so that 4 work processers are used instead of 1.

eg: if I give for 1 mon 01/01/2006 - 01/31/2006

I want to split it into

01/01/2006 01/08/2006

01/09/2006 01/16/2006

.

. 01/31/2006.

select individually for these dates at a time into 4 Internal tables, I hope any one understood what I mean. Is that Possible ?

Am I asking too much ?

please let me know the solution.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hello,

Note : write this program into separate include.

If you want to divide 4 tasks here is the logic.

1) Create 4 rangeas and fill dates i mean each range contains 1 week dates.

do 4 times.

2) *job open

call function 'JOB_OPEN'

exporting

jobname = p_job

importing

jobcount = l_jobcount.

3) submit <b>zprogram_name</b> with s_date in r_datum

with s_kunnr in r_kunnr

via job p_job

number l_jobcount

and return.

4) *job close

call function 'JOB_CLOSE'

exporting

jobcount = l_jobcount

jobname = p_job

strtimmed = 'X'.

enddo.

Just execute new include in background it will create 4 back ground jobs (for 4 weeks) with in 5secs. Each job execute paralally offcourse depends on processes availablity.

********Poorna********

6 REPLIES 6

Former Member
0 Kudos

Hi,

Do you want to split the tasks for the BKPF select or the BSEG select??

Thanks,

Naren

0 Kudos

Hi narendran,

If I can split for BKPF select then I want to split for BSEG select also.

Thanks

KP

Former Member
0 Kudos

Before doing anything major, make sure that your select is using an index. If your first select looks something like:

  SELECT  *
    FROM bkpf
    INTO TABLE bkpf_int
    WHERE bukrs EQ p_bukrs
    AND budat = pst_dt
    AND monat = ?
    AND gjahr EQ p_gjahr.

Change it to:

  SELECT  *
    FROM bkpf
    INTO TABLE bkpf_int
    WHERE bukrs EQ p_bukrs
    AND bstat IN (' ', 'A', 'B', 'D', 'M', 'S', 'V', 'W', 'Z')
    AND budat = pst_dt
    AND monat = ?
    AND gjahr EQ p_gjahr.

Adding all of the possible values of BSTAT will not change the result, but it will cause the SELECT to use a secondary index.

If you do this properly, you won't have to worry about the BSEG select timing out. (But you may have to worry about memory.)

Rob

Message was edited by: Rob Burbank

0 Kudos

Hi Rob,

My select is similar to your select

SELECT *

FROM bkpf

INTO TABLE bkpf_int

WHERE bukrs EQ p_bukrs

AND bstat IN (' ', 'A', 'B', 'D', 'M', 'S', 'V', 'W', 'Z')

AND budat = pst_dt

AND monat = ?

AND gjahr EQ p_gjahr.

My select

SELECT *

FROM bkpf

INTO TABLE bkpf_int

WHERE bukrs EQ s_bukrs

AND bstat <= 'B'

AND budat in s_budat

AND monat in s_monat

AND gjahr EQ s_gjahr.

I am not selecting all fields only 7 fields which I have declared in the Internal table in order.

Please let me know the best solution.

Thanks

KP

0 Kudos

Indexes work best when testing for equality. See if this works any better:


SELECT * FROM bkpf
  INTO TABLE bkpf_int
  WHERE bukrs EQ s_bukrs
    AND bstat IN (' ', 'A', 'D', 'M', 'S', 'V', 'W', 'Z')
    AND budat in s_budat
    AND monat in s_monat
    AND gjahr EQ s_gjahr.

(IE - remove 'B'.)

I did some testing of this. The method I described gives a substantial performance boost.

Rob

Message was edited by: Rob Burbank

It seems to me that this should have helped. Can you tell me if it did?

Former Member
0 Kudos

Hello,

Note : write this program into separate include.

If you want to divide 4 tasks here is the logic.

1) Create 4 rangeas and fill dates i mean each range contains 1 week dates.

do 4 times.

2) *job open

call function 'JOB_OPEN'

exporting

jobname = p_job

importing

jobcount = l_jobcount.

3) submit <b>zprogram_name</b> with s_date in r_datum

with s_kunnr in r_kunnr

via job p_job

number l_jobcount

and return.

4) *job close

call function 'JOB_CLOSE'

exporting

jobcount = l_jobcount

jobname = p_job

strtimmed = 'X'.

enddo.

Just execute new include in background it will create 4 back ground jobs (for 4 weeks) with in 5secs. Each job execute paralally offcourse depends on processes availablity.

********Poorna********