Upcoming SlideShare
×

# Abap HR Function

3,530 views

Published on

0 Likes
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

• Be the first to like this

Views
Total views
3,530
On SlideShare
0
From Embeds
0
Number of Embeds
157
Actions
Shares
0
135
0
Likes
0
Embeds 0
No embeds

No notes for slide

### Abap HR Function

1. 1.    call function 'RHPA_APPRAISORS_APP_READ'  &quot; 직번을 가지고  BA 를 구함 . *   EXPORTING *     BEGDA               = '19000101' *     ENDDA               = SY-DATUM *     WITH_STEXT          = 'X' *     WITH_ADD_INFO       = 'X'     tables       appraisors          = p_appraisors       appraisals          = p_appraisals *   EXCEPTIONS *     NO_AUTHORITY        = 1 *     UNDEFINED           = 2 *     OTHERS              = 3             .   if sy-subrc <> 0. * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.   endif.   data:         p_appraisors type table of hrsobid,         ls_appraisors type hrsobid,         p_appraisals type table of hrpe_profa,         ls_appraisals type hrpe_profa.   ls_appraisors-plvar = '01'.   ls_appraisors-otype = 'P'.   ls_appraisors-sobid = pernr.  append ls_appraisors to p_appraisors. 직번을 기준으로 자기가 평가자로 속하 모든 BA 문서를 가져온다 . Pernr <= 직번 Otype <= person
2. 2.      ls_appraisals_1-plvar = ls_appraisors-plvar.     ls_appraisals_1-otype = 'BA'.     ls_appraisals_1-objid = ls_appraisals-tobid.     append ls_appraisals_1 to lt_appraisals_1. “BA 로 피평가자 정보 가져온다 .      call function 'RHPA_APP_APPRAISEES_READ' *   EXPORTING *     MAINTAIN           = ' '       tables         appraisals         = lt_appraisals_1         appraisees         = lt_appraisees *   EXCEPTIONS *     NO_AUTHORITY       = 1 *     UNDEFINED          = 2 *     OTHERS             = 3               .     if sy-subrc <> 0. * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.     endif. BA 로 피평가자 정보 가져온다 . ls_appraisals_1-objid <= 피평가자 직번
3. 3. * GET IFT 0000 DATA   call function 'HR_READ_INFOTYPE'        exporting            pernr           = pernr            infty           = c_ift0000            begda           = '19000101'            endda           = '99991231' *      IMPORTING *          SUBRC           = SUBRC        tables            infty_tab       = it_0000        exceptions            infty_not_found = 1            others          = 2. 직번을 기준으로 infotye 에 따른 HR 기본정보를 가져온다 . pernr <= 직번
4. 4.    move : '01' to tmp_plvar,          item_object to tmp_objid.    &quot; 현재 정보 가져오기 .   call function 'RHPA_APPRAISAL_DISPLAY_READ'     exporting       plvar                = tmp_plvar       objid                = tmp_objid *   BEGDA                = *   ENDDA                = *   READ_DB              = ' ' *   MAINTAIN             = ' '  importing    app_attributes       = get_app_attributes  tables *   APPRAISORS           = *   APPRAISEES           =    appraisal            = lt_appraisal *   APPRAISALS           =  exceptions    no_authority         = 1    nothing_found        = 2    others               = 3             .   if sy-subrc <> 0. * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.   endif. BA 문서 번호를 가지고 문서의 모든 정보를 가져온다 . Tmp_objid <= 문서 번호 .
5. 5.      move : ls_zhrta01-otype to tmp_act_otype,             ls_zhrta01-objid to tmp_act_objid,             'A047' to tmp_act_wegid,             '01' to tmp_act_plvar.     call function 'RH_STRUC_GET'       exporting         act_otype              = tmp_act_otype         act_objid              = tmp_act_objid         act_wegid              = tmp_act_wegid *       ACT_INT_FLAG           =        act_plvar              = tmp_act_plvar *       ACT_BEGDA              = SY-DATUM *       ACT_ENDDA              = SY-DATUM *       ACT_TDEPTH             = 0        act_tflag              = 'X'        act_vflag              = 'X'        authority_check        = 'X' *       TEXT_BUFFER_FILL       = *       BUFFER_MODE            = *     IMPORTING *       ACT_PLVAR              =      tables *       RESULT_TAB             =        result_objec           = lt_result_objec *       RESULT_STRUC           =      exceptions        no_plvar_found         = 1        no_entry_found         = 2        others                 = 3               . BA 에 정의된 BK 항목들을 가져온다 .
6. 6.    &quot;  평가 항목  READ.   data : ls_hrp1002         type hrp1002,          ls_hrt1002         type hrt1002,          lt_hrt1002         type table of hrt1002,          tmp_string         type string.   loop at lt_question into stru_question.     select single * into corresponding fields of ls_hrp1002       from hrp1002       where plvar eq '01'         and otype eq 'BK'         and objid eq stru_question-obj_id         and subty eq '0001'         and istat eq '1'         and langu eq '3'.     select * into corresponding fields of table lt_hrt1002       from hrt1002       where tabnr eq ls_hrp1002-tabnr.     loop at lt_hrt1002 into ls_hrt1002.       concatenate tmp_string ls_hrt1002-tline into tmp_string.     endloop.               . BK 번호 text 를 읽어 온다 .
7. 7.    data:         tmp_rank                type pt1045-rank,         tmp_index               type sy-tabix,         flag                    type char01.    &quot;BG MODIFY     if ls_appraisal-app_otype eq 'BG'.       move ls_appraisal-rank to tmp_rank.       call function 'RHPA_CALC_VALUE_AVERAGE'         exporting           rank_base                = tmp_rank         importing           new_calculated           = flag         tables           app_pt1045               = set_appraisal         exceptions           error_during_calculation = 1           others                   = 2.     endif.      if ls_appraisal-app_otype eq 'BS'.       move ls_appraisal-rank to tmp_rank.       call function 'RHPA_CALC_VALUE_AVERAGE'         exporting           rank_base                = tmp_rank         importing           new_calculated           = flag         tables           app_pt1045               = set_appraisal         exceptions           error_during_calculation = 1           others                   = 2.     endif. 변경된  BK 값으로  bs bg 값 구합 .
8. 8.    &quot; SAVE LOGIC   call function 'RHPA_APPRAISAL_MODIFY_ACTIVE'     exporting       app_attributes_db           = get_app_attributes       app_attributes_cur          = get_app_attributes     vtask                       = 'S'  tables *   appraisal_db                = lt_appraisal    appraisal_cur               = set_appraisal *   appraisal_cur                = lt_appraisal  exceptions    no_authority                = 1    nothing_found               = 2    invalid_date                = 3    appraisal_table_error       = 4    error_during_insert         = 5    historicized                = 6    others                      = 7 다면평가 결과 값 저장 VTASK = ‘S’ <= 저장 데이터 즉시반영 flag S Synchronous update in the update task V Asynchronous update in the update task D Update in dialog B Update in internal buffer No update via personnel planning update task
9. 9.    &quot;  평가 문서 완료  .   move : '01' to tmp_planversion,         item_object to tmp_appraisal_id.   call function 'RHPA_APPRAISAL_HISTORICIZE'    exporting      i_planversion                  = tmp_planversion      i_appraisal_id                 = tmp_appraisal_id *   TABLES *     PROCESS_ERROR                  =    exceptions      no_authority                   = 1      nothing_found                  = 2      input_duty                     = 3      parts_not_historicized         = 4      error_during_update            = 5      processing_not_processed       = 6      wrong_status                   = 7      others                         = 8 다면평가 문서 완료 (closing)