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: 

Error while opening browser using gui_download

former_member342013
Contributor
0 Kudos

hi All ,

how to open url by using gui_download function module ?

I'm downloading all the attachments using gui_download and i'm able to open all the files except url .

can any one help me to open url which is downloaded from sap to local drive .

Regards

Smitha

1 ACCEPTED SOLUTION

former_member342013
Contributor
0 Kudos

Thnx for the replies .

here is the solution

types : begin of x_tab, line(255) type c, end of x_tab.

data g_url type string.

data i_tab type standard table of x_tab.

data w_tab type x_tab.

w_tab-line = '[internetshortcut]'.

append w_tab to i_tab.

w_tab-line = 'URL=http://google.com'.

append w_tab to i_tab.

g_url = 'C:\APPS\ATTACHMENTS\WORKORDER\000004020723\AUFNR.url'.

CALL FUNCTION 'GUI_DOWNLOAD'

  EXPORTING

    FILENAME         = g_url

    FILETYPE         = 'ASC'

  TABLES

    DATA_TAB         = i_tab

  EXCEPTIONS

    FILE_WRITE_ERROR = 1

    OTHERS           = 22.

6 REPLIES 6

yogendra_bhaskar
Contributor
0 Kudos

Hi Smitha ,

Try this :

REPORT  ZTEST_URL_FILE.

TYPES: BEGIN OF TEXT,

        LINE(1000),

       END OF TEXT.

DATA: RESPONSE         TYPE TABLE OF TEXT WITH HEADER LINE,

      RESPONSE_HEADERS TYPE TABLE OF TEXT WITH HEADER LINE.

DATA: L_STAT(3)        TYPE C,

      L_STEXT(128)     TYPE C.

PARAMETERS: P_URL(100) TYPE C LOWER CASE.

PARAMETERS: P_FILE     LIKE RLGRAP-FILENAME.

START-OF-SELECTION.

  CALL FUNCTION 'HTTP_GET'

    EXPORTING

      ABSOLUTE_URI          = P_URL

    TABLES

      RESPONSE_ENTITY_BODY  = RESPONSE

      RESPONSE_HEADERS      = RESPONSE_HEADERS

    EXCEPTIONS

      CONNECT_FAILED        = 1

      TIMEOUT               = 2

      INTERNAL_ERROR        = 3

      TCPIP_ERROR           = 4

      DATA_ERROR            = 5

      SYSTEM_FAILURE        = 6

      COMMUNICATION_FAILURE = 7

      OTHERS                = 8.

  IF SY-SUBRC <> 0.

    WRITE : SY-SUBRC , 'ERROR' , L_STAT, L_STEXT.

  ELSE .

    WRITE : 'SUCCESS'.

  ENDIF.

  SKIP 1.

  LOOP AT RESPONSE.

    WRITE : /1 RESPONSE.

  ENDLOOP.

  OPEN DATASET P_FILE FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.

  IF SY-SUBRC GT 0.

    WRITE:/ 'error opening file'.

    EXIT.

  ENDIF.

  • Transfer internal table data to file

  LOOP AT RESPONSE.    TRANSFER RESPONSE TO P_FILE.  ENDLOOP.

  • Closed file

  CLOSE DATASET P_FILE.

gouravkumar64
Active Contributor
0 Kudos

Hi,

GUI_DOWNLOAD IS for within pc,server only.

u have to use OPEN_DATSET for this purpose.

check this for details

http://scn.sap.com/thread/1775565

Thanks

Gourav.

0 Kudos

hi Gourav ,

Thanks for the reply .

i'm trying to open url from  C:\APPS\SMITHA.URL

when i try to click on this smitha.url i'm getting error , and not able to open the link

Can you please suggest on this ?

Regards

Smitha

0 Kudos

Hi ,

Try like this.

cl_gui_frontend_services=>execute.

expo.....

document = lv_url. "url

exceptions

others =1.

also

Have a look at sap standard program  SAPHTML_DEMO1.( in se38)

it will very helpful for u.

AND LASTLY LOOK at this thread

http://scn.sap.com/thread/164037

Hope it will solve ur problem.

Thanks

Gourav.

Former Member
0 Kudos

Hi.

Try only DOWNLOAD function.

sandeep sharma

former_member342013
Contributor
0 Kudos

Thnx for the replies .

here is the solution

types : begin of x_tab, line(255) type c, end of x_tab.

data g_url type string.

data i_tab type standard table of x_tab.

data w_tab type x_tab.

w_tab-line = '[internetshortcut]'.

append w_tab to i_tab.

w_tab-line = 'URL=http://google.com'.

append w_tab to i_tab.

g_url = 'C:\APPS\ATTACHMENTS\WORKORDER\000004020723\AUFNR.url'.

CALL FUNCTION 'GUI_DOWNLOAD'

  EXPORTING

    FILENAME         = g_url

    FILETYPE         = 'ASC'

  TABLES

    DATA_TAB         = i_tab

  EXCEPTIONS

    FILE_WRITE_ERROR = 1

    OTHERS           = 22.