728x90
(FI) 전기기간을 회사코드별로 관리하는 프로그램
REPORT ZFIR905.
TABLES BKPF.
DATA: BEGIN OF GT_OPVAR OCCURS 0,
OPVAR LIKE T001-OPVAR,
END OF GT_OPVAR.
DATA : GT_SELLIST TYPE VIMSELLIST OCCURS 0 WITH HEADER LINE.
SELECT-OPTIONS S_BUKRS FOR BKPF-BUKRS.
START-OF-SELECTION.
CLEAR : GT_OPVAR, GT_OPVAR[].
SELECT OPVAR
INTO CORRESPONDING FIELDS OF TABLE GT_OPVAR
FROM T001
WHERE BUKRS IN S_BUKRS
AND OPVAR <> ''.
DATA: LV_TABIX LIKE SY-TABIX,
LV_LINES TYPE I.
SORT GT_OPVAR BY OPVAR.
DELETE ADJACENT DUPLICATES FROM GT_OPVAR COMPARING ALL FIELDS.
DESCRIBE TABLE GT_OPVAR LINES LV_LINES.
LOOP AT GT_OPVAR.
LV_TABIX = SY-TABIX.
GT_SELLIST-VIEWFIELD = 'BUKRS'.
GT_SELLIST-OPERATOR = 'EQ'.
GT_SELLIST-VALUE = GT_OPVAR-OPVAR.
IF LV_TABIX < LV_LINES.
GT_SELLIST-AND_OR = 'OR'.
ENDIF.
APPEND GT_SELLIST.
CLEAR GT_SELLIST.
ENDLOOP.
CALL FUNCTION 'VIEW_MAINTENANCE_CALL'
EXPORTING
ACTION = 'U'
VIEW_NAME = 'V_T001B'
TABLES
DBA_SELLIST = GT_SELLIST.
반응형