显示内部表? [英] Display an internal table?
问题描述
我必须从表格中读取一些数据并显示出来.程序启动了,但我不知道如何显示我选择的任何数据.我想把它摆成一张桌子.
I have to read some data from a table and display it. The program starts but I don't know how to display any of the data I've selected. I want to put it out as a table.
老实说,我什至不知道以下代码是否正确.
I honestly don't even know if the following code is correct.
REPORT ZT_THIEMANN_TEST.
types : begin of ts_output,
object_id type CRMD_ORDERADM_H-object_id,
created_by type CRMD_ORDERADM_H-created_by,
end of ts_output,
tt_output type table of ts_output.
PARAMETERS Mel_Nr TYPE CRMD_ORDERADM_H-Object_ID obligatory.
data gt_output type tt_output.
START-OF-SELECTION.
SELECT cm~object_id cm~created_by
from CRMD_ORDERADM_H as cm
into corresponding fields of table gt_output
where cm~object_id like Mel_Nr.
推荐答案
正如 Sandra 所说,您可以使用调试器检查您的代码/选择是否有效.
As Sandra said, you can check if your code/the select works by using the debugger.
您可以用不同的方式输出数据,但最简单的方法是使用 CL_SALV_TABLE
类.在不添加任何附加功能(例如标题、工具栏按钮、排序、热点等)的情况下,以下代码是您如何使用 oo alv 网格显示数据的方法.
You can output data different ways, but the easiest is using the class CL_SALV_TABLE
. Without adding any additional features (such as a title, toolbar buttons, sorting, hotspots, etc.), the below code is how you can display your data using the oo alv grid.
...
DATA: go_alv TYPE REF TO cl_salv_table,
gx_salv_msg TYPE REF TO cx_salv_msg.
...
TRY.
cl_salv_table=>factory(
IMPORTING
r_salv_table = go_alv
CHANGING
t_table = gt_output ).
CATCH cx_salv_msg INTO gx_salv_msg.
MESSAGE 'error' TYPE 'E'.
ENDTRY.
go_alv->display( ).
这篇关于显示内部表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!