Skip to Content
author's profile photo Former Member
Former Member

How to call a Search help in a function module?

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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

6 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Aug 17, 2009 at 06: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

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Aug 17, 2009 at 08: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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Aug 17, 2009 at 06:43 AM

    Whats your requirement. Search helps are used in fields. calling search helps, what do u mean by that ?

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Aug 17, 2009 at 06: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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Aug 17, 2009 at 07: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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Aug 17, 2009 at 09: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

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.