วันศุกร์ที่ 3 กันยายน พ.ศ. 2553

Function ABAP : ZCM_GET_BOT_EXCHANGERATE

function zcm_get_bot_exchangerate.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"  IMPORTING
*"     VALUE(URI) TYPE  C
*"     VALUE(DEST) TYPE  RFCDES-RFCDEST DEFAULT 'SAPHTTP'
*"     VALUE(BTOCRLF) TYPE  C DEFAULT 'Y'
*"  TABLES
*"      RESPONSE
*"      RESPONSE_HEADERS
*"----------------------------------------------------------------------

  typesbegin of text,
         line(120type c,
         end of text.

  data: xuri type string,
        status(3type c,
        statustext(128type c,
        rlength type i,
        key type i value 1303621,
        slen type i,
        t1 type i,
        t2 type i,
        ti type i,
        user(30type c,
        pwd(30type c.

  xuri = uri.


  slen = strlen( user ).

  call function 'HTTP_SCRAMBLE'
    exporting
      source      = user
      sourcelen   = slen
      key         = key
    importing
      destination = user.

  slen = strlen( pwd ).

  call function 'HTTP_SCRAMBLE'
    exporting
      source      = pwd
      sourcelen   = slen
      key         = key
    importing
      destination = pwd.

  get run time field t1.
  data : lv_uri(500type c.
  lv_uri = uri.

  call function 'HTTP_GET'
    exporting
      absolute_uri                = lv_uri
      rfc_destination             = dest
      user                        = user
      password                    = pwd
      blankstocrlf                = btocrlf
    importing
      status_code                 = status
      status_text                 = statustext
      response_entity_body_length = rlength
    tables
      response_entity_body        = response
      response_headers            = response_headers.


  call function 'RFC_CONNECTION_CLOSE'
    exporting
      destination = dest
    exceptions
      others      = 0.

endfunction.

ไม่มีความคิดเห็น:

แสดงความคิดเห็น