Hi,
The upload can go like:
CALL METHOD cl_gui_frontend_services=>gui_upload
EXPORTING
filename = gv_fpath
filetype = 'ASC'
CHANGING
data_tab = gt_line_itm
EXCEPTIONS
OTHERS = 1.
IF sy-subrc NE 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.ENDIF.
Then do the following considering there is no header data :
READ gt_line_itm INTO wa_line_itm INDEX 1.
Split the work area data based on separator. Assumption are the columns are separated by comma or space. Also
wa_line_itm
should have structure like
TYPES: BEGIN OF x_line_itm,
line(10000) TYPE c,
END OF x_line_itm.
The split logic with w_30fields as a structure with 30 fileds each say type C and length 40.
SPLIT w_line_itm AT gc_sep INTO w_30fields-field1
w_30fields-field2
w_30fields-field3
w_30fields-field4
w_30fields-field5
.... goes on till 30 fields
IN CHARACTER MODE.
Then check field 7
IF w_30fields-field7 IS space the file is 6 columns. Thats all
Cheers,
Arindam