我在之前的程序中使用了这段代码,但它确实有效。现在我正在使用它来应用具有可用于该字段的范围的事务,我想要填充点击热点的信息。当进入ME2N视图时,它不会在场中放置任何东西。有什么建议吗?
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
CASE r_ucomm.
WHEN '&IC1'.
IF rs_selfield-fieldname = 'EBELN'.
READ TABLE itab_usr INTO wa_usr INDEX rs_selfield-tabindex.
SET PARAMETER ID 'BES' FIELD wa_usr-ebeln.
CALL TRANSACTION 'ME2N'.
ENDIF.
ENDCASE.
ENDFORM.
答案 0 :(得分:1)
你正在做的事情基本上是在墙上写点什么,然后轻推下一个人。由下一个人来决定他们是否想要阅读墙上写的任何内容。参数区域只是一个全局内存 - 也许被调用的程序会对它做些什么,但除非它在文档中说明,否则你不能依赖它。
如果是ME2N
,您可能需要检查交易并发现它只是调用报告的选择屏幕,让我们说RM06EN00
。然后,您可能需要查找关键字SUBMIT
以及有关filling the selection screen of a called program的相关文档。
答案 1 :(得分:0)
您可以从here中找到更多信息。
DATA : WA_FCAT TYPE LVC_S_FCAT,
IT_FCAT TYPE STANDARD TABLE OF LVC_S_FCAT,
OB_CUSTOM_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
OB_GRID TYPE REF TO CL_GUI_ALV_GRID,
G_VARIANT LIKE DISVARIANT,
LT_DEMO_DATA TYPE TABLE OF ZDEMO_TABLE.
INITIALIZATION.
START-OF-SELECTION.
" GET DATA .
REFRESH LT_DEMO_DATA.
SELECT * INTO TABLE LT_DEMO_DATA FROM ZDEMO_TABLE.
PERFORM FIELDCAT.
CALL SCREEN 1001.
CLASS LCL_EVENT_HANDLER DEFINITION.
PUBLIC SECTION.
METHODS HANDLE_HOTSPOT_CLICK FOR EVENT HOTSPOT_CLICK OF CL_GUI_ALV_GRID
IMPORTING E_ROW_ID E_COLUMN_ID ES_ROW_NO.
ENDCLASS.
CLASS LCL_EVENT_HANDLER IMPLEMENTATION.
METHOD HANDLE_HOTSPOT_CLICK .
PERFORM HOTSPOT_CLICK USING E_ROW_ID E_COLUMN_ID.
ENDMETHOD.
ENDCLASS.
FORM HOTSPOT_CLICK USING E_ROW TYPE LVC_S_ROW E_COLUMN_ID TYPE LVC_S_COL.
DATA : WA_DEMO TYPE ZDEMO_TABLE.
READ TABLE LT_DEMO_DATA INTO WA_DEMO INDEX E_ROW-INDEX.
SET PARAMETER ID 'MAT' FIELD WA_DEMO-MATNR.
CALL TRANSACTION 'MB51'.
ENDFORM.
*&---------------------------------------------------------------------*
*& Module STATUS_1001 OUTPUT
*&---------------------------------------------------------------------*
MODULE STATUS_1001 OUTPUT.
SET PF-STATUS 'STANDARD_FULLSCREEN'.
SET TITLEBAR 'TITLE'.
IF G_VARIANT IS INITIAL.
G_VARIANT-REPORT = SY-REPID.
G_VARIANT-USERNAME = SY-UNAME.
ENDIF.
"Object creation for custom container exporting the name
CREATE OBJECT OB_CUSTOM_CONTAINER
EXPORTING
CONTAINER_NAME = 'ALV_GRID'.
CREATE OBJECT OB_GRID
EXPORTING
I_PARENT = OB_CUSTOM_CONTAINER.
CALL METHOD OB_GRID->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
IS_VARIANT = G_VARIANT
I_DEFAULT = 'X'
I_SAVE = 'A'
CHANGING
IT_FIELDCATALOG = IT_FCAT
IT_OUTTAB = LT_DEMO_DATA.
**** For Hotspot Event Handling
DATA: G_HANDLER TYPE REF TO LCL_EVENT_HANDLER.
CREATE OBJECT G_HANDLER.
SET HANDLER G_HANDLER->HANDLE_HOTSPOT_CLICK FOR OB_GRID.
ENDMODULE.
*&---------------------------------------------------------------------*
*& Form FIELDCAT
*&---------------------------------------------------------------------*
ENDFORM.
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_1001 INPUT
*&---------------------------------------------------------------------*
MODULE USER_COMMAND_1001 INPUT.
IF SY-UCOMM = '&F03' OR SY-UCOMM = '&F12' OR SY-UCOMM = '&F15'.
FREE: OB_GRID.
REFRESH: LT_DEMO_DATA.
LEAVE TO SCREEN 0.
ENDIF.
ENDMODULE.