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

Upload from presentation server - Data Interpretation Error

Former Member
0 Likes
1,600

Hi all,

I have written a program to populate an internal table from database table and download the data to a file on presentation server(Desktop).

I have also wriiten a program to upload the data from the same file on presentation server to populate the internal table.

I got a data interpretation error.

Database table i used is SBOOK.

The fields that caused the data interpretation error while uploading the data from presentation server to populate internal table are, LUGGWEIGHT ( Luggage Weight - Decimal Value), FORCURAM ( Foreign Currency) and LOCCURAM(Local Currency).

Is there anyway i can fix this error. How to make the interpretation correctly.

Thanks for your time. <REMOVED BY MODERATOR>

Thanks,

Shiv

Edited by: Sivaram Naga on Apr 14, 2008 6:24 AM

Edited by: Alvaro Tejada Galindo on Apr 14, 2008 3:27 PM

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,540

i think u have created flat file check the entries in sbook table and try to recreate flat file according to it

10 REPLIES 10
Read only

Former Member
0 Likes
1,540

Dear Sivaram,

Please specify which FM you are using ,and what is the file format into which you are downloading...

Regards,

Talwinder

Read only

0 Likes
1,540

I'm using GUI_UPLOAD and GUI_DOWNLOAD

Read only

0 Likes
1,540

Hi,

use Gui_Download like below

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

  • BIN_FILESIZE =

filename = 'C:\Documents and Settings\saptrng\Desktop\desktop\xyz.txt'

FILETYPE = 'ASC'

  • APPEND = ' '

WRITE_FIELD_SEPARATOR = 'X'

  • HEADER = '00'

  • TRUNC_TRAILING_BLANKS = ' '

  • WRITE_LF = 'X'

  • COL_SELECT = ' '

  • COL_SELECT_MASK = ' '

  • DAT_MODE = 'X'

  • CONFIRM_OVERWRITE = ' '

  • NO_AUTH_CHECK = ' '

  • CODEPAGE = ' '

  • IGNORE_CERR = ABAP_TRUE

  • REPLACEMENT = '#'

  • WRITE_BOM = ' '

  • TRUNC_TRAILING_BLANKS_EOL = 'X'

  • WK1_N_FORMAT = ' '

  • WK1_N_SIZE = ' '

  • WK1_T_FORMAT = ' '

  • WK1_T_SIZE = ' '

  • IMPORTING

  • FILELENGTH =

tables

data_tab = itab

  • FIELDNAMES =

  • EXCEPTIONS

  • FILE_WRITE_ERROR = 1

  • NO_BATCH = 2

  • GUI_REFUSE_FILETRANSFER = 3

  • INVALID_TYPE = 4

  • NO_AUTHORITY = 5

  • UNKNOWN_ERROR = 6

  • HEADER_NOT_ALLOWED = 7

  • SEPARATOR_NOT_ALLOWED = 8

  • FILESIZE_NOT_ALLOWED = 9

  • HEADER_TOO_LONG = 10

  • DP_ERROR_CREATE = 11

  • DP_ERROR_SEND = 12

  • DP_ERROR_WRITE = 13

  • UNKNOWN_DP_ERROR = 14

  • ACCESS_DENIED = 15

  • DP_OUT_OF_MEMORY = 16

  • DISK_FULL = 17

  • DP_TIMEOUT = 18

  • FILE_NOT_FOUND = 19

  • DATAPROVIDER_EXCEPTION = 20

  • CONTROL_FLUSH_ERROR = 21

  • OTHERS = 22

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

Read only

Former Member
0 Likes
1,541

i think u have created flat file check the entries in sbook table and try to recreate flat file according to it

Read only

0 Likes
1,540

Hi Singh and KPN,

Thanks for your quick answer.

I need to add some more.

I populated the internal table with 10 fields from database table and downloaded the internal table records to a file on my desktop using GUI_DOWNLOAD Function Module.

Later, I commented out the above Function Module and Select Query and used the GUI_UPLOAD function module to upload the same file to populate the internal table and have written those entries to output using LOOP AT ITAB.

Out of 10 fields 7 fields(including a date field in it) caused no problem at all, They have been successfully written to output.

I checked each field by commenting out rest of the fields. Thats how i came to know the only three fields with decimal values are causing errors. I am not sure whether their floating point nature is causing the problem.

I hope you are clear now.

Kindly help me out in fixing the problem.

PLEASE HELP ME OUT

Thanks,

Shiv

Edited by: Sivaram Naga on Apr 14, 2008 8:00 PM

Read only

0 Likes
1,540

please paste how you declared the internal table,

for both FMs, upload and download

Read only

0 Likes
1,540
 REPORT  zpbfileupload1.

TABLES: sbook.


DATA: BEGIN OF itab OCCURS 0,
carrid LIKE sbook-carrid,
connid LIKE sbook-connid,
fldate LIKE sbook-fldate,
bookid TYPE sbook-bookid,
customid TYPE sbook-customid,
custtype TYPE sbook-custtype,
class TYPE sbook-class,
*luggweight TYPE sbook-luggweight,
passname TYPE sbook-passname,
smoker TYPE sbook-smoker,
forcuram TYPE sbook-forcuram,
loccuram TYPE sbook-loccuram,
END OF itab.

* Download Part

*SELECT * FROM sbook INTO CORRESPONDING FIELDS OF TABLE itab UP TO 20 ROWS.
*
*
* CALL FUNCTION 'GUI_DOWNLOAD'
*   EXPORTING
*      filename                        = 'C:\users\vamc\documents\bookinginfo.txt'
*
*   tables
*     data_tab                        = itab.

* Upload Part

CALL FUNCTION 'GUI_UPLOAD'
  EXPORTING
    filename                      = 'C:\users\vamc\documents\bookinginfo.txt'
   tables
    data_tab                      = ITAB.



loop at itab.
write: / itab-carrid, itab-connid, itab-bookid, itab-fldate, itab-customid, itab-custtype, itab-class, itab-passname, itab-smoker.
endloop.
Read only

0 Likes
1,540

i just added

FILETYPE = 'ASC'

HAS_FIELD_SEPARATOR = 'X'

to both upload and download and it is working perfect.

Read only

Former Member
0 Likes
1,540

Take a look at this weblog

[Taking good care of Z Data|https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/3340] [original link is broken] [original link is broken] [original link is broken];

Already does what you need -;)

Greetings,

Blag.

Read only

Former Member
0 Likes
1,540

Hi,

Please refer the code below:


*   Download internal table to presentation server file(PC)
*   Separating fields/columns by a tab

  DATA: ld_filename TYPE string,
* Pre version 4.7 declaration e_file like rlgrap-filename.

  DATA: begin of it_datatab occurs 0,
  col1(50) type c,
  col2(50) type c,
  col3(50) type c,
*       etc....
 end of it_datatab.

"Write select statement to get the data from some table and store it in it_datatab.

"Use below code to download the data
  CALL FUNCTION 'GUI_DOWNLOAD'
   EXPORTING
        filename         = ld_filename
        filetype         = 'ASC'
*       APPEND           = 'X'
        write_field_separator = 'X'
*       CONFIRM_OVERWRITE = 'X'
   TABLES
        data_tab         = it_datatab[]
   EXCEPTIONS
        file_open_error  = 1
        file_write_error = 2
        OTHERS           = 3.

Thanks,

Sriram Ponna.