Application Development and Automation 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: 
Read only

Hyperlink in ABAP

Former Member
0 Likes
6,225

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

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
3,709

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.

5 REPLIES 5
Read only

former_member195698
Active Contributor
0 Likes
3,709

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

Read only

Former Member
0 Likes
3,710

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.

Read only

Former Member
0 Likes
3,709

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.

Read only

Former Member
0 Likes
3,709

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

Read only

0 Likes
3,709

can we call module program in reports.