搜索帮助赋值多个字段给屏幕

F4函数:

  lv_fieldname = 'ZSFI_PAYMENT_HEADER-BANKN'.
  CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
    EXPORTING
      retfield         = 'BANKN'
      dynpprog         = sy-repid
      dynpnr           = sy-dynnr
      dynprofield      = lv_fieldname
      value_org        = 'S'
      callback_program = sy-repid "必填,不然会报错
      callback_form    = 'FRM_CM_FORM_BANKN' "回调函数,主要是在这里面写
    TABLES
      value_tab        = lt_but0bk
*     return_tab       = lt_return
    EXCEPTIONS
      parameter_error  = 1
      no_values_found  = 2
      OTHERS           = 3.

回调函数:

*&---------------------------------------------------------------------*
*&      Form  cb_form
*&---------------------------------------------------------------------*
FORM frm_cm_form_bankn TABLES record_tab STRUCTURE seahlpres
                      CHANGING shlp TYPE shlp_descr_t
                               callcontrol LIKE ddshf4ctrl.
  DATA: interface LIKE LINE OF shlp-interface.

"把其他想要赋值的屏幕字段加进interface表中,屏幕字段的属性必须是可编辑的,不可编辑的会赋值失败
  READ TABLE shlp-interface INTO interface INDEX 1.
  interface-shlpfield+4(1) = '3'.
  interface-valfield = 'ZSFI_PAYMENT_HEADER-ACCNAME'.
  APPEND interface TO shlp-interface.

  interface-shlpfield+4(1) = '4'.
  interface-valfield = 'ZSFI_PAYMENT_HEADER-BANKL'.
  APPEND interface TO shlp-interface.

  interface-shlpfield+4(1) = '5'.
  interface-valfield = 'ZSFI_PAYMENT_HEADER-BKDSC'.
  APPEND interface TO shlp-interface.
ENDFORM.

 

posted @ 2024-08-13 17:52  阿胖的阿多  阅读(20)  评论(0编辑  收藏  举报