Skip to Content
0
Former Member
Aug 02, 2007 at 02:11 PM

Hey guys, ive got some problem with KCD_EXCEL_OLE_TO_INT_CONVERT

259 Views

Im trying to use this function module to get the rows into internal table for upload into database, for some reason not all the 14403 records are not being loaded into the internal table.Only 10000 records are being loaded into the table. Below is my code can you guys help me out, its a little urgent.

p_table is reference to table whose structure is like.

  • Internal Table for uploading from Excel spreadsheet

DATA: BEGIN OF jtable OCCURS 0,

field_001(25) TYPE c, "Ship To

field_002(25) TYPE c, "Material

field_003(25) TYPE c, "Area

field_004(25) TYPE c, "Sales Org

field_005(25) TYPE c, "Comp Code

field_006(25) TYPE c, "Plant

field_007(25) TYPE c, "Version

field_008(25) TYPE c, "Currency

field_009(25) TYPE c, "UOM

field_010(25) TYPE c, "Fiscal Year

field_011(25) TYPE c, "Jan Qty

field_012(25) TYPE c, "Feb Qty

field_013(25) TYPE c, "Mar Qty

field_014(25) TYPE c, "Apr Qty

field_015(25) TYPE c, "May Qty

field_016(25) TYPE c, "Jun Qty

field_017(25) TYPE c, "Jul Qty

field_018(25) TYPE c, "Aug Qty

field_019(25) TYPE c, "Sep Qty

field_020(25) TYPE c, "Oct Qty

field_021(25) TYPE c, "Nov Qty

field_022(25) TYPE c, "Dec Qty

field_023(25) TYPE c, "Jan Rev

field_024(25) TYPE c, "Feb Rev

field_025(25) TYPE c, "Mar Rev

field_026(25) TYPE c, "Apr Rev

field_027(25) TYPE c, "May Rev

field_028(25) TYPE c, "Jun Rev

field_029(25) TYPE c, "Jul Rev

field_030(25) TYPE c, "Aug Rev

field_031(25) TYPE c, "Sep Rev

field_032(25) TYPE c, "Oct Rev

field_033(25) TYPE c, "Nov Rev

field_034(25) TYPE c, "Dec Rev

msg_011(50) TYPE c,

END OF jtable.

FORM c200-upload_file TABLES p_table

USING p_file.

  • Data Declarations.......................................

DATA : l_intern TYPE kcde_cells OCCURS 0 WITH HEADER LINE.

DATA : l_index TYPE i.

DATA : l_start_col TYPE i VALUE '1',

l_start_row TYPE i VALUE '1',

l_end_col TYPE i VALUE '256',

l_end_row TYPE i VALUE '65536'.

  • Field Symbols...........................................

FIELD-SYMBOLS : <fs>.

CALL FUNCTION 'KCD_EXCEL_OLE_TO_INT_CONVERT'

EXPORTING

filename = p_file

i_begin_col = l_start_col

i_begin_row = l_start_row

i_end_col = l_end_col

i_end_row = l_end_row

TABLES

intern = l_intern

EXCEPTIONS

inconsistent_parameters = 1

upload_ole = 2

OTHERS = 3.

.

IF sy-subrc <> 0.

  • MESSAGE E002(ZA). " File Error

FORMAT COLOR COL_BACKGROUND INTENSIFIED.

WRITE : / 'File Error'.

EXIT.

ENDIF.

IF l_intern[] IS INITIAL.

  • MESSAGE E003(ZA). " No Data Uploaded

FORMAT COLOR COL_BACKGROUND INTENSIFIED.

WRITE : / 'No Data Uploaded'.

EXIT.

ELSE.

SORT l_intern BY row col.

LOOP AT l_intern.

MOVE l_intern-col TO l_index.

ASSIGN COMPONENT l_index OF STRUCTURE p_table TO <fs>.

MOVE l_intern-value TO <fs>.

AT END OF row.

APPEND p_table.

CLEAR p_table.

ENDAT.

ENDLOOP.

ENDIF.

end form.

*One more thing the excel file contains 34 columns and 14403 rows.