Posted: Sun Nov 25, 2007 12:29 pm Post subject: Implementation of a self-programmed value help for F4
A simple implementation of a self-programmed value help for F4
Code:
REPORT ZMAIN .
************************************************************************
* This program implements a self-programmed value help for F4.
* When F4 or the down arrow is pressed, a custom list pops up
* with the selectable values.
* This method does not require help-view, check table or
* or matchcode. We can also avoid the programming of a more
* complex transaction with PROCESS ON VALUE-REQUEST in the flow
* logic. Furthermore, the help values can be anything (not only
* values from tables linked with foreign keys)
************************************************************************
DATA: BEGIN OF FIELDS OCCURS 10.
INCLUDE STRUCTURE HELP_VALUE.
DATA: END OF FIELDS.
DATA: BEGIN OF VALUETAB OCCURS 10,
LINE(80),
END OF VALUETAB.
* ZTSTSTRC: a custom structure defined in the data dictionary:
* field data_element type length
* NAME CHAR0008 CHAR 8
* FLAG CHAR0001 CHAR 1
* TEXT CHAR012 CHAR 12
TABLES: ZTSTSTRC.
* Display the selection screen
SELECTION-SCREEN BEGIN OF BLOCK BL1.
PARAMETERS: A LIKE ZTSTSTRC-NAME.
SELECTION-SCREEN END OF BLOCK BL1.
* Value list requested (F4 or click on the arrow)
AT SELECTION-SCREEN ON VALUE-REQUEST FOR A.
CLEAR FIELDS. REFRESH FIELDS.
CLEAR VALUETAB. REFRESH VALUETAB.
* Fill the structure table
FIELDS-TABNAME = 'ZTSTSTRC'.
FIELDS-FIELDNAME = 'NAME'.
FIELDS-SELECTFLAG = 'X'.
APPEND FIELDS. CLEAR FIELDS.
FIELDS-TABNAME = 'ZTSTSTRC'.
FIELDS-FIELDNAME = 'FLAG'.
APPEND FIELDS. CLEAR FIELDS.
FIELDS-TABNAME = 'ZTSTSTRC'.
FIELDS-FIELDNAME = 'TEXT'.
APPEND FIELDS. CLEAR FIELDS.
* Fill the value table
VALUETAB-LINE = 'aaa'. APPEND VALUETAB.
VALUETAB-LINE = 'b'. APPEND VALUETAB.
VALUETAB-LINE = 'ccc'. APPEND VALUETAB.
VALUETAB-LINE = 'ddd'. APPEND VALUETAB.
VALUETAB-LINE = 'e'. APPEND VALUETAB.
VALUETAB-LINE = 'fff'. APPEND VALUETAB.
VALUETAB-LINE = 'ggg'. APPEND VALUETAB.
VALUETAB-LINE = 'h'. APPEND VALUETAB.
VALUETAB-LINE = 'iii'. APPEND VALUETAB.
* Call the help value screen
CALL FUNCTION 'HELP_VALUES_GET_WITH_TABLE'
EXPORTING
* cucol = 10
* curow = 10
TITLE_IN_VALUES_LIST = 'List header line'
TITEL = 'Window title'
IMPORTING
SELECT_VALUE = A
TABLES
FIELDS = FIELDS
VALUETAB = VALUETAB.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG. SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG. Every effort is made to ensure content integrity. Use information on this site at your own risk.