今天在做一个程序,功能是调用FBL3N(总账科目行项目显示),并且向这个程序传入相应的选择屏幕值,直接展示报表。但是,遇到了一个问题,就是这里面的动态选择中的屏幕选项,无法写入值,废了好大的周折,才搞定。分享一下,留念一下。
实现功能:通过事务FBL3N查询特定,总账科目、公司代码、过账日期和会计期间下的总账科目行项目
实现方法:1、建立程序RFITEMGL的变式,变式名ZFBL3N,或者使用标准SAP变式SAP&AUDIT
2、在自开发程序中添加类似如下代码:
TYPE-POOLS:rsds.
DATA: trange TYPE rsds_trange,
trange_line
LIKE LINE OF trange,
trange_frange_t_line
LIKE LINE OF trange_line-frange_t,
trange_frange_t_selopt_t_line
LIKE LINE OF trange_frange_t_line-selopt_t,
texpr TYPE rsds_texpr.
trange_line-tablename = ‘BSIS’.
trange_frange_t_line-fieldname = ‘MONAT’.
trange_frange_t_selopt_t_line-sign = ‘I’.
trange_frange_t_selopt_t_line-option = ‘BT’.
trange_frange_t_selopt_t_line-low = ’13’.
trange_frange_t_selopt_t_line-high = ’16’.
APPEND trange_frange_t_selopt_t_line
TO trange_frange_t_line-selopt_t.
APPEND trange_frange_t_line TO trange_line-frange_t.
APPEND trange_line TO trange.
CALL FUNCTION ‘FREE_SELECTIONS_RANGE_2_EX’
EXPORTING
field_ranges = trange
IMPORTING
EXPRESSIONS = texpr.
SUBMIT rfitemgl “VIA SELECTION-SCREEN
USING SELECTION-SET ‘SAP&AUDIT’
WITH sd_saknr = ‘2423423432’
WITH sd_bukrs = ‘9000’
WITH x_opsel = ‘ ‘
WITH x_clsel = ‘ ‘
WITH x_aisel = ‘X’
WITH so_budat BETWEEN ‘20120601’ AND ‘20120630’
WITH FREE SELECTIONS texpr
AND RETURN.
简单的修改上面的代码就可以定制你自己的调用方式。
good luck to u!
原创文章,作者:Maggie-Hunter,如若转载,请注明出处:https://blog.ytso.com/19664.html