在ALV报表的选择画面中加一个parameter输入一个布局名称,这样程序运行之前用户可以先选择自己布局。
ALV布局(Layout)的F4函数是 REUSE_ALV_VARIANT_F4。
详细代码如下:
数据定义:
ABAP
DATA: git_fieldcat TYPE lvc_t_fcat,
gwa_fieldcat LIKE LINE OF git_fieldcat,
git_sort TYPE lvc_t_sort,
gwa_variant TYPE disvariant,"layout
gwa_sort LIKE LINE OF git_sort,
gwa_layout TYPE lvc_s_layo.
1
2
3
4
5
6
DATA:git_fieldcatTYPElvc_t_fcat,
gwa_fieldcatLIKELINEOFgit_fieldcat,
git_sortTYPElvc_t_sort,
gwa_variantTYPEdisvariant,"layout
gwa_sortLIKELINEOFgit_sort,
gwa_layoutTYPElvc_s_layo.
选择画面:
ABAP
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-030.
PARAMETERS: p_vari TYPE disvariant-variant.
SELECTION-SCREEN END OF BLOCK b2.
1
2
<