在系统中调用本系统Odata Service服务会提示要求登录,通过一下方法可以跳过登录验证

 DATA: lt_request_header     TYPE /iwfnd/sutil_property_t,
        lv_csrf_uri           TYPE string,
        mv_status_code              TYPE i,
        mv_response_body            TYPE xstring,
        mv_request_body             TYPE xstring.

  ls_vd-ztyxydm = '913700007456935935'.
  ls_vd-name1 = 'XXXX'.
  ls_vd-ktokk = 'Z**1'.
  ls_vd-country = 'CN'.
  ls_vd-region = '1**'.
  ls_vd-city1 = '济南市'.
  ls_vd-street = '济南市市中YYYYY'.
  ls_vd-post_code1 = '2***1'.

  DATA(lv_request_data) = /ui2/cl_json=>serialize( data        = ls_vd pretty_name = /ui2/cl_json=>pretty_mode-camel_case ).

  APPEND INITIAL LINE TO lt_request_header ASSIGNING FIELD-SYMBOL(<fs_header>).
  <fs_header>-name = 'Content-Type'.  <fs_header>-value = 'application/json'.

*请求方式
  APPEND INITIAL LINE TO lt_request_header ASSIGNING <fs_header>.
  <fs_header>-name = '~request_method'.  <fs_header>-value = 'POST'.

*Odata Service服务地址
  APPEND INITIAL LINE TO lt_request_header ASSIGNING <fs_header>.
  <fs_header>-name = '~request_uri'.  <fs_header>-value = '/sap/opu/odata/sap/ZMDG_LIFNR_SRV/CreateSet'.

  APPEND INITIAL LINE TO lt_request_header ASSIGNING <fs_header>.
  <fs_header>-name = 'Accept'.  <fs_header>-value = 'application/json'.

  CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
    EXPORTING
      TEXT           = lv_request_data
*     MIMETYPE       = ' '
*     ENCODING       =
   IMPORTING
     BUFFER         = mv_request_body
*   EXCEPTIONS
*     FAILED         = 1
*     OTHERS         = 2
            .

  CALL FUNCTION 'CRM_FDT_XSTRING2STRING'
    EXPORTING
      INXSTRING       = mv_response_body
   IMPORTING
     OUTSTRING       = lv_request_data
            .
  WRITE: lv_request_data.