Skip to content

Instantly share code, notes, and snippets.

@larshp
Last active May 3, 2018 11:59
Show Gist options
  • Save larshp/72feb1c17a8ba1f2ffc751a0b373b1d1 to your computer and use it in GitHub Desktop.
Save larshp/72feb1c17a8ba1f2ffc751a0b373b1d1 to your computer and use it in GitHub Desktop.
DATA(lt_list) = cl_srt_wsp_account_factory=>if_srt_wsp_account_factory~list( ).
DATA(li_account) = cl_srt_wsp_account_factory=>if_srt_wsp_account_factory~get_user_account(
im_user_account_name = 'NAME'
im_user_account_type = 'LOCAL' ).
li_account->get_service_user_credentials(
IMPORTING
ex_username = DATA(lv_username)
ex_password = DATA(lv_password) ).
BREAK-POINT.
***********************
DATA: lv_xstr TYPE xstring.
DATA(lv_str) = |{ is_user_pass-username }:{ is_user_pass-password }|.
DATA(lo_obj) = cl_abap_conv_out_ce=>create( encoding = 'UTF-8' ).
lo_obj->convert( EXPORTING data = lv_str
IMPORTING buffer = lv_xstr ).
rv_value = cl_http_utility=>if_http_utility~encode_x_base64( lv_xstr ).
rv_value = |Basic { rv_value }|.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment