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

gui_upload

Former Member
0 Likes
504

Hi Experts,

Can we run gui_upload fm in back ground if we hard code the file path??

see the code.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

FILENAME = 'C:\DATA.TXT'

FILETYPE = 'ASC'

HAS_FIELD_SEPARATOR = 'X'

  • HEADER_LENGTH = 0

  • READ_BY_LINE = 'X'

  • DAT_MODE = ' '

  • CODEPAGE = ' '

  • IGNORE_CERR = ABAP_TRUE

  • REPLACEMENT = '#'

  • IMPORTING

  • FILELENGTH =

  • HEADER =

TABLES

DATA_TAB = it_bg

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.

Regards

3 REPLIES 3
Read only

Former Member
0 Likes
475

Hi Ravi,

GUI_UPLOAD is a frontend Fm. You can't use for background.

Use OPEN DATASET for that.

Reward points if this helps.

Manish

Read only

Former Member
0 Likes
475

No you cannot run this in background.

When you are running your report in background, it gets executed on application server and your file in on presentation server i. e. desktop. Hence it cannot run in background.

U can place your file on application server and then use open dataset and close dataset functionality to use that file in your report.

I hope it helps.

Best Regards,

Vibha

*Please mark all the helpful answers

Read only

Former Member
0 Likes
475

HI Ravi,

GUI_UPLOAD cannot be executed in the background.

The only possible solution is to upload the file from the presentation server to the application server.

And from there you can read the file in the background using :

OPEN DATASET

READ DATASET

CLOSE DATASET...

Regards,

Kumar