人法地,地法天,天法道,道法自然
分类:
2009-03-27 15:36:39
供应商物料凭证清单讨论
该报表的开发类似MB51,且显示的格式要求也与之一至,但是另外要求,显示数据要按照物料编码(MATNR)、移动类型(BWART)、供应商(LIFNR)进行小计:
东园公 2009-3-26 15:08:28
大哥:请教
ALV程序中如何设置两列来小总数量,我试过,一列的话没问题,但两列时运行出错!代码如下:
form e02_layout_sort_build changing lt_sort type slis_t_sortinfo_alv.
data ls_sort type slis_sortinfo_alv.
clear ls_sort.
ls_sort-fieldname = 'MATNR'.
ls_sort-spos = 1.
ls_sort-up = 'X'.
ls_sort-subtot = 'X'.
append ls_sort to lt_sort.
* CLEAR ls_sort.
* ls_sort-fieldname = 'BWART'.
* ls_sort-spos = 2.
* ls_sort-up = 'X'.
* ls_sort-subtot = 'X'.
* APPEND ls_sort TO lt_sort.
*
* CLEAR ls_sort.
* ls_sort-fieldname = 'LIFNR'.
* ls_sort-spos = 3.
* ls_sort-up = 'X'.
* ls_sort-subtot = 'X'.
* APPEND ls_sort TO lt_sort.
endform.
你看看我是哪里设置不对?
Gary.C? 2009-3-26 16:08:18
目前没看出啥问题
Gary.C? 2009-3-26 16:08:20
都是对的
Gary.C? 2009-3-26 16:08:25
报错内容是啥
Gary.C? 2009-3-26 16:08:53
首先你要确定你的字段是不是C类型
Gary.C? 2009-3-26 16:09:02
P小计是无用的
Gary.C? 2009-3-26 16:09:10
而且你要是小计两个P类型可能会出错
Gary.C? 2009-3-26 16:09:18
N 和 C类型可以
东园公 2009-3-26 16:09:26
我找给你看看
Gary.C? 2009-3-26 16:09:39
我看了你都是C N类型,应该没啥问题
东园公 2009-3-26 16:09:59
Error when generating text environment.
Gary.C? 2009-3-26 16:10:04
请问。。有没有写错字段名。。
Gary.C? 2009-3-26 16:10:14
生成测试环境错误?
Gary.C? 2009-3-26 16:10:18
你怎么确定就是这边的问题
Gary.C? 2009-3-26 16:10:26
你打断点到那了么?
东园公 2009-3-26 16:10:44
不是这个错误
Gary.C? 2009-3-26 16:10:51
你如果就小计这三个是没问题的
东园公 2009-3-26 16:11:06
Invalid dynamic line component.
Gary.C? 2009-3-26 16:11:09
肯定没问题,你打个断点在那吧先,看问题出在哪块
东园公 2009-3-26 16:11:09
呵呵
东园公 2009-3-26 16:11:16
好的
东园公 2009-3-26 16:11:24
When the ABAP program "SAPLKKBL" attempted
table "RT_OUTTAB[]" with "SORT", a compone
as the contents of the field "A02".
Gary.C? 2009-3-26 16:11:26
对,看DUMP在哪行
东园公 2009-3-26 16:11:33
错误分析是上面那个
东园公 2009-3-26 16:11:39
说是移动类型那字段
东园公 2009-3-26 16:12:36
- "BWART " contained significant trailing spaces (only possible with type
STRING).
Gary.C? 2009-3-26 16:12:45
。。。
Gary.C? 2009-3-26 16:12:50
你BWART是怎么定义的
Gary.C? 2009-3-26 16:13:22
你是就按照移动类型那样定义的?NUM4还是什么
Gary.C? 2009-3-26 16:13:25
STRING?
Gary.C? 2009-3-26 16:13:57
STRING好像是会出现小计的问题,我好像记得点
东园公 2009-3-26 16:14:26
bwart like mseg-bwart
Gary.C? 2009-3-26 16:15:03
那你内表中的NUMC里的内容是什么?
东园公 2009-3-26 16:15:38
form build_runtimetable.
rx'MSEG MATNR +01+01'.
rx'MSEG WERKS +02+02'.
rx'MSEG LGORT +03+03'.
rx'MSEG BWART +07+04'.
rx'MSEG SOBKZ +08+05'.
rx'MKPF MBLNR 00+06'.
rx'MSEG ZEILE 00+07'.
rx'MKPF BUDAT +09+08'.
rx'MSEG ERFMG 00+09QERFME-'.
rx'MSEG ERFME 00+10 +'.
rx'MSEG ANLN1 00 00'.
rx'MSEG ANLN2 00 00'.
rx'MSEG APLZL 00+00'.
rx'MSEG AUFNR 00 00'.
rx'MSEG AUFPL 00+00'.
rx'MKPF BKTXT 00 00'.
rx'MKPF BLDAT 00 00'.
rx'MSEG BPMNG 00+00QBPRME-'.
rx'MSEG BPRME 00+00 +'.
rx'MSEG BSTME 00 00 +'.
rx'MSEG BSTMG 00 00QBSTME-'.
rx'MSEG BUKRS 00 00'.
rx'MSEG BWTAR 00 00'.
rx'MSEG CHARG +04+00'.
rx'MKPF CPUDT +09+08'.
rx'MKPF CPUTM 00+00'.
rx'MSEG DMBTR 00 00CWAERS-X'.
rx'MSEG EBELN 00+00'.
rx'MSEG EBELP 00+00'.
rx'MSEG EXBWR 00 00CWAERS-'.
rx'MSEG EXVKW 00 00CWAERS-'.
rx'MSEG GRUND 00 00'.
rx'MSEG KDAUF 00 00'.
rx'MSEG KDEIN 00 00'.
rx'MSEG KDPOS 00 00'.
rx'MSEG KOSTL 00 00'.
rx'MSEG KUNNR +06+00'.
rx'MSEG KZBEW 00+00'.
rx'MSEG KZVBR 00+00'.
rx'MSEG KZZUG 00+00'.
rx'MSEG LIFNR +05+00'.
rx'MSEG MEINS 00+00 +'.
rx'MSEG MENGE 00+00QMEINS-'.
rx'MKPF MJAHR 00+00'.
rx'MSEG NPLNR 00+00'.
rx'MSEG PS_PSP_PNR 00+00'.
rx'MSEG RSNUM 00 00'.
rx'MSEG RSPOS 00 00'.
rx'MSEG SHKZG 00+00'.
rx'MKPF USNAM +10+00'.
rx'MKPF VGART +11+00'.
rx'MSEG VKWRT 00 00CWAERS-X'.
rx'MSEG WAERS 00 00 +X'.
rx'MSEG WEMPF 00 00'.
rx'MKPF XABLN 00 00'.
rx'MSEG XAUTO 00 00'.
rx'MKPF XBLNR 00 00'.
rx'MSEG SGTXT 00 00'.
endform. "build_runtimetable
东园公 2009-3-26 16:15:55
是这样的,他是调用了宏
东园公 2009-3-26 16:15:58
在宏中定义的
东园公 2009-3-26 16:16:12
rx'MSEG BWART +07+04'.
Gary.C? 2009-3-26 16:16:33
rx'MSEG BWART +07+04'.?
东园公 2009-3-26 16:16:41
ls_sort-spos = 2.
这个位置和定义的位置有关吗?
Gary.C? 2009-3-26 16:16:50
没
Gary.C? 2009-3-26 16:16:54
这个是汇总的先后顺序
东园公 2009-3-26 16:17:32
rx 的定义是这样的:
DEFINE rx.
cs = &1.
append cs to rtt.
END-OF-DEFINITION.
东园公 2009-3-26 16:17:45
哦
东园公 2009-3-26 16:18:52
DATA: BEGIN OF rtt OCCURS 0.
INCLUDE STRUCTURE cs.
DATA: END OF rtt.
东园公 2009-3-26 16:18:59
rtt的定义
东园公 2009-3-26 16:19:18
CS的定义:
DATA: BEGIN OF cs,
tabname(5), "MKPF or MSEG
fieldname(12), "fieldname
selection(1), "status for selection screen
selection_position(2), "mandatory position on sel screen
output(1), "status for output list
output_position(2), "mandatory position on output list
cqindicator(1), "does it need a UNIT/CURR field?
cqfieldname(5), "what it's name
color(1), "does it need to be colorized?
fiauth(1), "does it require auth. checks?
END OF cs.
东园公 2009-3-26 16:19:28
有点像mb51里面的程序
Gary.C? 2009-3-26 16:20:36
恩。呃
东园公 2009-3-26 16:24:31
设断点,那个没错!~
东园公 2009-3-26 16:24:46
CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = sy-repid
I_CALLBACK_PF_STATUS_SET = 'SET_STATUS'
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
IS_LAYOUT = gs_layout
IT_FIELDCAT = fc_hier[]
I_SAVE = 'A'
I_TABNAME_HEADER = 'HEADER'
I_TABNAME_ITEM = 'LIST'
IS_KEYINFO = alv_keyinfo
I_BYPASSING_BUFFER = 'X'
I_BUFFER_ACTIVE = ' '
IT_SORT = it_sort[]
TABLES
T_OUTTAB_HEADER = HEADER
T_OUTTAB_ITEM = LIST
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
.
东园公 2009-3-26 16:24:57
CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = sy-repid
I_CALLBACK_PF_STATUS_SET = 'SET_STATUS'
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
IS_LAYOUT = gs_layout
IT_FIELDCAT = fc_hier[]
I_SAVE = 'A'
I_TABNAME_HEADER = 'HEADER'
I_TABNAME_ITEM = 'LIST'
IS_KEYINFO = alv_keyinfo
I_BYPASSING_BUFFER = 'X'
I_BUFFER_ACTIVE = ' '
IT_SORT = it_sort[]
TABLES
T_OUTTAB_HEADER = HEADER
T_OUTTAB_ITEM = LIST
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
.
东园公 2009-3-26 16:25:16
看看这个的设置:IT_SORT = it_sort[]
东园公 2009-3-26 16:25:22
有问题吗?
东园公 11:03:59
暗暗大哥:原因找到了,lifnr,bwart不是作为表头显示的字段,所以设置汇总时出错,只把这两个字段放在表头显示,MB51里作为表头显示的字段只有,matnr,maktx,werks,name1,而bwart,lifnr在栏(职)位(当前变式格式中是这样显示)中;现在加上bawrt,lifnr加入到表头中!
东园公 11:09:06
现在有一个问题,能不能只按matnr,bwart,lifnr小计,现在的小计显示是这样的,分了三层小计,第一层:matnr,bwart,lifnr;第二次:matnr,bwart;第三层:matnr;
我将: ls_sort-spos = 1.全设置为1,还是一样的结果