如何在ALV中得到对字段有效性检查的结果
1个回答
展开全部
增加一个参量 在你所要合计的FIELD 中添加一个 CFIELDNAME或者qfieldname = 你的单位的FIELD
2、Here is a simple example.
1) Add a unit field "UNIT" for PCS and TON
2) Refer to the unit measure field to the number field
REPORT ztest NO STANDARD PAGE HEADING LINE-SIZE 170.
* ALV
TYPE-POOLS: slis.
TYPES: BEGIN OF typ_data,
key(10),
num TYPE i,
unit TYPE lvc_quan,
END OF typ_data.
*--------------------------------------------------------------------
* g l o b a l d a t a
*--------------------------------------------------------------------
DATA gt_outtab TYPE TABLE OF typ_data WITH HEADER LINE.
DATA gt_fieldcat TYPE slis_t_fieldcat_alv.
DATA gt_sort TYPE slis_t_sortinfo_alv.
DATA gs_variant TYPE disvariant.
*--------------------------------------------------------------------
* Program constructor.
*--------------------------------------------------------------------
LOAD-OF-PROGRAM.
** For Display Variant
gs_variant-report = sy-repid.
PERFORM layout_sort_build CHANGING gt_sort.
PERFORM prepare_field_catalog changing gt_fieldcat.
*--------------------------------------------------------------------
* s t a r t - o f - s e l e c t i o n.
*--------------------------------------------------------------------
START-OF-SELECTION.
PERFORM selection.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = gs_variant-report
it_fieldcat = gt_fieldcat[]
it_sort = gt_sort[]
is_variant = gs_variant
TABLES
t_outtab = gt_outtab[]
EXCEPTIONS
program_error = 1
OTHERS = 2.
*---------------------------------------------------------------------*
* Form prepare_field_catalog
*---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM prepare_field_catalog changing lt_fieldcat TYPE slis_t_fieldcat_alv..
DATA ls_fieldcat TYPE slis_fieldcat_alv.
2、Here is a simple example.
1) Add a unit field "UNIT" for PCS and TON
2) Refer to the unit measure field to the number field
REPORT ztest NO STANDARD PAGE HEADING LINE-SIZE 170.
* ALV
TYPE-POOLS: slis.
TYPES: BEGIN OF typ_data,
key(10),
num TYPE i,
unit TYPE lvc_quan,
END OF typ_data.
*--------------------------------------------------------------------
* g l o b a l d a t a
*--------------------------------------------------------------------
DATA gt_outtab TYPE TABLE OF typ_data WITH HEADER LINE.
DATA gt_fieldcat TYPE slis_t_fieldcat_alv.
DATA gt_sort TYPE slis_t_sortinfo_alv.
DATA gs_variant TYPE disvariant.
*--------------------------------------------------------------------
* Program constructor.
*--------------------------------------------------------------------
LOAD-OF-PROGRAM.
** For Display Variant
gs_variant-report = sy-repid.
PERFORM layout_sort_build CHANGING gt_sort.
PERFORM prepare_field_catalog changing gt_fieldcat.
*--------------------------------------------------------------------
* s t a r t - o f - s e l e c t i o n.
*--------------------------------------------------------------------
START-OF-SELECTION.
PERFORM selection.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = gs_variant-report
it_fieldcat = gt_fieldcat[]
it_sort = gt_sort[]
is_variant = gs_variant
TABLES
t_outtab = gt_outtab[]
EXCEPTIONS
program_error = 1
OTHERS = 2.
*---------------------------------------------------------------------*
* Form prepare_field_catalog
*---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM prepare_field_catalog changing lt_fieldcat TYPE slis_t_fieldcat_alv..
DATA ls_fieldcat TYPE slis_fieldcat_alv.
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
您可能需要的服务
百度律临官方认证律师咨询
平均3分钟响应
|
问题解决率99%
|
24小时在线
立即免费咨询律师
13350人正在获得一对一解答
济南夏日炎炎4分钟前提交了问题
广州萤火虫6分钟前提交了问题
苏州天空之城3分钟前提交了问题