‎2007 Aug 23 9:13 AM
hi experts !
there is a program for displaying domestic sales figures as per
customer/document type/Invoice wise.
input data for report is
Company code
DOCUMENT TYPE
START DATE & END DATE
FINANCIAL YEAR.
problem is in date when i entered date 01.05.07 to 04.05.07 or 02.05.07 to 05.05.07 or 02.05.07 to 06.05.07 its taking data for all 3 line items in invoice and showing correct data. but if date is 01.05.07 to 05.05.07 or 01.05.07 to 06.05.07 its taking data for two line items leaving 1st line item in invoice . Date for these invoice creation is 02.05.07, its showing correct data for it . but not showing correct data in some date intervals(i.e its taking data for two line items leaving 1st line item in invoice ) . for other invoices its giving correct data except in this specific doc.no. otherwise it is correct . can anybody help me why its showing incorrect data for only one specific doc.no.
code for date is
i have checked fb03 and its showing correct 3 line items in invoice
FORM FORM_COLLECT_BKPF.
SELECT BUKRS BELNR GJAHR BLDAT BUDAT BLART XBLNR BKTXT USNAM CPUDT
CPUTM FROM BKPF
INTO CORRESPONDING FIELDS OF TABLE IT_BKPF
WHERE BUKRS = PR_BUKRS
AND GJAHR = PR_GJAHR
AND BLART IN SO_BLART
AND BUDAT IN SO_BUDAT
AND XREVERSAL = ''
AND BSTAT = ''.
FORM FORM_COLLECT_BSEG .
SELECT BUKRS BELNR GJAHR HKONT DMBTR KUNNR LIFNR BSCHL KOART MENGE
MWSKZ ZUONR MWSTS PRCTR FROM BSEG INTO CORRESPONDING FIELDS OF TABLE
IT_BSEG
FOR ALL ENTRIES IN IT_BKPF
WHERE
BELNR = IT_BKPF-BELNR AND
BUKRS = PR_BUKRS AND
GJAHR = PR_GJAHR.
ENDFORM.
‎2007 Aug 23 9:24 AM
hi ranjna,
if I understand right this is one document with three line items. In this case the problem is not with the BKPF selection, but with the line item selections. Pls. check your code or copy it here and people can have a look.
hope this helps
ec
‎2007 Aug 23 9:24 AM
hi ranjna,
if I understand right this is one document with three line items. In this case the problem is not with the BKPF selection, but with the line item selections. Pls. check your code or copy it here and people can have a look.
hope this helps
ec
‎2007 Aug 23 10:00 AM
ranjana,
Change the SQL to this -
FORM FORM_COLLECT_BSEG .
SELECT BUKRS BELNR GJAHR <b>BUZEI</b> HKONT DMBTR KUNNR LIFNR BSCHL KOART MENGE
MWSKZ ZUONR MWSTS PRCTR FROM BSEG INTO CORRESPONDING FIELDS OF TABLE
IT_BSEG
FOR ALL ENTRIES IN IT_BKPF
WHERE
BELNR = IT_BKPF-BELNR AND
BUKRS = PR_BUKRS AND
GJAHR = PR_GJAHR.
ENDFORM.
If you do this - you will get all the line items.
Make sure - You have added this BUZEI to ur internal table IT_BSEG also.
Normally - FOR ALL ENTRIES fetches unique entries based on the Fields you are trying to SELECT. As you missed the BUZEI , it was fetching the unique sets based on the fields you have selected
Hope it solves the problem.
Cheers.
SKC.
Message was edited by:
SKC
‎2007 Aug 23 12:01 PM
Hi E.C !
THANKS A LOT . U REALLY SOLVED MY PROBLEM.
THANKS AGAIN.
‎2007 Aug 23 12:07 PM
‎2007 Aug 23 12:09 PM
‎2007 Aug 23 10:50 AM
see the changes below, i hope it will solve your problem...
FORM FORM_COLLECT_BSEG .
if not IT_BKPF[] is initial.
SELECT BUKRS BELNR GJAHR HKONT DMBTR KUNNR LIFNR BSCHL KOART MENGE
MWSKZ ZUONR MWSTS PRCTR FROM BSEG INTO CORRESPONDING FIELDS OF TABLE
IT_BSEG
FOR ALL ENTRIES IN IT_BKPF
WHERE
BELNR = IT_BKPF-BELNR AND
BUKRS = IT_BKPF-BUKRS AND
GJAHR = IT_BKPF-GJAHR.
*Changes to code made here
*BUKRS = PR_BUKRS AND
*GJAHR = PR_GJAHR.
endif.
ENDFORM.
Reward points if useful, get back in case of query...
Cheers!!!
and do always check the previous internal table is not empty while using for all entries in.
Message was edited by:
Tripat Pal Singh
‎2007 Aug 23 11:57 AM