‎2007 Jan 05 9:09 PM
I have a question reg. select statement:
data: str_knmt type knmt.
SELECT single vkorg vtweg kunnr
FROM knmt
INTO str_knmt
WHERE vkorg = p_vkorg
AND vtweg = p_vtweg
AND kunnr = p_kunnr.
Now on the selection screen, I entred only value for p_kunnr (i.e 0000019900) and pressed F8. Now in debugging mode, I see no entries in str_knmt even though there is an entry existing in knmt table with the kunnr value i entered. (the entry in the structure str_knmt is expected as
B280 for vkorg
10 for vtweg
0000019900 for kunnr).
Why that record is not coming into the structure? Please give your input.
Thanks.
‎2007 Jan 05 9:28 PM
Hi,
You can also add NO-EXTENSION NO INTERVALS to allow enter only one value in the select-option..
REPORT ztest .
TABLES: knmt.
SELECT-OPTIONS: s_vkorg FOR knmt-vkorg <b>NO-EXTENSION NO INTERVALS</b>,
s_vtweg FOR knmt-vtweg <b>NO-EXTENSION NO INTERVALS</b>.
PARAMETERS: p_kunnr LIKE knmt-kunnr.
Thanks,
Naren
‎2007 Jan 05 9:13 PM
There is no record in KNMT where vkorg is blank, vtweg is blank, and kunnr = 0000019900.
‎2007 Jan 05 9:16 PM
thank you.
Yes, i know. so, how to get that record even though i keep them blank or sometimes i may enter them..?
thanks again.
‎2007 Jan 05 9:17 PM
As Rob suggested, use Select-Options instead of Parameters and use IN in your select statement instead of =.
‎2007 Jan 05 9:15 PM
If you didn't enter values in p_vkorg or p_vtweg, the select is looking for entries where these are blank as well. Remember, parameters are not select options and behave differently.
Rob
‎2007 Jan 05 9:25 PM
Like:
REPORT ztest .
TABLES: knmt.
SELECT-OPTIONS: s_vkorg FOR knmt-vkorg,
s_vtweg FOR knmt-vtweg.
PARAMETERS: p_kunnr LIKE knmt-kunnr.
DATA: str_knmt TYPE knmt.
SELECT SINGLE vkorg vtweg kunnr
FROM knmt
INTO CORRESPONDING FIELDS OF str_knmt
WHERE vkorg IN s_vkorg
AND vtweg IN s_vtweg
AND kunnr = p_kunnr.
Rob
Added "INTO CORRESPONDING FIELDS OF..."
Message was edited by:
Rob Burbank
‎2007 Jan 05 9:17 PM
This could be because the you havenet entered anything in the selection screen for p_vtweg. This is causing a blank value to be fed into the select statement and the statement is failing for this.
If your p_vtweg is a optional field then you declare it as a select option with no intervals and extension. This will appear as a parameter in the screen and will serve your perpose. Dont forget to alter the select statement to accomodate the select option instead of the parameter.
- Guru
Reward points for helpful answers
‎2007 Jan 05 9:19 PM
Hi Krishen,
You are querying on database table KNMT with the combinatio of VKORG,VTWEG nd KUNNR where a you are querying only with the value of KUNNR at your datatable level through SE11.
In SE11, it will search for only those KUNNR value of 0000019900. You can interpret this as the below query.
SELECT single vkorg vtweg kunnr
FROM knmt
INTO str_knmt
WHERE kunnr = p_kunnr.
In your SELECT query it will search will blank values for VKORG and VTWEG. So you are unable to get an entry to this internal table.
Note: Plz mark all helpfuls answers.
Thanks,
Vinay
‎2007 Jan 05 9:22 PM
Hi Krishen,
Please try this instead.
TABLES: KNMT.
SELECT-OPTIONS: S_VKORG FOR KNMT-VKORG,
S_VTWEG FOR KNMT-VTWEG.
PARAMETERS: P_KUNNR LIKE KNMT-KUNNR.
DATA: BEGIN OF STR_KNMT,
VKORG LIKE KNMT-VKORG,
VTWEG LIKE KNMT-VTWEG,
KUNNR LIKE KNMT-KUNNR.
DATA: END OF STR_KNMT.
SELECT SINGLE VKORG VTWEG KUNNR
FROM KNMT
INTO STR_KNMT
WHERE VKORG IN S_VKORG
AND VTWEG IN S_VTWEG
AND KUNNR EQ P_KUNNR.
WRITE: / STR_KNMT.Regards,
Ferry Lianto
‎2007 Jan 05 9:25 PM
If you are going to use select-option then make sure vkorg and vtweg is not initial otherwise it will search for all the rows in the table and may cause performance issue.
Thanks,
Santosh
‎2007 Jan 05 9:28 PM
Hi,
You can also add NO-EXTENSION NO INTERVALS to allow enter only one value in the select-option..
REPORT ztest .
TABLES: knmt.
SELECT-OPTIONS: s_vkorg FOR knmt-vkorg <b>NO-EXTENSION NO INTERVALS</b>,
s_vtweg FOR knmt-vtweg <b>NO-EXTENSION NO INTERVALS</b>.
PARAMETERS: p_kunnr LIKE knmt-kunnr.
Thanks,
Naren
‎2007 Jan 05 9:56 PM
For your Select query the problem might be for the value of KUNNR
Check the conversion exit for this field.
p_kunnr
like kunnr is having conversion exit ALPHA
call function 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = p_kunnr
IMPORTING
OUTPUT = p_kunnr.
These things you have to do before select statement and then write
SELECT single vkorg vtweg kunnr
FROM knmt
INTO str_knmt
WHERE vkorg = p_vkorg
AND vtweg = p_vtweg
AND kunnr = p_kunnr.
Regards,
Aman