2013 Feb 04 6:39 AM
Hi Experts,
I am creating a report in which I have to upload values from excel sheet to the internal table. I am getting a dump. I debugged it. Its because its picking up the heading as well. I want to pick from the 2nd line. Pl guide.
Regards
Purnand
Hi Experts,
I am creating a report in which I have to upload values from excel sheet to the internal table. I am getting a dump. I debugged it. Its because its picking up the heading as well. I want to pick from the 2nd line. Pl guide.
Regards
Purnand
2013 Feb 04 6:45 AM
Hi,
If you are using SPLIT command then you can delete the record at index 1 as it will be Header Record.
If you are using any Function Module for conversion then it will be having some option related to 'I_LINE_HEADER', make it as 'X'. Check for the same.
Reward points if helpful.
2013 Feb 04 6:46 AM
Hi Purnand,
Please try to do like this :
CALL METHOD cl_gui_frontend_services=>gui_upload
EXPORTING
filename = w_filename
filetype = 'ASC'
* has_field_separator = 'X'
codepage = '1160'"w_cpage
CHANGING
data_tab = i_raw[]
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
not_supported_by_gui = 17
error_no_gui = 18
OTHERS = 19.
IF sy-subrc = 0 .
* Re-format uploaded data to align fields in internal table
CLEAR wa_105_upld.
LOOP AT i_raw INTO wa_raw.
IF sy-tabix = 1.
CONTINUE.
ENDIF.
IF wa_raw IS NOT INITIAL.
IF sy-tabix GT 1. "This code will ignore the header line."
SPLIT wa_raw AT cl_abap_char_utilities=>horizontal_tab INTO
wa_105_upld-pernr
wa_105_upld-begda
wa_105_upld-endda
wa_105_upld-subty
wa_105_upld-usrid
wa_105_upld-usridlong
wa_105_upld-type
wa_105_upld-message.
APPEND wa_105_upld TO i_105_upld.
CLEAR: wa_105_upld, wa_raw .
ENDIF.
ELSE.
MESSAGE i164.
RETURN.
ENDIF.
ENDLOOP.
ENDIF.
Thanks
Jainender Jain
2013 Feb 04 6:50 AM
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
FILENAME = p_file
I_BEGIN_COL = 1
I_BEGIN_ROW = 2
I_END_COL = 14
I_END_ROW = 100
TABLES
INTERN = G_XLDATA
Its still picking up the heading.
2013 Feb 04 6:56 AM
Hi Purnand,
Use my method .......i had already done like that ..
Thanks
2013 Feb 04 6:52 AM
HI.
Please give row number as below ,
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = filename
i_begin_col = 1
i_begin_row = <where you have to start-row number>
i_end_col = 11
i_end_row = 9999
TABLES
intern = Excel
EXCEPTIONS
inconsistent_parameters = 1
upload_ole = 2
OTHERS = 3.
Thanks.
NJ
2013 Feb 04 6:56 AM
I have to start from the second. I tried '2' as well. Still not working
2013 Feb 04 6:59 AM
ITs done. Its row no. 11 acc to excel file. I was doing 2 because 1st was the heading.
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |