05-16-2006 12:59 PM
Hi All,
I am creating a F4 help using this FM F4IF_INT_TABLE_VALUE_REQUEST. But i would like to know which parameter returns the selected entries of F4 help. So that i can use them update my other screen fields.
05-16-2006 1:07 PM
Hi Durgesh,
The Function Module provides an F4 help that returns the values that have selected in an internal table.
This FM(Function Module) is quite useful when you are programming your own F4 help for a field.
the following example may be of some help to you:
DATA: lf_repid LIKE sy-repid,
lf_dynnr LIKE sy-dynnr,
lf_dynprofield LIKE help_info-dynprofld,
lf_retfield LIKE dfies-fieldname.
MOVE sy-repid TO lf_repid.
MOVE sy-dynnr TO lf_dynnr.
MOVE 'PA_DPROF' TO lf_dynprofield.
MOVE 'PROFILNAME' TO lf_retfield.
PERFORM prepare_gt_value_tab.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = lf_retfield
dynpprog = lf_repid
dynpnr = lf_dynnr
dynprofield = lf_dynprofield
value_org = 'S'
TABLES
value_tab = it_value_tab
EXCEPTIONS
parameter_error = 1
no_values_found = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
Now to retrieve the selected field ,
READ TABLE it_value_tab INDEX 1 .
IF sy-subrc = 0 .
<field_to_get_Fvalue> = it_value_tab-fieldval .
ENDIF .
Refer the documentation for the function module.
Thanks,
Susmitha
05-16-2006 1:07 PM
Hi,
Find below a sample code.
The selected value(s) reference is in the return_values internal table.
Hope this helps.
Thanks and regards,
Satya
DATA: return_values LIKE ddshretval OCCURS 0 WITH HEADER LINE.
STATICS: BEGIN OF value_tab OCCURS 0,
key TYPE textpoolky,
entry TYPE textpooltx,
END OF value_tab.
DESCRIBE TABLE value_tab LINES sy-index.
IF sy-index EQ 0.
READ TEXTPOOL 'RVTEXTE' INTO texttab.
LOOP AT texttab WHERE id = 'I' AND " Textsymbole
key(1) EQ 'A'.
value_tab-key = texttab-key+2(1).
value_tab-entry = texttab-entry.
APPEND value_tab.
ENDLOOP.
ENDIF.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'KEY'
value_org = 'S'
TABLES
value_tab = value_tab
return_tab = return_values
EXCEPTIONS
OTHERS = 1.
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_values INDEX 1.
05-16-2006 1:07 PM
Hai,
The field name for which you have created this F4 help will have the selected value.
For example if it is a parameter(p_matnr) , p_matnr will have the selected value.
Cheers
Umasankar
05-16-2006 1:08 PM
For this you have to populate the fields for which you want the values to be returned in the tables parameter DYNPFLD_MAPPING.
After selection the values selected will be found in the same internal table in the field FLDINH.
05-16-2006 1:08 PM
REPORT Z.
data: begin of inttab occurs 10,
bukrs like t001-bukrs,
butxt like t001-butxt,
ort01 like t001-ort01,
end of inttab,
ret_tab like DDSHRETVAL occurs 0 with header line.
start-of-selection.
select bukrs butxt ort01 from t001 into table inttab.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
DDIC_STRUCTURE = ' '
RETFIELD = 'BUKRS'
PVALKEY = ' '
DYNPPROG = ' '
DYNPNR = ' '
DYNPROFIELD = ' '
STEPL = 0
WINDOW_TITLE = 'Select Company Code'
VALUE = 'S*'
VALUE_ORG = 'S'
MULTIPLE_CHOICE = ' '
DISPLAY = ' '
CALLBACK_PROGRAM = ' '
CALLBACK_FORM = ' '
TABLES
VALUE_TAB = inttab
FIELD_TAB =
RETURN_TAB = ret_tab
DYNPFLD_MAPPING =
EXCEPTIONS
PARAMETER_ERROR = 1
NO_VALUES_FOUND = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
write: / 'Error =', sy-subrc.
else.
loop at ret_tab.
write ret_tab-fieldval.
endloop.
ENDIF.
end of code
regards
vinod
05-16-2006 1:11 PM
Hi,
Check the sample code..
REPORT ZTEST_F4HELP .
*---Report with selection screen and to display the list of
* possible entries for field 'B' as per the value in field 'A'.
parameters: p_vbeln type vbak-vbeln,
p_posnr type vbap-posnr.
at selection-screen on value-request for p_posnr.
data: begin of help_item occurs 0,
posnr type vbap-posnr,
matnr type vbap-matnr,
arktx type vbap-arktx,
end of help_item.
data: dynfields type table of dynpread with header line.
dynfields-fieldname = 'P_VBELN'.
append dynfields.
call function 'DYNP_VALUES_READ'
exporting
dyname = sy-cprog
dynumb = sy-dynnr
translate_to_upper = 'X'
tables
dynpfields = dynfields
exceptions
invalid_abapworkarea = 1
invalid_dynprofield = 2
invalid_dynproname = 3
invalid_dynpronummer = 4
invalid_request = 5
no_fielddescription = 6
invalid_parameter = 7
undefind_error = 8
double_conversion = 9
stepl_not_found = 10
others = 11.
read table dynfields with key fieldname = 'P_VBELN'.
p_vbeln = dynfields-fieldvalue.
call function 'CONVERSION_EXIT_ALPHA_INPUT'
exporting
input = p_vbeln
importing
output = p_vbeln.
select posnr matnr arktx into table help_item
from vbap
where vbeln = p_vbeln.
call function 'F4IF_INT_TABLE_VALUE_REQUEST'
exporting
retfield = 'POSNR'
dynprofield = 'P_POSNR'
dynpprog = sy-cprog
dynpnr = sy-dynnr
value_org = 'S'
tables
value_tab = help_item.
Regards
vijay