ALV 报表的问题

[复制链接]
查看11 | 回复9 | 2013-7-2 19:27:39 | 显示全部楼层 |阅读模式
REPORTYTEST26.
*定义内表
DATA WA_SPFLI LIKE TABLE OF SPFLI WITH HEADER LINE.
*内表赋值
SELECT * INTO TABLE WA_SPFLI FROM SPFLI.
*通过数据字典结构显示ALV
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
I_STRUCTURE_NAME = 'SPFLI'
TABLES
T_OUTTAB = WA_SPFLI
EXCEPTIONS
PROGRAM_ERROR= 1
OTHERS = 2.
IF SY-SUBRC0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
这是一个ALV报表的例子.里面就用了一个透明表.运行正常. 但我用多个透明表连接成的内表.生成ALV,就不行了,出不了数据.哪借了,麻烦哪位达人帮看看.
REPORTztest26.
*TYPE-POOLS: slis.
TABLES: mara, makt, mard, mbew.
DATA: BEGIN OF itab OCCURS 0,
matnr LIKEmard-matnr,
labst LIKEmard-labst,
END OF itab.
DATA: matnr LIKE mara-matnr, "'material number
maktx LIKE makt-maktx, "'material discribe
labst LIKE mard-labst, "'material store
topri LIKE mbew-verpr, "'TOTAL PRICE
mopri LIKE mbew-verpr, "'MOVE PRICE
stpri LIKE mbew-stprs. "'STAND PRICE
TYPES: BEGIN OF itab2 , "OCCURS 0,
matnr LIKE mara-matnr, "'material number
maktx LIKE makt-maktx, "'material discribe
labst LIKE mard-labst, "'material store
topri LIKE mbew-verpr, "'TOTAL PRICE
mopri LIKE mbew-verpr, "'MOVE PRICE
stpri LIKE mbew-stprs, "'STAND PRICE
END OF itab2.
DATA itab1 TYPE TABLE OF itab2 WITH HEADER LINE.
TYPESwa TYPE itab2.
*data:itab2 TYPE itab1.
*TYPES itab2 like itab1.
SELECT-OPTIONS matnr1 FORmara-matnr.
SELECT matnr SUM( labst ) INTO TABLE itab
FROM mard
GROUP BY matnr .
ULINE AT /1(108).
SELECT a~matnr MIN( b~maktx ) AS maktx SUM( c~labst ) AS labst
d~verpr d~stprs
INTO (matnr, maktx, labst, mopri, stpri)
FROM mara AS a INNER JOIN makt AS b ON a~matnr = b~matnr
INNER JOIN mard AS c ON a~matnr = c~matnr
INNER JOIN mbew AS d ON a~matnr = d~matnr
WHERE a~matnr IN matnr1
GROUP BY a~matnr d~verpr d~stprs
ORDER BY a~matnr.
itab1-matnr = matnr.
itab1-maktx = maktx.
itab1-labst = labst.
topri = labst * mopri.
itab1-mopri = mopri.
itab1-stpri = stpri.
APPENDitab1.
ENDSELECT.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_structure_name
= 'itab2'
TABLES
t_outtab
= itab1
EXCEPTIONS
program_error
= 1
OTHERS
= 2.
IF sy-subrc0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
回复

使用道具 举报

千问 | 2013-7-2 19:27:39 | 显示全部楼层
原帖由 SDERP 于 2008-10-31 17:09 发表
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_structure_name
= 'itab2'
TABLES
t_outtab
= itab1
EXCEPTIONS
program_error
= 1
OTHERS
= 2.

Internal output table structure name
Description
If the internal output table is defined via an ABAP/4 Dictionary
structure (INCLUDE STRUCTURE struct or LIKE struct), the field catalog
can be built-up automatically by passing the structure name.
The field catalog is internally built up for this structure as follows:
o All fields are in the list (NO_OUT = SPACE) except fields of data
type CLNT.
o The key fields of the Dictionary structure are also key fields in
the field catalog.
o Dictionary references to unit fields are copied if the reference
fields are in the structure.
o If a field catalog is also passed as parameter, the structure
information is combined with this field catalog.
For further information about the automatic build-up of the field
catalog, see the documentation of the function module
回复

使用道具 举报

千问 | 2013-7-2 19:27:39 | 显示全部楼层


原帖由 rosefish 于 2008-10-31 17:30 发表

Internal output table structure name
Description
If the internal output table is defined via an ABAP/4 Dictionary
structure (INCLUDE STRUCTURE struct or LIKE struct), the field catalog
can be built-up automatically by passing the structure name.
The field catalog is internally built up for this structure as follows:
o All fields are in the list (NO_OUT = SPACE) except fields of data
type CLNT.
o The key fields of the Dictionary structure are also key fields in
the field catalog.
o Dictionary references to unit fields are copied if the reference
fields are in the structure.
o If a field catalog is also passed as parameter, the structure
information is combined with this field catalog.
For further information about the automatic build-up of the field
catalog, see the documentation of the function module

回复

使用道具 举报

千问 | 2013-7-2 19:27:39 | 显示全部楼层
学习
回复

使用道具 举报

千问 | 2013-7-2 19:27:39 | 显示全部楼层
原帖由 rosefish 于 2008-10-31 17:30 发表

Internal output table structure name
Description
If the internal output table is defined via an ABAP/4 Dictionary
structure (INCLUDE STRUCTURE struct or LIKE struct), the field catalog
can be built-up automatically by passing the structure name.
The field catalog is internally built up for this structure as follows:
o All fields are in the list (NO_OUT = SPACE) except fields of data
type CLNT.
o The key fields of the Dictionary structure are also key fields in
the field catalog.
o Dictionary references to unit fields are copied if the reference
fields are in the structure.
o If a field catalog is also passed as parameter, the structure
information is combined with this field catalog.
For further information about the automatic build-up of the field
catalog, see the documentation of the function module



高手一出招就搞定哦!
回复

使用道具 举报

千问 | 2013-7-2 19:27:39 | 显示全部楼层
搞的这么复杂,这样不就可以了吗。
REPORTztest26.
TYPE-POOLS: slis.
TABLES: mara, makt, mard, mbew.
DATA WS_FIELDCAT TYPE slis_t_fieldcat_alv WITH HEADER LINE.
DATA: BEGIN OF itab OCCURS 0,
matnr LIKEmard-matnr,
labst LIKEmard-labst,
END OF itab.
DATA: BEGIN OF itab1 OCCURS 0,
matnr LIKE mara-matnr, "'material number
maktx LIKE makt-maktx, "'material discribe
labst LIKE mard-labst, "'material store
verpr LIKE mbew-verpr, "'TOTAL PRICE
stprs LIKE mbew-stprs, "'STAND PRICE
END OF itab1.
SELECT-OPTIONS matnr1 FORmara-matnr.
SELECT matnr SUM( labst ) INTO TABLE itab
FROM mard
GROUP BY matnr .
ULINE AT /1(108).
SELECT A~MATNR MIN( b~maktx ) AS maktx SUM( c~labst ) AS labst
d~verpr d~stprs
INTO TABLE ITAB1
FROM mara AS a INNER JOIN makt AS b ON a~matnr = b~matnr
INNER JOIN mard AS c ON a~matnr = c~matnr
INNER JOIN mbew AS d ON a~matnr = d~matnr
WHERE a~matnr IN matnr1
GROUP BY a~matnr d~verpr d~stprs
ORDER BY a~matnr.
PERFORM get_fieldcat.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
* I_INTERFACE_CHECK
= ' '
* I_BYPASSING_BUFFER
=
* I_BUFFER_ACTIVE
= ' '
* I_CALLBACK_PROGRAM
= ' '
* I_CALLBACK_PF_STATUS_SET = ' '
* I_CALLBACK_USER_COMMAND= ' '
* I_STRUCTURE_NAME
=
* IS_LAYOUT
=
IT_FIELDCAT
= WS_FIELDCAT[]
* IT_EXCLUDING
=
* IT_SPECIAL_GROUPS
=
* IT_SORT
=
* IT_FILTER
=
* IS_SEL_HIDE
=
* I_DEFAULT
= 'X'
I_SAVE
= 'A'
* IS_VARIANT
=
* IT_EVENTS
=
* IT_EVENT_EXIT
=
* IS_PRINT
=
* IS_REPREP_ID
=
* I_SCREEN_START_COLUMN
= 0
* I_SCREEN_START_LINE
= 0
* I_SCREEN_END_COLUMN
= 0
* I_SCREEN_END_LINE
= 0
* IR_SALV_LIST_ADAPTER =
* IT_EXCEPT_QINFO
=
* I_SUPPRESS_EMPTY_DATA
= ABAP_FALSE
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER=
* ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab
= ITAB1
* EXCEPTIONS
* PROGRAM_ERROR
= 1
* OTHERS
= 2

.
IF sy-subrc0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

FORM get_fieldcat.
CLEAR WS_fieldcat.
WS_fieldcat-tabname = 'ITAB1'.
WS_fieldcat-fieldname = 'MATNR'.
WS_fieldcat-col_pos = 1.
" Position on screen
WS_fieldcat-seltext_l = '物料号'.
*WS_fieldcat-key = 'X'.
WS_fieldcat-outputlen = 18.
APPEND ws_fieldcat.
CLEAR ws_fieldcat.
WS_fieldcat-tabname = 'ITAB1'.
ws_fieldcat-fieldname = 'MAKTX'.
ws_fieldcat-col_pos = 2.
" Position on screen
ws_fieldcat-seltext_l = '物料编码'.
* WS_LAYOUT-BOX_FIELDNAME = 'BOX'.
*ws_fieldcat-key = 'X'.
ws_fieldcat-outputlen = 40.
APPEND ws_fieldcat.
CLEAR ws_fieldcat.
ws_fieldcat-tabname = 'ITAB1'.
ws_fieldcat-fieldname = 'LABST'.
ws_fieldcat-col_pos = 3.
" Position on screen
ws_fieldcat-seltext_l = '数量'.
ws_fieldcat-outputlen = 17.
APPEND ws_fieldcat.
CLEAR ws_fieldcat.
ws_fieldcat-tabname = 'ITAB1'.
ws_fieldcat-fieldname = 'VERPR'.
ws_fieldcat-col_pos = 4.
" Position on screen
ws_fieldcat-seltext_l = '移动平均价格/周期单价'.
ws_fieldcat-outputlen = 17.
APPEND ws_fieldcat.
CLEAR ws_fieldcat.
ws_fieldcat-tabname = 'ITAB1'.
ws_fieldcat-fieldname = 'STPRS'.
ws_fieldcat-col_pos = 5.
" Position on screen
ws_fieldcat-seltext_l = '标准价格'.
ws_fieldcat-outputlen = 17.
APPEND ws_fieldcat.
ENDFORM.
回复

使用道具 举报

千问 | 2013-7-2 19:27:39 | 显示全部楼层
汗...... 這程序能在開發机上跑么. 性能可以么.
回复

使用道具 举报

千问 | 2013-7-2 19:27:39 | 显示全部楼层
你说我吗?为什么这么说呢,我刚跑了,只要物料号给个范围就可以。
回复

使用道具 举报

千问 | 2013-7-2 19:27:39 | 显示全部楼层
沒事.
回复

使用道具 举报

千问 | 2013-7-2 19:27:39 | 显示全部楼层
原帖由 shenzhen_sap 于 2008-11-1 09:47 发表
沒事.

说说看吗。哪些地方不足
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行