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

hard coding f4 help values in select options

hi ,

i have requirement to hardcode certain values in the select-options in the selection-screen as F4 help . how to do it please help me out.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Best Answer
    Posted on Dec 18, 2008 at 01:13 PM

    Hello,

    Plz try this code below:

    
    DATA:
          v_fname        TYPE fieldname,
          v_dynfield     TYPE dynfnam,
          v_fname01      TYPE fieldname,
          v_dynfield01   TYPE dynfnam.
    
    CONSTANTS:
     c_fname01    TYPE fieldname VALUE 'S_LOKKT-LOW',
     c_fname02    TYPE fieldname VALUE 'S_LOKKT-HIGH',
     c_dynfield01 TYPE dynfnam   VALUE  'S_LOKKT-LOW',
     c_dynfield02 TYPE dynfnam   VALUE  'S_LOKKT-HIGH'.
    
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_lokkt-low.
      v_fname    = c_fname01.
      v_dynfield = c_dynfield01.
    
      PERFORM f_get_help 
      USING v_fname
                 v_dynfield.
    
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_lokkt-high.
    
      v_fname01    = c_fname02.
      v_dynfield01 = c_dynfield02.
    
      PERFORM f_get_help 
      USING v_fname01
                 v_dynfield01.
    
    FORM f_get_help USING fp_v_fname    TYPE fieldname
                          fp_v_dynfield TYPE dynfnam.
    
    TYPES: 
    BEGIN OF ty_f4_tab,
      data type char2,                
    END OF ty_f4_tab.  
    
    DATA:
    l_it_return TYPE STANDARD TABLE OF ddshretval,
    l_wa_return TYPE ddshretval,
    l_it_f4_tab TYPE STANDARD TABLE OF ty_f4_tab,
    l_wa_f4_tab TYPE ty_f4_tab,
    l_v_program TYPE sy-repid,
    l_v_dynnr   TYPE sy-dynnr.
    
    CONSTANTS: c_s    TYPE char1 VALUE 'S'.
    
    * Populate the hardcoded values here
    l_wa_f4_tab-data = 'AA'.
    APPEND l_wa_f4_tab TO l_it_f4_tab.
    
    l_wa_f4_tab-data = 'AB'.
    APPEND l_wa_f4_tab TO l_it_f4_tab.
    
    l_wa_f4_tab-data = 'AC'.
    APPEND l_wa_f4_tab TO l_it_f4_tab.
    
    l_wa_f4_tab-data = 'AD'.
    APPEND l_wa_f4_tab TO l_it_f4_tab.
    
      l_v_program = sy-repid.
      l_v_dynnr   = sy-dynnr.
    
    *Function module used to display F4 help in the selection-screen
      CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
        EXPORTING
          retfield        = fp_v_fname
          dynpprog        = l_v_program
          dynpnr          = l_v_dynnr
          dynprofield     = fp_v_dynfield
          value_org       = c_s
        TABLES
          value_tab       = l_it_f4_tab
          return_tab      = l_it_return
        EXCEPTIONS
          parameter_error = 1
          no_values_found = 2
          OTHERS          = 3.
    
      IF sy-subrc NE 0.
    
        CLEAR l_it_f4_tab.
    
      ELSE.
    
        READ TABLE l_it_return INTO l_wa_return INDEX 1.
        IF sy-subrc = 0.
          fp_v_fname =  l_wa_return-fieldval.
        ENDIF.
    
      ENDIF.
    
    ENDFORM.
    

    Hope this is clear.

    BR,

    Suhas

    Edited by: Suhas Saha on Dec 18, 2008 2:18 PM

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 18, 2008 at 12:54 PM

    Hi,

    U can make z table and put all those entries in that table which u want as hard coded... then fetch value from that table and provide that to f4 help FM thru internal table..

    try this...

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Dec 18, 2008 at 01:02 PM

    HI Dear,

    Better create a LIst Box on selection screen.

    Below is the piece of code to create List box.

    TYPE-POOLS: vrm.

    DATA: name TYPE vrm_id,

    list TYPE vrm_values,

    value LIKE LINE OF list.

    PARAMETERS: ps_parm(10) AS LISTBOX VISIBLE LENGTH 10.

    AT SELECTION-SCREEN OUTPUT.

    name = 'PS_PARM'.

    value-key = '1'.

    value-text = 'Text 1'.

    APPEND value TO list.

    value-key = '2'.

    value-text = 'Text 2'.

    APPEND value TO list.

    CALL FUNCTION 'VRM_SET_VALUES'

    EXPORTING id = name

    values = list.

    Regards,

    Piyush

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 18, 2008 at 01:05 PM

    any example would do it

    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.