Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Uploading the data from Application server to Database

Former Member
0 Likes
835

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@

6 REPLIES 6
Read only

Former Member
0 Likes
777

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

Read only

0 Likes
777

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@

Read only

0 Likes
777

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

Read only

Former Member
0 Likes
777

try condensing the fields before updating it to database

Read only

kamesh_g
Contributor
0 Likes
777

Hi

In application server we wont get tab separator records Tab will be replaced by # only . its sap standard .

Read only

Former Member
0 Likes
777

Hi V.Reddy it was a really good guidance.

Regards

VEnk@