2007 Jan 03 9:05 PM
Hello friends,
I need to generate a FI report based on document type(blart) and document status(bstat). I have three check boxes in the selection screen where I can select the document status(cleared, open or parked). I have to consider all the possible selections of the checkboxes. I can only think of all the possiblities of the checkbox selection and write the select statement .....
Could any on help with simpler logic for this particular report. Thank u in advance.
Hello friends,
I need to generate a FI report based on document type(blart) and document status(bstat). I have three check boxes in the selection screen where I can select the document status(cleared, open or parked). I have to consider all the possible selections of the checkboxes. I can only think of all the possiblities of the checkbox selection and write the select statement .....
Could any on help with simpler logic for this particular report. Thank u in advance.
2007 Jan 03 9:11 PM
Hi,
Create a ranges and build the ranges for each check box..
Example
-
PARAMETER: P_CDATE AS CHECKBOX.
PARAMETER: P_YDATE AS CHECKBOX.
PARAMETER: P_TDATE AS CHECKBOX.
START-OF-SELECTION.
RANGES: R_DATE FOR SY-DATUM.
CURRENT DATE
IF P_CDATE = 'X'.
R_DATE-SIGN = 'I'.
R_DATE-OPTION = 'EQ'.
R_DATE-LOW = SY-DATUM.
APPEND R_DATE.
ENDIF.
YESTERDAY DATE
IF P_YDATE = 'X'.
R_DATE-SIGN = 'I'.
R_DATE-OPTION = 'EQ'.
R_DATE-LOW = SY-DATUM - 1.
APPEND R_DATE.
ENDIF.
TOMORROW'S DATE
IF P_TDATE = 'X'.
R_DATE-SIGN = 'I'.
R_DATE-OPTION = 'EQ'.
R_DATE-LOW = SY-DATUM + 1.
APPEND R_DATE.
ENDIF.
LOOP AT R_DATE.
WRITE: / R_DATE-LOW.
ENDLOOP.
**You can use the ranges in a where clause..
Thanks,
Naren
2007 Jan 03 9:33 PM
The most simple way is to use ranges in selection.
First you must know what blart and bstat values correspond to each of the checkboxes. The most simple way to do a selection is to create two ranges (for blart and bstat) and populate them with proper values for each selected checkbox. After this you can use select ... where ... blart in range_blart and bstat in range_bstat. BUT it's very IMPORTANT to understand that after that you need properly check every condition, because it is possible to select some fake lines.
Another way is to use where (itab) variant of select clause and populate it with proper ANDs and ORs. Here is an except from help:
PARAMETERS: CARR_ID LIKE SPFLI-CARRID,
CONN_ID LIKE SPFLI-CONNID.
DATA: WTAB(72) OCCURS 100 WITH HEADER LINE,
AND(3),
WA_SPFLI TYPE SPFLI.
REFRESH WTAB.
IF NOT CARR_ID IS INITIAL.
CONCATENATE 'CARRID = ''' CARR_ID '''' INTO WTAB.
APPEND WTAB.
AND = 'AND'.
ENDIF.
IF NOT CONN_ID IS INITIAL.
CONCATENATE AND ' CONNID = ''' CONN_ID '''' INTO WTAB.
APPEND WTAB.
ENDIF.
SELECT * FROM SPFLI WHERE (WTAB) INTO WA_SPFLI
WRITE: / WA_SPFLI-CARRID, WA_SPFLI-CONNID, WA_SPFLI-CITYFROM,
WA_SPFLI-CITYTO, WA_SPFLI-DEPTIME.
ENDSELECT.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |