Skip to content

Ahmet Faruk Bişkinler


SAP ABAP Get UME User Details information from WS (Web service) and parsing xml information PDF Print E-mail
(0 votes, average 0 out of 5)
SAP - ABAP
Written by Administrator   
Friday, 09 January 2009 13:09
SAP ABAP Get UME User Details getting information from WS (Web service) and parsing xml information with call tranformation.
Z_XML_GET_MASS
  1.  
  2. *&---------------------------------------------------------------------*
  3. *& Report Z_XML_GET_MASS
  4. *&
  5. *&---------------------------------------------------------------------*
  6. *&
  7. *&
  8. *&---------------------------------------------------------------------*
  9.  
  10. REPORT z_xml_get_mass.
  11.  
  12.  
  13. TYPES : BEGIN OF typ_userdetail ,
  14. test1 TYPE string,
  15. test2 TYPE string,
  16. orgunit TYPE string,
  17. displayname TYPE string,
  18. accessibilitylevel TYPE string,
  19. cellphone TYPE string,
  20. city TYPE string,
  21. company TYPE string,
  22. country TYPE string,
  23. currency TYPE string,
  24. department TYPE string,
  25. email TYPE string,
  26. fax TYPE string,
  27. firstname TYPE string,
  28. jobtitle TYPE string,
  29. lastname TYPE string,
  30. locale TYPE string,
  31. parentgroups TYPE string,
  32. roles TYPE string,
  33. salutation TYPE string,
  34. state TYPE string,
  35. street TYPE string,
  36. telephone TYPE string,
  37. timezone TYPE string,
  38. title TYPE string,
  39. transientattribute TYPE string,
  40. uid TYPE string,
  41. uniquename TYPE string,
  42. useraccountuniqueids TYPE string,
  43. useraccounts TYPE string,
  44. userfactory TYPE string,
  45. zip TYPE string,
  46. END OF typ_userdetail.
  47.  
  48. TYPES typ_t_userdetail TYPE STANDARD TABLE OF typ_userdetail.
  49.  
  50. DATA: BEGIN OF ws_xml_data OCCURS 0,
  51. userid TYPE string,
  52. namespace TYPE string,
  53. attribute TYPE typ_t_userdetail,
  54. END OF ws_xml_data.
  55.  
  56. data: wa_xml like ws_xml_data.
  57. data: wa_x TYPE typ_userdetail.
  58.  
  59. *-- variables for text processing
  60. DATA xmlstr TYPE string.
  61. " End of XMl
  62.  
  63. " Start of WS getData
  64. *-- variables for proxy class
  65. DATA : input TYPE zws_get_attribute_mass_in_doc,
  66. output TYPE zws_get_attribute_mass_out_doc,
  67. io_clientproxy TYPE REF TO zws_co_ipr_ws_ume_ejbvi_docume,
  68. xslt_err TYPE REF TO cx_xslt_exception,
  69. lo_sys_exception TYPE REF TO cx_ai_system_fault,
  70. lo_app_exception TYPE REF TO cx_ai_application_fault.
  71.  
  72. *-- input screen
  73. PARAMETERS : p_input(50) DEFAULT 'abiskinler'.
  74. PARAMETERS : p_name(50) DEFAULT 'com.sap.security.core.usermanagement' LOWER CASE.
  75. PARAMETERS : p_attrib(50) DEFAULT 'orgunit' LOWER CASE.
  76.  
  77. APPEND p_input TO input-user_id-string.
  78. input-name_space = p_name.
  79. APPEND p_attrib TO input-attribute_name-string.
  80. APPEND 'displayname' TO input-attribute_name-string.
  81.  
  82. *-- create web service proxy class instance
  83. CREATE OBJECT io_clientproxy
  84. EXPORTING
  85. logical_port_name = 'DEFAULT'.
  86.  
  87. CATCH cx_ai_system_fault.
  88.  
  89.  
  90.  
  91. *-- call web service methods
  92. CALL METHOD io_clientproxy->get_attribute_mass
  93. EXPORTING
  94. IMPORTING
  95. output = output.
  96.  
  97. CATCH cx_ai_system_fault INTO lo_sys_exception.
  98. MESSAGE lo_sys_exception TYPE 'I'.
  99. CATCH cx_ai_application_fault INTO lo_app_exception.
  100. MESSAGE lo_app_exception TYPE 'I'.
  101.  
  102.  
  103. xmlstr = output-response.
  104.  
  105. *CALL TRANSFORMATION id
  106. * SOURCE ATTRIBUTE = outtab1[]
  107. * RESULT XML xmlstr.
  108.  
  109. *REFRESH outtab1.
  110. CALL TRANSFORMATION id
  111. SOURCE XML xmlstr
  112. RESULT users = ws_xml_data[].
  113.  
  114. *WRITE xmlstr.
  115.  
  116. LOOP AT ws_xml_data INTO wa_xml.
  117. LOOP AT wa_xml-attribute INTO wa_x.
  118. WRITE:/ 'uniquename: ',wa_x-uniquename.
  119. WRITE:/ 'displayname: ',wa_x-displayname.
  120. WRITE:/ p_attrib(10),': ',wa_x-orgunit.
  121.  
  122.  
  123.  
http://www.biskinler.com/
 

Add comment


Security code
Refresh