‎2008 Apr 02 12:44 PM
The function 'VALUES_DISPLAY' is obseleted. I have to replace it with F4IF_INT_TABLE_VALUE_REQUEST. But now, I can't change the field text like 'VALUES_DISPLAY' .
in 'VALUES_DISPLAY' , the field text was put into table F_TAB. now, in F4IF_INT_TABLE_VALUE_REQUEST,I put the field text into T_TAB. But, when I run it, the program will dump.
look at the source code please.
LOOP AT T_POS.
FLG = 0.
AT NEW SHORT.
FLG = 1.
ENDAT.
IF FLG = 1.
LIN = LIN + 1.
V_TAB-LINE = LIN.
V_TAB-POS = 1.
V_TAB-LOW_VALUE = T_POS-SHORT.
APPEND V_TAB.
V_TAB-LINE = LIN.
V_TAB-POS = 2.
V_TAB-LOW_VALUE = T_POS-STEXT.
APPEND V_TAB.
ENDIF.
ENDLOOP.
**
F_TAB-POS = 1.
F_TAB-TABNAME = 'TAB1'.
F_TAB-FIELDNAME = 'FIELD1'.
F_TAB-SELECTFLAG = 'X'.
F_TAB-FIELDLEN = 20.
F_TAB-KEYWORD = TEXT-TH1.
APPEND F_TAB.
F_TAB-POS = 2.
F_TAB-TABNAME = 'TAB2'.
F_TAB-FIELDNAME = 'FIELD2'.
F_TAB-FIELDTYPE = '1'.
F_TAB-SELECTFLAG = ' '.
F_TAB-FIELDLEN = 20.
F_TAB-KEYWORD = TEXT-TH2.
APPEND F_TAB.
*
CALL FUNCTION 'VALUES_DISPLAY'
EXPORTING
CUCOL = 0
CUROW = 0
DISPLAY = SPACE
TABNAME = 'TABNAME'
FIELDNAME = 'FIELDNAME'
TITLE_IN_VALUES_LIST = TEXT-TH0
NO_CONVERSION = SPACE
EXTERNAL_F4 = 'X'
IMPORTING
SELECT_VALUE = VALUE
EXTERNAL_F4_CALL_2ND_TIME = DO_F4_2ND_TIME
TABLES
VALUES = V_TAB
VALUESTRUCTURE = F_TAB
EXCEPTIONS
CHECK_TABLE_LOCKED = 01
NO_VALUES_FOR_FIELD = 02
TABLEFIELD_DOES_NOT_EXIST = 03.
IF SY-SUBRC = 0.
LP_SHORT = VALUE.
ENDIF.
DATA: BEGIN OF T_HELP OCCURS 0,
SHORT LIKE HRP1000-SHORT,
STEXT LIKE HRP1000-STEXT,
END OF T_HELP.
DATA:
T_SHORT LIKE HRP1000-SHORT,
T_STEXT LIKE HRP1000-STEXT.
DATA: T_RETURN LIKE DDSHRETVAL OCCURS 0 WITH HEADER LINE.
DATA: BEGIN OF T_TAB OCCURS 10.
INCLUDE STRUCTURE DFIES.
DATA: END OF T_TAB.
LOOP AT T_POS.
T_SHORT = T_POS-SHORT.
T_STEXT = T_POS-STEXT.
AT NEW SHORT.
CLEAR T_HELP.
T_HELP-SHORT = T_SHORT.
T_HELP-STEXT = T_STEXT.
APPEND T_HELP.
endat.
CLEAR T_POS.
CLEAR T_SHORT.
CLEAR T_STEXT.
endloop.
T_TAB-REPTEXT = TEXT-TH1.
APPEND T_TAB.
T_TAB-REPTEXT = TEXT-TH2.
APPEND T_TAB.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
DDIC_STRUCTURE = ' '
RETFIELD = 'SHORT'
PVALKEY = ' '
DYNPPROG = SY-REPID
DYNPNR = SY-DYNNR
DYNPROFIELD = T_LP_SHORT
STEPL = 0
WINDOW_TITLE =
VALUE = ' '
VALUE_ORG = 'S'
MULTIPLE_CHOICE = ' '
DISPLAY = ' '
CALLBACK_PROGRAM = ' '
CALLBACK_FORM = ' '
MARK_TAB =
IMPORTING
USER_RESET =
TABLES
VALUE_TAB = T_HELP
FIELD_TAB = T_TAB
RETURN_TAB = T_RETURN
DYNPFLD_MAPPING =
EXCEPTIONS
PARAMETER_ERROR = 1
NO_VALUES_FOUND = 2
OTHERS = 3
.
READ TABLE T_RETURN INDEX 1.
MOVE T_RETURN-FIELDVAL TO LP_SHORT.
‎2008 Apr 02 12:51 PM
Hi Maggie,
how did u declare T_TAB.?
it should be lof structure DFIES
‎2008 Apr 03 1:22 AM
Look at my source please. It said:
DATA: BEGIN OF T_TAB OCCURS 10.
INCLUDE STRUCTURE DFIES.
DATA: END OF T_TAB.
‎2008 Apr 03 3:47 AM
Maggie Wu,
I think your requirement is that when have to get value from F4 help and when you select value from F4 automatically corresponding text should be displayed. Am I right ? If I am right, Just follow the steps to get it done.
1.
Use F4IF_INT_TABLE_VALUE_REQUEST to display internal table data to display as f4 help values.
example
2.
Build this internal table with data. Internal table which we are going to pass any type. you can pass any table.
3.
"types
types:
begin of t_zhrpat_contrtyp1,
zhrpae_contrtyp type zhrpat_contrtyp1-zhrpae_contrtyp,
zhrpae_ctyp_desc type zhrpat_contrtyp1-zhrpae_ctyp_desc,
end of t_zhrpat_contrtyp1,
" Work areas
data :
w_zhrpat_contrtyp1 type t_zhrpat_contrtyp1.
" Tables
data :
i_zhrpat_contrtyp1 type standard table of t_zhrpat_contrtyp1.
4.
If you want text that should be displayed automatically next to field value , read the internal table which is displayed on f4 help with the value which u got in the previous point 3 and pass the text and field name to the following function module.
g_progname = 'MP001600'.
g_scr_num = '2000'.
call function 'F4IF_INT_TABLE_VALUE_REQUEST'
exporting
retfield = 'ZHRPAE_CONTRTYP' "--> Field on F4 popup window
dynpprog = g_progname
dynpnr = g_scr_num
dynprofield = 'P0016-ZZ_CONTR_TYP' "--> Field on the screen
value_org = 'S'
tables
value_tab = i_zhrpat_contrtyp1 "-->Data that is displayed on F4 help
return_tab = i_ret_values "-->This contains selected record
properties
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.
else .
" Read table i_ret_values with index 1.
read table i_ret_values into w_ret_values index 1.
p0016-zz_contr_typ = w_ret_values-fieldval.
endif." Work areas
data :
w_dynpfields type t_dynpfields.w_dynpfields-fieldname = 'G_CONTRTYPE1_TXT'."Text field name on the screen.
w_dynpfields-fieldvalue = g_contrtype1_txt.
append w_dynpfields to i_dynpfields.
clear w_dynpfields.
I hope that it helps you.
Regards,
Venkat.O
call function 'DYNP_VALUES_UPDATE'
exporting
dyname = 'MP001600'
dynumb = '2000'
tables
dynpfields = i_dynpfields
exceptions
invalid_abapworkarea = 1
invalid_dynprofield = 2
invalid_dynproname = 3
invalid_dynpronummer = 4
invalid_request = 5
no_fielddescription = 6
undefind_error = 7
others = 8.
if sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.