Skip to content

Instantly share code, notes, and snippets.

@larshp
Last active March 17, 2018 11:49
Show Gist options
  • Save larshp/30ed5bbed145c48128c9d82f9efd147f to your computer and use it in GitHub Desktop.
Save larshp/30ed5bbed145c48128c9d82f9efd147f to your computer and use it in GitHub Desktop.
REPORT zreentrance_ticket.
START-OF-SELECTION.
PERFORM run.
FORM run.
DATA: lv_ticket TYPE string.
CALL FUNCTION 'CREATE_RFC_REENTRANCE_TICKET'
IMPORTING
ticket = lv_ticket
EXCEPTIONS
OTHERS = 1.
IF sy-subrc <> 0.
WRITE: / 'Error,', sy-subrc.
RETURN.
ENDIF.
cl_http_client=>create_by_url(
EXPORTING
url = 'http://localhost:8000/sap/bc/echo?sap-client=001'
IMPORTING
client = DATA(li_client) ).
li_client->request->set_header_field(
name = 'MYSAPSSO2'
value = lv_ticket ).
li_client->send(
EXCEPTIONS
http_communication_failure = 1
http_invalid_state = 2
http_processing_failed = 3
http_invalid_timeout = 4
OTHERS = 5 ).
WRITE: / sy-subrc.
li_client->receive(
EXCEPTIONS
http_communication_failure = 1
http_invalid_state = 2
http_processing_failed = 3
OTHERS = 4 ).
WRITE: / sy-subrc.
DATA(lv_raw) = li_client->response->get_cdata( ).
li_client->response->get_status( IMPORTING code = DATA(lv_code) ).
WRITE: / 'HTTP code:', lv_code.
WRITE: / lv_raw.
ENDFORM.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment