2007 Aug 04 6:36 AM
HI ALL I HAVE WRITTEN A REPORT AND I AM DISPLAYING THE OUTPUT OF EACH DISTRICT..
NOW THE REPORT IS SHOWING RIGHT WHEN IT IS CHANGING THE DISTRICT BUT IT IS NOT TRIGGERING AT THE END OF THE REPORT AS AFTER THAT THE DISTRICT IS NOT CHANGING..
I TRIED WITH AT END OF BUT IT IS SOME HOW SHOWING PROBLEM SO I USED A VARIBLE CONCEPT TO GET THE REPORT....
HERE IS THE REPORT can anyone please look at this and let me know how can i do that..
is there any method where i can used in the IF condition to get the last record...
==========================================================
&----
*& Report ZDISTRICT_CUST_AUCSALES
*&
&--THE PROGRAM USED TO DISPLAY THE TOTAL NUMBER OF CONSUMER IN A D.C.-
&----PROCESSED ON A PERTICULAR MONTH AND YEAR..--
*&
&----
REPORT ZDISTRICT_CUST_AUCSALES .
*TABLE DECLARATION*****************************************************
TABLES: /BIC/AUCSALES00,
/BIC/TCOKEY.
*DATA DECLARATION*****************************************************
DATA: BEGIN OF ITAB OCCURS 0,
/BIC/COKEY LIKE /BIC/TCOKEY-/BIC/COKEY,
TXTSH LIKE /BIC/TCOKEY-TXTSH,
END OF ITAB.
DATA: BEGIN OF ITAB2 OCCURS 0,
BILL_DATE LIKE /BIC/AUCSALES00-BILL_DATE,
/BIC/COKEY LIKE /BIC/AUCSALES00-/BIC/COKEY,
BPARTNER LIKE /BIC/AUCSALES00-BPARTNER,
END OF ITAB2.
DATA: COUNT TYPE I,
COKEY TYPE I,
COKEYNO(2) TYPE C,
COKEYCH(2),
BILDT TYPE I,
PROCOKEY TYPE I,
NOTPROCOKEY TYPE I,
TOTCOKEYDIV TYPE I,
TOTCOKEYDIV1 TYPE I,
TOTCOKEYDIV2 TYPE I,
TOTAL TYPE I.
DATA: C TYPE I VALUE 4.
SELECT OPTION FOR DATE SELECTION IN THE SELECTION SCREEN.************
SELECTION-SCREEN BEGIN OF BLOCK DATE WITH FRAME TITLE TEXT-001.
PARAMETERS: S_BILDT LIKE /BIC/AUCSALES00-BILL_DATE OBLIGATORY .
SELECTION-SCREEN END OF BLOCK DATE.
*INITIALIZATION******************************************************
FORMAT INTENSIFIED ON COLOR = C.
write:/ 'PROCESSING DATE:', 20 S_BILDT,
128 'TIME:', 135 SY-UZEIT.
WRITE:/ 'USER NAME :', 20 SY-UNAME,
142 ' '.
WRITE SY-ULINE.
WRITE: / 'D.C' , 12 SY-VLINE,
'NAME OF D.C' , 39 SY-VLINE,
'NUMBER OF CONSUMER' , 60 SY-VLINE,
'REMARKS' , 105 SY-VLINE.
WRITE:/ SY-ULINE.
FORMAT INTENSIFIED OFF.
*AT SELECTION-SCREEN**************************************************
SELECT BILL_DATE
UP TO 1 ROWS
INTO (/BIC/AUCSALES00-BILL_DATE)
FROM /BIC/AUCSALES00
WHERE BILL_DATE = S_BILDT.
ENDSELECT.
IF SY-SUBRC <> 0.
WRITE:/ ' NO DATA FOUND ON THIS DATE'.
EXIT.
ENDIF.
START OF SELECTION***************************************************
SELECT /BIC/COKEY TXTSH from /BIC/TCOKEY into table itab.
SORT ITAB.
IF NOT ITAB[] IS INITIAL.
SELECT BILL_DATE
/BIC/COKEY
BPARTNER
FROM /BIC/AUCSALES00
INTO CORRESPONDING FIELDS OF TABLE ITAB2
FOR ALL ENTRIES IN ITAB
WHERE /BIC/COKEY = ITAB-/BIC/COKEY
AND BILL_DATE = S_BILDT.
SORT ITAB BY /BIC/COKEY.
ENDIF.
*CHECK WHETHER THE DATA RETRIVE SUCESSFULLY OR NOT********************
IF SY-SUBRC NE 0.
WRITE:/ 'THIS DATE DOESNOT CONTAIN ANY DATA'.
ENDIF.
*DATA DISPLAY*********************************************************
*****GET THE FIRST VALUE AND DELETE THE ADJECENT AND DUPLICATE FROM ITAB2.
READ TABLE ITAB INDEX 1.
IF SY-SUBRC = 0.
COKEYNO = ITAB-/BIC/COKEY+4(2).
ENDIF.
READ TABLE ITAB2 WITH KEY /BIC/COKEY = itab-/BIC/COKEY.
IF SY-SUBRC = 0.
SORT ITAB2 BY /BIC/COKEY.
DELETE ADJACENT DUPLICATES FROM ITAB2 COMPARING /BIC/COKEY.
ENDIF.
LOOP AT ITAB.
READ TABLE ITAB2 WITH KEY /BIC/COKEY = itab-/BIC/COKEY.
*IF THE D.C ARE NOT SAME THEN DISPLAY THE SUM***************************
COKEYCH = ITAB-/BIC/COKEY+4(2).
IF ( COKEYCH <> COKEYNO ).
FORMAT COLOR = 4.
WRITE:/ ' TOTAL NUMBER OF D.C IN PERTICULAR RAO ','(', COKEYNO,')','=',TOTCOKEYDIV.
WRITE:/ ' TOTAL NUMBER OF CONSUMER PROCESSED IN RAO ','(', COKEYNO,')','=',TOTAL.
WRITE:/ ' TOTAL NUMBER OF D.C PROCESSED IN RAO ','(', COKEYNO,')','=',PROCOKEY.
WRITE:/ ' TOTAL NUMBER OF D.C NOT PROCESSED IN RAO ','(', COKEYNO,')','=',NOTPROCOKEY.
WRITE:/ '', 128 'PAGE NUMBER:', 139 SY-PAGNO.
SKIP 4.
*******INITIALLIZE ALL THE VARIABLE*************************************
FORMAT COLOR OFF .
TOTCOKEYDIV = 0.
TOTCOKEYDIV1 = 0.
TOTCOKEYDIV2 = 0.
TOTAL = 0.
PROCOKEY = 0.
NOTPROCOKEY = 0.
WRITE:/ SY-ULINE.
NEW-PAGE WITH-TITLE.
NEW-PAGE WITH-HEADING.
ENDIF.
**END OF THE TOTAL SUM OF ALL THE D.C.**********************************
*IF THE D.C ARE SAME THEN DISPLAY THE D.C.******************************
IF ITAB2-/BIC/COKEY = ITAB-/BIC/COKEY.
SELECT COUNT( DISTINCT BPARTNER )
INTO COUNT
FROM /BIC/AUCSALES00
WHERE /BIC/COKEY = ITAB2-/BIC/COKEY and
BILL_DATE = S_BILDT.
IF SY-SUBRC = 0.
PROCOKEY = PROCOKEY + 1.
ENDIF.
TOTCOKEYDIV1 = TOTCOKEYDIV1 + 1.
TOTAL = TOTAL + COUNT.
COKEY = ITAB2-/BIC/COKEY.
FORMAT INTENSIFIED ON COLOR = 2.
WRITE:/ ITAB2-/BIC/COKEY, SY-VLINE,
15 ITAB-TXTSH+1(19), 39 SY-VLINE,
40 COUNT, 60 SY-VLINE,
' ', 105 SY-VLINE.
WRITE 😕 SY-ULINE.
FORMAT INTENSIFIED ON COLOR = 2.
ELSE.
FORMAT INTENSIFIED ON COLOR = 2.
COKEY = ITAB-/BIC/COKEY.
WRITE:/ ITAB-/BIC/COKEY, SY-VLINE,
15 ITAB-TXTSH+1(19), 39 SY-VLINE,
40 ' ', 60 SY-VLINE,
'Data Not extracted to BW', 105 SY-VLINE.
FORMAT INTENSIFIED ON COLOR = 2.
WRITE:/ SY-ULINE.
TOTCOKEYDIV2 = TOTCOKEYDIV2 + 1.
ENDIF.
TOTCOKEYDIV = TOTCOKEYDIV1 + TOTCOKEYDIV2.
NOTPROCOKEY = TOTCOKEYDIV - PROCOKEY.
COKEYNO = ITAB-/BIC/COKEY+4(2).
CLEAR: ITAB, ITAB2.
ENDLOOP.
===========================================================
please at this and let me know..
thanks in advance,,,
2007 Aug 04 7:03 AM
HI ALL ,
I GOT THE ANSWER...
THANKS TO SDNNNN AND ALL THE FRIENDS LOOKING AT THIS...
THANKS ONCE AGAIN....