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

Type error using WS_UPLOAD

Former Member
0 Likes
571

Hi,

I am currently learning ABAP/4.

The following is my source code (i am aware that WS_UPLOAD has become obsolete, though i am running on 4.6):

REPORT ZBDC_1 .

PARAMETERS BDCFILE(80)

DEFAULT 'C:\BDC_file.txt'

lower case.

DATA: BEGIN OF IT_1,

SS(9),

FNAME(40),

MI(1),

LNAME(40),

DOB(8),

EMAIL_USERNAME(25),

EMAIL_DOMAIN(24),

ADDRESS(40),

APT(3),

CITY(30),

STATE(2),

ZIPCODE(5),

HOMEPHONE(10),

RESTIME(2),

OCCUPATION(20),

COMPANY(30),

WORKPHONE(10),

COMPTIME(2),

AHINCOME(9),

NETWORTH(9),

BANKTYPE(9),

RESTYPE(5),

MPAYMENT(9),

END OF IT_1.

DATA IT_2 LIKE IT_1 OCCURS 0 WITH HEADER LINE.

start-of-selection.

CALL FUNCTION 'WS_UPLOAD'

EXPORTING

  • CODEPAGE = ' '

FILENAME = BDCFILE

FILETYPE = 'DAT'

  • HEADLEN = ' '

  • LINE_EXIT = ' '

  • TRUNCLEN = ' '

  • USER_FORM = ' '

  • USER_PROG = ' '

  • DAT_D_FORMAT = 'X'

  • IMPORTING

  • FILELENGTH =

TABLES

data_tab = IT_2

  • EXCEPTIONS

  • CONVERSION_ERROR = 1

  • FILE_OPEN_ERROR = 2

  • FILE_READ_ERROR = 3

  • INVALID_TYPE = 4

  • NO_BATCH = 5

  • UNKNOWN_ERROR = 6

  • INVALID_TABLE_WIDTH = 7

  • GUI_REFUSE_FILETRANSFER = 8

  • CUSTOMER_ERROR = 9

  • OTHERS = 10

.

BREAK-POINT.

IF SY-SUBRC <> 0.

ENDIF.

LOOP AT IT_2.

WRITE: / IT_2-SS.

ENDLOOP.

----


at selection-screen on value-request for BDCFILE.

----


CALL FUNCTION 'WS_FILENAME_GET'

EXPORTING

  • DEF_FILENAME = ' '

DEF_PATH = 'C:\'

MASK = ',.txt ,.txt.'

  • MODE = 'O'

  • TITLE = 'PC-File-Selection'

IMPORTING

FILENAME = BDCFILE

  • RC =

EXCEPTIONS

INV_WINSYS = 1

NO_BATCH = 2

SELECTION_CANCEL = 3

SELECTION_ERROR = 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.

-


At runtime, i get the following error:

Type conflict when calling a function module.

The call to the function module "WS_UPLOAD" is incorrect:

The function module interface allows you to specify only fields of a parameter type under "FILENAME". The field "BDCFILE" specified here has a different filed type.

-


I have approached this problem from every possible point, but nothing helps.

What can i do to prevent this from happening? How do i fix this?

Many thanks,

John

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
527

can u change the declaration and check again

PARAMETERS BDCFILE(80)

to parameters BDCFILE LIKE RLGRAP-FILENAME.

regds,

kiran

3 REPLIES 3
Read only

Former Member
0 Likes
528

can u change the declaration and check again

PARAMETERS BDCFILE(80)

to parameters BDCFILE LIKE RLGRAP-FILENAME.

regds,

kiran

Read only

0 Likes
527

Thank you.

Everything works as expected.

Read only

Former Member
0 Likes
527

Hi,

Define the file path like this

PARAMETERS: p_bdcfile type RLGRAP-FILENAME DEFAULT 'C:\BDC_FILE.TXT'.

Cheers

VJ