ABAP F4 帮助 一例
*&---------------------------------------------------------------------*
*& Report Z_LJC_078
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT z_ljc_078 LINE-SIZE 200.
tables: mara.
parameters: p_sh like mara-matnr.
DATA: LTAB_FIELDS LIKE HELP_VALUE OCCURS 0 WITH HEADER LINE,
BEGIN OF LTAB_VALUES OCCURS 0,
FELD(40) TYPE C,
END OF LTAB_VALUES.
INITIALIZATION.
DATA: L_matnr(40),L_meins(40).
LTAB_FIELDS-TABNAME = 'MARA'.
LTAB_FIELDS-FIELDNAME = 'MATNR'.
LTAB_FIELDS-SELECTFLAG = 'X'.
APPEND LTAB_FIELDS.
LTAB_FIELDS-TABNAME = 'MARA'.
LTAB_FIELDS-FIELDNAME = 'MEINS'.
LTAB_FIELDS-SELECTFLAG = ''.
APPEND LTAB_FIELDS.
SELECT matnr meins INTO (L_matnr,L_meins)
FROM mara where matnr like '%380%'.
LTAB_VALUES-FELD = L_matnr.
APPEND LTAB_VALUES.
LTAB_VALUES-FELD = L_meins.
APPEND LTAB_VALUES.
ENDSELECT.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_SH.
PERFORM getF4help USING P_SH.
START-OF-SELECTION.
*&---------------------------------------------------------------------*
*& Form getF4help
*&---------------------------------------------------------------------*
FORM getF4help USING P_PARA.
CALL FUNCTION 'HELP_VALUES_GET_WITH_TABLE'
EXPORTING
FIELDNAME = 'MATNR'
TABNAME = 'MARA'
Titel = '搜索物料'
IMPORTING
SELECT_VALUE = P_PARA
TABLES
FIELDS = LTAB_FIELDS
VALUETAB = LTAB_VALUES
EXCEPTIONS
FIELD_NOT_IN_DDIC = 01
MORE_THEN_ONE_SELECTFIELD = 02
NO_SELECTFIELD = 03.
ENDFORM. " getF4help