on 02-27-2009 11:13 AM
Hello all, I am trying to create a shopping cart through a HTTP request.
The URL I am managing is the same that the one that the Web Service BBPSC01 uses.
Using the following code I cannot connect to the server in background, the error "This browser is not supported" is launched.
In addition to this, I can open the URL successfully via R/3 when executing online.
Help very appreciated!
Thanks.
data declarations
DATA: client TYPE REF TO if_http_client.
DATA: host TYPE string VALUE 'host',
host2 TYPE string,
service TYPE string VALUE '8000',
path TYPE string VALUE '/sap/bc/gui/sap/its/bbpsc01/?sap-client=020&sap-language=EN',
errortext TYPE string. "used for error handling
DATA: dest(13) TYPE c.
dest = 'ZPORTAL_CESTA'.
CALL METHOD cl_http_client=>create_by_destination
EXPORTING
destination = dest
IMPORTING
client = client
EXCEPTIONS
destination_not_found = 1
internal_error = 2
argument_not_found = 3
destination_no_authority = 4
plugin_not_active = 5
OTHERS = 6.
IF sy-subrc NE 0.
WRITE: / 'Create failed, subrc = ', sy-subrc.
EXIT.
ENDIF.
set http method POST
CALL METHOD client->request->set_method(
if_http_request=>co_request_method_post ).
client->request->set_version(
if_http_request=>co_protocol_version_1_1 ).
client->request->set_header_field( name = '~request_method'
value = 'GET' ).
set request uri (/<path>[?<querystring>])
DATA uri TYPE string.
uri = path.
cl_http_utility=>set_request_uri( request = client->request
uri = uri ).
**********************************************************************
FIN: conectamos el final de la peticion
**********************************************************************
Send
DATA timeout TYPE i.
CALL METHOD client->send
EXPORTING
timeout = timeout
EXCEPTIONS
http_communication_failure = 1
http_invalid_state = 2
http_processing_failed = 3
OTHERS = 4.
IF sy-subrc NE 0.
DATA: subrc TYPE sy-subrc.
CALL METHOD client->get_last_error
IMPORTING
code = subrc
MESSAGE = errortext.
WRITE: / 'communication_error( send )',
/ 'code: ', subrc,
/ 'message: ', errortext.
EXIT.
ENDIF.
CALL METHOD client->receive
EXCEPTIONS
http_communication_failure = 1
http_invalid_state = 2
http_processing_failed = 3
OTHERS = 4.
IF sy-subrc NE 0.
CALL METHOD client->get_last_error
IMPORTING
code = subrc
MESSAGE = errortext.
WRITE: / 'communication_error( receive )',
/ 'code: ', subrc, 'message: '.
EXIT.
ENDIF.
DATA return_str TYPE string.
return_str = client->response->get_cdata( ).
close
CALL METHOD client->close
EXCEPTIONS
http_invalid_state = 1
OTHERS = 2.
DATA html_control TYPE REF TO cl_gui_html_viewer.
DATA container TYPE REF TO cl_gui_custom_container.
DATA html_table TYPE TABLE OF char255.
Create container for HTML viewer
CREATE OBJECT container
EXPORTING
container_name = 'CONTAINER'
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5.
IF sy-subrc NE 0.
MESSAGE e208(00)
WITH 'The control HTML_CONTAINER could not be created'.
ENDIF.
CREATE OBJECT html_control
EXPORTING
parent = container.
CALL FUNCTION 'CONVERT_STRING_TO_TABLE'
EXPORTING
i_string = return_str
i_tabline_length = 255
TABLES
et_table = html_table.
DATA: l_doc_url(255) TYPE c.
CALL METHOD html_control->load_data
EXPORTING
type = 'text'
subtype = 'html'
IMPORTING
assigned_url = l_doc_url
CHANGING
data_table = html_table.
CALL METHOD html_control->show_url
EXPORTING
url = l_doc_url.
Dear Poster
Your thread has had no response since it's creation over
2 weeks ago, therefore, I recommend that you either:
- Rephrase the question.
- Provide additional Information to prompt a response.
- Close the thread if the answer is already known.
Thank you for your compliance in this regard.
Jason Boggans
SAP SRM SDN Moderator
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.