POPUP_GET_VALUES

来源:互联网 发布:韶关网络布线公司 编辑:程序博客网 时间:2024/06/05 04:04

通过 Function Module 弹出窗口,在用户确认或修改数据后,返回变更后的数据内容及用户提交或否定。
所属 Function Group : SPO4
所属 Package : SZP

DATA:rcode TYPE c LENGTH 1.

DATA:mytable TYPE STANDARD TABLE OF sval WITH HEADER LINE.

mytable-tabname = ‘USR02′.
mytable-fieldname = ‘BNAME’.
APPEND mytable.
CLEAR mytable.

mytable-tabname = ‘USR02′.
*mytable-FIELDNAME = ‘BCODE’."Internal type X is not supported
mytable-fieldname = ‘CLASS’.
mytable-value = ‘test’.
APPEND mytable.
CLEAR mytable.

mytable-tabname = ‘MARA’.
mytable-fieldname = ‘MATNR’.
mytable-value = ’01234567′.
mytable-FIELD_ATTR = ’03′.
mytable-FIELDTEXT = ‘MAT’.
APPEND mytable.
CLEAR mytable.

CALL FUNCTION ‘POPUP_GET_VALUES’
  EXPORTING
*   NO_VALUE_CHECK        = ‘ ‘
    popup_title           = ‘title’
   start_column          = ’5′
   start_row             = ’5′
 IMPORTING
   returncode            = rcode
  TABLES
    fields                = mytable
 EXCEPTIONS
   error_in_fields       = 1
   OTHERS                = 2
          .
IF sy-subrc <> 0.
  MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
          WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.

CASE rcode.
  WHEN ”.
    WRITE:’YES’.
  WHEN ‘A’.
    WRITE:’NO’.
ENDCASE.

*someting about TABLES fields:

*TABNAME (table name)
*The table must be active in the Data Dictionary.

*FIELDNAME (name of the field to be displayed)
*The field must belong to the table TABNAME.
*If a field is to appear twice, the second field must be passed on
*with ‘*’ before the table name (for example, *T001).

*VALUE (field value)
*VALUE can be assigned a value when the function module is called up.
*This value is displayed.  If the user does not cancel the action,
*VALUE contains the value entered by the user.
*The values must be converted to character format with Move not with
*Assign.

*FIELD_ATTR (field attribute)
*The field attribute determines the layout attribute of the field and
*must have one of the following values:
" " (Space) normal display, ready for input
"01" highlighted, ready for input
"02" normal display, protected against input
"03" highlighted, protected against input
"04" field is not displayed
"05" normal display, not ready for input, 2-dimensional

*FIELD_OBL (obligatory)
*This indicator determines whether or not the field is obligatory
*and must have one of the following values:
" " (Space) The field is optional
"X" The field is obligatory

*FIELDTEXT (keyword)
*In FIELDTEXT the keyword of the field can be specified if the
*dictionary keyword is not to be used.
*
*COMP_CODE
*The field is not required for this function module.
*
*COMP_TAB
*The field is not required for this function module.
*
*COMP_FIELD
*The field is not required for this function module.
*
*NOVALUEHLP
*This indicator determines whether the value help button should be
*displayed or not, and must have one of the following values:
" " = The value help button is permanently displayed
"X" = The value help button is not displayed
"S" = The possible help key is displayed and calls the F4 help from
"        the Dictionary.
"        This parameter is only useful in combination with
*user-defined F4 help
"        (POPUP_GET_VALUES_USER_HELP and POPUP_GET_VALUES_USER_BUTTON),
"        when you decide at field level whether the user-defined F4
"        help or the appropriate
"        Dictionary F4 help is to be called.

结果:
点击可看大图
————
注意:
1、可以填充 fieldname 的类型有限。
2、注意 TABLE fields 参数的说明,已附在上面。