12-25-2009 6:58 AM
Hi,
I had developed a vendor ageing report in which i am facing due to the dates i.e. As on date and select-option date. The As on date is sy-datum and other date is to sepcify from which date range it is displaying the date.
When i execute the report in it there Open date is sy datum and select option date i am taking 01.04.2007 so that when a user try to take data it can be done and match the data of Tcode FBL1N (only open items data ) of it. if remove the select option date or change the As on date from date remain same of selec option output gets wrong.
As on date is used basically used for calculating the number of days with the posting date so that no.. of days can be calculated.
Is there any way of displaying the right data.
12-25-2009 8:20 AM
Hi,
The one field "As On Date" is required to calculate the difference in days.
The other select option - is normally not required.
There are two tables which are very important. BSIK and BSAK.
BSIK stores open items, AS ON TODAY only.
BSAK stores closed items i.e. which have been cleared.
(But which were open at some time, in the past)
So, if on selection screen, if we give some past date, then that record will not be there in BSIK,
but it will be in BSAK with clearing date greater than or equal to the selection screen date.
So, we have to write query similar to
SELECT
bukrs lifnr umskz budat bldat blart bschl dmbtr augdt belnr buzei
shkzg rebzg rebzj rebzz gjahr
FROM bsik
INTO CORRESPONDING FIELDS OF TABLE t_bsik
FOR ALL ENTRIES IN t_lfb1
WHERE bukrs EQ p_bukrs
AND lifnr EQ t_lfb1-lifnr
* AND saknr EQ t_lfb1-akont
AND budat LE p_date.
SELECT bukrs lifnr umskz budat bldat blart
bschl dmbtr augdt belnr buzei shkzg rebzg rebzj rebzz gjahr
FROM bsak
INTO CORRESPONDING FIELDS OF TABLE t_bsak
FOR ALL ENTRIES IN t_lfb1
WHERE bukrs EQ p_bukrs
AND lifnr EQ t_lfb1-lifnr
AND budat LE p_date
AND augdt GT p_date.
IF NOT t_bsak IS INITIAL.
APPEND LINES OF t_bsak TO t_bsik.
ENDIF.
Note : In 2nd query for BSAK, we have to use AUGDT (clearing date) also.
Hope this helps.
Regards,
Amit Mittal.
12-25-2009 8:20 AM
Hi,
The one field "As On Date" is required to calculate the difference in days.
The other select option - is normally not required.
There are two tables which are very important. BSIK and BSAK.
BSIK stores open items, AS ON TODAY only.
BSAK stores closed items i.e. which have been cleared.
(But which were open at some time, in the past)
So, if on selection screen, if we give some past date, then that record will not be there in BSIK,
but it will be in BSAK with clearing date greater than or equal to the selection screen date.
So, we have to write query similar to
SELECT
bukrs lifnr umskz budat bldat blart bschl dmbtr augdt belnr buzei
shkzg rebzg rebzj rebzz gjahr
FROM bsik
INTO CORRESPONDING FIELDS OF TABLE t_bsik
FOR ALL ENTRIES IN t_lfb1
WHERE bukrs EQ p_bukrs
AND lifnr EQ t_lfb1-lifnr
* AND saknr EQ t_lfb1-akont
AND budat LE p_date.
SELECT bukrs lifnr umskz budat bldat blart
bschl dmbtr augdt belnr buzei shkzg rebzg rebzj rebzz gjahr
FROM bsak
INTO CORRESPONDING FIELDS OF TABLE t_bsak
FOR ALL ENTRIES IN t_lfb1
WHERE bukrs EQ p_bukrs
AND lifnr EQ t_lfb1-lifnr
AND budat LE p_date
AND augdt GT p_date.
IF NOT t_bsak IS INITIAL.
APPEND LINES OF t_bsak TO t_bsik.
ENDIF.
Note : In 2nd query for BSAK, we have to use AUGDT (clearing date) also.
Hope this helps.
Regards,
Amit Mittal.
12-25-2009 8:58 AM
Hi Amit,
Merry Christmas to you... and the problem i had solved it now by my self as there a condition problem in my days calculating and i am using only as on date only in my report selection and it is display exact for vendor ageing as it showned in FBL1N (Gran Total).
I am closing this thread ..
Regards,
Nav...