全屏时 ALV 网格工具栏丢失
我创建了一个简单的 ALV 网格并用数据填充了网格,现在网格显示在选择屏幕之后。我没有使用自定义容器并全屏显示网格。
ALV 网格对象是否有一个属性,可以启用带有按钮过滤、排序等的工具栏,这些按钮通常位于网格顶部?
到目前为止,这就是我所拥有的:
TRY.
cl_salv_table=>factory(
IMPORTING
r_salv_table = gr_alv
CHANGING
t_table = tbl_data
).
CATCH cx_salv_msg.
ENDTRY.
* initialize the alv settings - nothing done here for the moment.
PERFORM define_settings USING gr_alv.
* Display the ALV
gr_alv->display( ).
I've created a simple ALV grid and populated the grid with data, now the grid is displayed after the selection screen. I'm not using custom container and display the grid in full screen.
Is there a property of ALV grid object that enables toolbar with buttons filter, sort, etc, that is normally on top of the grid?
So far this is what I have:
TRY.
cl_salv_table=>factory(
IMPORTING
r_salv_table = gr_alv
CHANGING
t_table = tbl_data
).
CATCH cx_salv_msg.
ENDTRY.
* initialize the alv settings - nothing done here for the moment.
PERFORM define_settings USING gr_alv.
* Display the ALV
gr_alv->display( ).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
每个 ALV 函数在 Simple ALV 中都是作为单独的 CLASS 实现的,因此您必须单独处理它们。您不需要自定义控件。
为了添加工具栏:
完整的ALV显示:
Each ALV function is implemented as a separate CLASS in Simple ALV, so you have to handle them separately. You do not need a custom control.
In order to add the toolbar:
Complete ALV display:
当您使用 ALV 对象模型时,一开始会感到困惑。如果您在全屏模式下使用 ALV,则必须在程序中引用 GUI 状态,并在网格实例上使用 SET_SCREEN_STATUS 方法。 SAP 帮助此处对此进行了解释。
它有助于将 GUI 状态 SALV_TABLE_STANDARD 从函数组 SALV_METADATA_STATUS 复制到报告中作为起点,然后您可以删除任何不需要的函数。例如,如果将状态作为 ALV_STATUS 复制到程序中,则可以这样写:
如果要使用基于类的模型来设置 ALV 函数,则必须将网格对象嵌入屏幕中的自定义容器中。
This is confusing at first when you use the ALV object model. If you use the ALV in fullscreen mode you have to reference a GUI status in your program, and use the method SET_SCREEN_STATUS on your grid instance. It's explained in the SAP Help here.
It helps to copy the GUI status SALV_TABLE_STANDARD from function group SALV_METADATA_STATUS into your report as a starting point, and then you can remove any functions you don't need. For example, if you copied the status into your program as ALV_STATUS, you would write:
If you want to use the class-based model of setting up ALV functions, you have to embed the grid object in a custom container in a screen.
似乎您需要做的是从网格对象中获取 CL_SALV_FUNCTIONS_LIST 的实例,如下所示:
但是,从那里开始,您似乎需要做一些工作。我的建议:查看有关类 CL_SALV_TABLE 和 CL_SALV_FUNCTIONS_LIST 的文档(即,在事务 SE24 中显示类时单击文档按钮)。后者准确地告诉您需要做什么。
(另外,还有一点提示:将处理逻辑放在 try-catch 块中,因为如果初始化失败,您可能会捕获该异常,但继续尝试调用未实例化或未初始化的类上的方法)。
Seems what you need to do is get an instance of CL_SALV_FUNCTIONS_LIST from your grid object like so:
But, from there, it seems you need to do a bit or work. My advice: Look at the documentation on classes CL_SALV_TABLE and CL_SALV_FUNCTIONS_LIST (that is, click the documentation button when you display the class in transaction SE24). The latter tells you exactly what you need to do.
(Also, a little hint: Put your processing logic inside the try-catch block, because if the initialization fails, you might catch that exception but go on to try call a method on an uninstantiated or uninitialized class).
这将显示一个包含所有按钮的工具栏。您可以使用 set_table_for_first_display 方法的 IT_TOOLBAR_EXCLUDING 参数来控制工具栏中要显示的按钮。
this will display a toolbar with all buttons. you can control which buttons you want in the toolbar with the IT_TOOLBAR_EXCLUDING parameter to the set_table_for_first_display method.