‎2010 Nov 08 9:28 AM
Hi Techies,
Hi this is shafi. I am using this BAdI ''HRHAP00_VAL_DET'' for Tcode APPCREATE(MSS Tcode). Here I need to check in the portal that the manager filled all colums or not, when he fillng to register his flite in MSS. If he may leave anything blank then
it should not be save or exucute. For that what conditions I have to put.
FOR THAT I WRITTEN CODE LIKE THIS
data : x_body_cells like LINE OF t_body_cells.
data : lv_O(2) ,
lv_vg(2),
lv_g(2),
lv_u(2),
lv_oamt TYPE p length 8 DECIMALS 3 ,
lv_vgamt TYPE p length 8 DECIMALS 3 ,
lv_gamt TYPE p length 8 DECIMALS 3 ,
lv_uamt TYPE p length 8 DECIMALS 3 ,
lv_1 type P length 8 DECIMALS 3 ,
lv_2 TYPE p length 8 DECIMALS 3 ,
lv_3 TYPE p length 8 DECIMALS 3 ,
lv_4 TYPE p length 8 DECIMALS 3 .
clear : x_body_cells , lv_o, lv_vg, lv_g, lv_u, lv_oamt, lv_vgamt, lv_gamt, lv_uamt.
data: lv_x TYPE c.
*if s_base_cell = '00650008'.
*no_execution = 'X'.
endif.
if s_base_cell = '00650009' or s_base_cell = '00280009'. " To Execute the code one time
loop at t_body_cells INTO x_body_cells.
if x_body_cells-cell_value_class = 'Q'.
if x_body_cells-no_value = ' '.
if lv_x = 'X'.
MESSAGE e012(zhr). "Please select either one of the rating
exit.
LEAVE to SCREEN 2000.
else.
lv_x = 'X'.
endif.
else.
clear lv_x.
endif.
else.
clear lv_x.
endif.
clear x_body_cells.
endloop.
*TO calculate the number of Good , Very good and outstanding appraisal
loop at t_body_cells INTO x_body_cells.
if x_body_cells-Cell_value_class = 'Q' and
x_body_cells-value_text = 'O'.
lv_O = lv_o + 1.
ELSEif x_body_cells-Cell_value_class = 'Q' and
x_body_cells-value_text = 'VG'.
lv_VG = lv_VG + 1.
elseif x_body_cells-Cell_value_class = 'Q' and
x_body_cells-value_text = 'G'.
lv_G = lv_G + 1.
ELSEif x_body_cells-Cell_value_class = 'Q' and
x_body_cells-value_text = 'U'.
lv_U = lv_U + 1.
endif.
clear x_body_cells.
endloop.
if lv_o is NOT INITIAL or lv_vg is NOT INITIAL or lv_g is NOT INITIAL or lv_u is NOT INITIAL.
loop at t_body_cells INTO x_body_cells where cell_value_availability = 'D' and column_iid = '001'.
if lv_1 IS INITIAL.
lv_1 = x_body_cells-value_num.
x_body_cells-cell_value_type = lv_o.
ELSEIF lv_2 is INITIAL.
lv_2 = x_body_cells-value_num.
x_body_cells-cell_value_type = lv_vg.
ELSEIF lv_3 IS INITIAL.
lv_3 = x_body_cells-value_num.
x_body_cells-cell_value_type = lv_g.
ELSEIF lv_4 IS INITIAL.
lv_4 = x_body_cells-value_num.
x_body_cells-cell_value_type = lv_u.
endif.
clear: x_body_cells.
ENDLOOP.
*Calculate the amount based on the appraisal selected and pass it to output
lv_oamt = lv_o * lv_1.
lv_vgamt = lv_vg * lv_2.
lv_gamt = lv_g * lv_3.
lv_uamt = lv_u * lv_4.
data: lv_count type i.
loop at t_body_cells INTO x_body_cells where column_iid = '002' and cell_value_class = 'S'.
lv_count = lv_count + 1.
if lv_count = 1 .
x_body_cells-value_num = lv_o.
x_body_cells-no_value = ''.
ELSEIF lv_count = 2 .
x_body_cells-value_num = lv_vg.
x_body_cells-no_value = ''.
ELSEIF lv_count = 3.
x_body_cells-value_num = lv_g.
x_body_cells-no_value = ''.
ELSEIF lv_count = 4.
x_body_cells-value_num = lv_u.
x_body_cells-no_value = ''.
ELSEIF lv_count = 5.
x_body_cells-value_num = lv_oamt + lv_vgamt + lv_gamt + lv_uamt.
x_body_cells-no_value = ''.
ENDIF.
MODIFY t_body_cells from x_body_cells INDEX sy-tabix TRANSPORTING value_num no_value.
clear x_body_cells.
ENDLOOP.
read TABLE t_body_cells INTO x_body_cells with key Cell_value_class = 'U'.
if sy-subrc = 0.
x_body_cells-value_txt = lv_oamt + lv_vgamt + lv_gamt + lv_uamt.
*
modify t_body_cells FROM x_body_cells INDEX sy-tabix TRANSPORTING value_txt .
endif.
endif.
endif.
Data: w_body_cells like line of t_body_cells .
if s_base_cell = '00650008' or s_base_cell = '00280008' .
loop at t_body_cells INTO x_body_cells .
if s_base_cell = '00650008' or s_base_cell = '00280008' .
IF x_body_cells-row_iid = '0004' and x_body_cells-column_iid = '0005' and x_body_cells-cell_value_class = 'Q'.
IF x_body_cells-no_value EQ 'X'."SPACE.
IF x_body_cells-cell_value_type is not INITIAL .
IF x_body_cells-value_text NE 'G' AND x_body_cells-value_text NE 'VG' .
MESSAGE e013(zhr).
LEAVE to SCREEN 2000.
exit.
MESSAGE e013(zhr).
LEAVE to SCREEN 2000.
ENDIF.Endif .ENDIF.
ENDIF.
Endloop.
Thanks in advance
shafi.
Edited by: mohammad shafi on Nov 19, 2010 7:07 AM
‎2010 Nov 22 7:09 AM