09-17-2008 11:40 AM
Dear all,
I am actually trying to work on appraisal BADI HRHAP00_VAL_DET > VALUE_DETERMINATION.
The BADI actually stop at this point and i add in the following code. I wish to know which part should i change in order to replace the cell value with the value that i calculated? I downloaded this code from the net.
********Code Begin*********************************************************************
*-- Include
INCLUDE:
incl_hap_exits.
<P>
*-- Workarea definition
DATA:
lw_body_column TYPE hap_s_body_columns,
lw_body_cell TYPE hap_s_body_cells.
<P>
*-- Data definition
DATA:
l_total_num_val TYPE hap_value_num,
l_nr_p_apper TYPE i,
l_tabix TYPE sytabix,
l_no_value_det TYPE char1.
<P>
*-- Business-AddIn Definition
DATA:
l_exit_instance TYPE REF TO if_ex_hrhap00_value_type,
l_exit_implemented TYPE char1.
<P>
*-- Get the values for each part appraiser
LOOP AT t_body_columns INTO lw_body_column
WHERE
column_id = 'ZAW'. "
READ TABLE t_body_cells WITH KEY
row_iid = s_base_cell-row_iid
column_iid = lw_body_column-column_iid
INTO lw_body_cell.
IF sy-subrc EQ 0.
l_total_num_val = l_total_num_val + lw_body_cell-value_num.
l_nr_p_apper = l_nr_p_apper + 1.
ENDIF.
CLEAR:
lw_body_cell,
lw_body_column.
ENDLOOP.
<P>
IF l_nr_p_apper NE 0.
*-- Part Appraisal Values found -> Calc. Average
l_total_num_val = l_total_num_val DIV l_nr_p_apper.
*-- Check validity of the calc and/or try to find the next valid value!
READ TABLE t_body_cells INTO lw_body_cell
WITH KEY row_iid = s_base_cell-row_iid
column_iid = s_base_cell-column_iid
BINARY SEARCH.
IF sy-subrc = 0. "base element found
*-- Hold tabix of the base cell
l_tabix = sy-tabix.
check whether the new calculated value is a valid one
VALID means: is it in the list of the value type
if not -> try to find the next valid value
Business Add-In: get implementation information and instance
CALL FUNCTION 'HRHAP_C_GET_BUSINESS_ADD_IN'
EXPORTING
exit_name = c_badi_value_type
flt_val = lw_body_cell-cell_value_class
IMPORTING
is_implemented = l_exit_implemented
tables
active_imps =
CHANGING
instance = l_exit_instance.
IF NOT l_exit_implemented IS INITIAL.
CALL METHOD l_exit_instance->get_next_valid_value
EXPORTING
flt_val = lw_body_cell-cell_value_class
value_type = lw_body_cell-cell_value_type
value = l_total_num_val
no_value = l_no_value_det
IMPORTING
new_value = lw_body_cell-value_num
new_no_value = lw_body_cell-no_value
new_value_text = lw_body_cell-value_text
EXCEPTIONS
value_type_not_found = 1
OTHERS = 2.
IF sy-subrc EQ 0.
MODIFY t_body_cells FROM lw_body_cell INDEX l_tabix
TRANSPORTING value_num value_text no_value.
new calculated appraisal entry (for BASE_CELL)
new_value_determined = 'X'.
ENDIF.
ENDIF. "base cell found?
ENDIF.
ENDIF.
********Code End************************************************************************
Thanks
Regards,
Bryan
09-17-2008 11:45 AM
I suppose you have to fill these structures:
T_BODY_CELLS TYPE HAP_T_BODY_CELLS.
T_BODY_CELL_NOTES TYPE HAP_T_BODY_CELL_NOTES.
And set NEW_VALUE_DETERMINED = 'X'.
Please use to clear you code to us.
Regards,
Valter Oliveira.
09-17-2008 11:45 AM
I suppose you have to fill these structures:
T_BODY_CELLS TYPE HAP_T_BODY_CELLS.
T_BODY_CELL_NOTES TYPE HAP_T_BODY_CELL_NOTES.
And set NEW_VALUE_DETERMINED = 'X'.
Please use to clear you code to us.
Regards,
Valter Oliveira.