01-17-2013 6:43 AM
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
01-17-2013 9:09 AM
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.
01-17-2013 6:49 AM
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.
LOOP AT RESPONSE. TRANSFER RESPONSE TO P_FILE. ENDLOOP.
CLOSE DATASET P_FILE.
01-17-2013 6:50 AM
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.
01-17-2013 7:44 AM
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
01-17-2013 8:07 AM
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.
01-17-2013 7:02 AM
01-17-2013 9:09 AM
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.