ABAP AT SELECTION-SCREEN ON VALUE-REQUEST / PROGRESS ON VALUE-REQUEST

本文介绍ABAP中动态输入处理及屏幕帮助的实现方法,包括多值填入功能、单值填入功能及屏幕搜索帮助的使用。通过具体代码示例展示了如何调用系统函数进行值请求及值读取,并利用屏幕帮助功能增强用户界面的友好性和易用性。
摘要由CSDN通过智能技术生成

1.)  F4IF_INT_TABLE_VALUE_REQUEST  多值填入

 

 

REPORT Z_BARRY_TEST.
 
TYPES: shlp_descr_t TYPE shlp_descr .
DATA: BEGIN OF itab OCCURS 0 ,
        matnr LIKE mara-matnr ,
        maktx LIKE makt-maktx ,
      END OF itab.
DATA: return_tab TYPE ddshretval OCCURS 0 .
PARAMETERS: p_matnr LIKE itab-matnr ,
            p_maktx LIKE itab-maktx .

INITIALIZATION.
  SELECT matnr maktx INTO TABLE itab FROM makt UP TO 20 ROWS
    WHERE spras = '1'.
 
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_matnr .
  PERFORM f4.
 
*&---------------------------------------------------------------------*
*&      Form  f4
*&---------------------------------------------------------------------*
FORM f4.
  CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
    EXPORTING
      retfield         = 'MATNR'
      dynpprog         = sy-repid
      dynpnr           = sy-dynnr
      dynprofield      = 'P_MATNR'
      value_org        = 'S'
      callback_program = sy-repid
      callback_form    = 'CB_FORM'
    TABLES
      value_tab        = itab
      return_tab       = return_tab
    EXCEPTIONS
      parameter_error  = 1
      no_values_found  = 2
      OTHERS           = 3.
ENDFORM.                    "f4
 
*&---------------------------------------------------------------------*
*&      Form  cb_form
*&---------------------------------------------------------------------*
FORM cb_form TABLES record_tab STRUCTURE seahlpres
              CHANGING shlp TYPE shlp_descr_t
                       callcontrol LIKE ddshf4ctrl.
  DATA: interface LIKE LINE OF shlp-interface.
  READ TABLE shlp-interface INTO interface INDEX 1.
  interface-shlpfield+4(1) = '2'.
  interface-valfield = 'P_MAKTX'.
  APPEND interface TO shlp-interface.
ENDFORM.                    "bo_callback_form

 

 

 

2.)  DYNP_VALUES_READ   单值填入

 

  DATA : lt_dynpread TYPE STANDARD TABLE OF dynpread .
  DATA : lw_dynpread TYPE dynpread .

   lw_dynpread-fieldname = 'SO_CNTR-LOW' .
  APPEND lw_dynpread TO lt_dynpread .

  CALL FUNCTION 'DYNP_VALUES_READ'
    EXPORTING
       dyname                = sy-repid
       dynumb                = sy-dynnr
    TABLES
       dynpfields            = lt_dynpread
    EXCEPTIONS
       invalid_abapworkarea = 1
       invalid_dynprofield   = 2
       invalid_dynproname    = 3
       invalid_dynpronummer = 4
       invalid_request       = 5
       no_fielddescription   = 6
       invalid_parameter     = 7
       undefind_error        = 8
       double_conversion     = 9
       stepl_not_found       = 10
      OTHERS                 = 11 .
  IF sy-subrc <> 0 .
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF .

  CLEAR lw_dynpread .

  LOOP AT lt_dynpread INTO lw_dynpread .

    IF lw_dynpread-fieldname EQ 'SO_CNTR-LOW' .
      IF lw_dynpread-fieldvalue NE space OR
          lw_dynpread-fieldvalue IS NOT INITIAL .
          so_cntr-low = lw_dynpread-fieldvalue .
          so_cntr-sign = 'I' .
          so_cntr-option = 'EQ' .
        APPEND so_cntr.
      ENDIF .

    ENDIF .

  ENDLOOP .

 

 

3)  Screen Srearch Help

 

 

FORM HELP_CHECK.
*-- Set up fields to retrieve data

  ltab_fields-tabname    = 'ZFI_PMNTADV'.
  ltab_fields-fieldname  = 'CHECT'.
  ltab_fields-selectflag = 'X'.
  APPEND ltab_fields.

  ltab_fields-tabname    = 'ZFI_PMNTADV'.
  ltab_fields-fieldname  = 'PMNT_ADV'.
  ltab_fields-selectflag = 'X'.
  APPEND ltab_fields.

  SORT ltab_fields.
  DELETE ADJACENT DUPLICATES FROM ltab_fields.

*-- Fill values
  SELECT chect
  INTO TABLE ltab_values
         FROM zfi_pmntadv
            WHERE pmnt_adv NE space.
  SORT ltab_values.
  DELETE ADJACENT DUPLICATES FROM ltab_values.

CALL FUNCTION 'HELP_VALUES_GET_WITH_TABLE'
     EXPORTING
          fieldname                 = 'chect'
          tabname                   = 'zfi_pmntadv'
          title_in_values_list      = 'Select a value'
     IMPORTING
          select_value              = so_chect
     TABLES
          fields                    = ltab_fields
          valuetab                  = ltab_values
     EXCEPTIONS
          field_not_in_ddic         = 01
          more_then_one_selectfield = 02
          no_selectfield            = 03.
 

ENDFORM.                    "fiscal_year

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值