Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

fb03 datum problem

Former Member
0 Likes
923

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.

1 ACCEPTED SOLUTION
Read only

JozsefSzikszai
Active Contributor
0 Likes
871

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

7 REPLIES 7
Read only

JozsefSzikszai
Active Contributor
0 Likes
872

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

Read only

0 Likes
871

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

Read only

0 Likes
871

Hi E.C !

THANKS A LOT . U REALLY SOLVED MY PROBLEM.

THANKS AGAIN.

Read only

0 Likes
871

hey i am not E.C !! thanks for the points by the way.

Read only

0 Likes
871

ha ha, so who really solved ur problem?

Read only

Former Member
0 Likes
871

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

Read only

0 Likes
871

thanks a lot .