cancel
Showing results for 
Search instead for 
Did you mean: 

Method cl_gui_frontend_services=>gui_upload in runtime error.

Former Member
0 Kudos

Hi,

in a WDDOINIT method of a WD view and I've called the method cl_gui_frontend_services=>gui_upload and it give me a runtime error when at the point when it is called:

OBJECTS_OBJREF_NOT_ASSIGNED Access via 'NULL' object reference not possible.

the point is:

>>>>> FUNCTION DP_CONTROL_ASSIGN_TABLE.

2 *"----


3 ""Lokale Schnittstelle:

4 *" IMPORTING

5 *" REFERENCE(H_DP) TYPE CNTL_HANDLE OPTIONAL

6 *" REFERENCE(H_CNTL) TYPE CNTL_HANDLE

7 *" VALUE(TABNAME) LIKE X030L-TABNAME OPTIONAL

8 *" VALUE(MEDIUM) TYPE C OPTIONAL

9 *" VALUE(PROPERTYNAME) TYPE C

10 *" VALUE(DATE) LIKE SY-DATUM OPTIONAL

11 *" VALUE(TIME) LIKE SY-UZEIT OPTIONAL

12 *" VALUE(DESCRIPTION) TYPE C OPTIONAL

13 *" TABLES

14 *" DATA

15 *" TABFIELDS STRUCTURE RFC_FIELDS OPTIONAL

16 *" COLUMNS_TO_STRETCH TYPE TABLE_OF_STRINGS OPTIONAL

17 *" EXCEPTIONS

18 *" DP_ERROR_CREATE

19 *" DP_ERROR_SEND_DATA

20 *" DP_ERROR_ASSIGN

This is very strange for me because I've created a report (also a function) with the same code and the problem doesn't exist.

Here's the code:

DATA: p_up TYPE string VALUE 'C:\VB.pdf'.

TYPES: BEGIN OF t_itab,

filler TYPE xstring,

END OF t_itab.

DATA: lt_data TYPE TABLE OF x255.

DATA: ls_data LIKE LINE OF lt_data, lv_size TYPE i.

cl_gui_frontend_services=>gui_upload(

EXPORTING

filename = p_up

filetype = 'BIN'

  • has_field_separator = SPACE

  • header_length = 0

  • read_by_line = 'X'

  • dat_mode = SPACE

  • codepage = SPACE

  • ignore_cerr = ABAP_TRUE

  • replacement = '#'

  • virus_scan_profile =

IMPORTING

filelength = lv_size

  • header =

CHANGING

data_tab = lt_data

  • 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

  • not_supported_by_gui = 17

  • error_no_gui = 18

  • others = 19

).

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

Thanks for answers.

Accepted Solutions (1)

Accepted Solutions (1)

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

That's easy - you can't use GUI_UPLOAD from Web Dynpro. You can't use any SAPGUI specific functions, since there is no connection to the SAPGUI when you are running in a browser. You would have to use the fileUplaod UI element. If you are on 7.01 and don't mind writting your own ICF upload handler, then you could also use the ACFUpDownload UI element. Here is a eLearning and Source Code example for this (it will also be published on SDN with a few days):

http://enterprisegeeks.com/blog/2009/03/31/abap-freak-show-april-1st-acf-updownload-in-web-dynpro-ab...

Answers (0)