0

我试图总结一些价值观,但它一直给我奇怪的价值观。我正在发布代码以提供帮助,以及正在发生的事情的图像。

at end of kunnr.    

 soma-waers = <fs_main-waers.
 soma-wrbtr = <fs_main-wrbtr.
 soma-fwste = <fs_main-fwste.
 soma-hwaer = <fs_main-hwaer.
 soma-dmbtr = <fs_main-dmbtr.
 soma-hwste = <fs_main-hwste.
 APPEND soma TO it_soma.  



LOOP AT it_soma INTO soma.
   IF sy-tabix = 1.


     FORMAT COLOR COL_TOTAL INTENSIFIED OFF.
     SUM.
     WRITE: "/ sy-uline(137),
           / sy-vline NO-GAP,
             'Subtotal' NO-GAP,
            '-' NO-GAP,
            soma-waers,
            63 sy-vline NO-GAP,
            64 soma-wrbtr NO-GAP,
            sy-vline NO-GAP,
            soma-fwste NO-GAP,
            sy-vline NO-GAP,
            soma-hwaer NO-GAP,
            sy-vline NO-GAP,
            soma-dmbtr NO-GAP,
            sy-vline NO-GAP,
            soma-hwste NO-GAP,
            sy-vline NO-GAP,
           / sy-uline(137).


   ELSE.
   ENDIF.

 ENDLOOP.

 ENDAT.

在此处输入图像描述

4

2 回答 2

3

I think you made a wrong code sequence.

Inside a LOOP you can use AT-ENDAT. Do not use a LOOP inside the AT-ENDAT like in your code.

Your code should more look like this:

LOOP AT it_soma INTO soma.
  AT END OF kunnr.    
     FORMAT COLOR COL_TOTAL INTENSIFIED OFF.
     SUM.
     WRITE: "/ sy-uline(137),
           / sy-vline NO-GAP,
             'Subtotal' NO-GAP,
            '-' NO-GAP,
            soma-waers,
            63 sy-vline NO-GAP,
            64 soma-wrbtr NO-GAP,
            sy-vline NO-GAP,
            soma-fwste NO-GAP,
            sy-vline NO-GAP,
            soma-hwaer NO-GAP,
            sy-vline NO-GAP,
            soma-dmbtr NO-GAP,
            sy-vline NO-GAP,
            soma-hwste NO-GAP,
            sy-vline NO-GAP,
           / sy-uline(137).
  ENDAT.
ENDLOOP.

Other sources of Problems:

  • Your table must be sorted
于 2012-06-18T21:14:14.493 回答
-1

最后我需要清除内部表。它现在工作正常。谢谢你。

于 2012-06-19T10:03:53.680 回答