Standard Search Help 이용하기

1.
*internal table made to populate the value of werks when pressing f4
DATA: BEGIN OF IT_FINAL OCCURS 0,
      WERKS TYPE MARC-WERKS,
      END OF IT_FINAL.
DATA: IT_RETURN LIKE DDSHRETVAL OCCURS 0 WITH HEADER LINE.
PARAMETERS: P_WERKS(10) TYPE C.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_WERKS.
  SELECT  WERKS FROM MARC
  INTO TABLE IT_FINAL.
  CALL FUNCTION ‘F4IF_INT_TABLE_VALUE_REQUEST’
    EXPORTING
*   DDIC_STRUCTURE         = ‘ ‘
      RETFIELD               = ‘WERKS’   “field of internal table
     VALUE_ORG              = ‘S’ <—- 선언된 it_final의 필드가 dictionary로 선언되어 있어야 함.
    TABLES
      VALUE_TAB              = IT_FINAL
*   FIELD_TAB              =
     RETURN_TAB             = IT_RETURN
            .
  WRITE IT_RETURN-FIELDVAL TO P_WERKS.
  REFRESH IT_FINAL.

2.

FORM search_aufnr .
  DATA: help_infos TYPE help_info.
  DATA: selection TYPE string.
  DATA: select_value  LIKE  help_info-fldvalue.
  DATA: rsmdy_ret LIKE  rsmdy.
  DATA: dynpselect  LIKE  dselc OCCURS 0 WITH HEADER LINE.
  DATA: dynpvaluetab  LIKE  dval OCCURS 0 WITH HEADER LINE.

  help_infos-call = ‘M’.
  help_infos-object = ‘F’.
  help_infos-program = sy-repid.
  help_infos-dynpro = sy-dynnr.
  help_infos-tabname = ‘RESB’.
  help_infos-fieldname = ‘AUFNR’.
  help_infos-fieldtype = ‘CHAR’.
  help_infos-keyword = ‘오더’.
  help_infos-fieldlng = ’12’.
  help_infos-mcobj = ‘ORDE’.
  help_infos-spras = ‘KO’.
  help_infos-menufunct = ‘HC’.
  help_infos-title = ‘생산 오더 조회 : 초기 화면’.
  help_infos-dynprofld = ‘S2_AUFNR-LOW’.
  help_infos-checktable = ‘AUFK’.
  help_infos-checkfield = ‘AUFNR’.
  help_infos-tcode = ‘ZMMOC0060’.
  help_infos-pfkey = ‘AAUF’.
  help_infos-docuid = ‘FE’.
  help_infos-pov = ‘N’.
  help_infos-curow = ‘4’.
  help_infos-cucol = ’22’.
  help_infos-dynpprog = ‘ZMMOC0060’.
  help_infos-selectart = ‘F’.

  CALL FUNCTION ‘DD_SHLP_CALL_FROM_DYNP’
    EXPORTING
      help_infos   = help_infos
    IMPORTING
      selection    = selection
      select_value = select_value
      rsmdy_ret    = rsmdy_ret
    TABLES
      dynpselect   = dynpselect
      dynpvaluetab = dynpvaluetab
    EXCEPTIONS
      OTHERS       = 1.

ENDFORM.                    ” search_aufnr