SAP ABAP Get UME User Details getting information from WS (Web service) and parsing xml information with call tranformation.
Z_XML_GET_MASS
*&---------------------------------------------------------------------*
*& Report Z_XML_GET_MASS
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
TYPES : BEGIN OF typ_userdetail
, test1 TYPE string ,
test2 TYPE string ,
orgunit TYPE string ,
displayname TYPE string ,
accessibilitylevel TYPE string ,
cellphone TYPE string ,
city TYPE string ,
company TYPE string ,
country TYPE string ,
currency TYPE string ,
department TYPE string ,
email TYPE string ,
fax TYPE string ,
firstname TYPE string ,
jobtitle TYPE string ,
lastname TYPE string ,
locale TYPE string ,
parentgroups TYPE string ,
roles TYPE string ,
salutation TYPE string ,
state TYPE string ,
street TYPE string ,
telephone TYPE string ,
timezone TYPE string ,
title TYPE string ,
transientattribute TYPE string ,
uid TYPE string ,
uniquename TYPE string ,
useraccountuniqueids TYPE string ,
useraccounts TYPE string ,
userfactory TYPE string ,
zip TYPE string ,
END OF typ_userdetail.
TYPES typ_t_userdetail
TYPE STANDARD TABLE OF typ_userdetail
.
DATA : BEGIN OF ws_xml_data
OCCURS 0 , userid TYPE string ,
namespace TYPE string ,
attribute TYPE typ_t_userdetail,
END OF ws_xml_data.
data : wa_xml
like ws_xml_data
. data : wa_x
TYPE typ_userdetail
.
*-- variables for text processing
" End of XMl
" Start of WS getData
*-- variables for proxy class
DATA : input TYPE zws_get_attribute_mass_in_doc
, output TYPE zws_get_attribute_mass_out_doc,
io_clientproxy TYPE REF TO zws_co_ipr_ws_ume_ejbvi_docume,
xslt_err TYPE REF TO cx_xslt_exception,
lo_sys_exception TYPE REF TO cx_ai_system_fault,
lo_app_exception TYPE REF TO cx_ai_application_fault.
*-- input screen
PARAMETERS : p_name
( 50 ) DEFAULT 'com.sap.security.core.usermanagement' LOWER CASE . PARAMETERS : p_attrib
( 50 ) DEFAULT 'orgunit' LOWER CASE .
APPEND p_input
TO input
- user_id
- string . input- name_space = p_name.
APPEND p_attrib
TO input
- attribute_name
- string . APPEND 'displayname' TO input
- attribute_name
- string .
*-- create web service proxy class instance
CREATE OBJECT io_clientproxy
EXPORTING
logical_port_name = 'DEFAULT' .
CATCH cx_ai_system_fault
.
*-- call web service methods
CALL METHOD io_clientproxy-> get_attribute_mass
EXPORTING
IMPORTING
output = output .
CATCH cx_ai_system_fault
INTO lo_sys_exception
. CATCH cx_ai_application_fault
INTO lo_app_exception
.
xmlstr = output- response.
*CALL TRANSFORMATION id
* SOURCE ATTRIBUTE = outtab1[]
* RESULT XML xmlstr.
*REFRESH outtab1.
CALL TRANSFORMATION id
SOURCE XML xmlstr
RESULT users = ws_xml_data[ ] .
*WRITE xmlstr.
LOOP AT ws_xml_data INTO wa_xml.
LOOP AT wa_xml- attribute INTO wa_x.
WRITE :/ 'uniquename: ' , wa_x
- uniquename
. WRITE :/ 'displayname: ' , wa_x
- displayname
. WRITE :/ p_attrib
( 10 ) , ': ' , wa_x
- orgunit
.
http://www.biskinler.com/