Hi all,
i am trying to get the ffew feilds with the count of one specific feild called as bpartner but the cursor doesnot move inside the select and directly going to the message and thowing the message as output..
can u please check it out and let me know where i have to change the query....and if the code whatever is written is right or not....
thanks in advance,,,
REPORT ZDISTRICT_CUST_AUCSALES00.
TABLES: /BIC/AUCSALES00,
/BIC/TCOKEY.
DATA: BEGIN OF ITAB OCCURS 0,
BILL_DATE LIKE /BIC/AUCSALES00-BILL_DATE,
/BIC/COKEY LIKE /BIC/AUCSALES00-/BIC/COKEY,
BPARTNER LIKE /BIC/AUCSALES00-BPARTNER,
TXTSH LIKE /BIC/TCOKEY-TXTSH,
CUSTOMER TYPE I,
END OF ITAB.
DATA: BILDT LIKE /BIC/AUCSALES00-BILL_DATE.
SELECT-OPTIONS: S_BILDT FOR /BIC/AUCSALES00-BILL_DATE.
**AT SELECTION-SCREEN.
IF NOT s_bildt IS INITIAL.
write:/ 'please enter a value'.
SELECT * FROM /BIC/AUCSALES00
INTO BILDT
WHERE BILL_DATE EQ S_BILDT.
ENDIF.
IF SY-SUBRC <> 0.
WRITE:/ 'please enter a '.
MESSAGE E010 WITH 'NOT A VALID DATE'(003) S_BILL_DATE 'Found'(004).
ENDIF.
<b>SELECT A~BILL_DATE
A~/BIC/COKEY
A~BPARTNER
COUNT( DISTINCT A~BPARTNER )
B~TXTSH
INTO (BILL_DATE, COKEY, BPARTNER, COUNT, TXTSH)
INTO CORRESPONDING FIELDS OF TABLE ITAB
FROM /BIC/AUCSALES00 AS A INNER JOIN /BIC/TCOKEY AS B
ON A/BIC/COKEY = B/BIC/COKEY
WHERE BILL_DATE = S_BILDT
A/BIC/COKEY = B/BIC/COKEY
GROUP BY ABILL_DATE A/BIC/COKEY ABPARTNER BTXTSH
ORDER BY A~/BIC/COKEY.
ENDSELECT.</b>
<i>IF SY-SUBRC NE 0.
WRITE:/ 'doesnot contain any data'.
ENDIF.</i>
LOOP AT ITAB.
WRITE:/ SY-VLINE, ITAB-BILL_DATE,
15 SY-VLINE, ITAB-/BIC/COKEY,
30 SY-VLINE, ITAB-TXTSH,
45 SY-VLINE, ITAB-CUSTOMER,
60 SY-VLINE.
ULINE /(60).
AT END OF BPARTNER.
SUM.
WRITE:/45 'TOTAL NUMBER OF CUSTOMER:',45 ITAB-CUSTOMER.
ENDAT.