‎2011 Jan 18 3:28 PM
Hi All,
I have implemented parallel processing based on the number of jobs given on screen.In the table,if there are 1000 records and the number of jobs is 10,then 100 records would be passed to the submit program.The problem here is that those are accounts and each account can be associated to more than one contracts,so there is a possibility that if say 1 account has 4 contracts with it, 2 might get passed in the 1st batch while the other 2 can go in the next batch since the data is divided depending on the number of jobs given on screen.
I would like to ensure that all the contracts associated with that account go at a single time to the submit program.Can anyone give me an idea as to how can this be achieved?
gv_job_no is the number of records which will be sent in one batch and lt_ever is being sent to the submit program.
LOOP AT gt_ever
INTO gwa_ever.
IF gv_lines EQ gv_job_no.
CLEAR gv_lines.
EXIT.
ELSE.
APPEND gwa_ever TO lt_ever.
gv_lines = gv_lines + 1.
DELETE gt_ever
INDEX sy-tabix.
ENDIF.
ENDLOOP.
Thanks,
Shreeraj
Edited by: shreeraj pawar on Jan 18, 2011 4:29 PM
‎2011 Jan 18 4:08 PM
You can always sort by your account number so that all contracts belonging to single account will be passed in a single job...
but if number of contracts exceed your number of records that can be processed in single job, you can still run into this issue...
your options,
1) Use number of accounts allowed in single job as one of the parameters for parallel processing; Instead of number of records, you will be breaking up your jobs by number of accounts
or
2) keep number of records to break up your jobs; Sort your output list by account number and if number of records for single account exceed the number of records allowed in single job, allow it as exception (so that all records for single account is processed in one job)
‎2011 Jan 18 6:27 PM
Hi shreeraj pawar ,
do like this with sorted internal table first 2 fields account and contract (symbolic code):
loop at gt_account_contract assigning <any>.
at new account.
lv_start = sy-tabix.
endat.
at end of account.
append lines of gt_account_contract
from lv_start TO sy-tabix
to lt_account_contract.
if lines( lt_account_contract ) >= lv_lines_per_job.
* <submit lt_account_contract for processing>
clear:
lt_account_contract,
lv_start.
endif.
endat.
endloop.
You may have accounts with many contracts, this may lead to exceed the lv_lines_per_job limit. But you will still have a much smoother distribution.
Regards,
Clemens
‎2011 Jan 18 6:56 PM
Hi,
It can be easily solve using deep structure. Create one structure with
Accounts.. " Normal structure field
Contarct" " It will be a table type
now for each account you will get respective contracts in internal table. Now do you processing.
Thanks
Subhankar