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

need parameters for FM

Former Member
0 Likes
1,396

hi ,

iam uploading a text file from desktop and the FM being used is WS_UPLOAD

i gave the file type as DAT in the FM. but i could/nt find all the fields in the internal table.

iam using the version ECC6.0 should i need to change the fm to CL_GUI_FRONTEND_SERVICES=> GUI_UPLOAD.if so can you give the parameters to be passed for the textfile?

THANKS

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,371

Hi,

Go through the Sample Code



CALL METHOD cl_gui_frontend_services=>gui_upload
  EXPORTING
    filename            = filename
    filetype            = ASC          "'ASC'
    has_field_separator = X
  CHANGING
    data_tab            = li_input
  EXCEPTIONS
    file_open_error     = 1
    file_read_error     = 2
    OTHERS              = 3.

Regards

Sandipan

hi ,

iam uploading a text file from desktop and the FM being used is WS_UPLOAD

i gave the file type as DAT in the FM. but i could/nt find all the fields in the internal table.

iam using the version ECC6.0 should i need to change the fm to CL_GUI_FRONTEND_SERVICES=> GUI_UPLOAD.if so can you give the parameters to be passed for the textfile?

THANKS

9 REPLIES 9
Read only

Former Member
0 Likes
1,372

Hi,

Go through the Sample Code



CALL METHOD cl_gui_frontend_services=>gui_upload
  EXPORTING
    filename            = filename
    filetype            = ASC          "'ASC'
    has_field_separator = X
  CHANGING
    data_tab            = li_input
  EXCEPTIONS
    file_open_error     = 1
    file_read_error     = 2
    OTHERS              = 3.

Regards

Sandipan

Read only

0 Likes
1,371

hi iam getting the folowing error

CALL METHOD CL_GUI_FRONTEND_SERVICES=>GUI_UPLOAD

EXPORTING

FILENAME = p_pcfile

FILETYPE = 'ASC'

"P_PCFILE" is not type-compatible with formal parameter "FILENAME".

Read only

0 Likes
1,371

Hi,

You have to declare P_PCFILE as string.

Regards

Sandipan

Read only

0 Likes
1,371

Please make sure P_PCFILE is a string.

Read only

0 Likes
1,371

iam getting the following error

"TBL_INFILE" is not type-compatible with formal parameter "DATA_TAB".

Read only

0 Likes
1,371

iam getting the folling error

"TBL_INFILE" is not type-compatible with formal parameter "DATA_TAB".

DATA: BEGIN OF tbl_infile OCCURS 0,

kunnr(10) type c,

TEXTID(4) TYPE C,

text1(60) type c,

text2(60) type c,

text3(60) type c,

text4(60) type c,

text5(60) type c,

END OF tbl_infile.

CALL METHOD CL_GUI_FRONTEND_SERVICES=>GUI_UPLOAD

EXPORTING

FILENAME = l_file

FILETYPE = 'txt'

CHANGING

DATA_TAB = tbl_infile

  • EXCEPTIONS

Read only

0 Likes
1,371

Hi,

you have to declare as Table type.


TYPES: BEGIN OF tbl_infile ,
         kunnr(10) type c,
         TEXTID(4) TYPE C,
         text1(60) type c,
         text2(60) type c,
         text3(60) type c,
         text4(60) type c,
         text5(60) type c,
      END OF tbl_infile.

TYPES:  t_tbl_infile         TYPE STANDARD TABLE OF tbl_infile .  "file data
DATA:    li_input    TYPE  t_tbl_infile,

CALL METHOD CL_GUI_FRONTEND_SERVICES=>GUI_UPLOAD
    EXPORTING
      FILENAME                = l_file
      FILETYPE                = 'ASC'
    CHANGING
      DATA_TAB                = li_input
*    EXCEPTIONS

Regards

Sandipan

Read only

Former Member
0 Likes
1,371

Hi,

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

FILENAME = 'C:.....---->Pass file name

FILETYPE = 'ASC'

HAS_FIELD_SEPARATOR = 'X'

TABLES

DATA_TAB = -


> Pass internal table name

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.

Amresh

Read only

Former Member
0 Likes
1,371

For sample code Check where-used-lit of GUI_UPLOAD from SE37.