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: 

Exception UNKNOWN_ERROR while using GUI_DOWNLOAD in POWL

Former Member
0 Kudos

Hi,

I am trying to use FM GUI_DOWNLOAD to download an internal table in POWL to an excel sheet.

Using GUI_DOWNLOAD I get an exception 6 = UNKNOWN_ERROR.

Can anyone help? Or should I be using another function module? If yes, which?

Cheers

Kiran

10 REPLIES 10

Sandeep_Kumar
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi,

Can you tell us how you are calling ur FM ?

Rgds,

Sandeep

Former Member
0 Kudos

Hello,

Can you please paste your code so that it would be eay to get to the problem.

Thanks,

Jayant

Former Member
0 Kudos

Hi,

lt_final_tab is an internal table.

Any variation to lv_filename does not work too.

________________________________________________

lv_filename = 'C:\Export.xls'.

CALL METHOD cl_gui_frontend_services=>gui_download

EXPORTING

  • bin_filesize =

filename = lv_filename

CHANGING

data_tab = lt_final_tab

  • 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

  • not_supported_by_gui = 22

  • error_no_gui = 23

  • others = 24

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

Former Member
0 Kudos

Hi,

Try with the code below.

Check whether your getting proper output in the excel payroll.xls.

FORM download .
 
***** DECLARATION OF LOCAL VARIABLES *****
 
  DATA: lv_fullpath TYPE string,
        lv_action TYPE i,
        lv_path TYPE string.
 
lc_filepath = 'C:\PAYROLL'.
 
lc_filename = 'PAYROLL.XLS'.
 
***** FUNCTION CALL FOR DOWNLOAD *****
 
  CALL FUNCTION 'GUI_FILE_SAVE_DIALOG'
    EXPORTING
      window_title      = 'Local PC File'
      default_file_name = lc_filename
      initial_directory = lc_filepath
    IMPORTING
      path              = lv_path
      fullpath          = lv_fullpath
      user_action       = lv_action.
 
  IF lv_action > 2.
    WRITE: / 'An error occurred! User has cancelled the Request'.
  ENDIF.
 
  CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
      filename = lv_fullpath
      filetype = 'DAT'
    TABLES
      data_tab =  gi_dynitab.
 
ENDFORM.

Former Member
0 Kudos

Hello,

Just try to use 'GUI_DOWNLOAD" FM instead of using the class and see if the error still exist. Everything seems to be good with the class. May be you can check the TYPE of parameters that you are passing.

Thanks,

Jayant

Former Member
0 Kudos

Hi Jayant,

I had initially tried it with the normal FM also.The same error happens.

The very 1st time I ran this code, I got exception 'invalid_type' as I had put type as XLS.

But after that everytime I get UNKNOWN_ERROR.

cheers

Kiran

Former Member
0 Kudos

Hi,

Try giving the type as DAT.

Former Member
0 Kudos

Hello Kiran,

Strange Problem. Please try the code below. Also, please try any other drive other than C drive.

w_path---> file path in presentation server.

IF w_filepath IS NOT INITIAL.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

filename = w_filepath "TYPE STRING

TABLES

data_tab = p_t_output "TYPE STANDARD TABLE.

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.

CASE sy-subrc.

WHEN 0.

IF w_flaginfo IS INITIAL.

MESSAGE i109.

w_flaginfo = 1.

ENDIF.

WHEN 1.

MESSAGE e033 . "file write error

WHEN 2.

MESSAGE e034 . "no batch

WHEN 3.

MESSAGE e035 . "gui refuse filetransfer

WHEN 4.

MESSAGE e036 . "invalid type

WHEN 5.

MESSAGE e037 . "no authority

WHEN 6.

MESSAGE e038 . "unknown error

WHEN 7.

MESSAGE e039 . "header not allowed

WHEN 8.

MESSAGE e040 . "separator not allowed

WHEN 9.

MESSAGE e041 . "filesize not allowed

WHEN 10.

MESSAGE e042 . "header too long

WHEN 11.

MESSAGE e043 . "dp error create

WHEN 12.

MESSAGE e044 . "dp error send

WHEN 13.

MESSAGE e045 . "dp error write

WHEN 14.

MESSAGE e046 . "unknown dp error

WHEN 15.

MESSAGE e047 . "access denied

WHEN 16.

MESSAGE e048 . "dp out of memory

WHEN 17.

MESSAGE e049 . "disk full

WHEN 18.

MESSAGE e050 . "dp timeout

WHEN 19.

MESSAGE e051 . "file not found

WHEN 20.

MESSAGE e052 . "dataprovider exception

WHEN 21.

MESSAGE e053 . "control flush error

ENDCASE.

ENDIF.

Please let me know if this works or not.

Thanks,

Jayant

Former Member
0 Kudos

Yeah it is strange Jayant.

I changed the path and it dumps. First only exception, now short dump

Is it because of any UI problem ? I am using Web dynpro, actually the POWL screen.

Cheers

Kiran

Former Member
0 Kudos

Kiran,

You cannot use the GUI_DOWNLOAD on Web Dynpro screens. Its not an issue related to POWL, but to the FM which is used by SAP GU and cannot be used while working with web based screens.

For WD screens, you would need to use either the file UI element or the method cl_wd_runtime_services=>attach_file_to_response.

Best Regards,

Rashmi.