Application Development 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: 

reg uploading the data from flat file

venkata_reddy6
Participant
0 Kudos

Hi friends, this is very urgent, plz help.

when i am uploading flat file from presentation server to internal table its going to dump. the code i have written is below.

PARAMETERS p_file TYPE ibipparms-path LOWER CASE MODIF ID 001.

AT SELECTION-SCREEN ON VALUE-REQUEST for p_file.

PERFORM pre_help USING p_file .

PERFORM UPLOAD_INPUT_FILE.

FORM pre_help USING us_file TYPE ibipparms-path.

CALL FUNCTION 'F4_FILENAME'

EXPORTING

program_name = sy-cprog

dynpro_number = syst-dynnr

IMPORTING

file_name = us_file.

ENDFORM. " pre_help

FORM UPLOAD_INPUT_FILE.

IF P_PRESER EQ C_X.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

FILENAME = P_FILE

FILETYPE = 'ASC'

HAS_FIELD_SEPARATOR = C_X

IMPORTING

FILELENGTH = W_FILELENGTH

TABLES

DATA_TAB = I_ztppt01

EXCEPTIONS

FILE_OPEN_ERROR = C_EXCEPTION_01

FILE_READ_ERROR = C_EXCEPTION_02

NO_BATCH = C_EXCEPTION_03

GUI_REFUSE_FILETRANSFER = C_EXCEPTION_04

INVALID_TYPE = C_EXCEPTION_05

NO_AUTHORITY = C_EXCEPTION_06

UNKNOWN_ERROR = C_EXCEPTION_07

BAD_DATA_FORMAT = C_EXCEPTION_08

HEADER_NOT_ALLOWED = C_EXCEPTION_09

SEPARATOR_NOT_ALLOWED = C_EXCEPTION_10

HEADER_TOO_LONG = C_EXCEPTION_11

UNKNOWN_DP_ERROR = C_EXCEPTION_12

ACCESS_DENIED = C_EXCEPTION_13

DP_OUT_OF_MEMORY = C_EXCEPTION_14

DISK_FULL = C_EXCEPTION_15

DP_TIMEOUT = C_EXCEPTION_16

OTHERS = C_EXCEPTION_17.

IF SY-SUBRC NE 0.

MESSAGE I999 WITH 'Error uploading file :'(013) P_FILE.

endif.

1 ACCEPTED SOLUTION

varma_narayana
Active Contributor
0 Kudos

Hi..

The problem is in the Filename you are passing to The FM GUI_UPLOAD.

It must be type STRING.

So change the code like this. CHANGES ARE IN BOLD....

PARAMETERS p_file TYPE ibipparms-path LOWER CASE MODIF ID 001.

<b>DATA : V_FILE TYPE STRING.</b>

AT SELECTION-SCREEN ON VALUE-REQUEST for p_file.

PERFORM pre_help USING p_file .

PERFORM UPLOAD_INPUT_FILE.

FORM pre_help USING us_file TYPE ibipparms-path.

CALL FUNCTION 'F4_FILENAME'

EXPORTING

program_name = sy-cprog

dynpro_number = syst-dynnr

IMPORTING

file_name = us_file.

ENDFORM. " pre_help

FORM UPLOAD_INPUT_FILE.

<b>MOVE P_FILE TO V_FILE.</b>

IF P_PRESER EQ C_X.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

<b>FILENAME = V_FILE</b>

FILETYPE = 'ASC'

HAS_FIELD_SEPARATOR = C_X

IMPORTING

FILELENGTH = W_FILELENGTH

TABLES

DATA_TAB = I_ztppt01

EXCEPTIONS

FILE_OPEN_ERROR = C_EXCEPTION_01

FILE_READ_ERROR = C_EXCEPTION_02

NO_BATCH = C_EXCEPTION_03

GUI_REFUSE_FILETRANSFER = C_EXCEPTION_04

INVALID_TYPE = C_EXCEPTION_05

NO_AUTHORITY = C_EXCEPTION_06

UNKNOWN_ERROR = C_EXCEPTION_07

BAD_DATA_FORMAT = C_EXCEPTION_08

HEADER_NOT_ALLOWED = C_EXCEPTION_09

SEPARATOR_NOT_ALLOWED = C_EXCEPTION_10

HEADER_TOO_LONG = C_EXCEPTION_11

UNKNOWN_DP_ERROR = C_EXCEPTION_12

ACCESS_DENIED = C_EXCEPTION_13

DP_OUT_OF_MEMORY = C_EXCEPTION_14

DISK_FULL = C_EXCEPTION_15

DP_TIMEOUT = C_EXCEPTION_16

OTHERS = C_EXCEPTION_17.

IF SY-SUBRC NE 0.

MESSAGE I999 WITH 'Error uploading file :'(013) P_FILE.

endif.

<b>Reward if Helpful</b>

5 REPLIES 5

venkata_reddy6
Participant
0 Kudos

Hi for your information the error it is showing is

In perform or call function " gui_upload" the actual parameter ASC is incompatible with the formal parameter "filetype".

and

In perform or call function " gui_upload" the actual parameter "p_file" is incompatible with the formal parameter "filename".

regards.

settipalli_raj
Explorer
0 Kudos

Dump could be due to parameter type incompatibility. Create another variable of type STRING and move p_file value to this string type variable and use that in function module call.

Check all other parameter types as well.

Former Member
0 Kudos

HI,

before calling that function module GUI_UPLOAD.

write like this.

DATA : S_FILE TYPE STRING.

s_file = p_file.

and assign this s_file to exporting parameter "filename" in the FM gui_upload.

because here u need to pass string type.but u r are passing some different type.

<b>reward if helpful</b>

rgds,

bharat.

0 Kudos

Thank u very much Raj and Bharath,

one is solved.

for 'ASC' what type i have to take.

regards,

varma_narayana
Active Contributor
0 Kudos

Hi..

The problem is in the Filename you are passing to The FM GUI_UPLOAD.

It must be type STRING.

So change the code like this. CHANGES ARE IN BOLD....

PARAMETERS p_file TYPE ibipparms-path LOWER CASE MODIF ID 001.

<b>DATA : V_FILE TYPE STRING.</b>

AT SELECTION-SCREEN ON VALUE-REQUEST for p_file.

PERFORM pre_help USING p_file .

PERFORM UPLOAD_INPUT_FILE.

FORM pre_help USING us_file TYPE ibipparms-path.

CALL FUNCTION 'F4_FILENAME'

EXPORTING

program_name = sy-cprog

dynpro_number = syst-dynnr

IMPORTING

file_name = us_file.

ENDFORM. " pre_help

FORM UPLOAD_INPUT_FILE.

<b>MOVE P_FILE TO V_FILE.</b>

IF P_PRESER EQ C_X.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

<b>FILENAME = V_FILE</b>

FILETYPE = 'ASC'

HAS_FIELD_SEPARATOR = C_X

IMPORTING

FILELENGTH = W_FILELENGTH

TABLES

DATA_TAB = I_ztppt01

EXCEPTIONS

FILE_OPEN_ERROR = C_EXCEPTION_01

FILE_READ_ERROR = C_EXCEPTION_02

NO_BATCH = C_EXCEPTION_03

GUI_REFUSE_FILETRANSFER = C_EXCEPTION_04

INVALID_TYPE = C_EXCEPTION_05

NO_AUTHORITY = C_EXCEPTION_06

UNKNOWN_ERROR = C_EXCEPTION_07

BAD_DATA_FORMAT = C_EXCEPTION_08

HEADER_NOT_ALLOWED = C_EXCEPTION_09

SEPARATOR_NOT_ALLOWED = C_EXCEPTION_10

HEADER_TOO_LONG = C_EXCEPTION_11

UNKNOWN_DP_ERROR = C_EXCEPTION_12

ACCESS_DENIED = C_EXCEPTION_13

DP_OUT_OF_MEMORY = C_EXCEPTION_14

DISK_FULL = C_EXCEPTION_15

DP_TIMEOUT = C_EXCEPTION_16

OTHERS = C_EXCEPTION_17.

IF SY-SUBRC NE 0.

MESSAGE I999 WITH 'Error uploading file :'(013) P_FILE.

endif.

<b>Reward if Helpful</b>