Skip to Content
0
Former Member
Aug 23, 2007 at 10:10 AM

short dump in transfer dataset help me out

19 Views

hi to all experts,

im getting a short dump in transfer dataset if open the file in text mode encoding default.in short dump im getting a message that transfer f cannot be a non-char field

REPORT ZB14HAI_DATATRANSFER1 .

DATA : IT_emp LIKE TABLE OF ZB14hai_EMP with header line,

WA_emp LIKE LINE OF IT_emp.

SELECT * FROM ZB14hai_EMP INTO TABLE IT_emp.

WA_emp-EMPNO = '10'.

WA_emp-EMPNAME = 'FAHEEM'.

WA_EMP-EMPSAL = '34567'.

WA_EMP-EMPJD = '19122000'.

WA_EMP-DEPTNO = '20'.

INSERT WA_EMP INTO IT_EMP INDEX 9.

WA_EMP-EMPNO = '11'.

wa_emp-empname = 'VAHID'.

WA_EMP-EMPSAL = '45678'.

WA_EMP-EMPJD = '19122000'.

WA_EMP-DEPTNO = '20'.

INSERT WA_EMP INTO IT_EMP INDEX 10.

WA_EMP-EMPNO = '12'.

wa_emp-empname = 'juveriya anwar'.

WA_EMP-EMPSAL = '90000'.

WA_EMP-EMPJD = '19122000'.

WA_EMP-DEPTNO = '30'.

INSERT WA_EMP INTO IT_EMP INDEX 11.

WA_EMP-EMPNO = '13'.

wa_emp-empname = 'SRINIVAS'.

WA_EMP-EMPSAL = '45678'.

WA_EMP-EMPJD = '19122000'.

WA_EMP-DEPTNO = '30'.

INSERT WA_EMP INTO IT_EMP INDEX 12.

WA_EMP-EMPNO = '14'.

wa_emp-empname = 'KRISHNA'.

WA_EMP-EMPSAL = '432123'.

WA_EMP-EMPJD = '19122000'.

WA_EMP-DEPTNO = '40'.

INSERT WA_EMP INTO IT_EMP INDEX 13.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

  • BIN_FILESIZE =

FILENAME = 'C:\FAHEEM\EMPLOYEE.TXT'

  • FILETYPE = 'ASC'

  • APPEND = ' '

WRITE_FIELD_SEPARATOR = 'X'

  • HEADER = '00'

  • TRUNC_TRAILING_BLANKS = 'X'

  • WRITE_LF = 'X'

  • COL_SELECT = 'X'

  • COL_SELECT_MASK = ' '

  • DAT_MODE = ' '

  • IMPORTING

  • FILELENGTH =

TABLES

DATA_TAB = IT_EMP

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.

else.

message i000(zhnc) with 'downloaded successful'.

ENDIF.

clear it_emp.

clear wa_emp.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

FILENAME = 'C:\FAHEEM\EMPLOYEE.TXT'

  • FILETYPE = 'ASC'

HAS_FIELD_SEPARATOR = 'X'

  • HEADER_LENGTH = 0

READ_BY_LINE = 'X'

  • DAT_MODE = ' '

  • IMPORTING

  • FILELENGTH =

  • HEADER =

TABLES

DATA_TAB = IT_EMP

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.

ELSE.

MESSAGE I000(ZHNC) WITH 'UPLOAD SUCCESSFUL'.

ENDIF.

DATA : FNAME(90) VALUE 'hai2.txt'.

OPEN DATASET FNAME FOR OUTPUT IN binary MODE." ENCODING DEFAULT .

IF SY-SUBRC = 0.

WRITE : / 'FILE OPENED FOR OUT PUT'.

ELSE.

WRITE : /'FILE NOT OPENED'.

ENDIF.

loop at it_emp into wa_emp.

TRANSFER wa_emp TO FNAME.

endloop.

CLOSE DATASET FNAME.

IF SY-SUBRC = 0.

WRITE : / 'FILE CLOSED'.

ELSE.

WRITE : /'FILE NOT CLOSED'.

ENDIF.

DATA: BEGIN OF TABLE,

EMPNO LIKE ZB14hAi_EMP-EMPNO,

EMPNAme LIKE ZB14hai_EMP-EMPNAME,

EMPsal LIKE ZB14hai_EMP-EMPsal,

DEPtno LIKE zb14hai_emp-deptno,

END OF TABLE.

DATA: IT_TAB2 LIKE TABLE OF TABLE,

WA_TAB2 LIKE LINE OF IT_TAB2.

select * from zb14hai_emp into corresponding fields of table it_tab2.

FIELD-SYMBOLS <TABLE> TYPE FNAME.

ASSIGN WA_TAB2 TO <TABLE> CASTING.

OPEN DATASET FNAME FOR INPUT IN binary mode." TEXT MODE ENCODING DEFAULT

.

IF SY-SUBRC = 0.

WRITE : / 'FILE OPENED'.

ELSE.

WRITE : /'FILE NOT OPENED'.

ENDIF.

LOOP AT it_tab2 INTO wa_tab2.

READ DATASET FNAME INTO WA_TAB2.

WRITE : / WA_TAB2-EMPNO, wa_tab2-empname,WA_TAB2-EMPsal,WA_TAB2-DEPtno.

ENDLOOP.

CLOSE DATASET FNAME.

IF SY-SUBRC = 0.

WRITE : / 'FILE CLOSED'.

ELSE.

WRITE : /'FILE NOT CLOSED'.

ENDIF.

REPORT ZB14HAI_DATATRANSFER1 .

DATA : IT_emp LIKE TABLE OF ZB14hai_EMP with header line,

WA_emp LIKE LINE OF IT_emp.

SELECT * FROM ZB14hai_EMP INTO TABLE IT_emp.

WA_emp-EMPNO = '10'.

WA_emp-EMPNAME = 'FAHEEM'.

WA_EMP-EMPSAL = '34567'.

WA_EMP-EMPJD = '19122000'.

WA_EMP-DEPTNO = '20'.

INSERT WA_EMP INTO IT_EMP INDEX 9.

WA_EMP-EMPNO = '11'.

wa_emp-empname = 'VAHID'.

WA_EMP-EMPSAL = '45678'.

WA_EMP-EMPJD = '19122000'.

WA_EMP-DEPTNO = '20'.

INSERT WA_EMP INTO IT_EMP INDEX 10.

WA_EMP-EMPNO = '12'.

wa_emp-empname = 'juveriya anwar'.

WA_EMP-EMPSAL = '90000'.

WA_EMP-EMPJD = '19122000'.

WA_EMP-DEPTNO = '30'.

INSERT WA_EMP INTO IT_EMP INDEX 11.

WA_EMP-EMPNO = '13'.

wa_emp-empname = 'SRINIVAS'.

WA_EMP-EMPSAL = '45678'.

WA_EMP-EMPJD = '19122000'.

WA_EMP-DEPTNO = '30'.

INSERT WA_EMP INTO IT_EMP INDEX 12.

WA_EMP-EMPNO = '14'.

wa_emp-empname = 'KRISHNA'.

WA_EMP-EMPSAL = '432123'.

WA_EMP-EMPJD = '19122000'.

WA_EMP-DEPTNO = '40'.

INSERT WA_EMP INTO IT_EMP INDEX 13.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

  • BIN_FILESIZE =

FILENAME = 'C:\FAHEEM\EMPLOYEE.TXT'

  • FILETYPE = 'ASC'

  • APPEND = ' '

WRITE_FIELD_SEPARATOR = 'X'

  • HEADER = '00'

  • TRUNC_TRAILING_BLANKS = 'X'

  • WRITE_LF = 'X'

  • COL_SELECT = 'X'

  • COL_SELECT_MASK = ' '

  • DAT_MODE = ' '

  • IMPORTING

  • FILELENGTH =

TABLES

DATA_TAB = IT_EMP

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.

else.

message i000(zhnc) with 'downloaded successful'.

ENDIF.

clear it_emp.

clear wa_emp.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

FILENAME = 'C:\FAHEEM\EMPLOYEE.TXT'

  • FILETYPE = 'ASC'

HAS_FIELD_SEPARATOR = 'X'

  • HEADER_LENGTH = 0

READ_BY_LINE = 'X'

  • DAT_MODE = ' '

  • IMPORTING

  • FILELENGTH =

  • HEADER =

TABLES

DATA_TAB = IT_EMP

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.

ELSE.

MESSAGE I000(ZHNC) WITH 'UPLOAD SUCCESSFUL'.

ENDIF.

DATA : FNAME(90) VALUE 'hai2.txt'.

OPEN DATASET FNAME FOR OUTPUT IN binary MODE." ENCODING DEFAULT .

IF SY-SUBRC = 0.

WRITE : / 'FILE OPENED FOR OUT PUT'.

ELSE.

WRITE : /'FILE NOT OPENED'.

ENDIF.

loop at it_emp into wa_emp.

TRANSFER wa_emp TO FNAME.

endloop.

CLOSE DATASET FNAME.

IF SY-SUBRC = 0.

WRITE : / 'FILE CLOSED'.

ELSE.

WRITE : /'FILE NOT CLOSED'.

ENDIF.

DATA: BEGIN OF TABLE,

EMPNO LIKE ZB14hAi_EMP-EMPNO,

EMPNAme LIKE ZB14hai_EMP-EMPNAME,

EMPsal LIKE ZB14hai_EMP-EMPsal,

DEPtno LIKE zb14hai_emp-deptno,

END OF TABLE.

DATA: IT_TAB2 LIKE TABLE OF TABLE,

WA_TAB2 LIKE LINE OF IT_TAB2.

select * from zb14hai_emp into corresponding fields of table it_tab2.

FIELD-SYMBOLS <TABLE> TYPE FNAME.

ASSIGN WA_TAB2 TO <TABLE> CASTING.

OPEN DATASET FNAME FOR INPUT IN binary mode." TEXT MODE ENCODING DEFAULT

.

IF SY-SUBRC = 0.

WRITE : / 'FILE OPENED'.

ELSE.

WRITE : /'FILE NOT OPENED'.

ENDIF.

LOOP AT it_tab2 INTO wa_tab2.

READ DATASET FNAME INTO WA_TAB2.

WRITE : / WA_TAB2-EMPNO, wa_tab2-empname,WA_TAB2-EMPsal,WA_TAB2-DEPtno.

ENDLOOP.

CLOSE DATASET FNAME.

IF SY-SUBRC = 0.

WRITE : / 'FILE CLOSED'.

ELSE.

WRITE : /'FILE NOT CLOSED'.

ENDIF.