09-09-2009 11:22 AM
Hi All,
I am creating table control and having a requirement where depending on the input of COL1, F4 help for COL2 will vary. While entering data in current row its showing corresponding F4 help for COL2. (Here I need to press enter after putting value in COL1 so F4 help for COL2 can be generated.). But if I am moving to previous rows itu2019s not showing the F4 help that should come corresponding to COL1 in that row, instead its showing current F4 help in all rows for COL2 irrespective to row whou2019s COL2 I am pressing F4.
.
I want on clicking or pressing F4 help for COL2 corresponding to COL1 should come up for all the row in display/edit mode.
Please advice how can I proceed further.
09-09-2009 11:37 AM
Hello,
<li>You do not even need to press ENTER on COL1 before you select F4 on COL2. Its replaced by DYNP_VALUES_READ function module.
<li>Normally we use F4IF_INT_TABLE_VALUE_REQUEST to get F4 for field.
<li>Try the below program , change your program accordingly.
Thanks
Venkat.O
REPORT ztest_notepad.
DATA: BEGIN OF it_marc OCCURS 0,
matnr TYPE marc-matnr,
werks TYPE marc-werks,
END OF it_marc.
DATA:it_dynpread TYPE TABLE OF dynpread,
wa_dynpread LIKE LINE OF it_dynpread.
DATA: it_return_tab TYPE ddshretval OCCURS 0,
wa_return LIKE LINE OF it_return_tab.
PARAMETERS:
p_werks TYPE marc-werks,
p_matnr TYPE marc-matnr.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_matnr.
wa_dynpread-fieldname = 'P_WERKS'.
APPEND wa_dynpread TO it_dynpread.
CLEAR wa_dynpread.
"DYNP_VALUES_READ read screen
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
dyname = sy-repid
dynumb = sy-dynnr
TABLES
dynpfields = it_dynpread.
READ TABLE it_dynpread INTO wa_dynpread INDEX 1.
p_werks = wa_dynpread-fieldvalue.
IF it_marc[] IS INITIAL.
SELECT * FROM marc INTO CORRESPONDING FIELDS OF TABLE it_marc WHERE werks = p_werks.
ENDIF.
"F4 help F4IF_INT_TABLE_VALUE_REQUEST
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'MATNR'
dynpprog = sy-repid
dynpnr = sy-dynnr
dynprofield = 'P_MATNR'
value_org = 'S'
TABLES
value_tab = it_marc
return_tab = it_return_tab.
IF sy-subrc EQ 0.
READ TABLE it_return_tab INTO wa_return INDEX 1.
IF sy-subrc EQ 0.
p_matnr = wa_return-fieldval.
ENDIF.
ENDIF.
09-09-2009 11:40 AM
hI
in pai
process on value-request
field itab-field module get_f4.
in program
now you can read the table using Read table itab index lin and you can continue your F4
or you can use this GET CURSOR LINE LIN in module POV and proceed further
Hi, Is this issue been SOLVED
Cheers
Ram
Edited by: Ramchander Krishnamraju on Oct 30, 2009 7:40 AM
09-10-2009 6:35 AM
Declare.
DATA : DYN LIKE DYNPREAD OCCURS 0 WITH HEADER LINE,
LIN TYPE I,
FLI TYPE I.
DATA : BEGIN OF I_F4 OCCURS 0,
CARRID TYPE SPFLI-CARRID,
CONNID TYPE SPFLI-CONNID,
END OF I_F4.
Write this code in POV
REFRESH : DYN , I_F4.
GET CURSOR LINE LIN.
FLI = TC-TOP_LINE + LIN - 1.
DYN-FIELDNAME = 'SPFLI-CARRID'.
DYN-STEPL = FLI.
APPEND DYN.
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
DYNAME = SY-CPROG
DYNUMB = SY-DYNNR
* TRANSLATE_TO_UPPER = ' '
* REQUEST = ' '
* PERFORM_CONVERSION_EXITS = ' '
* PERFORM_INPUT_CONVERSION = ' '
* DETERMINE_LOOP_INDEX = ' '
* START_SEARCH_IN_CURRENT_SCREEN = ' '
* START_SEARCH_IN_MAIN_SCREEN = ' '
* START_SEARCH_IN_STACKED_SCREEN = ' '
* START_SEARCH_ON_SCR_STACKPOS = ' '
* SEARCH_OWN_SUBSCREENS_FIRST = ' '
* SEARCHPATH_OF_SUBSCREEN_AREAS = ' '
TABLES
DYNPFIELDS = DYN
* 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
.
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 DYN INDEX 1.
SELECT DISTINCT CARRID CONNID FROM SPFLI INTO TABLE I_F4 WHERE CARRID = DYN-FIELDVALUE.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
* DDIC_STRUCTURE = ' '
RETFIELD = 'SPFLI-CONNID'
* PVALKEY = ' '
DYNPPROG = SY-CPROG
DYNPNR = SY-DYNNR
DYNPROFIELD = 'SPFLI-CONNID'
* STEPL = 0
* WINDOW_TITLE =
* VALUE = ' '
VALUE_ORG = 'S'
* MULTIPLE_CHOICE = ' '
* DISPLAY = ' '
* CALLBACK_PROGRAM = ' '
* CALLBACK_FORM = ' '
* MARK_TAB =
* IMPORTING
* USER_RESET =
TABLES
VALUE_TAB = I_F4
* FIELD_TAB =
* RETURN_TAB =
* DYNPFLD_MAPPING =
* 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.
09-10-2009 10:25 AM
Thanks for suggestion, I have made the changes as suggested. I am getting the row # where the cursor is by
GET CURSOR LINE LIN. " Statement in PAI.
and using it in POV to get the right line. Its working F9 but only issue is i need to press enter to get the corresponding values in ref to COL1. I have used FM - 'DYNP_VALUES_READ' in POV.
I am using listbox (COL2) to show corresponding list of value in ref to COL1.
Problem is its not dynamicaly showing value for COL2 corresponding COL1 - I need to put cursor on desired line and press enter than only its refelecting the update values in ListBox (COL2).
Breif Code:
Screen 100 Coding
PROCESS BEFORE OUTPUT.
MODULE status_0100.
LOOP AT git_detail INTO gs_detail WITH CONTROL tab_detail
CURSOR tab_detail-current_line.
module save_data.
ENDLOOP.
*
* MODULE f4_help.
PROCESS AFTER INPUT.
LOOP AT git_detail.
module fill_git_detail. " In this MODULE i have getting current line - GET CURSOR LINE c_line.
ENDLOOP.
MODULE user_command_0100.
process on VALUE-REQUEST.
field gs_detail-flag module f4_help.
*
*
MODULE fill_git_detail INPUT.
GET CURSOR LINE c_line.
gs_detail-srno = ( tab_detail-current_line ) * 10.
MODIFY git_detail INDEX tab_detail-current_line FROM gs_detail.
CLEAR: DYNPFIELDS, DYNPFIELDS[].
ENDMODULE.
DATA : DYN LIKE DYNPREAD OCCURS 0 WITH HEADER LINE,
LIN TYPE I,
FLI TYPE I.
CLEAR: IT_FLAG.
* GET CURSOR LINE c_line.
REFRESH : DYN . " I_F4.
*GET CURSOR LINE LIN.
FLI = tab_detail-TOP_LINE + c_line - 1.
WA_DYNPFIELDS-FIELDNAME = 'GS_DETAIL-PERNR'.
WA_DYNPFIELDS-STEPL = FLI.
APPEND WA_DYNPFIELDS TO DYNPFIELDS.
* APPEND WA_DYNPFIELDS TO DYNPFIELDS.
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
DYNAME = SY-REPID
DYNUMB = SY-DYNNR
TABLES
DYNPFIELDS = DYNPFIELDS
EXCEPTIONS
.
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 DYNPFIELDS INTO WA_DYNPFIELDS WITH KEY FIELDNAME = 'GS_DETAIL-PERNR'.
IF SY-SUBRC EQ 0.
gs_detail-pernr = WA_DYNPFIELDS-FIELDVALUE.
if gs_detail-pernr eq '1'.
wa_FLAG-FLAG = 'A'. APPEND wa_FLAG to it_flag.
wa_FLAG-FLAG = 'B'. APPEND wa_FLAG to it_flag.
elseIF gs_detail-pernr eq '2'..
wa_FLAG-FLAG = 'I'. APPEND wa_FLAG to it_flag.
wa_FLAG-FLAG = 'J'. APPEND wa_FLAG to it_flag.
elseIF gs_detail-pernr eq '3'..
wa_FLAG-FLAG = 'N'. APPEND wa_FLAG to it_flag.
wa_FLAG-FLAG = 'O'. APPEND wa_FLAG to it_flag.
else.
wa_FLAG-FLAG = 'Y'. APPEND wa_FLAG to it_flag.
wa_FLAG-FLAG = 'Z'. APPEND wa_FLAG to it_flag.
endif.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
* DDIC_STRUCTURE = '
RETFIELD = 'GS_DETAIL-FLAG'
DYNPPROG = SY-CPROG
DYNPNR = SY-DYNNR
DYNPROFIELD = 'GS_DETAIL-FLAG'
STEPL = 1
* WINDOW_TITLE =
VALUE_ORG = 'S'
TABLES
VALUE_TAB = IT_FLAG
EXCEPTIONS
PARAMETER_ERROR = 1
NO_VALUES_FOUND = 2
OTHERS = 3
.
ENDIF.
CLEAR: DYNPFIELDS, DYNPFIELDS[].
ENDMODULE. " F4_HELP INPUT
09-11-2009 7:15 AM
Thanks for suggestion, I have made the changes as suggested. I am getting the row # where the cursor is by GET CURSOR LINE LIN. " Statement in PAI and using it in POV to get the right line.
Its working fine but only issue is i need to press enter to get the corresponding values in ref to COL1.
I have used FM - 'DYNP_VALUES_READ' in POV.
I am using listbox (COL2) to show corresponding list of value in ref to COL1.
Problem is its not dynamicaly showing value for COL2 corresponding COL1 - I need to put cursor on desired line and press enter than only its refelecting the update values in ListBox (COL2).
Please advice how can i rectify this.
10-31-2009 3:43 AM
11-06-2009 11:15 AM
Hi,
Refer the below code, its working:-
At screen logic:
PROCESS ON VALUE-REQUEST.
FIELD t_serial-info MODULE get_f4_info. "<--pass table control field
In POV include
MODULE get_f4_info INPUT.
DATA: lv_repid TYPE sy-repid,
lv_dynnr TYPE sy-dynnr.
DATA lv_sertype1 TYPE zzsertype.
DATA lt_dynpfields LIKE dynpread OCCURS 0 WITH HEADER LINE.
DATA lv_stepl TYPE sy-stepl.
CLEAR: t_info[], t_info.
CLEAR lv_stepl.
CALL FUNCTION 'DYNP_GET_STEPL'
IMPORTING
povstepl = lv_stepl
EXCEPTIONS
stepl_not_found = 1
OTHERS = 2.
IF sy-subrc = 0.
REFRESH lt_dynpfields.
lv_repid = sy-repid.
lv_dynnr = sy-dynnr.
lt_dynpfields-fieldname = 'T_SERIAL-SERTYPE'. "<-pass table control field
"for column based on which F4 for other column is reqd
lt_dynpfields-stepl = lv_stepl.
APPEND lt_dynpfields. CLEAR lt_dynpfields.
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
dyname = lv_repid
dynumb = lv_dynnr
TABLES
dynpfields = lt_dynpfields.
IF sy-subrc = 0.
READ TABLE lt_dynpfields INDEX 1.
CHECK sy-subrc EQ 0.
lv_sertype1 = lt_dynpfields-fieldvalue.
SELECT info
FROM zinfo_val
INTO TABLE t_info
WHERE sertype = lv_sertype1. "<--select values for F4
IF sy-subrc = 0.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'INFO'
dynpprog = lv_repid
dynpnr = lv_dynnr
dynprofield = 'T_SERIAL-INFO'
stepl = lv_stepl
value_org = 'S'
TABLES
value_tab = t_info
EXCEPTIONS
parameter_error = 1
no_values_found = 2
OTHERS = 3.
IF sy-subrc NE 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDMODULE. " GET_F4_INFO INPUT
Also you can refer:
https://wiki.sdn.sap.com/wiki/display/sandbox/DYNAMICF4HELPFORAFIELDINTABLECONTROL
Hope this helps you.
Regards,
Tarun
03-18-2012 11:23 AM
11-04-2009 6:11 PM
Hi try this,
Before the Fm 'F4IF_INT_TABLE_VALUE_REQUEST',
call function 'DYNP_GET_STEPL'
importing
povstepl = v_stepl.
--->This will fetch the current line number of ur table control where F4 is triggered
read table itab into wa_itab index v_stepl.
Now fetch data using the work area...
11-05-2009 1:41 PM
Try the below logic.
1.In process value request
For that particular column get the index of the particular row of the table control by using
GET CURSOR LINE <g_varaible of type i> for the column 2.
where F4 values required based on the column 1.
2.Read the internal table using index of g_varaible. Here get the column 1 value based on that fill the internal table to populate
the values for f4 help for column 2 using FM F4IF_INT_TABLE_VALUE_REQUEST .
Regards
Pramod M
03-17-2011 6:43 AM
+*hi all ,_*+_
+**i m facing some problems with dynamic f4 help ,*_*+_
+**ive creted table control , fields are name , state and city , dynamic f4 help is on city.*_*+_
+***used function modules , get step loop , dyn_values read and fm f4_int_table module , everything is fine but its nt taking values . please help me out , bellow_ is code ,*+_
+MODULE readfieldvalues INPUT.+_
CLEAR: it_dynpread_1 ,
wa_dynpread_1 ,
it_z1 ,
wa_z1 .
CALL FUNCTION 'DYNP_GET_STEPL'
IMPORTING
povstepl = lin
EXCEPTIONS
stepl_not_found = 1
OTHERS = 2.
IF sy-subrc = 0.
MESSAGE 'error in dynpro step loop' TYPE 'I'.
ENDIF.
wa_dynpread_1-stepl = lin.
wa_dynpread_1-fieldname = 'tab_ytable-state'.
+"error *-heres wat i done, i entered values in name , city and then pressed f4 to process POV . here values corresponds to tabytable-state are nt getting*+_
+*transfered to wadynpread , infact that screen field doesnt hav value , everything else is working fine ,*+_
wa_dynpread_1-fieldvalue = wa-state .
for column based on f4 for other column is req.
APPEND wa_dynpread_1 TO it_dynpread_1.
CLEAR wa_dynpread_1.
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
dyname = sy-repid
dynumb = sy-dynnr
TABLES
dynpfields = it_dynpread_1
fields values from screen transfered to this
*itab
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.
IF sy-subrc = 0.
MESSAGE 'error in values read' TYPE 'I'.
ENDIF.
READ TABLE it_dynpread_1 INDEX 1 INTO wa_dynpread_1 .
state1 = wa_dynpread_1-fieldvalue.
SELECT city FROM ztable4 INTO CORRESPONDING FIELDS OF TABLE
it_z1 WHERE state = state1.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'city'
dynpprog = sy-repid
dynpnr = sy-dynnr
dynprofield = 'tab_ytable-city'
value_org = 'S'
TABLES
value_tab = it_z1
RETURN_TAB = it_z1-city
EXCEPTIONS
parameter_error = 1
no_values_found = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE 'error in f4 help fm' TYPE 'I'.
ENDIF.
ENDIF.
ENDIF.
ENDMODULE.