‎2006 Jul 06 2:44 PM
Hi
All
i have a BDC program in which i have to pass record from a int table having a lot of entries..
Now i want to pass it by breaking it into 990 record for each pass to BDC ..
How i can braek int table of large size into smaller ones of size 990 ..
**BEST ANS HAS BEST POINTS ***
Thanks
Saurabh
‎2006 Jul 06 2:47 PM
‎2006 Jul 06 2:50 PM
U can try like this.
describe table lines lv_lines.
lv_lines1 = lv_lines / 990.
do lv_lines times.
loop at itab from lv_count to lv_count1.
move-corresponding to itab2.
append itab2.
endloop.
lv_count = lv_lines + 1.
lv_count1 = lv_lines + 990.
itab3[] = itab2[].
refresh itab2.
enddo.
If it is useful reward points
Regards,
Vasanth
‎2006 Jul 06 2:52 PM
Hi Saurabh,
You never know how many sets of 990 records will be there in your table. So it is better if you call the transaction for very 990 records.
loop at itab.
fg = sy-tabix mod 990.
if fg = 0.
call transaction...
endif.
endloop.
Regards,
ravi
‎2006 Jul 06 2:55 PM
You can call transactoin every 990 lines. Here is an easy way to calculate when to do your call transaction.
report zrich_0001 .
data: itab type table of string with header line.
data: frc type p decimals 4.
data: lines type i.
do 10000 times.
itab = sy-index.
append itab.
enddo.
describe table itab lines lines.
loop at itab.
frc = frac( sy-tabix / 990 ).
if frc = 0 or sy-tabix = lines.
write:/ sy-tabix, 'Hey, time for a transaction call'.
endif.
endloop.
Regards,
Rich Heilman
‎2006 Jul 06 2:54 PM
Hi,
Plz look at this pseudo code.
1. First get number of records in internal table.
DESCRIBE TABLE ITAB LINES LIN.
2. assign two var of type I
Var1 = 0.
Var2 = 990.
3.Then divide this by 990 store it in i.
4.Do I times .
INSERT LINES OF <itab1> FROM var1 TO var2 INTO TABLE <itab2>.
Process itab2.
Var1 = var2 + 1.
Var2 = 990 *( I + 1 )
Enddo.
‎2006 Jul 06 2:55 PM
Hi Surabhi,
consider itab with multiple recs, then u take first 990 recs from that itab based on sy-index, and pass it other temp internal table itab2 . then while loop at taht itab2 and call transation. Now refresh that itab2 and again take next 990 recs from itab and move to itab2 and do the respective contiuos process..
regards,
Kiran B
‎2006 Jul 06 2:56 PM
Hi,
loop at itab.
l_data = sy-tabix mod 990.
if l_data = 0.
new break on table itab
pass BDC with itab1
clear itab1. refresh itab1.
endif.
Insert in new table
insert itab1 from itab.
endloop.
Hope it helps.
Mireia
‎2007 Jan 27 12:55 PM
‎2007 Jan 27 1:53 PM
Hi saurabh,
data:
lv_lines type sytfill,
lv_from type sytfill value 1,
lv_to type sytfill,
lt_itab_proc like table of itab. "if itab has header line
* lt_itab_proc like itab. "if itab has no header line
describe table itab[] lines lv_lines.
while lv_from <= lv_lines.
lv_to = lv_from + 989. " -> 990 in first loop
append lines of itab[] to lt_itab_proc from lv_from to lv_to.
perform process_BDC using lt_itab_proc. "Process partial itab
lv_from = lv_to + 1.
clear lt_itab_proc.
endwhile.
I don't know if this is best but I'm convinced it is fastest solution.
Regards,
Clemens