财务要求
需要把CO类型的凭证去掉,经过调试发现
筛选条件在GT_selection
在这个函数里面做个增强试试
*----------------------------------------------------------------------*
***INCLUDE FAGL_FILL_GT_SELECTIONS .
*----------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*& Form fill_gt_selections
*&---------------------------------------------------------------------*
* fill gt_selections
*----------------------------------------------------------------------*
FORM fill_gt_selections TABLES ut_racct TYPE fagl_range_t_racct
ut_rbukrs TYPE fagl_range_t_bukrs
USING ut_rldnr TYPE rldnr
CHANGING ct_gt_selection TYPE gusl_t_selection.
DATA ls_selection TYPE gusl_s_selection.
DATA lt_rangetab TYPE gusl_t_range.
DATA ls_rangetab TYPE gusl_s_range.
* fill racct into gt_selection.
ls_selection-fieldname = 'RACCT'.
LOOP AT ut_racct.
ls_rangetab-sign = ut_racct-sign.
ls_rangetab-option = ut_racct-option.
ls_rangetab-low = ut_racct-low.
ls_rangetab-high = ut_racct-high.
APPEND ls_rangetab TO lt_rangetab.
ENDLOOP.
ls_selection-t_range = lt_rangetab.
APPEND ls_selection TO ct_gt_selection.
* fill rbukrs into gt_selection.
CLEAR ls_selection.
REFRESH lt_rangetab.
ls_selection-fieldname = 'RBUKRS'.
LOOP AT ut_rbukrs.
ls_rangetab-sign = ut_rbukrs-sign.
ls_rangetab-option = ut_rbukrs-option.
ls_rangetab-low = ut_rbukrs-low.
ls_rangetab-high = ut_rbukrs-high.
APPEND ls_rangetab TO lt_rangetab.
ENDLOOP.
ls_selection-t_range = lt_rangetab.
APPEND ls_selection TO ct_gt_selection.
* in transaction FAGLB03 only actual values are shown.
CLEAR ls_selection.
REFRESH lt_rangetab.
ls_selection-fieldname = 'RRCTY'.
ls_rangetab-sign = 'I'.
ls_rangetab-option = 'EQ'.
ls_rangetab-low = '0'.
ls_rangetab-high = '0'.
APPEND ls_rangetab TO lt_rangetab.
IF NOT x_glyec IS INITIAL OR NOT x_glyec2 IS INITIAL. "1830344
ls_rangetab-sign = 'I'. "1830344
ls_rangetab-option = 'EQ'. "1830344
ls_rangetab-low = '5'. "1830344
ls_rangetab-high = '5'. "1830344
APPEND ls_rangetab TO lt_rangetab. "1830344
CLEAR ls_rangetab. "1852423
ENDIF. "1830344
ls_selection-t_range = lt_rangetab.
APPEND ls_selection TO ct_gt_selection.
** Added with note 1735824
* CLEAR ls_selection.
* REFRESH lt_rangetab.
* ls_selection-fieldname = 'RVERS'.
* ls_rangetab-sign = 'I'.
* ls_rangetab-option = 'EQ'.
* ls_rangetab-low = '001'.
* ls_rangetab-high = '0'.
* APPEND ls_rangetab TO lt_rangetab.
* ls_selection-t_range = lt_rangetab.
* APPEND ls_selection TO ct_gt_selection.
* fill ryear into gt_selection
CLEAR ls_selection.
REFRESH lt_rangetab.
ls_selection-fieldname = 'RYEAR'.
ls_rangetab-sign = 'I'.
ls_rangetab-option = 'EQ'.
ls_rangetab-low = ryear.
APPEND ls_rangetab TO lt_rangetab.
ls_selection-t_range = lt_rangetab.
APPEND ls_selection TO ct_gt_selection.
* fill rldnr into gt_selection
CLEAR ls_selection.
REFRESH lt_rangetab.
ls_selection-fieldname = 'RLDNR'.
ls_rangetab-sign = 'I'.
ls_rangetab-option = 'EQ'.
ls_rangetab-low = ut_rldnr.
APPEND ls_rangetab TO lt_rangetab.
ls_selection-t_range = lt_rangetab.
APPEND ls_selection TO ct_gt_selection.
*{ INSERT DEVK904683 1
DATA:
LV_ID TYPE ZTEXIT-ID, "增强序列号
LV_STATUS TYPE CHAR1. "增强状态
LV_ID = 'ZFI108'.
CALL FUNCTION 'ZABAP_CHECK_EXIT'
EXPORTING
ID = LV_ID
IMPORTING
E_STATUS = LV_STATUS.
IF LV_STATUS = 'S'.
CLEAR ls_selection.
REFRESH lt_rangetab.
ls_selection-fieldname = 'BLART'.
ls_rangetab-SIGN = 'E'.
ls_rangetab-option = 'EQ'.
ls_rangetab-low = 'CO'.
APPEND ls_rangetab TO lt_rangetab.
ls_selection-t_range = lt_rangetab.
APPEND ls_selection TO ct_gt_selection.
ENDIF.
*} INSERT
* Begin of note 2974898:
* Select only ACDOCA line items with MIG_SOURCE SPACE, G and F
* so that only 'normal' line items and archived line items (not e.g. MIG_SOURCE R and U)
* are displayed
* If also MIG_SOURCE R or U records (which are created e.g. without AUFNR) are displayed, there is the
* danger that FAGLB03 doesn't display the correct line items if e.g. an additional selection on AUFNR is used
DATA: ld_param_name LIKE FAGL_SETTINGS-PARAM_NAME,
ld_param_value LIKE FAGL_SETTINGS-PARAM_VALUE.
ld_param_name = 'FAGLB03_RESTRICT_MIG'.
CALL FUNCTION 'FAGL_GET_FAGL_SETTINGS'
EXPORTING
ID_PARAM_NAME = ld_param_name
IMPORTING
ED_VALUE = ld_param_value.
IF not ld_param_value IS INITIAL.
CLEAR ls_selection.
REFRESH lt_rangetab.
ls_selection-fieldname = 'MIG_SOURCE'.
ls_rangetab-sign = 'I'.
ls_rangetab-option = 'EQ'.
ls_rangetab-low = ' '.
APPEND ls_rangetab TO lt_rangetab.
ls_rangetab-low = 'G'.
APPEND ls_rangetab TO lt_rangetab.
ls_rangetab-low = 'F'.
APPEND ls_rangetab TO lt_rangetab.
ls_selection-t_range = lt_rangetab.
APPEND ls_selection TO ct_gt_selection.
endif.
* End of note 2974898
ENDFORM. " fill_gt_selections
结果与对比