2010 Feb 02 1:56 PM
Hi experts,
I have a selection screen with 2 parameters p_a and p_b.
Suppose I input any value in p_a and leave p_b blank,
ideally in the output I should get all the results in which p_a
condition is satisfied.
But what is happening is that the select query searches for the
entry where p_a is equal to the value entered, and also it searches
for p_b equal to blank.
Since there is no combination of this type, sy-subrc is always 4
What should I do to rectify this issue?
The select query I am writing is:
select emaildate
emailtime
from zabc
into table it_zabc
where a = p_a
and b = p_b.
This query looks wrong to me. What can be a correct one?
Thanks,
Ajay.
Hi experts,
I have a selection screen with 2 parameters p_a and p_b.
Suppose I input any value in p_a and leave p_b blank,
ideally in the output I should get all the results in which p_a
condition is satisfied.
But what is happening is that the select query searches for the
entry where p_a is equal to the value entered, and also it searches
for p_b equal to blank.
Since there is no combination of this type, sy-subrc is always 4
What should I do to rectify this issue?
The select query I am writing is:
select emaildate
emailtime
from zabc
into table it_zabc
where a = p_a
and b = p_b.
This query looks wrong to me. What can be a correct one?
Thanks,
Ajay.
2010 Feb 02 1:59 PM
2010 Feb 02 2:01 PM
Hello,
Using parameters, the select query will always look for the exact match while retreiving the records. If you want the desired output declare them as select-options instead of parameters.
Vikranth
2010 Feb 02 2:08 PM
Hi
If you want to manage just one selection, u need to use the select-option instead of the parameter, so u have 2 chance:
A) Define p_a and p_b as select-option but having the format of parameter:
TABLES: BKPF.
SELECT-OPTIONS: SO_BUKRS FOR BKPF-BUKRS NO-EXTENSION NO INTERVALS,
SO_GJAHR FOR BKPF-GJAHR NO-EXTENSION NO INTERVALS.
SELECT * FROM BKPF WHERE BUKRS IN SO_BUKRS
AND GJAHR IN SO_GJAHR.
ENDSELECT.B) Transfer the parameters to a range:
TABLES: BKPF.
PARAMETERS: P_BUKRS LIKE BKPF-BUKRS,
P_GJAHR LIKE BKPF-GJAHR.
RANGES: R_BUKRS FOR BKPF-BUKRS,
R_GJAHR FOR BKPF-GJAHR.
IF NOT P_BUKRS IS INITIAL.
R_BUKRS(3) = 'IEQ'.
R_BUKRS-LOW = P_BUKRS.
APPEND R_BUKRS.
ENDIF.
IF NOT P_GJAHR IS INITIAL.
R_GJAHR(3) = 'IEQ'.
R_GJAHR-LOW = P_GJAHR.
APPEND R_GJAHR.
ENDIF.
SELECT * FROM BKPF WHERE BUKRS IN R_BUKRS
AND GJAHR IN R_GJAHR.
ENDSELECT.Max
2010 Feb 02 2:23 PM
Moderator message - Please do not ask or answer basic questions - thread locked
Rob
| User | Count |
|---|---|
| 6 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |