‎2009 Oct 23 7:06 AM
Hi,
I am trying to upload tab delimited file from application server into database.
I have upload the file from presentation to application server by CGZ3
and i am able to see file in app server with #s and it appers in application server as
10140#A#E#120#abcd#
10146#M#P#300#a.b#
10152#M#P#200#dat123.com##
140#A#P#300#blicksat123.com#
10140#A#E#260#cust1at123.com##
And my notepad records looks like
10140 A E 120 abcd
10146 M P 300 a.b
10152 M P 200 dat123.com
140 A P 300 blicksat123.com
10140 A E 260 cust1at123.com
I am using open data set and read dataset to read the file as shown below
DATA:
l_htab TYPE c, " Horizontal tab
l_line(100) TYPE c. " Content in the file
l_htab = cl_abap_char_utilities=>horizontal_tab.
Open dataset
OPEN DATASET pp_afname FOR INPUT IN TEXT MODE ENCODING DEFAULT.
IF sy-subrc EQ 0.
DO.
Read dataset
READ DATASET pp_afname INTO l_line.
IF sy-subrc EQ 0.
SPLIT l_line AT l_htab
INTO fs_file-carrid
fs_file-autoind
fs_file-commtype
fs_file-resptime
fs_file-smtpaddr.
APPEND fs_file TO pt_afile.
ELSE.
EXIT.
ENDIF. " IF SY-SUBRC EQ 0.
ENDDO. " DO.
CLOSE DATASET pp_afname.
ELSE.
MESSAGE 'Problem in opening the App.Server file' TYPE con_msgtyp_i.
ENDIF. " IF sy-subrc EQ 0.
Load the data to the database
PERFORM load_data_to_database USING t_afile.
When i am trying to upload it is taking me to dump and the errpr analysis is like
"The program attempted to interpret the value "26 0 " as a number, but
since the value contravenes the rules for correct number formats,
this was not possible."
Any suggestions on this
Regards
VEnk@
‎2009 Oct 23 7:18 AM
Hi,
Could be that at the time of uploading the the database, instead of the value ''260'', the internal table holds '26 0' which the database field is identifying it as a invalid number format. Check in debugging if this is the case and modify the value to correct format and see if the dump is avoided
Vikranth
‎2009 Oct 23 8:05 AM
Hi Reddy,
I have debugged and found tht i have missed one field so this happened now i am able to upload the records but,
at the end of my record i am getting # symbol. So to aviod that # symbol at the end of the record.
FOr example if record in Application server is like abcat.com in database table it is like abcat.com# i want to aviod this
#.
Any suggestions..
Regards
VEnk@
‎2009 Oct 23 8:12 AM
Hi,
Thats the line feed character. After reading the application server file, use this
data: lv_feed type c value CL_ABAP_CHAR_UTILITIES=>CR_LF.
loop at itab.
replace all occurrences of lv_feed in itab-field with space.
modify itab.
endloop.
Vikranth
‎2009 Oct 23 7:59 AM
‎2009 Oct 23 8:02 AM
Hi
In application server we wont get tab separator records Tab will be replaced by # only . its sap standard .
‎2009 Oct 23 9:52 AM