1. The document calls various SAP functions to retrieve appraisal and employee data based on an employee ID number.
2. It loads evaluation questions, calculates average scores, and saves the updated appraisal data.
3. It then historicizes the completed appraisal document.
6. " 평가 항목 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. data: tmp_rank type pt1045-rank, tmp_index type sy-tabix, flag type char01. "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. " 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. " 평가 문서 완료 . 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)
10. move : 'PA' to tmp_add_on_application, '01' to tmp_plan_version, ls_hrhap_appee-appraisal_id to tmp_appraisal_id. call function 'HRHAP_DOCUMENT_GET_DETAIL' exporting add_on_application = tmp_add_on_application * MODE = ' ' * UI_MODE = ' ' plan_version = tmp_plan_version s_appraisal_id = tmp_appraisal_id * ADMINISTRATOR = ' ' * S_DISPLAY_UI = * NO_ACTION_LOG = ' ' importing * S_DOC_PROCESSING = * S_HEADER_TEXTS = t_header_appraiser = tmp_header_appraiser " 평가자 t_header_appraisee = tmp_header_appraisee " 피평가자 T_HEADER_PART_APPRAISER = tmp_header_part_appraisers “ 부분 평가자 * T_HEADER_OTHERS = s_header_status = tmp_header_status " 상태 2: 계획중 . s_header_dates = tmp_header_dates " 목표세팅일 검토일 . " 시작일 종료일 * T_HEADER_ADD_DATA = * S_HEADER_DISPLAY = * T_BUTTONS = * T_BODY_COLUMNS = t_body_elements = tmp_body_elements "va 문서 번호 * T_BODY_ELEMENT_BUTTONS = * T_BODY_ELEMENT_DESCR = * T_BODY_CELLS = * T_BODY_CELL_VAL_VALUES = * T_BODY_CELL_VAL_RANGES = * T_BODY_CELL_VAL_C_LIKE = * T_BODY_CELL_VAL_DESCR = * T_BODY_CELL_NOTES = * T_STATUS_NOTES = * S_RETURN = . * 직번으로 피평가자로 속한 모든 VA 문서번호 가져온다 . select * into corresponding fields of table lt_hrhap_appee from hrhap_appee where plan_version eq '01' and type eq 'P' and id eq id. * 평가자로 속한 모든 문서 가져온다 . select * into corresponding fields of table lt_hrhap_apper from hrhap_apper where plan_version eq '01' and type eq 'P' and id eq id. * 부분평가자가 속한 모든 문서 가져온다 . select * into corresponding fields of table lt_hrhap_p_apper from hrhap_p_apper where plan_version eq '01' and type eq 'P' and id eq id. 평가 상태 : tmp_header_status-ap_status 1 In Preparation 2 In Planning 3 In Review 4 In Process 5 Completed 6 Approved 7 Closed Approved 8 Rejected 9 Closed Rejected
11. move : 'PA' to tmp_add_on_application, '01' to tmp_plan_version, stru_sel_line-doc_no to ls_appraisal_id-appraisal_id, '0000' to ls_appraisal_id-part_ap_id. . " 저장 로직 . call function 'HRHAP_DOCUMENT_SAVE' exporting plan_version = tmp_plan_version t_header_appraiser = tmp_header_appraiser t_header_appraisee = tmp_header_appraisee t_header_others = tmp_header_others s_header_texts = tmp_header_texts s_header_dates = tmp_header_dates s_header_status = tmp_header_status s_header_display = tmp_header_display t_body_columns = tmp_body_column t_body_elements = tmp_body_elements "va 문서번호 t_body_cells = tmp_body_cells " 가중치 * NO_ACTION_LOG = * VTASK = 'D‘ “ importing s_return = tmp_return " 결과 changing s_appraisal_id = ls_appraisal_id s_doc_processing = tmp_doc_processing t_header_part_appraisers = tmp_header_part_appraisers t_body_cell_notes = t_body_cell_notes "text t_status_notes = tmp_status_note . ls_appraisal_id-part_ap_id 에 ‘ 0000’ 을 넣어야 저장된다 . 문서 read 할 때는 안넣어도 상관없다 . VTASK type 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 tmp_body_cells-no_value: flag check 를 초기화 시켜야 한다 . ( 초기값은 ‘ X’ 로 되어있다 )
12. data : tmp_enqueue type hap_doc_enqueue. move : 'C' to tmp_enqueue. "entire call function 'HRHAP_DOCUMENT_DEQUEUE' exporting plan_version = tmp_plan_version s_appraisal_id = ls_appraisal_id * IMPORTING * S_RETURN = changing doc_enqueue = tmp_enqueue . 평가 문서가 lock 잡힐때가 있다 . 그때는 강제로 dequeue 를 시켜 줘야 한다 . tmp_enqueue : 상태 Appraisal Document Not Enqueued C Entire Appraisal Document Enqueued P Part Appraisal Enqueued F Entire Appraisal Document Enqueued (First Time)
13. call function 'HRHAP_DOCUMENT_CHANGE_STATUS' exporting plan_version = tmp_plan_version template_id = tmp_template_id button_id = tmp_button_id * ADMINISTRATOR = ' ' importing * T_UI_VAL_DET = * T_VAL_DET_RETURN = * DOCUMENT_LEAVE = s_return = tmp_return changing s_appraisal_id = ls_appraisal_id s_header_status = tmp_header_status s_doc_processing = tmp_doc_processing s_header_display = tmp_header_display t_header_appraiser = tmp_header_appraiser t_header_appraisee = tmp_header_appraisee t_header_p_appraiser = tmp_header_part_appraisers t_header_others = tmp_header_others * T_HEADER_ADD_DATA = s_header_texts = tmp_header_texts s_header_dates = tmp_header_dates * T_BUTTONS = t_body_elements = tmp_body_elements * T_BODY_ELEMENT_DESCR = * T_BODY_ELEMENT_BUTTONS = t_body_columns = tmp_body_columns t_body_cells = tmp_body_cells * T_BODY_CELL_VAL_VALUES = * T_BODY_CELL_VAL_RANGES = * T_BODY_CELL_VAL_C_LIKE = * T_BODY_CELL_VAL_DESCR = t_body_cell_notes = tmp_body_cell_notes * T_STATUS_NOTES = tmp_status_note . . MBO 평가 문서의 상태 변경 계획중 => 검토중으로 .. ls_body_elements-element_id to tmp_template_id, ‘REVIEW' to tmp_button_id. “ 현재 상태를 그대로 두보 버튼 ID 만 변경” read table tmp_body_elements with key element_type = 'VA' into ls_body_elements. " 완료 로직 . " data : tmp_template_id type hap_template_id, tmp_button_id type ui_func. move : ls_body_elements-element_id to tmp_template_id, 'COMPLETE' to tmp_button_id. “ 현 단계에서 complete 하면 다음 단계로 넘어간다 . 검토중 => 평가시작 ls_body_elements-element_id to tmp_template_id, 'START' to tmp_button_id. " 부분 평가 . 'COMPL_P' to tmp_button_id.
14. “ button_id 참조 . CONSTANTS: * APPRAISAL STATUS DEPENDENT buttons c_button_perform TYPE hap_button_id VALUE 'PERFORM', "Perform app. c_button_start TYPE hap_button_id VALUE 'START', "Start App. Pr c_button_plan_obj TYPE hap_button_id VALUE 'OBJECTIVE',"Plan object. c_button_review TYPE hap_button_id VALUE 'REVIEW', "Review c_button_next_rev TYPE hap_button_id VALUE 'N_REVIEW', "Next Review c_button_complete TYPE hap_button_id VALUE 'COMPLETE', "Complete app. c_button_compl_p TYPE hap_button_id VALUE 'COMPL_P', "Compl.part ap c_button_approve TYPE hap_button_id VALUE 'APPROVE', "Approve app. c_button_reject TYPE hap_button_id VALUE 'REJECT', "Reject app. c_button_close_apr TYPE hap_button_id VALUE 'CLOSEAPR', "CloseApprove c_button_close_rej TYPE hap_button_id VALUE 'CLOSEREJ', "CloseRejected c_button_closeprep TYPE hap_button_id VALUE 'CLOSEPREP'."Close Prep. CONSTANTS: * STATUS DEPENDENT BUTTON CONTAINERS c_button_status_1 TYPE hap_button_id VALUE 'STATUS_1', c_button_status_2 TYPE hap_button_id VALUE 'STATUS_2', c_button_status_3 TYPE hap_button_id VALUE 'STATUS_3'. CONSTANTS: * ELEMENT buttons c_button_enhance TYPE hap_button_id VALUE 'ENHANCE', "enhance template c_button_delete TYPE hap_button_id VALUE 'DELETE'. "delete element . .
15. call function 'HRHAP_DOCUMENT_GET_LIST_XXL' exporting * SEL_FILTER = ' ' add_on_application = tmp_add_on_application plan_version = tmp_plan_version * T_CATEGORIES = t_templates = tmp_templates * T_TMPL_DETAIL = * T_APPRAISERS = s_and_or = tmp_s_sel_option_and_or * T_APPRAISEES = t_part_appraisers = tmp_part_appraisers * T_OTHERS = * S_SEL_DATE = * S_SEL_STATUS = t_sel_status_sub = tmp_sel_status_sub s_sel_with_or_without = tmp_s_sel_with_or_without * S_DOCUMENT_FILL = * EXTRACT_M_N = ' ' * NO_DIALOG = importing t_documents = tmp_documents * S_RETURN = . read table tmp_documents with key appraisal_id = stru_main_list-doc_no into ls_documents. move : 'PA' to tmp_add_on_application, '01' to tmp_plan_version. move : '01' to ls_templates-plvar, 'VA' to ls_templates-otype, stru_main_list-va_no to ls_templates-objid. append ls_templates to tmp_templates. move : '01' to ls_part_appraisers-plvar, 'P' to ls_part_appraisers-otype, stru_main_list-appraisee to ls_part_appraisers-sobid. append ls_part_appraisers to tmp_part_appraisers. move : '4' to ls_sel_status_sub-ap_status, stru_main_list-sub_status to ls_sel_status_sub-ap_status_sub. append ls_sel_status_sub to tmp_sel_status_sub. tmp_s_sel_option_and_or-apper_and_appee = 'X'. tmp_s_sel_with_or_without-sel_display_existing = 'X'. “ 해당 도큐먼트 단계별 세부 단계 정보 가져온다 .. read table tmp_documents with key appraisal_id = stru_main_list-doc_no into ls_documents.