SAP/Plant Maintenance

IW59 를 Selection-Options 에서 Search Help 로 사용

그녀는애교쟁이 2013. 2. 21. 08:21
반응형
*----------------------------------------------------------------------*
* At Selection-Screen On Value-Request
*----------------------------------------------------------------------*
AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_qmnum-low.
  PERFORM get_noti_by_search_help.

FORM get_noti_by_search_help .

  DATA : l_return_tab	LIKE	ddshretval OCCURS 0 WITH HEADER LINE.
  REFRESH l_return_tab.

  CALL FUNCTION 'F4IF_FIELD_VALUE_REQUEST'
    EXPORTING
      tabname           = 'QMEL'
      fieldname         = 'QMNUM'
      searchhelp        = 'QMEG'
      multiple_choice   = 'X'
    TABLES
      return_tab        = l_return_tab
    EXCEPTIONS
      field_not_found   = 1
      no_help_for_field = 2
      inconsistent_help = 3
      no_values_found   = 4
      OTHERS            = 5.

  DATA l_qmnum TYPE viqmel-qmnum.
  IF sy-subrc EQ 0 AND l_return_tab[] IS NOT INITIAL.

    REFRESH s_qmnum.

    LOOP AT l_return_tab.
      CLEAR l_qmnum.
      s_qmnum-sign = 'I'.
      s_qmnum-option = 'EQ'.

      l_qmnum = l_return_tab-fieldval.

      CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
        EXPORTING
          input  = l_qmnum
        IMPORTING
          output = l_qmnum.

      s_qmnum-low = l_qmnum.

      APPEND s_qmnum. CLEAR s_qmnum.
      CLEAR l_return_tab.
    ENDLOOP.

    READ TABLE l_return_tab INDEX 1.
    IF sy-subrc EQ 0.
      s_qmnum-low = l_return_tab-fieldval.
    ENDIF.
  ENDIF.

ENDFORM.                    " get_noti_by_search_help


반응형