SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

Use of Roles



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> HR
View previous topic :: View next topic  
Author Message
vga
Мастер
Мастер


Age: 160
Joined: 04 Oct 2007
Posts: 1218
Location: Санкт-Петербург

PostPosted: Mon Dec 01, 2008 6:14 pm    Post subject: Use of Roles Reply with quote

Once you create role might want to try it.
- SAP does NOT provide the opportunity to test skills.
- However we can develop a small program to be able to prove it.
- The program should be based on the module to be able to function RH_GET_ACTORS evaluate the role.
- This module function receives the name of the container and its role as an entry and returns a table with the players selected.

Code:
REPORT ztestrule .
INCLUDE <cntn01>.

PARAMETERS: p_ekorg TYPE ekko-ekorg.
DATA: ev_holders TYPE STANDARD TABLE OF swhactor,
      actor_tab TYPE STANDARD TABLE OF swhactor,
      ac_agents TYPE STANDARD TABLE OF swhactor,
      wa_ac_agents TYPE swhactor,
      wa_ev_holders TYPE swhactor,
      num_lines TYPE i.

swc_container ac_container.
swc_clear_container ac_container.
swc_set_element ac_container 'PurchOrganization' p_ekorg.

CALL FUNCTION 'RH_GET_ACTORS'
     EXPORTING
          act_object      = 'AC90000001'
     TABLES
          actor_container = ac_container
          actor_tab       = ac_agents.

LOOP AT ac_agents INTO wa_ac_agents.
  IF wa_ac_agents-otype = 'US'.
    APPEND wa_ac_agents TO actor_tab.
  ELSE.
    CLEAR ev_holders[].
    swc_clear_container ac_container.
    swc_set_element ac_container 'OTYPE' wa_ac_agents-otype.
    swc_set_element ac_container 'OBJID' wa_ac_agents-objid.
    CALL FUNCTION 'RH_GET_STRUCTURE'
         EXPORTING
              act_wegid       = 'WF_ORGUS'
         TABLES
              actor_tab       = ev_holders
              ac_container    = ac_container
         EXCEPTIONS
              nobody_found    = 1
              no_active_plvar = 2
              OTHERS          = 3.
    IF sy-subrc = 0.
      LOOP AT ev_holders INTO wa_ev_holders.
        APPEND wa_ev_holders TO actor_tab.
      ENDLOOP.
    ENDIF.
  ENDIF.
ENDLOOP.

DELETE actor_tab WHERE otype NE 'US'.

DESCRIBE TABLE actor_tab LINES num_lines.

IF num_lines IS INITIAL.
  WRITE: 'No agents found.'.
ENDIF.

WRITE: / 'The following agents where found:'.
LOOP AT actor_tab INTO wa_ac_agents.
  WRITE: / wa_ac_agents-otype, wa_ac_agents-objid.
ENDLOOP.
Back to top
View user's profile Send private message Blog Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> HR All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG.
Every effort is made to ensure content integrity. Use information on this site at your own risk.