Skip to Content
author's profile photo Former Member
Former Member

Re:type casting error in function module

Hi Expert,

I have written below code i am uploading data from .csv file to iternal table in GUI_UPLOAD function module i am getting error saying P_FILE specifiesd here

is a different field type.

Please any one can throw some light.

SELECTION-SCREEN begin of block b1 with frame TITLE text-001.
*parameters: p_file type string default 'C:\ME22N.CSV' OBLIGATORY.
parameters: p_file type LOCALFILE.
SELECTION-SCREEN end of block b1.


AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.


CALL FUNCTION 'F4_FILENAME'
EXPORTING
PROGRAM_NAME = SYST-CPROG
DYNPRO_NUMBER = SYST-DYNNR
FIELD_NAME = 'P_FILE' " 'P_FILE '
IMPORTING
FILE_NAME = P_FILE "P_FILE
.

START-OF-SELECTION.

************* Function module to upload file from path***************

*data: p_file type string.
*data: v_file TYPE string.
* v_file = P_file.


CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = p_file
FILETYPE = 'ASC'

TABLES
DATA_TAB = gtab
* 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.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Posted on Jun 04, 2012 at 09:23 AM

    Go to SE37. Look at GUI_UPLOAD. What type is p_file? Hint: it isn't LOCALFILE.

    The answer to your query is in your question. Very basic question. Locked.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.