设置参数 ID 不适用于自定义屏幕

Set Parameter ID not working for custom screen

我试图在用户单击 ALV 网格 (reuse_alv_grid_display) 中的热点时调用自定义屏幕。我希望用户选择的行中的特定值显示在自定义屏幕的字段中。

form handle_user_command using r_ucomm     like sy-ucomm
                               rs_selfield type slis_selfield.

  CASE r_ucomm.
    when '&IC1'.

      if rs_selfield-fieldname = 'SEL'.

        READ TABLE it_zcnclog into wa_zcnclog INDEX rs_selfield-tabindex.
        SET PARAMETER ID 'MAT' FIELD wa_zcnclog-material.
        Call SCREEN '1001'.

如果我用标准 SAP 事务替换自定义事务,则值会显示在标准事务的屏幕上,否则不会显示。我检查了 SET/GET 参数复选框,还检查了 TPARA table 的条目,但没有成功。

感谢您的帮助。

您正在调用的自定义事务需要在参数声明中设置 MEMORY ID 值。

PARAMETER: matnr type mara-matnr MEMORY ID MAT.

如果您调用的事务是经典的dynpro事务,您需要编辑字段的元素属性并添加MEMORY ID和SET & GET Parameter框。

只有在以下情况下,屏幕字段才能采用“SET PARAMETER ID 'ZZZ' FIELD 'VALUE' 设置的值:

  • 字段的类型为 "input/output"(在设计时和 运行 时)
  • 字段属性"parameter ID"同SAP内存ID(ZZZ)
  • 字段属性 "GET parameter" 已检查
  • 程序中,屏幕字段名对应的全局变量是初始的(至少在Process Before Output阶段结束时)

摘自ABAP documentation:"When defining input fields, dynpro fields can be associated with SPA/GPA parameters by entering the name of an SPA/GPA parameter from the database table TPARA as an attribute PARAMETER ID. If the corresponding parameter GET PARAMETER is set and no other value is assigned to the input field, the input field is filled with the value of the SPA/GPA parameter when the screen is sent."

演示,第一屏输入的值出现在第二屏,反之亦然:

REPORT z.

TABLES sscrfields.

" Selection screen 1000 (implicit first one)
SELECTION-SCREEN COMMENT /1(40) text1000.
PARAMETERS p_start TYPE c LENGTH 10 LOWER CASE MEMORY ID zzzz.

" Selection screen 1001
SELECTION-SCREEN BEGIN OF SCREEN 1001.
SELECTION-SCREEN COMMENT /1(40) text1001.
PARAMETERS p_b1ab1a TYPE c LENGTH 10.
PARAMETERS p_end TYPE c LENGTH 10 LOWER CASE MEMORY ID zzzz.
PARAMETERS p_b2ab2a TYPE c LENGTH 10.
SELECTION-SCREEN END OF SCREEN 1001.

INITIALIZATION.
  text1000 = 'Press Enter to go to next screen'(000).
  text1001 = 'Press Enter to go to previous screen'(001).

AT SELECTION-SCREEN.
  IF sscrfields-ucomm IS INITIAL.
    CASE sy-dynnr.
      WHEN 1000.
        CLEAR p_end. " <== very important !
        CALL SELECTION-SCREEN 1001.
      WHEN 1001.
        CLEAR p_start. " <== very important !
        LEAVE TO SCREEN 0. " go to previous screen (don't use CALL 
          " SELECTION-SCREEN to avoid a stack of more than 50 dynpros)
    ENDCASE.
  ENDIF.