私はレポートを作成してきましたが、現在は品質サーバーにあります。問題は、開発中は正常に機能していましたが、現在はすべてではなく一部の請求書番号を繰り返し、1つの請求書に対して2回、別の請求書に対して4回繰り返しています。それがコードの問題なのか、それとも他の何かなのかわかりません。コードは次のとおりです。
IF kunnr[] IS INITIAL
AND belnr[] IS INITIAL
AND spart IS NOT INITIAL
AND gjahr[] IS NOT INITIAL
AND bukrs[] IS NOT INITIAL
AND allgstid IS INITIAL
AND augdt[] IS NOT INITIAL
AND budat[] IS INITIAL
AND kbetr IS INITIAL
AND vkorg IS INITIAL.
SELECT c~kunnr a~belnr d~spart a~bldat a~waers c~wrbtr a~hwaer c~dmbtr
INTO CORRESPONDING FIELDS OF TABLE lt_data
FROM ( ( bkpf AS a
INNER JOIN bsad AS c ON c~belnr = a~belnr )
INNER JOIN vbrk AS d ON d~xblnr = c~belnr )
WHERE a~gjahr IN gjahr
AND a~bukrs IN bukrs
AND d~spart = spart
AND c~augdt IN augdt.
IF sy-subrc <> 0.
MESSAGE i425.
ENDIF.
ENDIF.
LOOP AT lt_data ASSIGNING <fs_main>.
CLEAR <fs_main>-kbetr.
CLEAR <fs_main>-fwste.
CLEAR <fs_main>-hwste.
IF kbetr IS INITIAL.
SELECT SINGLE kbetr fwste hwste
FROM bset
INTO (<fs_main>-kbetr, <fs_main>-fwste, <fs_main>-hwste)
WHERE belnr = <fs_main>-belnr
AND bukrs IN bukrs
AND gjahr IN gjahr
AND mwskz BETWEEN 'L0' AND 'L2'.
ELSE.
SELECT SINGLE kbetr fwste hwste
FROM bset
INTO (<fs_main>-kbetr, <fs_main>-fwste, <fs_main>-hwste)
WHERE belnr = <fs_main>-belnr
AND bukrs IN bukrs
AND gjahr IN gjahr
AND mwskz BETWEEN 'L0' AND 'L2'
AND kbetr = kbetr.
ENDIF.
AT NEW kunnr.
SELECT SINGLE name1 FROM kna1
INTO (wa_bseg-name1)
WHERE kunnr = <fs_main>-kunnr.
IF sy-subrc = 0.
FORMAT COLOR COL_TOTAL INTENSIFIED ON.
WRITE:/ sy-uline(137), / sy-vline NO-GAP,
2 'Entidade: ', <fs_main>-kunnr, wa_bseg-name1,
137 sy-vline NO-GAP, / sy-uline(137).
ENDIF.
ENDAT.
FORMAT COLOR COL_NORMAL INTENSIFIED OFF.
WRITE:/
sy-vline NO-GAP,
(16) <fs_main>-belnr NO-GAP,
sy-vline NO-GAP,
(16) <fs_main>-spart CENTERED NO-GAP,
sy-vline NO-GAP,
(10) <fs_main>-bldat NO-GAP,
sy-vline NO-GAP.
perc = <fs_main>-kbetr / 10.
WRITE: (10) perc NO-GAP,
sy-vline NO-GAP,
(5) <fs_main>-waers NO-GAP,
sy-vline NO-GAP,
(16) <fs_main>-wrbtr NO-GAP,
sy-vline NO-GAP,
(16) <fs_main>-fwste NO-GAP,
sy-vline NO-GAP,
(5) <fs_main>-hwaer NO-GAP,
sy-vline NO-GAP,
(16) <fs_main>-dmbtr NO-GAP,
sy-vline NO-GAP,
(16) <fs_main>-hwste NO-GAP,
sy-vline NO-GAP.
WRITE:/ sy-uline(137).