Skip to Content
0
Former Member
Sep 19, 2007 at 08:28 AM

Problem in downloaded data

9 Views

Hi Friends,

My requirement is I need to download the data from table to application server. I coded the program so that it downloads the data into application server, But the problem is some fields like CURR (Data type) are downloading as special characters.,

Here is my code, can any one check my code and suggest me what to do.,

DATA: BEGIN OF ws_prps OCCURS 0.

INCLUDE STRUCTURE prps.

DATA END OF ws_prps.

DATA: BEGIN OF prps_file OCCURS 0,

filler(255) TYPE c,

END OF prps_file.

DATA: BEGIN OF mtab_data OCCURS 0,

line(132) TYPE c,

END OF mtab_data.

SELECTION-SCREEN BEGIN OF BLOCK 1 WITH FRAME TITLE text-100.

SELECT-OPTIONS: so-pbukr FOR prps-pbukr,

so-erdat FOR prps-erdat

DEFAULT sy-datum

TO sy-datum

OPTION nb

SIGN i,

so-pspnr FOR prps-pspnr.

SELECTION-SCREEN SKIP 1.

PARAMETERS: pa-lpc RADIOBUTTON GROUP x1,

pa-dsn RADIOBUTTON GROUP x1 DEFAULT 'X'.

PARAMETERS: pa-name LIKE rlgrap-filename DEFAULT '/tmp'.

SELECTION-SCREEN END OF BLOCK 1.

START-OF-SELECTION.

SELECT * FROM prps INTO ws_prps WHERE pbukr IN so-pbukr

AND erdat IN so-erdat

AND pspnr IN so-pspnr.

IF sy-subrc EQ 0.

APPEND ws_prps.

ENDIF.

ENDSELECT.

END-OF-SELECTION.

PERFORM download_prps.

PERFORM write_dataset.

FORM download_prps.

*download to local pc.

name = 'C:\prps.dat'.

typ = 'ASC'.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

  • BIN_FILESIZE =

filename = name

filetype = 'ASC'

  • IMPORTING

  • FILELENGTH =

TABLES

data_tab = ws_prps

EXCEPTIONS

file_write_error = 1

no_batch = 2

gui_refuse_filetransfer = 3

invalid_type = 4

OTHERS = 5

.

IF sy-subrc <> 0.

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

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

ENDIF.

ENDFORM.

FORM write_dataset.

CONCATENATE pa-name '/prps_' sy-datum '.dat' INTO pa-name.

OPEN DATASET pa-name FOR OUTPUT IN TEXT MODE. "encoding default.

IF sy-subrc EQ 0.

LOOP AT ws_prps. " into wa_prps.

TRANSFER ws_prps TO pa-name LENGTH 9999.

ENDLOOP.

ENDIF.

CLOSE DATASET pa-name.

ENDFORM.

<b>sample downloaded data.,</b>

RM 3 00000000OC 0000001 INST RISER (STALK-ON) @ BADP-A 00000000 00000000 000000000000

Regards,

Line