‎2009 Aug 17 7:39 AM
Hi Experts,
I am a novice to ABAP, I am working on search helps. My requirement is to call a search help in a function module.
Can anyone please throw some light on this.
Any inputs will be helpful.
Thanks,
Amita
‎2009 Aug 17 7:43 AM
Whats your requirement. Search helps are used in fields. calling search helps, what do u mean by that ?
‎2009 Aug 17 7:43 AM
Hi,
I am afraid u can't attach a search help to any importing parameters in the Function Module.
U can try looking at some std FM u shall not see any one providing search helps....
but i if u want to add a search help to a field other than in FM than there r FM'S for that ....
Regards
Ravi
‎2009 Aug 17 7:52 AM
Hi,
for search help:
*internal table made to populate the value of werks when pressing f4
DATA: BEGIN OF IT_FINAL OCCURS 0,
WERKS TYPE MARC-WERKS,
END OF IT_FINAL.
data: IT_RETURN LIKE DDSHRETVAL OCCURS 0 WITH header line.
parameters: p_werks(10) type c.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_werks.
select werks from marc
into table IT_FINAL.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
* DDIC_STRUCTURE = ' '
RETFIELD = 'WERKS' "field of internal table
VALUE_ORG = 'S'
TABLES
VALUE_TAB = IT_FINAL
* FIELD_TAB =
RETURN_TAB = IT_RETURN
.
*---now put your logic to use dat into your Fun Mod
Thanks,
Krishna
‎2009 Aug 17 8:08 AM
yes you can do that..
in side the source code ..
write the select statement according to requirement and pass the internal table to below function moduel and return field to yor help field..
call the below fm inside the function module..
'POPUP_WITH_TABLE_DISPLAY' or 'REUSE_ALV_POPUP_TO_SELECT'
see the sample code...
FUNCTION Z_MFG_PLANTS_F4 .
"----
"*"Local Interface:
" IMPORTING
" REFERENCE(W_WERKS) TYPE WERKS OPTIONAL
" IMPORTING
" REFERENCE(W_MATNR) TYPE MANTR OPTIONAL
"----
Alv popup display
DATA : gc_selfield TYPE slis_selfield,
gt_fieldcat_drd TYPE slis_t_fieldcat_alv WITH HEADER LINE.
p_werks = W_WERKS.
data : begin of t_marc occurs 0,
werks type werks,
matnr type matnr,
end of t_marc
select matnr werks from marc into table t_marc where werks = p_werks.
IF t_disp[] IS NOT INITIAL.
gt_fieldcat_drd-seltext_m = 'Material'.
gt_fieldcat_drd-fieldname = 'MATNR'.
APPEND gt_fieldcat_drd.
CLEAR : gt_fieldcat_drd.
gt_fieldcat_drd-seltext_m = 'WERKS'.
gt_fieldcat_drd-fieldname = ''WERKS'.
APPEND gt_fieldcat_drd.
CLEAR : gt_fieldcat_drd.
Allow the user to select the required plant
CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'
EXPORTING
i_title = 'Material Selection for Plant'
i_selection = 'X'
i_screen_start_column = 5
i_screen_start_line = 5
i_screen_end_column = 70
i_screen_end_line = 20
i_tabname = 'T_MARC'
it_fieldcat = gt_fieldcat_drd[]
IMPORTING
es_selfield = gc_selfield
TABLES
t_outtab = t_MARC
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc 0.
ENDIF.
READ TABLE t_MARC INDEX gc_selfield-tabindex.
IF sy-subrc = 0.
w_matnr = t_matnr-matnr.
ENDIF.
ENDIF.
ENDFUNCTION.
rgrds,
Shweta
‎2009 Aug 17 9:14 AM
Try the following FM [F4IF_FIELD_VALUE_REQUEST|https://wiki.sdn.sap.com/wiki/dosearchsite.action?searchQuery.queryString=F4IF_FIELD_VALUE_REQUEST&searchQuery.spaceKey=conf_global].
CALL FUNCTION 'F4IF_FIELD_VALUE_REQUEST'
EXPORTING
tabname =
fieldname =
* SEARCHHELP = ' ' < search help here
* SHLPPARAM = ' '
* DYNPPROG = ' '
* DYNPNR = ' '
* DYNPROFIELD = ' '
* STEPL = 0
* VALUE = ' '
* MULTIPLE_CHOICE = ' '
* DISPLAY = ' '
* SUPPRESS_RECORDLIST = ' '
* CALLBACK_PROGRAM = ' '
* CALLBACK_FORM = ' '
* TABLES
* RETURN_TAB =
* EXCEPTIONS
* FIELD_NOT_FOUND = 1
* NO_HELP_FOR_FIELD = 2
* INCONSISTENT_HELP = 3
* NO_VALUES_FOUND = 4
* OTHERS = 5.Regards,
Raymond
‎2009 Aug 17 10:08 AM
Hi Amita,
Try these function modules DDIF_SHLP_GET and 'F4IF_FIELD_VALUE_REQUEST'.
Sample Code:
AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_CLASS-HIGH.
CALL FUNCTION 'F4IF_FIELD_VALUE_REQUEST'
EXPORTING
TABNAME = 'CABN'
FIELDNAME = 'ATNAM'
SEARCHHELP = 'SEARCH HELP NAME '
SHLPPARAM = ' '
DYNPPROG = SY-CPROG
DYNPNR = SY-DYNNR
DYNPROFIELD = 'ATNAM'
STEPL = 0
VALUE = ' '
MULTIPLE_CHOICE = ' '
DISPLAY = ' '
SUPPRESS_RECORDLIST = ' '
CALLBACK_PROGRAM = ' '
CALLBACK_FORM = ' '
TABLES
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.
Hope, it would help you.
with regards,
Mamta Kumari
Edited by: Mamta Kumari on Aug 17, 2009 11:12 AM
‎2023 Sep 20 2:23 PM
First define the field catalog

After specify the event on F4

At end
handle_on_f4 FOR EVENT onf4 OF cl_gui_alv_grid IMPORTING e_fieldnamee_display.
METHOD handle_on_f4.
DATA: lt_return TYPE STANDARD TABLE OF DDSHRETVAL.
TRY.
CALL FUNCTION 'F4IF_FIELD_VALUE_REQUEST'
EXPORTING
tabname = 'VBAK'
fieldname = 'AUDAT'
searchhelp = 'BU_DATE_CHAR'
TABLES
return_tab = lt_return
EXCEPTIONS
field_not_found = 1
no_help_for_field = 2
inconsistent_help = 3
no_values_found = 4
others = 5.
IF sy-subrc = 0.
IF lines( lt_return ) > 0.
READ TABLE gt_info REFERENCE INTO DATA(lr_info) INDEX es_row_no-row_id.
IF sy-subrc = 0.
DATA(lv_date) = lt_return[ 1 ]-FIELDVAL.
CONDENSE lv_date NO-GAPS.
REPLACE '.' IN lv_date WITH ''.
lr_info->fecha_doc = zcl_functions=>format_date(
i_date = CONV dats( lv_date )
i_format = 'ddmmyyyy'
i_separator = ''
) .
gv_gui->refresh_table_display( ).
ENDIF.
ENDIF.
ELSE.
* MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
* WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
CATCH cx_root INTO DATA(lx_ex).
DATA(lv_ex) = |Ocurrio el error=> { lx_ex->get_text( ) }|.
MESSAGE lv_ex TYPE 'W'.
ENDTRY.
ENDMETHOD.
‎2023 Oct 02 2:30 PM
‎2023 Oct 03 5:54 PM
xiswanto raymond.giuseppi For information, the moderator has just turned the comment into an answer, but your comments were left here...