Modificar registro de una tabla interna
Hola a todos, tengo la siguiente duda sobre como modificar un regsitro de una tabla interna:
la tabla interna es
data: begin of t_resimp occurs 0,
KEYCTO(6),
TEXTCTO(50),
IMPUESTO like ZPSCD_VLRSATRIB-VALOR,
RESTAIMP like ZPSCD_VLRSATRIB-VALOR,
INDCTO(1),
end of t_resimp.
luego tengo un rutina que lee la tabla, si el registro no existe lo adiciona, en caso contrario lo modifica
*---------------------------------------------------------------------*
* Calcula valores a mostrar en resumen
*---------------------------------------------------------------------*
FORM CALCULA-VALORES.
READ TABLE t_resimp WITH KEY KEYCTO = TOPERA.
IF sy-subrc = 0.
if SUMRES = '+'.
WVALOR = t_resimp-IMPUESTO + t_detimp-VALOR.
t_resimp-IMPUESTO = WVALOR.
MODIFY t_resimp TRANSPORTING IMPUESTO WHERE KEYCTO = TOPERA.
else.
WVALOR = t_resimp-RESTAIMP + t_detimp-VALOR.
t_resimp-RESTAIMP = WVALOR.
MODIFY t_resimp TRANSPORTING RESTAIMP WHERE KEYCTO = TOPERA.
endif.
else.
t_resimp-KEYCTO = TOPERA.
t_resimp-TEXTCTO = DOPERA.
t_resimp-INDCTO = SUMRES.
CLEAR t_resimp-IMPUESTO.
CLEAR t_resimp-RESTAIMP.
if SUMRES = '+'.
t_resimp-IMPUESTO = t_detimp-VALOR.
else.
t_resimp-RESTAIMP = t_detimp-VALOR.
endif.
APPEND t_resimp.
endif.
ENDFORM.
el tema es que la modificacion no me funciona ¿que puede ser? ¿ alguien sabe un metodo mejor?
gracias por la ayuda
|