ABAP Search help

For ABAP search help, there are a lot of ways to use it, here I just list one of them to show out how to use F4 help.

**定义屏幕选

PARAMETERS:    P_PRNPL(4) TYPE C                 .

**在下面的事件中指定检索help的字段

AT

SELECTION-SCREEN ON VALUE-REQUEST FOR P_PRNPL.

 

*-->Search help of print pool

  PERFORM F4_PRNTP_HELP

          USING P_LGNUM

                'P_PRNPL'.

**下面是实现检索help的子程序

FORM F4_PRNTP_HELP USING L_LGNUM LIKE LRF_WKQU-LGNUM

                         L_FIELD TYPE HELP_INFO-DYNPROFLD.

***定义检索help要显示的信息的内表

  TYPES: BEGIN OF T_ZDTWM00014,

           LGNUM  TYPE ZDTWM00014-LGNUM,

           ZZPRPOOL TYPE ZDTWM00014-ZZPRPOOL,

           ZZPPOTXT TYPE ZDTWM00014-ZZPPOTXT,

         END OF T_ZDTWM00014.

  DATA: I_ZDTWM00014 TYPE T_ZDTWM00014 OCCURS 0 WITH HEADER LINE.

**清空这个内表

  REFRESH I_ZDTWM00014.

**如果屏幕上没有输入的情况下,取得所有数据库表里有的内容

  IF L_LGNUM IS INITIAL.

    SELECT *

      FROM ZDTWM00014

      INTO CORRESPONDING FIELDS OF TABLE I_ZDTWM00014.

  ELSE.

**如果屏幕输入的话,取得相关输入的信息

    SELECT *

      FROM ZDTWM00014

      INTO CORRESPONDING FIELDS OF TABLE I_ZDTWM00014

     WHERE LGNUM   = L_LGNUM

       AND ZZPRPOOL = P_PRNPL.

  ENDIF.

  IF SY-SUBRC <> 0.

    EXIT.

  ENDIF.

**排序

  SORT I_ZDTWM00014 BY LGNUM

                       ZZPRPOOL.

  DELETE ADJACENT DUPLICATES FROM I_ZDTWM00014

         COMPARING LGNUM ZZPRPOOL.

* 调用函数把内容显示出来

  CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

    EXPORTING

      RETFIELD               = 'ZZPRPOOL'

      DYNPPROG               = SY-REPID

      DYNPNR                 = SY-DYNNR

      DYNPROFIELD            = L_FIELD

      VALUE_ORG              = 'S'

    TABLES

      VALUE_TAB              = I_ZDTWM00014

    EXCEPTIONS

      PARAMETER_ERROR        = 1

      NO_VALUES_FOUND        = 2

      OTHERS                 = 3.

  IF SY-SUBRC <> 0.

****调用失败,处理错误

    EXIT.

  ENDIF.

ENDFORM.

你可能感兴趣的:(search)