1. 程式人生 > >ABAP 點選搜尋幫助後取的值。

ABAP 點選搜尋幫助後取的值。

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
  EXPORTING
*        DDIC_STRUCTURE         = ' '
    RETFIELD               = 'BUDAT1'
*        PVALKEY                = ' '
    DYNPPROG               = SY-REPID
    DYNPNR                 = SY-DYNNR
    DYNPROFIELD            = 'GS_HEADER-BUDAT1'
*        STEPL                  = 0
*        WINDOW_TITLE           =
        VALUE                  = 'BUDAT1'
       VALUE_ORG              = 'S'
*        MULTIPLE_CHOICE        = ' '
*        DISPLAY                = ' '
*        CALLBACK_PROGRAM       = ' '
*        CALLBACK_FORM          = 'VALUE_HELP_PRCNO_CALLBACK'
*        MARK_TAB               =
*       IMPORTING
*       USER_RESET             =
  TABLES
    VALUE_TAB              = LT_HELP
*        FIELD_TAB              =
        RETURN_TAB             = RETURN_TAB
*        DYNPFLD_MAPPING        =
      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.
  ELSE.
    READ TABLE RETURN_TAB INDEX 1.
    IF SY-SUBRC EQ 0 .
     CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'
       EXPORTING
         DATE_EXTERNAL                 = RETURN_TAB-FIELDVAL
      IMPORTING
        DATE_INTERNAL                  = GS_HEADER-BUDAT1
      EXCEPTIONS
       DATE_EXTERNAL_IS_INVALID       = 1
               .
     IF SY-SUBRC <> 0.
* Implement suitable error handling here
     ENDIF.

                .
    ENDIF.
READ TABLE RETURN_TAB INDEX 1.

 讀取第一行即點選搜尋幫助後返回的內容。

另外。函式CONVERT_DATE_TO_INTERNAL  將格式為2013.11.14的日期(字串)轉化為日期格式20131114(DATE)