Execute URL from ABAP (no gui session)
I have an RFC function module which I am calling from Visual Composer application. The function module is designed to execute and external URL using method cl_gui_frontend_services=>execute. However, I am getting an exception error NOT_SUPPORTED_BY_GUI because from Visual Composer there is no SAP gui session open. I have tried some other function modules like WF_WINDOWS_EXECUTE, PRGN_GENER_EXECUTE_URL, CALL_BROWSER...etc but they are all designed to work with gui session only.
Is there any other class or function module that I can use to resolve this issue (w/ example please)?
Hi,
For opening a url through ABAP,
Try using a sample code below:
DATA: BEGIN OF URL_TABLE OCCURS 0,
L(35),
END OF URL_TABLE.
url_table-l = 'http://www.abc.com'.
APPEND url_table.
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.
Hope it helps
Regards
Mansi
Similar Messages
-
Hi friends,
Can we call a web URL from a ABAP program?
Is there anyway its possible ? if yes how?
Please provide the solution.
Thanks & Regards
kapilHi Kapil,
<b>Look at the below example program:-</b>
REPORT zget_mayors_for_cities.
DATA: it_citymayors TYPE TABLE OF zcitymayors,
wa_citymayors LIKE LINE OF it_citymayors,
mayor TYPE full_name,
trash TYPE string.
PARAMETERS: s_city TYPE s_city LOWER CASE.
SELECT * FROM zcitymayors INTO TABLE it_citymayors
WHERE city LIKE s_city.
* HTTP Client according to
* /people/thomas.jung3/blog/2005/07/01/bsp-create-a-weather-magnet-using-xml-feed-from-weathercom
DATA: client TYPE REF TO if_http_client,
<b>url TYPE string,</b>
xml TYPE xstring,
c_xml TYPE string,
city TYPE string.
* Converter
DATA: l_convin TYPE REF TO cl_abap_conv_in_ce.
LOOP AT it_citymayors INTO wa_citymayors.
* Use the Progress Indicator to show the user which City is processed
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
percentage = sy-index
text = wa_citymayors-city.
city = wa_citymayors-city.
* Spaces have to be replaced by _ in the URL
REPLACE FIRST OCCURRENCE OF space IN city WITH '_'.
<b> CONCATENATE
'http://de.wikipedia.org/wiki/Spezial:Export/' city
INTO url.</b>
****Create the HTTP client
TRY.
<b> CALL METHOD cl_http_client=>create_by_url
EXPORTING
url = url
IMPORTING
client = client
EXCEPTIONS
OTHERS = 1.</b>
client->send( ).
client->receive( ).
xml = client->response->get_data( ).
client->close( ).
CATCH cx_root.
WRITE: / 'HTTP Connection error: ', city.
ENDTRY.
* Wikipedia does not provide a encoding with the returned XML
* so we have to do the conversion manually
TRY.
CALL METHOD cl_abap_conv_in_ce=>create
EXPORTING
encoding = 'UTF-8'
input = xml
endian = 'L'
RECEIVING
conv = l_convin.
CALL METHOD l_convin->read
IMPORTING
data = c_xml.
CATCH cx_root.
WRITE: / 'Problem during Character conversion: ', city.
ENDTRY.
****Transform XML to ABAP Values
TRY.
CALL TRANSFORMATION zwikipedia_mayor_to_abap
SOURCE XML c_xml
RESULT mayor = mayor.
CATCH cx_root.
WRITE: / 'Data loss during transformation: ', city.
ENDTRY.
* Some Mayors already have pecial Pages
REPLACE FIRST OCCURRENCE OF '[[' IN mayor WITH ''.
REPLACE FIRST OCCURRENCE OF ']]' IN mayor WITH ''.
* Some Mayors are members of a Party
SPLIT mayor AT '(' INTO mayor trash.
wa_citymayors-mayor = mayor.
WRITE: / wa_citymayors-city.
* Update Database
IF NOT wa_citymayors-mayor IS INITIAL.
UPDATE zcitymayors FROM wa_citymayors.
WRITE: wa_citymayors-mayor.
ENDIF.
ENDLOOP.
Look at the below thread for more info:-
/people/gregor.wolf3/blog/2006/06/29/use-data-from-wikipedia
Regards
Sudheer -
Can we get a "Add to Browser Favorites" URL from ABAP-side?
Hi,
via "Add to Browser Favorites", you can get a URL for opening exactly the portal page you are currently on. Is there any possibility
to get (or create/generate) the URL for such a page from ABAP-side? We have the requirement to send e-mails from the ABAP
backend with links (URLs) to a corresponding portal page (like the example below). This has to be done quite generic, mi.e. the server,
the port, the application parameters, etc. cannot be hardcoded but have to be generated in a generic way.
Thank you and kind regards,
Florian
PS: Example:
http://pwdf6460.wdf.sap.corp:50000/irj/portal/ajax?navigationtarget=roles://portal_content/com.sap.pct/every_user/com.sap.pct.erp.common.bp_folder/com.sap.pct.erp.common.roles/com.sap.pct.erp.common.erp_common/com.sap.pct.erp.common.lpd_start_wd_abap&&WebDynproApplication=CPROJECTS_FPM&WebDynproConfiguration=CPROJECTS_FPM&ApplicationParameter=OBJ_EVENT%253dDPO47BAB5FEB7A55A28E10000000A424B1D47BAB5FEB7A55A28E10000000A424B1DDPO++++++++++++++++++++++++NON&NavMode=3&System=SAP_cProjects&PrevNavTarget=ROLES%253a%252f%252fportal_content%252fcom.sap.pct%252fevery_user%252fcom.sap.pct.plm.ppm.PPM50%252fcom.sap.pct.plm.ppm.Roles%252fcom.sap.pct.plm.ppm.port_prj_mgmt_showcase%252fcom.sap.pct.plm.ppm.projectmanagement_showcase%252fcom.sap.pct.plm.ppm.pm_overview%252fcom.sap.pct.plm.ppm.ws_projects%252fcom.sap.pct.plm.ppm.cpr_projects_showcase&WebDynproNamespace=sap&&NavigationContext=merge(ROLES://portal_content/every_user/general/eu_core_role/com.sap.uwl.home_core_ws/com.sap.netweaver.bc.uwl.overview%7CROLES://portal_content/every_user/general/eu_core_role/com.sap.portal.home_core/com.sap.portal.home.overview)Hi,
It is hard to know exactly what to suggest since I don't know the full story behind the process you are trying to implement. However I can make some suggestions:
1. Use short URLs. These can be configured in the portal and will allow for easier navigation. you will see this as a "quick link" parameter in the page properties.
2. Rather then hard coding any values use a configuration table in the ABAP system.
3. If the process starts in the portal you could have your portal application send the necessary data to the ABAP system so it could use it to generate the email (e.g. Server/Port/Parameters etc...)
4. If it is a dual stack system you may be able to leverage the co-existance of portal an ABAP on the same server.
5. What about using a web service on the portal to supply the URL to the ABAP system. You could call this web service from the ABAP and have the portal provide the data that way. This would be good if your process kicks off on the ABAP side and not via the portal.
Anyway, I hope some of those suggestions help.
BRgds,
Simon -
Execute webdynpro from abap program and return to the caller program
Guys,
I have a question here.
I know there is a way to call an abap webdynpro application from normal abap program by either using a class method, or use a function module WDY_EXECUTE_IN_PLACE by providing
the webdynpro application or using CALL TRANSACTION statement.
But, is there anyways that we can call the webdynpro application from abap program by supplying data to the webdynpro and display to the user from the portal, and then
once the user do some manipulation on the data, can we transfer back the data to the caller abap program?hey ,
you can pack any web-dynpro program in tranasaction code and run it from R/3 and not via portal :
search in " SAPTECHNICAL" how to do so - for some reason i cant post a link here
than you can use call transaction .
regards
ASA -
Call external URL from ABAP userexit, capture data and return it to SAP?
My apologies if this question has been asked before, but I've searched for a few hours today and haven't found anything directly related to my question. Thank you in advance for any help you may be able to provide!
I would like to be able to make a call from an SAP userexit during Sales Order Entry in the VA01 transaction in the SD module to an external website, allow the user to capture some data in the external site and then pass that data back into the userexit where I can use it to populate internal tables, etc.
I'm completely unfamiliar with Web Dynpro programming, but this seems like a good place to start my search for a solution.
Does this sound like a problem that can be solved with Web Dynpro and what documentation or code examples should I reference to go about building such a solution.
I should also note that I'm hoping to build a solution that could be called from any userexit in R/3, SAP ERP, SAP CRM, etc. and would obviously need to learn about what dependencies to consider (ex: SAP GUI version, SAP product release number, Web AS release, etc.).
EricThank you for the response. Let me provide some additional information.
The external application will be a Hosted Web page. It is not an SAP system.
The external application will be a web page served by a separate system outside of the company domain(shouldn't matter what the technology is I would think - but the web page will be hosted by a different company than the one calling the URL) that would appear as a web page in which the user will enter data, logic will be performed on that data and then some or all of the data would need to be passed back to the calling point in SAP.
For practical discussions it doesn't matter to me if the call in ABAP occurs in an SD userexit, in a custom report, in an HR screen or in a CRM business partner screen. There will be many places where this external application may be called from and I'm just trying to figure out how to call an external HTTPS URL and return data from that web page to the calling point in ABAP.
I hope that clarifies my question.
Thanks!
Eric -
How to encrypt Password while calling Portal URL from Abap
Hi all,
My requirement is to call portal from R/3 4.6C. As part of it I'm calling Portal URL along with user id & Password by using the FM CALL_BROWSER. The problem here is User ID & Password are visible everyone in the URL.
Is there any way that I can encrypt sothat it doesn't become a security issue?
I really appreaciate for your help.
Thanks
Seshucan you please mention the abap code by which you are sending the username and password to a portal via url.....
are you able to log on to the portal...please share your code ......
Edited by: Ashutosh Shukla on Apr 18, 2008 9:17 AM -
How to call url from abap in background
Hi,
I could open url but it opens browser window
i saw several threads on how to cal url in background but no good answer
kindly help
thanks
BHi,
Try the following (primitive) example, it calls an url and display the result on screen.
Hope this will help you.
<pre>
REPORT test.
CLASS lcx_http_client DEFINITION
Minimal Error Handling
CLASS lcx_http_client DEFINITION INHERITING FROM cx_static_check.
PUBLIC SECTION.
INTERFACES:
if_t100_message.
DATA:
mv_method TYPE string, "#EC NEEDED
mv_subrc TYPE i. "#EC NEEDED
METHODS:
constructor
IMPORTING iv_method TYPE string OPTIONAL
iv_subrc TYPE i OPTIONAL
iv_msgid TYPE symsgid DEFAULT '00'
iv_msgno TYPE i DEFAULT 162.
ENDCLASS. "lcx_http_client DEFINITION
CLASS lcx_http_client IMPLEMENTATION
CLASS lcx_http_client IMPLEMENTATION.
METHOD constructor.
super->constructor( ).
mv_method = iv_method.
mv_subrc = iv_subrc.
if_t100_message~t100key-msgid = iv_msgid.
if_t100_message~t100key-msgno = iv_msgno.
if_t100_message~t100key-attr1 = 'MV_METHOD'.
if_t100_message~t100key-attr2 = 'MV_SUBRC'.
ENDMETHOD. "constructor
ENDCLASS. "lcx_http_client IMPLEMENTATION
CLASS lcl_http_client DEFINITION
Facade for if_http_client
CLASS lcl_http_client DEFINITION.
PUBLIC SECTION.
CLASS-METHODS:
get_http_client_by_url
IMPORTING iv_url TYPE string
iv_proxy_host TYPE string OPTIONAL
iv_proxy_service TYPE string OPTIONAL
PREFERRED PARAMETER iv_url
RETURNING value(ro_http_client) TYPE REF TO lcl_http_client
RAISING lcx_http_client.
DATA:
mr_http_client TYPE REF TO if_http_client.
METHODS:
send
RAISING lcx_http_client,
receive
RAISING lcx_http_client,
close
RAISING lcx_http_client,
get_response_header_fields
RETURNING value(rt_fields) TYPE tihttpnvp,
get_response_cdata
RETURNING value(rv_data) TYPE string.
ENDCLASS. "lcl_http_client DEFINITION
CLASS lcl_http_client IMPLEMENTATION
CLASS lcl_http_client IMPLEMENTATION.
METHOD get_http_client_by_url.
DATA: lv_subrc TYPE sysubrc.
CREATE OBJECT ro_http_client.
cl_http_client=>create_by_url( EXPORTING url = iv_url
proxy_host = iv_proxy_host
proxy_service = iv_proxy_service
IMPORTING client = ro_http_client->mr_http_client
EXCEPTIONS argument_not_found = 1
plugin_not_active = 2
internal_error = 3
OTHERS = 999 ).
CHECK sy-subrc <> 0.
lv_subrc = sy-subrc.
RAISE EXCEPTION TYPE lcx_http_client EXPORTING iv_method = 'GET_HTTP_CLIENT_BY_URL' iv_subrc = lv_subrc.
ENDMETHOD. "get_http_client_by_url
METHOD send.
DATA: lv_subrc TYPE sysubrc.
mr_http_client->send( EXCEPTIONS http_communication_failure = 5
http_invalid_state = 6
http_processing_failed = 7
http_invalid_timeout = 8
OTHERS = 999 ).
CHECK sy-subrc <> 0.
lv_subrc = sy-subrc.
RAISE EXCEPTION TYPE lcx_http_client EXPORTING iv_method = 'SEND' iv_subrc = lv_subrc.
ENDMETHOD. "send
METHOD close.
DATA: lv_subrc TYPE sysubrc.
CALL METHOD mr_http_client->close
EXCEPTIONS
http_invalid_state = 10
OTHERS = 999.
CHECK sy-subrc <> 0.
lv_subrc = sy-subrc.
RAISE EXCEPTION TYPE lcx_http_client EXPORTING iv_method = 'CLOSE' iv_subrc = lv_subrc.
ENDMETHOD. "close
METHOD receive.
DATA: lv_subrc TYPE sysubrc.
mr_http_client->receive( EXCEPTIONS http_communication_failure = 9
http_invalid_state = 10
http_processing_failed = 11
OTHERS = 999 ).
CHECK sy-subrc <> 0.
lv_subrc = sy-subrc.
RAISE EXCEPTION TYPE lcx_http_client EXPORTING iv_method = 'RECEIVE' iv_subrc = lv_subrc.
ENDMETHOD. "receive
METHOD get_response_header_fields.
mr_http_client->response->get_header_fields( CHANGING fields = rt_fields ).
ENDMETHOD. "get_response_header_fields
METHOD get_response_cdata.
rv_data = mr_http_client->response->get_cdata( ).
ENDMETHOD. "get_response_cdata
ENDCLASS. "lcl_http_client IMPLEMENTATION
PARAMETERS: p_url TYPE string DEFAULT 'http://www.google.com' LOWER CASE,
p_phost TYPE string DEFAULT 'your_proxy_here' LOWER CASE,
p_pserv TYPE string DEFAULT '8080' LOWER CASE.
*===================================================================================
START-OF-SELECTION.
TRY .
DATA: gt_data TYPE string_table,
gv_data TYPE string,
gr_http_client TYPE REF TO lcl_http_client,
go_cx TYPE REF TO lcx_http_client.
"Initialize the http client
gr_http_client =
lcl_http_client=>get_http_client_by_url( iv_url = p_url
iv_proxy_host = p_phost
iv_proxy_service = p_pserv ).
"Call the specified URL and retrieve data from the response
gr_http_client->send( ).
gr_http_client->receive( ).
gv_data = gr_http_client->get_response_cdata( ).
"Its over....
gr_http_client->close( ).
"Display result
REPLACE ALL OCCURRENCES OF cl_abap_char_utilities=>cr_lf IN gv_data WITH cl_abap_char_utilities=>newline.
SPLIT gv_data AT cl_abap_char_utilities=>newline INTO TABLE gt_data.
LOOP AT gt_data INTO gv_data.
WRITE: / gv_data.
ENDLOOP.
CATCH lcx_http_client INTO go_cx.
MESSAGE go_cx TYPE 'S' DISPLAY LIKE 'E'.
ENDTRY.
</pre> -
Hi,
When an user clicks on a document display link in a SAP tranasction(for example FB02),an URL has to be called in the background(by ABAP) and the details of the URL should be displayed in a browser.
What are the possilbe options available in SAP4.7 to meet the above requirement?
Thanks in advance,
Leohi,
you can use call browser function
data url(200) type c.
url = 'your_url'.
CALL FUNCTION 'CALL_BROWSER'
EXPORTING
URL = url
WINDOW_NAME = ' '
NEW_WINDOW = ' '
BROWSER_TYPE =
CONTEXTSTRING =
EXCEPTIONS
FRONTEND_NOT_SUPPORTED = 1
FRONTEND_ERROR = 2
PROG_NOT_FOUND = 3
NO_BATCH = 4
UNSPECIFIED_ERROR = 5
OTHERS = 6
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
for this you have to enable SSO on your server.
hope this helps you, else revert back.
regards,
Hemendra -
Hi,
I am using the method mentioned by Durairaj (@ /people/durairaj.athavanraja/blog/2005/04/03/execute-bw-query-using-abap-part-i )
to execute queries from ABAP.
When I try to execute a query with characteristics in rows and if the characteristics name is large then i get a dump:
'Field symbol has not yet been assigned'
@ <l_field> = wa_set-chavl .
I tried the same for another cahracteristic of lesser length and it works fine.
Initially the chara name was like:
<8 letter dim name>__<7 letter chara name >
when i used a dim name with lesser no of letters:
<7 letter dim name>__<6 letter chara name >
It works fine.
is there any restricition on the lenght of characteristics ?
Thanks,
Message was edited by:
Rithesh VijayakrishnanMatthias,
I have tried to use this method before, but with the follow URL:
/SAP/BC/WebDynpro/SAP/YWEBTEMPLATE_TEST/bi_template_page.htm?&varn1=0pcalmon&varv1=200901&varn2=0p_cocd&varv2=b047&url=/irj/servlet/prt/portal/prtroot/pcd!3aportal_content!2fcom.sap.pct!2fplatform_add_ons!2fcom.sap.ip.bi!2fiViews!2fcom.sap.ip.bi.bex
didn't work as I image.
Do I have to transform this url before execute the method?
Tnks for your patience. -
Accessing/Executing URL without bringing up a browser
Hello Friends
I need some help with ABAP. I have written a tool in ABAP that can shut down and restart communication channels in PI. It is working as expected.
The way it works is by calling a URL (a feature supported by PI to control Communication Channels externally) by sending parameters like Communication Channel name etc.,
Since I do this in a loop stopping/starting multiple channels, it opens multiple browser tabs which is kind of annoying.
I would like to know if there is a way to access URL and execute it but not open a browser?
If you can please let me know, I would appreciate it.
Thanks
RamHi Ram,
You can use function module HTTP_GET to access URLs from ABAP and pass parameters to execute the URL without opening the browser. Go to SE37 and use the "where used list" to get sample codes on how to use this function module.
You would need the RFC destinations SAPHTTP or SAPHTTPS defined in the system, as a pre-requisite.
Hope this helps.
Sajan Joseph. -
Call http url in Abap - Should not open Browser
Hi Friends,
I have a requirement where i need to check whether a perticular http service is running or not. For that i need a some code to call http url from abap and it should not open the browser. If that perticular url is not found or time out then i should know that in program...
Is there any way to do that..just run the following url (after changing the values for host,etc) from browser
http://<abaphost>.<domain>.com:<port>/sap/public/ping
to get the values for http://<abaphost>.<domain>.com:<port> just go to transaction se80 and choose bsp application option and choose any existing bsp application and then doubl click on a page. on the right side click on the attributes tab and at the end you can find the url
Regards
Raja -
Hi, i´m trying to get an url from abap, i see some function like:
PRGN_GENER_EXECUTE_URL
But i don´t want this behaviour, i need something like a http request without the browser interaction.
Thanks !!!Hi, thanks for reply, is a normal job and i have to check the status from two servers...
I see this function HTTP2_GET, i solved with this function.
Thanks again -
Hi friends,
i am looking for a way to open a webbrowser pointing to a specific url from abap coding. how to do that ?
clemensHi,
refer the below code.
CALL FUNCTION 'GUI_RUN'
EXPORTING
command ='IEXPLORE.EXE'
PARAMETER ='WWW.YAHOOMAIL.COM'.
> * CD =
> * IMPORTING
> * RETURNCODE =
reward if needful.
Thanks,
Sreeram. -
Hi,
I create Business Contacts with BAPI_BCONTACT_CREATEFROMDATA from an external application.
Is it possible to add a URL to this contact, that can be opened from the SAP GUI?
Our customer uses the native windows sap gui. The browser should open and load the
URL if you click on the it.
Any hints how this could be done?
ThomasHi,
Here is a demo.
CALL METHOD cl_gui_frontend_services=>execute
EXPORTING
document = 'http://www.sap.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
others = 10
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
hope this helps u.,
Thanks & Regards,
Sukai -
Calling GUI Scripting from ABAP program
Is it possible to call GUI Scripting from ABAP and thus to use GUI Scripting as an alternative to CALL TRANSACTION?
Is the class CL_JAVA_SCRIPT suitable to access GUI Scripting engine? Accessing ABAP data object would work as well in this case as i think. What SAP Logon and WAS releases are required? Is the 6.20 release sufficient for this case?
I would appreciate if somebody could post an example.Hi,
CL_JAVA_SCRIPT has nothing to do with SAPGUI Scripting.
Calling SAPGUI Scripting API from ABAP could be possible for programmes experienced with OLE automation calls from ABAP coding.
The hardest thing will be, to access the scripting engine handle as an entry point. Once you have a handle in your abap session, any api function can be invoked.
Best regards
Jens
BTW: SAP testtool eCATT does call SAPGUI-Scripting from ABAP.
Maybe you are looking for
-
Can't get File.copy(target) to work.
Hi, I'm writing a script where I want to copy a file to another location after the render has finished, but I can't get the File.copy() method to work. Here's a snippet of the code: app.project.renderQueue.render(); var renderedFile = app.project.ren
-
Change font colour in Text Field
If I have typed 'The Cat Sat On The Mat' into a text field yet I want 'The Cat' to appear in bold and the rest as normal, how can I do this or even in a different colour? Any help would be appreciated
-
How to start a new line in a text field?
I tried the following formula to break for a new line but it is not working. stringvar notes; stringvar newline; newline := chr(100); replace (notes := {HNO_NOTE_TEXT.NOTE_TEXT}, "\r\n", newline); Any suggestions?
-
WAD 3.x Logon page - javascript problem
Hi, At the beginning, I'd like to mention that I'm not JavaScript programmer. So please be charitable and give clear answers if possible. Based on this code in Internet: <a href="http://javascript.about.com/library/bldydrop1.htm">http://javascript.a
-
How to solve the SIGABRT error in Xcode 3 ?
I've built an iOS app and SIGABRT makes it crash . The app uses accelerator . I use the latest version of Xcode 3 (3.2.6) . How to sovle the problem ?