Code: Alles auswählen.
data:
l_string type string,
it_ECN_DATA type TIHTTPNVP.
l_string = server->request->GET_CDATA( ).
server->request->GET_FORM_FIELDS(
* exporting
* FORMFIELD_ENCODING = 0 " CO_FORMFIELD_ENCODING_RAW / _ENCODED
* SEARCH_OPTION = 3 " CO_BODY_BEFORE_QUERY_STRING or others
changing
FIELDS = it_ECN_DATA " Form-Felder
).
DATA: lv_change_no TYPE AENNR.
DATA: lt_change_header TYPE AENR_API02.
FIELD-SYMBOLS <wa_ECN_DATA> LIKE LINE OF it_ECN_DATA.
*FIELD-SYMBOLS <wa_change_header> LIKE LINE OF lt_change_header.
* ECN Nummer wird gelesen
LOOP AT it_ECN_DATA ASSIGNING <wa_ECN_DATA>.
lv_change_no = <wa_ECN_DATA>-VALUE.
ENDLOOP.
CALL FUNCTION 'CCAP_ECN_HEADER_READ'
EXPORTING
CHANGE_NO = lv_change_no
IMPORTING
CHANGE_HEADER = lt_change_header
EXCEPTIONS
NO_RECORD_FOUND = 1
* ERROR = 2
* OTHERS = 3
.
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.
Code: Alles auswählen.
server->response.
Code: Alles auswählen.
*String wird in XString umgewandelt.
CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
EXPORTING
TEXT = l_resp
* MIMETYPE = ' '
* ENCODING = 'utf-8'
IMPORTING
BUFFER = l_respx
EXCEPTIONS
FAILED = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.
* Binär XString senden.
server->response->set_status( code = 200 reason = 'OK').
server->response->set_data( l_respx ).
Code: Alles auswählen.
DATA conv TYPE REF TO cl_abap_conv_in_ce.
DATA buffer(4) TYPE x.
DATA text(100) TYPE c.
buffer = '41424332'. "bytes represent ABC2 in UTF-8
conv = cl_abap_conv_in_ce=>create(
encoding = 'UTF-8' ).
conv->convert(
EXPORTING input = buffer
IMPORTING data = text ).
ASSERT text = `ABC2`.