Sunday, December 26, 2010
Show a list of possible values for F4 popup help on selection screens. This function module pops up a screen that is just like all the other F4 helps, so it looks like the rest of the SAP system. Very useful for providing dropdowns on fields that do not have them predefined.


REPORT ZTEST_NOTEPAD.
TABLES: T001W.

DATA:
      LC_WERKS      LIKE T001W-WERKS,
      LTAB_FIELDS   LIKE HELP_VALUE OCCURS 0 WITH HEADER LINE,
      BEGIN OF LTAB_VALUES OCCURS 0,
        FELD(40) TYPE C,
      END OF LTAB_VALUES.

START-OF-SELECTION.
  " Set up fields to retrieve data
  LTAB_FIELDS-TABNAME    = 'T001W'.
  LTAB_FIELDS-FIELDNAME  = 'WERKS'.
  LTAB_FIELDS-SELECTFLAG = 'X'.
  APPEND LTAB_FIELDS.

  LTAB_FIELDS-TABNAME    = 'T001W'.
  LTAB_FIELDS-FIELDNAME  = 'NAME1'.
  LTAB_FIELDS-SELECTFLAG = SPACE.
  APPEND LTAB_FIELDS.

  " Fill values
  SELECT * FROM T001W.
    LTAB_VALUES-FELD = T001W-WERKS.
    APPEND LTAB_VALUES.
    LTAB_VALUES-FELD = T001W-NAME1.
    APPEND LTAB_VALUES.
  ENDSELECT.

  CALL FUNCTION 'HELP_VALUES_GET_WITH_TABLE'
    EXPORTING
      FIELDNAME                 = 'WERKS'
      TABNAME                   = 'T001W'
      TITLE_IN_VALUES_LIST      = 'Select a value'
    IMPORTING
      SELECT_VALUE              = LC_WERKS
    TABLES
      FIELDS                    = LTAB_FIELDS
      VALUETAB                  = LTAB_VALUES
    EXCEPTIONS
      FIELD_NOT_IN_DDIC         = 01
      MORE_THEN_ONE_SELECTFIELD = 02
      NO_SELECTFIELD            = 03.

0 comments:

Post a Comment

Your useful comments, suggestions are appreciated.Your comments are moderated.

Followers

Contact Form

Name

Email *

Message *

Web Dynpro ABAP Book

An SAP Consultant

Follow US


Want to Contribute ?

If you are interested in writing about the new stuff you learn everyday while working, please write to the.sap.consultants@gmail.com.

Click on Contribution for more details.