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

Problem with UPLOAD function.

amarnath_singanamala2
Participant
0 Likes
976

Hi All,

I am working in an Upgrade project(The upgrade is from 4.6B to ECC 5.0). So in ECC 5.0 the function module UPLOAD is obsolete so I need to replace it with GUI_UPLOAD. In a program they are using this function module where they have used CANCEL parameter( in the Export parameters of the function module ) and they are performing some checks on this parameter. But this parameter is not present in the GUI_UPLOAD in ECC 5.0 , So what could be the solution for this case.

Please reply as soon as possible..

With Regards,

Amarnath Singanamala

10 REPLIES 10
Read only

Vinod_Chandran
Active Contributor
0 Likes
926

Hi,

Before using the GUI_UPLOAD function module, use GUI_FILE_SAVE_DIALOG.

Hope this will help you.

Cheers

Vinod

Read only

Former Member
0 Likes
926

I suggest you to do this.

class CL_GUI_FRONTEND_SERVICES

1. Call the method FILE_OPEN_DIALOG (This should have the cancel)

2. Then call the method GUI_UPLOAD of the same class if you want to proceed with the upload of the selected file from the previous method.

Regards,

Ravi

Note : Please mark the helpful answers

Read only

0 Likes
926

Hi ravi,

Thanks for ur reply i hope this will resolve my issue.

thnx a lot.

Read only

0 Likes
926

HI ravi,

I Have a doubt regarding UPLOAD function. In function UPLOAD we have few parameters like FILETYPE_NO_CHANGE, SILENT . so these are not there in GUI_UPLOAD in ECC 5.0, can u you please give the corresponding parameters of those two in GUI_UPLOAD function in ECC 5.0.

Read only

0 Likes
926

Hi,

Currently I am not infront of the system and so cannot see the functionality of those parameters. However, is there a specific functionality that you are looking from GUI_UPLOAD method.

As UPLOAD is really a old function, quite a few changes were done by SAP, so the parameters might not exist in the new one now.

Regards,

Ravi

Read only

Former Member
0 Likes
926

Hi

I controlled fm WS_UPLOAD and I couldn't see that parameter, so you should explain which is its use (which checks user ahve done on it).

This is an example to open a download a file (in my case I created an excel file):

  • Open dialog

CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG

EXPORTING

WINDOW_TITLE = 'Open file'

DEFAULT_EXTENSION = 'XLS'

DEFAULT_FILENAME = 'C:\filetest.xls'

  • FILE_FILTER =

  • INITIAL_DIRECTORY =

  • MULTISELECTION =

  • WITH_ENCODING =

CHANGING

FILE_TABLE = FILETABLE

RC = RC

USER_ACTION = USER_ACTION

  • FILE_ENCODING =

EXCEPTIONS

FILE_OPEN_DIALOG_FAILED = 1

CNTL_ERROR = 2

ERROR_NO_GUI = 3

NOT_SUPPORTED_BY_GUI = 4

OTHERS = 5.

IF SY-SUBRC = 0.

IF RC = 1

AND USER_ACTION = CL_GUI_FRONTEND_SERVICES=>ACTION_OK.

  • Downlod file

READ TABLE FILETABLE INTO WA_FILE INDEX 1.

MOVE WA_FILE-FILENAME TO FILENAME.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

FILENAME = FILENAME

FILETYPE = 'ASC'

WRITE_FIELD_SEPARATOR = 'X'

CONFIRM_OVERWRITE = 'X'

TABLES

DATA_TAB = ITAB

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.

CALL FUNCTION 'WS_EXECUTE'

EXPORTING

DOCUMENT = 'X'

COMMANDLINE = FILENAME

PROGRAM = 'EXCEL'

EXCEPTIONS

OTHERS = 99.

ENDIF.

ELSE.

IF USER_ACTION =

CL_GUI_FRONTEND_SERVICES=>ACTION_CANCEL.

MESSAGE S208(00) WITH 'Action cancelled by user'.

ENDIF.

ENDIF.

ENDIF.

You can use the method GUI_DOWNLOAD of class CL_GUI_FRONTEND_SERVICES instead of fm GUI_DOWNLOAD just as the guys have said before.

Max

Read only

0 Likes
926

hi Max,

thanks for ur reply too. i think u r also correct.

Amarnath

Read only

0 Likes
926

Hi

I'm happy for that.

Don't forget to assign the points to any answers are helpful for you and close this post if you've solved your problem.

Max

Read only

0 Likes
926

HI Max,

I am really sorry for that,

I think we can assign points for only one person.

Ravi answered before you that's y i haved assigned to him.

if we can assign points for many ppl i can assign points .

Amarnath

Read only

0 Likes
926

Hi

Don't worry! That's no problem fot the points!

We are here to give a little help.

Only close this post if u've solved the problem.

Max