2006 Jul 24 11:22 AM
hi,
i want to have f4 help for a field in my selection screen.
can anyone explain me the full step by step procedure
thanks
2006 Jul 24 11:24 AM
For example, look at this code
=====================================================
TABLES : MARD.
DATA: BEGIN OF IT_MARD OCCURS 0,
WERKS LIKE MARD-WERKS,
LGORT LIKE MARD-LGORT,
END OF IT_MARD.
DATA : T_RETURN TYPE STANDARD TABLE OF DDSHRETVAL WITH HEADER LINE.
parameters : P_WERKS LIKE MARD-WERKS.
parameters : P_LGORT LIKE MARD-LGORT.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_WERKS.
SELECT WERKS LGORT FROM MARD UP TO 10 ROWS INTO table IT_MARD.
DELETE ADJACENT DUPLICATES FROM IT_MARD COMPARING WERKS.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
RETFIELD = 'WERKS'
DYNPPROG = SY-REPID
DYNPNR = '1000'
DYNPROFIELD = 'P_WERKS'
VALUE_ORG = 'S'
TABLES
VALUE_TAB = IT_MARD
RETURN_TAB = T_RETURN
EXCEPTIONS
PARAMETER_ERROR = 1
NO_VALUES_FOUND = 2
OTHERS = 3.
if sy-subrc = 0.
read table it_mard index 1. "transporting werks.
move it_mard-lgort to p_lgort.
endif.
2006 Jul 24 11:24 AM
For example, look at this code
=====================================================
TABLES : MARD.
DATA: BEGIN OF IT_MARD OCCURS 0,
WERKS LIKE MARD-WERKS,
LGORT LIKE MARD-LGORT,
END OF IT_MARD.
DATA : T_RETURN TYPE STANDARD TABLE OF DDSHRETVAL WITH HEADER LINE.
parameters : P_WERKS LIKE MARD-WERKS.
parameters : P_LGORT LIKE MARD-LGORT.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_WERKS.
SELECT WERKS LGORT FROM MARD UP TO 10 ROWS INTO table IT_MARD.
DELETE ADJACENT DUPLICATES FROM IT_MARD COMPARING WERKS.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
RETFIELD = 'WERKS'
DYNPPROG = SY-REPID
DYNPNR = '1000'
DYNPROFIELD = 'P_WERKS'
VALUE_ORG = 'S'
TABLES
VALUE_TAB = IT_MARD
RETURN_TAB = T_RETURN
EXCEPTIONS
PARAMETER_ERROR = 1
NO_VALUES_FOUND = 2
OTHERS = 3.
if sy-subrc = 0.
read table it_mard index 1. "transporting werks.
move it_mard-lgort to p_lgort.
endif.
2008 Feb 02 11:07 PM
Hi Kishan,
Thank you so much for the code, it really helped me when i was trying to create function module for HR position with the sales org and couldn't find a way to link it to F4. But the sample code you had in the blog really helped me.
Thanks a lot ..
Regards
Nirav
2006 Jul 24 11:25 AM
Hi,
Chcek this code.
*------------Parameter--------------------*
*
PARAMETERS : p_regtyp TYPE char1 .
PARAMETERS : p_sumfl TYPE char255 .
PARAMETERS : p_detfl TYPE char255 .
*
*
*
*---------------------Selection Screen Help----------------------------*
*
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_regtyp.
*-Registration Type
PERFORM f1000_show_f4help_regtyp .
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_sumfl.
*-File Path For Summary Report
PERFORM f2000_filepath_f4 USING lc_s
CHANGING p_sumfl.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_detfl.
*-File Path For Detail Report
PERFORM f2000_filepath_f4 USING lc_d
CHANGING p_detfl.
*
*
*
*---------------------Forms for F4
*----------------------------------------------------------------------*
* Prepair table for Field Registration type
*----------------------------------------------------------------------*
FORM f1000_show_f4help_regtyp .
TYPES: BEGIN OF ty_summary_stat,
reg_type TYPE char1,
reg_text TYPE char20,
END OF ty_summary_stat.
CONSTANTS : lc_reg_type LIKE dfies-fieldname VALUE 'REG_TYPE',
lc_pregtyp LIKE help_info-dynprofld VALUE 'P_REGTYP'.
DATA : lit_summary_in TYPE TABLE OF ty_summary_stat,
ls_help_input TYPE ty_summary_stat.
ls_help_input-reg_type = lc_l.
* Loss & Reg
ls_help_input-reg_text = text-018.
APPEND ls_help_input TO lit_summary_in.
* Standard Process
ls_help_input-reg_type = lc_s.
ls_help_input-reg_text = text-019.
APPEND ls_help_input TO lit_summary_in.
* Function Module to Call F4 Help
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = lc_reg_type
dynpprog = sy-repid
dynpnr = sy-dynnr
dynprofield = lc_pregtyp
value_org = lc_s
TABLES
value_tab = lit_summary_in
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.
ENDFORM. " f1000_show_f4help_regtyp
*---------------------------------------------------------------------*
* F4 Help To get File Path
*----------------------------------------------------------------------*
FORM f2000_filepath_f4 USING xv_indicator TYPE char1
CHANGING xyv_filepath TYPE char255.
*---------------Popup for file name---------------------*
CONSTANTS :
lc_dft_ext TYPE string VALUE 'XLS',
lc_file_flt TYPE string VALUE '*.xls',
lc_int_drc TYPE string VALUE 'C:'.
DATA : lv_win_title TYPE string,
lv_file_name TYPE string,
lv_dft_fname TYPE string,
lv_fname TYPE string,
lv_path TYPE string.
CLEAR: lv_fname,
lv_path,
lv_file_name,
lv_win_title,
lv_dft_fname.
*---------------Set File Details F4 Based on Report Type--------------*
IF xv_indicator = lc_s.
lv_win_title = text-045.
lv_dft_fname = text-038.
ELSE.
lv_win_title = text-044.
lv_dft_fname = text-033.
ENDIF.
CALL METHOD cl_gui_frontend_services=>file_save_dialog
EXPORTING
window_title = lv_win_title
default_extension = lc_dft_ext
default_file_name = lv_dft_fname
file_filter = lc_file_flt
initial_directory = lc_int_drc
prompt_on_overwrite = lc_true
CHANGING
filename = lv_fname
path = lv_path
fullpath = lv_file_name
EXCEPTIONS
cntl_error = 1
error_no_gui = 2
not_supported_by_gui = 3
OTHERS = 4.
IF sy-subrc <> 0 OR lv_fname IS INITIAL
OR lv_path IS INITIAL
OR lv_file_name IS INITIAL.
CLEAR xyv_filepath.
ELSE.
*---FilePath
xyv_filepath = lv_file_name.
ENDIF.
ENDFORM. " f2000_filepath_f4<b>Please Reward Points & Mark Helpful Answers</b>
To mark Helpful Answers ;click radio Button next to the post.
RadioButtons
<b>o</b> Helpful Answer
<b>o</b> Very helpful Answer
<b>o</b> Problem Solved.
Click any of the above button next to the post; as per the anwers
<b>To close the thread; Click Probelm solved Radio Button next to the post , which u feel is best possible answers</b>
2006 Jul 24 11:25 AM
Hi, try this code.
<b>parameters: source(20).
at selection-screen on value-request for source.
perform search_help_source.
FORM search_help_source.
progname = sy-repid.
dynnum = sy-dynnr.
clear value_tab.
refresh value_tab.
* Filling the Value_tab internal table by itab2 internal table.
*------------------
loop at itab_desc.
write itab_desc-description to value_tab.
append value_tab.
endloop.
*------------------
prog = sy-repid.
no = 1000.
clear tab.
refresh tab.
*------------------
* Building the Structure of the Seach Help.
tab-tabname = 'FMFCTRT'.
tab-fieldname = 'BESCHR'.
collect tab.
* Function Used to provide Search Help.
call function 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
retfield = 'BESCHR'
dynpprog = prog
dynpnr = no
dynprofield = 'SOURCE'
window_title = 'Function'
TABLES
value_tab = value_tab
field_tab = tab.
ENDFORM. " search_help_source</b>Regards,
Wasim Ahmed
2006 Jul 24 11:27 AM
Hi Sandeep,
Check this sample code.
REPORT ZHELP .
TABLES : MARA.
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
PARAMETERS : P_MATNR(10) TYPE C.
SELECTION-SCREEN END OF BLOCK B1.
DATA : BEGIN OF ITAB OCCURS 0,
MATNR TYPE MATNR,
END OF ITAB.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_MATNR.
SELECT MATNR
FROM MARA
INTO TABLE ITAB
UP TO 10 ROWS.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
RETFIELD = 'MATERIAL NUMBER'
DYNPPROG = SY-REPID
DYNPNR = SY-DYNNR
DYNPROFIELD = 'P_MATNR'
VALUE_ORG = 'S'
TABLES
VALUE_TAB = ITAB
EXCEPTIONS
PARAMETER_ERROR = 1
NO_VALUES_FOUND = 2
OTHERS = 3.
2006 Jul 24 11:28 AM
Hi,
Its easy.
1. if your parameter is like some system field or standard table field use like stmt .F4 will automaticaly come.
tables : vbak.
parameters: s like sy-datum,
v like vbak-vbeln.
2. else create a match-code object in se11 and use following stmnt
SELECT-OPTIONS <sel-opt name> FOR <fieldname> MATCHCODE OBJECT <match-code obj nam>.
Regards,
Sumit.
2006 Jul 24 11:29 AM
Hi sandeep,
1. sample code (just copy paste)
2.
REPORT ABC.
*----
DATA : BEGIN OF ITAB OCCURS 0,
UNAME LIKE USR01-BNAME,
END OF ITAB.
data : RETURN_TAB LIKE DDSHRETVAL occurs 0 .
data : RETURN_wa LIKE DDSHRETVAL .
*----
PARAMETERS : A(12) TYPE C.
*----
AT SELECTION-SCREEN ON VALUE-REQUEST FOR A.
ITAB-UNAME = 'U01'. APPEND ITAB.
ITAB-UNAME = 'U02'. APPEND ITAB.
ITAB-UNAME = 'U03'. APPEND ITAB.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
DDIC_STRUCTURE = ' '
retfield = 'ITAB-UNAME'
PVALKEY = ' '
DYNPPROG = SY-REPID
DYNPNR = SY-DYNNR
DYNPROFIELD = 'A'
STEPL = 0
WINDOW_TITLE =
VALUE = ' '
VALUE_ORG = 'S'
MULTIPLE_CHOICE = ' '
DISPLAY = ' '
CALLBACK_PROGRAM = ' '
CALLBACK_FORM = ' '
MARK_TAB =
IMPORTING
USER_RESET =
tables
value_tab = ITAB
FIELD_TAB = FTAB
RETURN_TAB = return_tab
DYNPFLD_MAPPING =
EXCEPTIONS
PARAMETER_ERROR = 1
NO_VALUES_FOUND = 2
OTHERS = 3
.
break-point.
regards,
amit m.
2006 Jul 24 11:39 AM
Hi,
Have a look at this simple working code-
<b>Declaration:</b>
PARAMETERS:
txt_fld1 TYPE char100.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR txt_fld1.
perform f100_your_functionality.
Reward points if you find this answer useful.
Regards,
Tanuja.
Message was edited by: Tanuja Sarraju
2006 Jul 24 12:26 PM
hi friends
thanx for the reply
but it need to take data from a table.
thanx
2006 Jul 24 12:29 PM
Hi Sandeep,
Just check my code.It is taking the data from the database table MARA to an internal tabel after that i am passing that internal table to the FM.
There is not any FM in which you can pass the database table directly.
Regards,
Mukesh KUmar
2006 Jul 24 12:33 PM
Hi Sandeep,
Create a search (in DDIC/SE11) and Check Import and Export Checkbox in that search. Give the Table name and field which has the value (Table that has the Value for that field). Then Assign this search help to the field in the Database table. Use the Database field assigned with this for the Field in your Program.
Hope this would help you!
🐵
Cheers,
Prashanth
Message was edited by: Prashanth KR