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

Break a Int .Table

Former Member
0 Likes
1,060

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

9 REPLIES 9
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
999

Do you want to break it into multiple internal tables, or just call the transaction every 990 records.

Regards

Rich Heilman

Read only

Former Member
0 Likes
999

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

Read only

Former Member
0 Likes
999

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

Read only

0 Likes
999

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

Read only

Former Member
0 Likes
999

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.

Read only

Former Member
0 Likes
999

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

Read only

Former Member
0 Likes
999

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

Read only

Former Member
0 Likes
999

hi

if Dancer.

reply,

elseif

sorry.

endif.

Read only

Clemenss
Active Contributor
0 Likes
999

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