Calling a Browser from ABAP The following function modules can be used to call a browse from ABAP.
WS_EXECUTE
cl_gui_frontend_services=>execute
CALL_BROWSER
Please see the cod below.
REPORT ZBROWSER1 . DATA: BEGIN OF URL_TABLE OCCURS 10, d(50), END OF URL_TABLE. data: d_url1(100), d_url2(100). move: 'http://www.sap.com' to d_url1, 'http://abaplovers.blogspot.com' to d_url2. URL_TABLE-d = 'http://www.abaplovers.blogspot.com'. APPEND URL_TABLE. URL_TABLE-d = d_url1. APPEND URL_TABLE. URL_TABLE-d = d_url2. 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.
Always use Pretty Printer and Extended Program Check before releasing the code.
Do not leave unused code in the program. Comment the code thoroughly. Align the comments and the Code. Follow the SAP Standards and SAP Best Practices guidelines. It’s a good practice to take a dump of the code on your local drive.
No comments:
Post a Comment