生活随笔
收集整理的這篇文章主要介紹了
使用ABAP SAT工具分析SAP OData service实现明细
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
Created by Wang, Jerry, last modified on Mar 26, 2015
使用SAT運行OData service測試report:
直接運行report:
確保OData service返回正確結(jié)果:
REPORT ZGATEWAY_TOOL.
PARAMETERS: url
TYPE string
OBLIGATORY DEFAULT `/sap/opu/odata/SAP/CRM_OPPORTUNITY/Opportunities(guid'0090FA11-45EC-1ED2-B7C9-DDF68EF91193')?$expand=Products`.DATA:lo_http_client
TYPE REF TO if_http_client
,lv_status
TYPE i
,lt_header
TYPE TIHTTPNVP,ls_header
LIKE LINE OF lt_header
,lv_sysubrc
TYPE sysubrc
.CALL METHOD cl_http_client
=>create_by_destination
EXPORTINGdestination
= 'NONE'IMPORTINGclient
= lo_http_client
EXCEPTIONSargument_not_found
= 1plugin_not_active
= 2internal_error
= 3OTHERS = 4.ASSERT sy
-subrc
= 0.CALL METHOD lo_http_client
->request
->set_method( if_http_request
=>co_request_method_get
).
*Disable pop
-up when request receives unauthorized error
: error
401.lo_http_client
->propertytype_logon_popup = if_http_client
=>co_disabled
.
*Send request
.
ls_header
-name
= '~request_method'.
ls_header
-value
= 'GET'.
APPEND ls_header
TO lt_header
.
ls_header
-name
= '~request_uri'.
ls_header
-value
= url
.
APPEND ls_header
TO lt_header
.
lo_http_client
->request
->set_header_fields( lt_header
).CALL METHOD lo_http_client
->send
EXCEPTIONShttp_communication_failure
= 1http_invalid_state
= 2http_processing_failed
= 3.ASSERT sy
-subrc
= 0.
* Get response
.CALL METHOD lo_http_client
->receive
EXCEPTIONShttp_communication_failure
= 1http_invalid_state
= 2http_processing_failed
= 3.IF sy
-subrc
<> 0.CALL METHOD lo_http_client
->get_last_error
IMPORTINGcode
= lv_sysubrcmessage
= DATA(ev_message
).BREAK-POINT.RETURN.ENDIF.DATA(lv_text
) = lo_http_client
->response
->get_cdata( ).lo_http_client
->close( ).BREAK-POINT.
總結(jié)
以上是生活随笔為你收集整理的使用ABAP SAT工具分析SAP OData service实现明细的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。