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

Problem using open dataset

Former Member
0 Likes
377

Hi All,

I am trying to upload flat file data into appl server.but it is uploading some unwanted characters at the end.The code and data is given below.plz let me know the solution.

DATA : file type rlgrap-filename.

data : begin of itab occurs 0,

rec(500) type c,

end of itab.

file = '/lz01/fin/in/bop_Checkrecon1.txt'.

clear : itab.

refresh : itab.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

FILENAME = 'C:\bop3.txt'

FILETYPE = 'ASC'

  • HAS_FIELD_SEPARATOR = ' '

HEADER_LENGTH = 0

READ_BY_LINE = 'X'

  • DAT_MODE = ' '

  • CODEPAGE = ' '

  • IGNORE_CERR = ABAP_TRUE

  • REPLACEMENT = '#'

  • CHECK_BOM = ' '

  • VIRUS_SCAN_PROFILE =

  • IMPORTING

  • FILELENGTH =

  • HEADER =

TABLES

DATA_TAB = itab

EXCEPTIONS

FILE_OPEN_ERROR = 1

FILE_READ_ERROR = 2

NO_BATCH = 3

GUI_REFUSE_FILETRANSFER = 4

INVALID_TYPE = 5

NO_AUTHORITY = 6

UNKNOWN_ERROR = 7

BAD_DATA_FORMAT = 8

HEADER_NOT_ALLOWED = 9

SEPARATOR_NOT_ALLOWED = 10

HEADER_TOO_LONG = 11

UNKNOWN_DP_ERROR = 12

ACCESS_DENIED = 13

DP_OUT_OF_MEMORY = 14

DISK_FULL = 15

DP_TIMEOUT = 16

OTHERS = 17

.

IF SY-SUBRC <> 0.

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

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

ENDIF.

open dataset file for input in text mode encoding default.

clear itab.

loop at itab.

transfer itab-rec to file.

clear itab.

endloop.

close dataset file.

The exact structure and the data present in the flat file is as follows:

078041953 0000000001000000052507 0000070000 R

078041953 0000000003000000052507 0000199500 R

078041953 0000000005000000052507 0000530000 R

078041953 0000000007000000052507 0000005000 R

078041953 0000000008000000052507 0000004000 R

078041953 0001000000000000052507 0000058250 R

029005582 0001000000000000052507 0000012300 R

029005582 0001000001000000052507 0009438200 R

030404975 0001000000000000052507 0000056700 R

030404975 0001000001000000052507 0000004500 R

314018577 0001000002000000052507 0000001500 R

314018577 0001000003000000052507 0000435300 R

314018577 0001000007000000052507 0000066600 R

Thanks,

Rakesh.

1 REPLY 1
Read only

Former Member
0 Likes
355

Hi Rakesh,

You have written INPUT instead of OUTPUT in Open dataset staetment.

Replace INPUT with OUTPUT. Problem will be solved.

Reward points for helpful answers..

Ashvender