09-26-2008 6:21 AM
Hello friends,
I am uploading one text file with 15000 records and i am proccessing it with i_tab.
But it slows down the performance.
So, new requirement is to process first 1000 records then next 1000 records so on.
How can we do that?
regards,
Rh
09-26-2008 6:32 AM
Hi
Try like this.....
Loop at itab.
Counter = counter + 1.
"Prepare another internal table of same type as itab.
jtab = itab.
endloop.
if counter ("your condition)
Loop at jtab.
---
---
---
endloop.
Regards
09-26-2008 6:29 AM
Hi,
Either you split your text file by batches say 5K records per file or you can run it in background.
09-26-2008 6:32 AM
Hi
Try like this.....
Loop at itab.
Counter = counter + 1.
"Prepare another internal table of same type as itab.
jtab = itab.
endloop.
if counter ("your condition)
Loop at jtab.
---
---
---
endloop.
Regards
09-26-2008 6:40 AM
Hi
Keep a counter. and write the loop like this..
Loop at itab.
Counter = counter + 1.
if counter = 1000.
call transaction
counter = 0.
endif.
endloop.
Regards,
Vishwa.
09-26-2008 7:45 AM
If it is from Excel file you can use FM
ALSM_EXCEL_TO_INTERNAL_TABLE
in which you can specify rows and columns from where to to upload.
try to make the text file as Excel sheet, you can do it by following way but as your Functional con to prepare data in Excel sheet.
Open the text file,
Click Save As,
In File name give in "TEXT.XLS"
Save as Types select All files, Save.
Your Excel sheet is now ready.
use the following sample code and modify accouding to your spec. It has 3 fields only.
*******************************************************************
REPORT zpbk_sdnrem.
TYPES : BEGIN OF ty_emp,
empno(2) TYPE c,
empid(10) TYPE c,
empname(3) TYPE c,
END OF ty_emp.
DATA: it_excel TYPE TABLE OF alsmex_tabline,
wa_excel TYPE alsmex_tabline,
l_row TYPE i VALUE 1.
DATA : it_emp TYPE TABLE OF ty_emp,
wa_emp TYPE ty_emp.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS : p_file TYPE rlgrap-filename DEFAULT 'D:\BALA\CLASS\EM.XLS'.
SELECTION-SCREEN END OF BLOCK b1.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = p_file
i_begin_col = 1
i_begin_row = 1
i_end_col = 3
i_end_row = 2
TABLES
intern = it_excel.
CHECK NOT it_excel[] IS INITIAL.
LOOP AT it_excel INTO wa_excel.
CASE wa_excel-col.
WHEN 1.
wa_emp-empno = wa_excel-value.
WHEN 2.
wa_emp-empid = wa_excel-value.
WHEN 3.
wa_emp-empname = wa_excel-value.
ENDCASE.
AT END OF row.
APPEND wa_emp TO it_emp.
CLEAR wa_emp.
ENDAT.
ENDLOOP.
BREAK-POINT.
***********************************************************
Regards
Bala Krishna
10-01-2008 3:14 PM