Organization structure in SAP HR


Organization structure in SAP HR

Structural profiles use the data model in an organization for Personnel Management components Organizational Management, Personnel Development and Training and Event Management to build hierarchies using objects and relationships. Different types of objects (Object Types) and different types of relationships are used in this process.



  • Objects (such as O (Organizational Unit), S (Position), P (Person)) ,R Resource type,T Task etc .
  • Relationships (such as A003 (belongs to) bottom up or B003 (belongs to) top down )

  • Evaluation Paths (such as O-S-P Staffing Assignments along Organizational Structure)
Example:Go to se11 àHRP1001 give object type = S (position ),Object id (found in PPOSE)
The above we can see in PPOSE tcode (Organization and staffing display) and PPOSA (attribute in organization management display)

PPOSE

Example:
Here we will get the employee belongs to which org unit or dept (based on the org unit structure)
·         Get the employee Id based on the sap user ID
    SELECT SINGLE pernr FROM pa0105
      
INTO l_pernr WHERE subty EQ '0001'  "Get Personal no. of emp
         
AND  endda GE sy-datum
         
AND  begda LE sy-datum
         
AND  usrid EQ sy-uname.

·         Pass l_pernr from the above into the FM
      CALL FUNCTION 'HR_READ_INFOTYPE'
       
EXPORTING
        pernr                 
= l_pernr
        infty                 
'0001'
        begda                 
sy-datum
        endda                 
sy-datum
      
TABLES
        infty_tab             
it_p0001[]
     
EXCEPTIONS
       infty_not_found       
1
       
OTHERS                2
Now read it_p0001 table to the get the org unit orgeh
(Org unit can be anything department, group it depend the organization structure How a organization structure is managed)

·         Now if we like to the above departments use FM RH_STRUC_GET
CALL FUNCTION 'RH_STRUC_GET'
        
EXPORTING
          act_otype      
'O' “Org Unit
          act_objid      
= orgeh “Org unit object id
          act_wegid      
'O-O' “Evaluation path (Org to Org)
          act_plvar      
'01' “Plan version 01 = current version
          act_begda      
sy-datum
          act_endda      
sy-datum
        
TABLES
          result_tab     
it_org[]     
        
EXCEPTIONS
          no_plvar_found 
1
          no_entry_found 
2
          
OTHERS         3.

free plagiarism checker

free plagiarism checker


Sample ALV report with Hotspot

TYPE-POOLS : slis.
TABLES : mara.
TYPES :ty_mara TYPE STANDARD TABLE OF mara.
DATA : int_tbl TYPE STANDARD TABLE OF mara,
      wa_tbl TYPE mara ,
      it_final type TABLE OF mara,
      fld_cat TYPE slis_t_fieldcat_alv,
      wa_fld TYPE slis_fieldcat_alv,
      wa_fld_cat TYPE slis_fieldcat_alv.
DATA : et_event TYPE slis_t_event,
      we_event TYPE slis_alv_event.

START-OF-SELECTION.
  perform event_call.
  SELECT * FROM mara INTO TABLE int_tbl.
  perform field_catalog_merge.
  PERFORM call_alv_grid using 'SUB1'
        'USER_COMMAND'
        fld_cat
         et_event
         CHANGING
           int_tbl.
FORM sub1 USING extab TYPE slis_t_extab.
  SET PF-STATUS 'PF_STATUS'." EXCLUDING extab.
ENDFORM .
FORM user_command USING l_ucomm LIKE sy-ucomm l_sel TYPE slis_selfield.
    CASE l_ucomm.
    WHEN '&IC1'.
      IF l_sel-FIELDNAME = 'MATNR'.
        READ TABLE int_tbl INTO wa_tbl INDEX  l_sel-TABINDEX.
        append wa_tbl to it_final.
      ENDIF.
    perform field_catalog_merge.
    perform DISPLAY_OUTPUT2.
  ENDCASE.
ENDFORM.
form EVENT_CALL .
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
   EXPORTING
     I_LIST_TYPE           = 0
   IMPORTING
     ET_EVENTS             = et_event
            .
  IF SY-SUBRC <> 0.
 MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
endform.

FORM POPULATE_EVENT.
  READ TABLE et_event INTO We_EVENT WITH KEY NAME = 'TOP_OF_PAGE'.
  IF SY-SUBRC EQ 0.
    We_EVENT-FORM = 'TOP_OF_PAGE'.
    MODIFY et_event FROM We_EVENT TRANSPORTING FORM WHERE NAME =
We_EVENT-FORM.
  ENDIF.

  READ TABLE  et_event INTO We_EVENT WITH KEY NAME = 'USER_COMMAND'.
  IF SY-SUBRC EQ 0.
    We_EVENT-FORM = 'USER_COMMAND'.
    MODIFY et_event FROM We_EVENT TRANSPORTING FORM WHERE NAME =
We_EVENT-NAME.
  ENDIF.
ENDFORM.

form FIELD_CATALOG_MERGE .
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
   EXPORTING
      i_program_name               = sy-repid
     i_internal_tabname           = 'int_tbl'
     i_structure_name             = 'MARA'
    CHANGING
      ct_fieldcat                  = fld_cat
            .
  IF sy-subrc &lt;&gt; 0.
 MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ELSE .
    READ TABLE fld_cat INTO wa_fld WITH KEY fieldname = 'MATNR' .
    wa_fld-hotspot = 'X' .
    MODIFY fld_cat INDEX sy-tabix FROM wa_fld TRANSPORTING hotspot .
  ENDIF.
endform.
form DISPLAY_OUTPUT2 .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
 EXPORTING
   I_CALLBACK_PROGRAM                = sy-repid
   IT_FIELDCAT                       = fld_cat
  TABLES
    t_outtab                          = it_final
 EXCEPTIONS
   PROGRAM_ERROR                     = 1
   OTHERS                            = 2
          .
IF sy-subrc &lt;&gt; 0.
 MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

endform.

*&---------------------------------------------------------------------*
*&      Form  CALL_ALV_GRID
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_0059   text
*      -->P_0060   text
*      -->P_FLD_CAT  text
*      -->P_ET_EVENT  text
*      <--P_INT_TBL  text
*----------------------------------------------------------------------*
form CALL_ALV_GRID  using    value(p_0059)
                             value(p_0060)
                             p_fld_cat
                             p_et_event
                    changing p_int_tbl TYPE ty_mara.
 CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
   EXPORTING
     i_callback_program                = sy-repid
     i_callback_pf_status_set          = p_0059 "'SUB1'
     i_callback_user_command           = p_0060 "'USER_COMMAND'
     it_fieldcat                       = p_fld_cat
     it_events                         = p_et_event
    TABLES
      t_outtab                          = p_int_tbl
   EXCEPTIONS
     program_error                     = 1
     OTHERS                            = 2
            .
  IF sy-subrc &lt;&gt; 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.

endform.                    " CALL_ALV_GRID


OuOutput









  • click on the material 5






Send email with attachment with using ABAP program


This example shows how to send

   -  a simple text provided in an internal table of text lines 
  -   and an attached MS word document provided in internal table

   - to some internet email address.
All activities done via facade CL_BCS!

Workflow Transaction codes


·  Customization Settings:
  • SWU3 - Automatic Customizing Workflow.
  • SCOT - SAP to mail server Configuration
  • SU01 - User Maintenance
·  Workflow Design:
  • SE37 - Function Builder
  • SE38 - ABAP Editor
  • SWO1 - Business Object Builder
  • PFTC - Task Maintain
  • SWDD - Workflow Builder
· Runtime Behavior/Analysis:
  • SBWP - Business Workplace
  • SWUD - Workflow Diagnosis
  • SWU_OBUF - Synchronize Runtime Buffer
  • SWPR - Workflow Restart After Error           


Factory calendar in SAP

General introduction about the factory calender and how to get the dates validated based on calender key 


If a public holiday calendar or a factory calendar is set, the non-working days in the relevant region or in the company are highlighted in color in the calendar display and are not included in the search for appointments. By default, a calendar that does not contain public holidays is assigned to the appointment calendar.



Tcode--> SCAL


 click display


Based on the calendar key T001W-FABKL get the valid from and valid to date for a plant.
Example: - Suppose get the factory calendar for a plant in organization
First get the cost centre for the org unit à get the business area and company code àget the plant àget the key from table T001W (  Plants/Branch)

Enhance and Populate fields using BADI

Here we will learn how to enhance fields in the Datasource  and find out which BADI needs to be enhanced .

  • Get the BW data source and hierarchy tcode -->RSA6 (In this tcode we get the data sources based on the business area )
Double click the above data source and go to the extract structureàdouble click  
How append structure 
  • Enhance the extract structure 


  •  Append Enhance the extract structure


  •  Add the required fields to the the append structure 


  •  Activate the structure (better to choose enhancement category as “cannot be enhanced” )

 Now Find out where we need to code to populate the new fields
How to find the user exits/BADI ‘s  for data source  

  •  Put a break point at class CL_EXITHANDLER-->Method  Get_INSTANCE -->EXIT_NAME (where you will get the BADI name ) and  Go to the tcode RSA3 and execute.


  • Now you got the BADI name to SE18 and implement the same 



Cost center assignment for Org Unit


PPO1 à cost center for org unit 





Getting the Email ID for a employee from HR system



Main steps to get the email ID of a employee
  • Go to the PA30 with info type 0105 (communication ) and subtype 0010 (email id) click on the display button 



  •  Call SE37  Call function model ‘HR_READ_SUBTYPE
    • Here ENDA must be entered to get the email id 


Code snips :

CALL FUNCTION 'HR_READ_SUBTYPE'
  
EXPORTING
*   TCLAS                                      = 'A'
    pernr                
p_num     "Personnel number of the employee
    infty                
'0105'             " Info type
    SUBTY                
'0010'             " Subtyp
    ENDDA                                       = '99991231'
  
TABLES
    infty_tab           
l_t_p0105  "Records fetched
 
EXCEPTIONS
   INFTY_NOT_FOUND       
1
   INVALID_INPUT         
2
   
OTHERS                3.
READ TABLE l_t_p0105 INTO l_r_p0105 INDEX 1.
  
IF  sy-subrc =  0.
     p_EMAIL = l_r_p0105-usrid_long " usrid_long is the email id
  Endif.



/*Newer Posts*/ Older Posts Home