Luego de los eventos PBO - PAI, estan los Value Request, que se activan a la hora de setear el campo.
Por ejemplo
process on value-request.
field p9003-campo1 module zcampo1.
field p9003-campo2 module zcampo2.
Estos modulos tenian que tene una ayuda de busqueda basada en una tabla Z, y a la vez cuando seleccionaba en un campo el valor, el correspondiente al otro campo se debia actualizar.
Pasos, hacer la busqueda a la tabla Z guardo en lt_tab_valores, agregarle un Indice numerico, para luego llamar a funcion que muestar la ayuda en el dialogo.
call function 'F4IF_INT_TABLE_VALUE_REQUEST'
exporting
retfield = 'ZINDEX_ACT' "este campo es una clave interna que me invento para tener referencia
window_title = 'Titulo que quiero'
value_org = 'S'
tables
value_tab = lt_tab_valores
return_tab = lt_return
exceptions
parameter_error = 1
no_values_found = 2
others = 3.
if sy-subrc = 0.
read table lt_return index 1 assigning field-symbol(<lfs_return>).
if sy-subrc is initial.
read table lt_tab_valores assigning field-symbol(<lfs_pgl_i>)
with key zindex_act = <lfs_return>-fieldval.
if sy-subrc is initial.
move <lfs_pgl_i>-valor_muestra to p9003-campo1 .
lv_value = <lfs_pgl_i>-campo2.
"fUERZO LA ACTUALIZACION DEL OTRO CAMPO DEPENDIENTE
call function 'SET_DYNP_VALUE'
exporting
i_field = 'P9003-CAMPO2'
i_repid = sy-cprog
i_dynnr = sy-dynnr
i_value = lv_value.
endif.
endif.
endif.
Idea:
Fuente:
https://www.lapolitecnica.net/foro/abap/77-actualizar-campo-dynpro-desde-ayuda-con-function-set-dynp-value
* Actualizar de modo inmediato el campo de una dynpro, sin pasar por PBO
CALL FUNCTION 'SET_DYNP_VALUE' EXPORTING i_field = 'CAMPO_DYNPRO' i_repid = sy-cprog i_dynnr = sy-dynnr i_value = vl_valor.
Para obtener el valor modificado sin validación:CALL FUNCTION 'GET_DYNP_VALUE' EXPORTING i_field = 'CAMPO_DYNPRO' i_repid = sy-cprog i_dynnr = sy-dynnr CHANGING o_value = vl_valor.
Comentarios
Publicar un comentario