Domanda

I have a report that is getting info from bsis, bsas, bsid, bsad, vbrk, bkpf and bset. the problem is when there are two invoices with the same number, the report copies the info from the first line to the second. So, if invoice no.4100111596 has a tax total of 2.140,20 in the first line, the same invoice number has the same tax toal in the second, but the value is 40.140,64. What can I do? do I have to use the buzei field some where? Heres de code:

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.

I tried getting the buzei and it still gives me the same line twice. Here's the code, that I do before the code above:

SELECT c~kunnr a~belnr d~spart c~bldat c~waers c~wrbtr a~hwaer c~dmbtr c~buzei
      INTO CORRESPONDING FIELDS OF TABLE lt_data
        FROM ( ( ( bsis AS f
      INNER JOIN bkpf AS a ON f~belnr = a~belnr )
      INNER JOIN bsid AS c ON c~belnr = a~belnr )
      INNER JOIN vbrk AS d ON d~vbeln = c~belnr )
      WHERE a~gjahr IN gjahr
        AND a~bukrs IN bukrs
        AND a~blart = 'R1'
        AND f~hkont = '0034930020'
        AND ( c~mwskz = 'L0' OR c~mwskz = 'L1' OR c~mwskz = 'L2' ).
È stato utile?

Soluzione 2

Found the problem. I was doing the selection os the wrong fields i the wrong table. BKPF only gave me one line and BSET gave me two lines. So, I change the tables that was getting the fields from and it work just fine. Thank you.

Altri suggerimenti

-You have to use all key fields on your condition part of your "SELECT" in order to get a "SINGLE" line. Otherwise table might not return you a single line but you'll get the first line.

-So you have to use BUZEI field too on your condition in your select.

Hope it was helpful

Talha

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top