+ -

Pages

Saturday, July 26, 2014

Call F4 help from selection-screen

      1  report ZDKFRAHEN_TEST001.
      2  ************************************************************************
      3  * This program demonstrates how to call custom F4 help for a
      4  * field on the selection screen of a report
      5  *
      6  * The selection screen contains a select-options for PLANT. validt
      7  * values for plant can be found in custom table zpluksortlist.
      8  * Besides the values from zpluksortlist it should also be possible to
      9  * select an empty value
     10  *
     11  * Programmer: Henrik Frank
     12  * Date      : 07-08-2007
     13  *
     14  ************************************************************************
     15 
     16  tables: zpluksortlist.
     17 
     18  SELECT-OPTIONS: p_plant FOR zpluksortlist-plant.
     19 
     20  *-------------------------------------------------------------
     21  * Call F4 help for plant
     22  *-------------------------------------------------------------
     23  AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_plant-low.
     24    PERFORM show_f4_help.
     25 
     26  AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_plant-high.
     27    PERFORM show_f4_help.
     28 
     29  *&---------------------------------------------------------------------*
     30  *&      Form  show_f4_help
     31  *&---------------------------------------------------------------------*
     32  *       Display F4 help for select-options P_PLANT
     33  *----------------------------------------------------------------------*
     34  FORM show_f4_help.
     35    DATA:
     36      BEGIN OF it_plants OCCURS 0,
     37        plant LIKE zpluksortlist-plant,
     38      END OF it_plants.
     39 
     40    DATA: t_return LIKE ddshretval OCCURS 0 WITH HEADER LINE.
     41 
     42  * Read plants from table ZPLUKSORTLIST
     43    SELECT plant FROM zpluksortlist INTO TABLE it_plants.
     44 
     45    CLEAR it_plants.
     46 
     47  * Add defalut plant '0000'
     48    it_plants-plant = '0000'.
     49    APPEND it_plants.
     50 
     51  * Add empty plant
     52    it_plants-plant = '   '.
     53    APPEND it_plants.
     54 
     55 
     56    SORT it_plants BY plant.
     57 
     58    CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
     59      EXPORTING
     60       retfield               = 'PLANT'   "Key field from it_plants
     61       dynpprog               = sy-cprog  "Program
     62       dynpnr                 = sy-dynnr  "Dynpro number
     63       dynprofield            = 'P_PLANT' "Select-options field
     64       value_org              = 'S'       "Value return: C: cell by cell,
     65                                          "S: structured
     66       display                = 'F'       "Override readiness for input
     67      TABLES
     68        value_tab              = it_plants "table with selection values
     69        return_tab             = t_return  "Return value
     70   EXCEPTIONS
     71     parameter_error        = 1
     72     no_values_found        = 2
     73     OTHERS                 = 3
     74              .
     75    IF sy-subrc <> 0.
     76      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
     77              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
     78    ENDIF.
     79 
     80 
     81  ENDFORM.                    " show_f4_help
  
5 ABAP Tips: Call F4 help from selection-screen 1   report ZDKFRAHEN_TEST001. 2   ************************************************************************ 3   * This pr...

No comments:

Post a Comment

< >