Matchcode dinamico
process on value-request.
field lfa1-zcat
module f4_categoria.
field lfa1-zsubcat
module filtro_subcat.
----------------------------------------------------------------
module f4_categoria.
data: begin of it_zproveedorcat occurs 0,
codcateg like zproveedorcat-codcateg,
descrcateg like zproveedorcat-descrcateg.
data end of it_zproveedorcat.
data: begin of return_tab occurs 0.
include structure ddshretval.
data end of return_tab.
call function 'F4IF_FIELD_VALUE_REQUEST'
exporting
tabname = 'ZPROVEEDORCAT'
fieldname = 'CODCATEG'
searchhelp = 'ZCATPRO'
* SHLPPARAM = ' '
dynpprog = sy-cprog
dynpnr = sy-dynnr
dynprofield = 'LFA1-ZCAT'
* STEPL = 0
* VALUE = ' '
* MULTIPLE_CHOICE = ' '
* DISPLAY = ' '
* SUPPRESS_RECORDLIST = ' '
* CALLBACK_PROGRAM = ' '
* CALLBACK_FORM = ' '
* SELECTION_SCREEN = ' '
* IMPORTING
* USER_RESET =
tables
return_tab = return_tab
exceptions
field_not_found = 1
no_help_for_field = 2
inconsistent_help = 3
no_values_found = 4
others = 5.
.
if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
read table return_tab with key fieldname = 'LFA1-ZCAT'.
lfa1-zcat = return_tab-fieldval.
**********************************************************************
module filtro_subcat
data: begin of it_cat_return_tab occurs 0.
include structure ddshretval.
data end of it_cat_return_tab.
data: begin of it_zproveedorsubcat occurs 0,
descrsubcateg like zproveedorsubcat-descrsubcateg,
codcateg like zproveedorsubcat-codcateg,
codsubcateg like zproveedorsubcat-codsubcateg.
data end of it_zproveedorsubcat.
select * into corresponding fields of table it_zproveedorsubcat
from zproveedorsubcat
where codcateg = lfa1-zcat.
call function 'F4IF_INT_TABLE_VALUE_REQUEST'
exporting
retfield = 'ZSUBCAT'
dynpprog = sy-cprog
dynpnr = sy-dynnr
dynprofield = 'LFA1-ZSUBCAT'
value_org = 'S'
tables
value_tab = it_zproveedorsubcat
return_tab = it_cat_return_tab
exceptions
parameter_error = 1
no_values_found = 2
others = 3.
read table it_cat_return_tab with key fieldname = 'lfa1-zsubcat'.
lfa1-zsubcat = it_cat_return_tab-fieldval.
Comentarios