‎2008 Jun 11 2:36 PM
Hallo,
I would like to know how I can call a link from an ABAP program. I am a novice in ABAP but can manage writing a little code.
I know that I need to use the EXECUTE method in someway but since I am a Java guy, I have no idea how to go about it. Could anyone help me out with it?
To be more precise - the aim is to write a short ABAP Program which is fed with a hyperlink. This hyperlink is then shown to the user who can click it to call up a website.
I would be happy if someone could show me how it is done.
Bye!
Sameer
‎2008 Jun 11 2:42 PM
cehck this sample..
REPORT ZTEST_LINK.
write : 'www.yahoo.com' hotspot on.
at line-selection.
CL_GUI_FRONTEND_SERVICES=>EXECUTE(
EXPORTING
DOCUMENT = 'http://www.yahoo.com'
OPERATION = 'OPEN'
EXCEPTIONS
CNTL_ERROR = 1
ERROR_NO_GUI = 2
BAD_PARAMETER = 3
FILE_NOT_FOUND = 4
PATH_NOT_FOUND = 5
FILE_EXTENSION_UNKNOWN = 6
ERROR_EXECUTE_FAILED = 7
SYNCHRONOUS_FAILED = 8
NOT_SUPPORTED_BY_GUI = 9
).
IF SY-SUBRC NE 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
‎2008 Jun 11 2:40 PM
Try using the FM RH_URL_CALL_BROWSER. You can pass the Input URL to the FM. It will result in the website opened in the installed web browser.
In your program you can display the url as a Hyperlink. On clicking , AT user-Command event will be triggered. Within the event you can call the FM,
Regards,
Aj
‎2008 Jun 11 2:42 PM
cehck this sample..
REPORT ZTEST_LINK.
write : 'www.yahoo.com' hotspot on.
at line-selection.
CL_GUI_FRONTEND_SERVICES=>EXECUTE(
EXPORTING
DOCUMENT = 'http://www.yahoo.com'
OPERATION = 'OPEN'
EXCEPTIONS
CNTL_ERROR = 1
ERROR_NO_GUI = 2
BAD_PARAMETER = 3
FILE_NOT_FOUND = 4
PATH_NOT_FOUND = 5
FILE_EXTENSION_UNKNOWN = 6
ERROR_EXECUTE_FAILED = 7
SYNCHRONOUS_FAILED = 8
NOT_SUPPORTED_BY_GUI = 9
).
IF SY-SUBRC NE 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
‎2008 Jun 11 2:42 PM
Hello,
Take a look on this at page 22: [https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e8a1d690-0201-0010-b7ad-d9719a415907].
Regards.
‎2008 Jun 11 9:04 PM
Hi,
Check the following code:
REPORT ZURL NO STANDARD PAGE HEADING.
DATA: BEGIN OF URL_TABLE OCCURS 10,
L(25),
END OF URL_TABLE.
URL_TABLE-L = 'http://www.lycos.com'.APPEND URL_TABLE.
URL_TABLE-L = 'http://www.hotbot.com'.APPEND URL_TABLE.
URL_TABLE-L = 'http://www.sap.com'.APPEND URL_TABLE.
LOOP AT URL_TABLE.
SKIP. FORMAT INTENSIFIED OFF.
WRITE: / 'Single click on '.
FORMAT HOTSPOT ON.FORMAT INTENSIFIED ON.
WRITE: URL_TABLE. HIDE URL_TABLE.
FORMAT HOTSPOT OFF.FORMAT INTENSIFIED OFF.
WRITE: 'to go to', URL_TABLE.
ENDLOOP.
CLEAR URL_TABLE.
AT LINE-SELECTION.
IF NOT URL_TABLE IS INITIAL.
CALL FUNCTION 'WS_EXECUTE'
EXPORTING
program = 'C:\Program Files\Internet Explorer\IEXPLORE.EXE'
commandline = URL_TABLE
INFORM = ''
EXCEPTIONS
PROG_NOT_FOUND = 1.
IF SY-SUBRC <> 0.
WRITE:/ 'Cannot find program to open Internet'.
ENDIF.
ENDIF.
Regards,
Bhaskar
‎2013 Nov 28 11:45 AM