matinal:SAP ABAP 弹出输入框函数

2023-10-14 15:09:40 浏览数 (1)

代码语言:javascript复制
*函数1
DATA:lv_answer TYPE string .
DATA:value1 TYPE char30 .
CALL FUNCTION 'POPUP_TO_GET_ONE_VALUE'
  EXPORTING
    textline1   = 'haha'
*   TEXTLINE2   = ' '
*   TEXTLINE3   = ' '
    titel       = 'titel'
    valuelength = 8
  IMPORTING
    answer      = lv_answer
    value1      = value1
* EXCEPTIONS
*   TITEL_TOO_LONG       = 1
*   OTHERS      = 2
  .
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
"lv_answer  根据用户的操作会有三个值
"     J   继续
"     A   取消
"value1就是用户输入的值

*函数2
DATA : itb_sval TYPE  TABLE  OF  sval,
       wa_sval  LIKE  LINE  OF  itb_sval.
DATA:l_returncode TYPE string .
CLEAR wa_sval .
wa_sval-tabname = 'MARA' .  "表名
wa_sval-fieldname = 'MATNR' .    "字段名
wa_sval-field_obl = 'X' .          "强制输入
APPEND wa_sval TO itb_sval.

"如果是金额的话要把参考表和参考字段也写进来,然后隐藏,不然金额的输入框是不能输入的
CLEAR wa_sval .
wa_sval-tabname = 'BSIS'.
wa_sval-fieldname = 'WRBTR'.
APPEND wa_sval TO itb_sval.

CLEAR wa_sval .
wa_sval-tabname = 'BSIS'.
wa_sval-fieldname = 'WAERS'.
wa_sval-field_attr = '04'.   "隐藏货币字段
APPEND wa_sval TO itb_sval.

CALL FUNCTION 'POPUP_GET_VALUES'
  EXPORTING
*   NO_VALUE_CHECK  = ' '
    popup_title     = '请填写提交支付日期'
*   START_COLUMN    = '5'
*   START_ROW       = '5'
  IMPORTING
    returncode      = l_returncode
  TABLES
    fields          = itb_sval
  EXCEPTIONS
    error_in_fields = 1
    OTHERS          = 2.
*itb_sval-value 就是输入框的值

0 人点赞