對選擇螢幕上的一個欄位設定自定義Search Help

mmccking發表於2009-10-16
如果設定的欄位自帶Search Help的話,那麼自定義的Search Help會覆蓋系統定義好的Search Help。[@more@]*&-----------------------------------------------------------*
*&------------------------------------------------------------*
*& Make a search help for a parameter
*&
*&------------------------------------------------------------*

REPORT Y_TEST_F4HELP.

TYPES: BEGIN OF TYP_MARA,
MATNR TYPE MAKT-MATNR,
MAKTX TYPE MAKT-MAKTX ,
END OF TYP_MARA.

PARAMETERS P_OUTPT TYPE MARA-MATNR
OBLIGATORY.

* 選択畫面処理(検索ヘルプ)
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_OUTPT.
* 検索ヘルプ
PERFORM F_GET_HELP.

*&------------------------------------------------------------*
*& Form F_GET_HELP
*&------------------------------------------------------------*
* 出力パターン検索ヘルプ
*-------------------------------------------------------------*
FORM F_GET_HELP.

DATA:
LV_RESET(1) TYPE C,
LT_RETURN_TAB TYPE TABLE OF DDSHRETVAL,
LT_FILED_TAB TYPE TABLE OF DFIES,
LT_MARA TYPE TABLE OF TYP_MARA,
LW_RETURN TYPE DDSHRETVAL,
LW_FILED TYPE DFIES.

CONSTANTS:
LCNS_RETFIELD TYPE DFIES-FIELDNAME VALUE 'MATNR',
LCNS_DNF TYPE HELP_INFO-DYNPROFLD VALUE 'P_OUTPT',
LCNS_VALUE_ORG TYPE DDBOOL_D VALUE 'S'.

SELECT MATNR
MAKTX
FROM MAKT
INTO TABLE LT_MARA.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
RETFIELD = LCNS_RETFIELD
DYNPPROG = SY-REPID
DYNPNR = SY-DYNNR
DYNPROFIELD = LCNS_DNF
WINDOW_TITLE = TEXT-001
VALUE_ORG = LCNS_VALUE_ORG
IMPORTING
USER_RESET = LV_RESET
TABLES
VALUE_TAB = LT_MARA
RETURN_TAB = LT_RETURN_TAB
EXCEPTIONS
PARAMETER_ERROR = 1
NO_VALUES_FOUND = 2
OTHERS = 3.

IF SY-SUBRC <> 0.
* システムメッセージ出力
MESSAGE ID SY-MSGID
TYPE SY-MSGTY
NUMBER SY-MSGNO
WITH SY-MSGV1
SY-MSGV2
SY-MSGV3
SY-MSGV4.
ENDIF.

ENDFORM. " F_GET_HELP

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/8356764/viewspace-1027920/,如需轉載,請註明出處,否則將追究法律責任。

相關文章