SELECT option question....
Hi all,
What is the meaning of FOR ALL ENTRIES IN.. as in the code below: where can I find the documentation of FOR ALL?
Code:
SELECT * INTO CORRESPONDING FIELDS OF TABLE L_SPETAB
FROM VBAK
FOR ALL ENTRIES IN LVBUK
WHERE VBELN = LVBUK-VBELN
AND LIFSK IN LIFSPE
AND VKORG = VKORG
AND VTWEG IN VTWEG
AND SPART IN SPART.
What is the meaning of IN (as in the last line of code above)?
Thanks,
Charles.
Hi,
From online help ...
http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3a1f358411d1829f0000e829fbfe/content.htm
Tabular Conditions:
The WHERE clause of the SELECT statement has a special variant that allows you to derive conditions from the lines and columns of an internal table:
SELECT ... FOR ALL ENTRIES IN <itab> WHERE <cond> ...
<cond> may be formulated as described above. If you specify a field of the internal table <itab> as an operand in a condition, you address all lines of the internal table. The comparison is then performed for each line of the internal table. For each line, the system selects the lines from the database table that satisfy the condition. The result set of the SELECT statement is the union of the individual selections for each line of the internal table. Duplicate lines are automatically eliminated from the result set. If <itab> is empty, the addition FOR ALL ENTRIES is disregarded, and all entries are read.
The internal table <itab> must have a structured line type, and each field that occurs in the condition <cond> must be compatible with the column of the database with which it is compared. Do not use the operators LIKE, BETWEEN, and IN in comparisons using internal table fields. You may not use the ORDER BY clause in the same SELECT statement.
You can use the option FOR ALL ENTRIES to replace nested select loops by operations on internal tables. This can significantly improve the performance for large sets of selected data.
Regards,
Ferry Lianto
Similar Messages
-
Selection Option question in Info Package
We would like to stop update Master Data if no master data exists for a characteristics. I found there is a selection options in Info Package Update Tab called "Do not update data if no master data exists for a characteristic"
I added a row in one of the InfoObject which has been used in another InfoObject as an Attribute. I selected this option in the IP and tried to re-load Master Data, and it didn't fail.
What does this option do?
Thanks!For example:
InfoObject ITEM and ITMPLN. ITEM is an Attribute in ITMPLN.
ITEM has
Item Description
001 Test 1
002 Test 2
ITMPLN has
Project No Item Description
A 001 Test A
B 002 Test B
<b>C 004 Test C</b>
After I load the last row to ITMPLN, I would like to see the error message instead of adding <b>004</b> into ITEM InfoObject. Do you know how to do it?
Thank you! -
Update using select/option question
Morning,
Does anyone have a snippet of code somewhere that I can use for an update select?
I need it to take the values from a database table and show the one the user selected like :
<SELECT NAME="DinnerChoice">
<OPTION SELECTED = 'Dinner1'>Dinner1
<OPTION = 'Dinner 2'>Dinner 2
<OPTION = 'Dinner 3'>Dinner 3
</SELECT>
Thanks,
LauraWell, if it is supposed to be a Webapplication and you need to generate HTML via PLSQL then you should code something like this:
SQL> BEGIN
/* Just necessary in SQL*Plus (initialization) */
OWA.cgi_var_name (1) := 1;
OWA.cgi_var_val (1) := 1;
OWA.init_cgi_env (1, OWA.cgi_var_name, OWA.cgi_var_val);
HTP.formSelectOpen ('DinnerChoice');
/* Choose your table here*/
FOR c IN (SELECT 'Dinner' || ROWNUM d
FROM user_objects
WHERE ROWNUM <= 3)
LOOP
HTP.formselectoption (cvalue => c.d,
cselected => CASE
WHEN c.d = 'Dinner1'
THEN 1
END
END LOOP;
HTP.formSelectClose ();
/* Just necessary in SQL*Plus */
HTP.showpage;
END;
Content-type: text/html
Content-length: 96
<SELECT NAME="DinnerChoice">
<OPTION SELECTED>Dinner1
<OPTION>Dinner2
<OPTION>Dinner3
</SELECT>
PL/SQL procedure successfully completed. -
Quick question re select-options
Hi
I am relatively new to ABAP but have a quick question:
I need to create a select-options which does the following:
1. Allows ONLY "equals" signs
2. Disallows intervals
3. Disallows the use of ranges in the multiple selection box.
4. Allows multiple individual selections.
I can achieve most using the following:
select-options s_knvh for knvh-kunnr no intervals.
However, this still allows ranges using the multiple selection box, and also allows the "not equal to" option.
Adding the "no-extension" syntax simply removes my ability to use multiple individual entries.
Any ideas?
Thanks
JonUse this FM.
SELECT_OPTIONS_RESTRICT -
How to disable the select options button, while audio is playing in the question template in captivate 8?
Apologies for late reply.
I mean "On Question screens audio keeps on playing even after we have selected an option or options depending on the question type and clicked Submit. How do we stop the audio on selecting an option?" -
Question regarding SELECT-OPTIONS
All,
When I create a select-option in my program like:
SELECT-OPTIONS: s_role FOR AGR_DEFINE-AGR_NAME.
It does not work. To make it work I need to define AGR_DEFINE with the tables statement.
My question is why? In my opinion I just make a reference to a dictionary object. The tables statement is more or less used to create a headerline for a used database table. I don't see any relation in that. Still it is needed to make it work. Any ideas?This has been the syntax for select-options since the begining. You need the definition of 'FOR' defined before you use it in the select-option.
I guess the interpreter/compiler was designed to understand and inherit the properties of the referred field if you use 'LIKE' or 'TYPE' but not when you are using 'FOR'. Since the LOW and HIGH fields of the select-option inherits the properties of the 'FOR' field, the properties of it are needed to be defined before. Why, I still don't know, but that is the design.
For some strange reason, SYST(or SY) fields reference will work even if you don't define them before. Is there a clue here? System structure/fields seem to be available for referencing but not static database table fields.
Regards,
Srinivas -
Issue with Select options in select statement - ABAP Question
Hi
I am facing an issue with select options. Select statement is returning sy-subrc as 4.
I wrote the program as below:
SELECT-OPTIONS:
s_kunnr FOR bsad-kunnr,
s_lifnr FOR bsak-lifnr,
s_gjahr FOR bsad-gjahr,
s_bukrs FOR bsad-bukrs,
s_saknr FOR bsad-saknr,
s_budat FOR bsak-budat.
In start of selection I have written the select statement as
SELECT * FROM bsak INTO TABLE lt_bsak
WHERE bukrs IN s_bukrs AND lifnr = s_lifnr AND gjahr IN s_gjahr AND budat IN s_budat AND saknr IN s_saknr.
In selection screen I have not entered any values and executed the program. I am not getting any result. When I debug that, sy-subrc is 4 at above select statement. But table has records.
If am removing the "lifnr = s_lifnr " condition in select then select is returning values.
I am not getting where I made the mistake. Please suggest.
Thank you
HanuHi,
The problem here with where condition select option lifnr = s_lifnr.
Use below select query.
SELECT * FROM bsak INTO TABLE lt_bsak
WHERE bukrs IN s_bukrs
AND lifnr IN s_lifnr
AND gjahr IN s_gjahr
AND budat IN s_budat
AND saknr IN s_saknr.
s_lifnr is a select option and you are passing it as parameter lifnr = s_lifnr.
if you want to pass this s_lifnr as single vale then pass in below mentioned way.
lifnr = s_lifnr-low
BR,
Vijay -
Please solve the question on select options
i have added 5 select options Each of these new selection options (when selected) will then display on the report .
If A the 1st select option is selected then the new column in the report will display to the right of the existing select-option column.
Message was edited by:
nchandra sekharHi,
U mean what are the seelct-options that are selected should be display on the report output??if that is the case then refer the beloe code.
Internal table for Selection screen parameters
i_seltable TYPE STANDARD TABLE OF rsparams.
*& Form get_selection_screen
Subroutine to get the user selection on selection screen
FORM get_selection_screen .
CALL FUNCTION 'RS_REFRESH_FROM_SELECTOPTIONS'
EXPORTING
curr_report = sy-repid
TABLES
selection_table = i_seltable
EXCEPTIONS
not_found = 01
no_report = 02.
IF sy-subrc NE 0.
REFRESH i_seltable.
ENDIF.
ENDFORM. " get_selection_screen
*& Form display_selection_criteria
Subroutine to display the selction criteria in the output
FORM display_selection_criteria .
CALL FUNCTION 'RS_LIST_SELECTION_TABLE'
EXPORTING
report = sy-repid
seltext = c_x
newpage = space
TABLES
sel_tab = i_seltable
EXCEPTIONS
sel_tab_empty = 1
OTHERS = 2.
IF sy-subrc <> 0.
REFRESH i_seltable.
ENDIF.
ENDFORM. " display_selection_criteria
Reward if helpful.
Regards,
Nagaraj -
Hi Experts,
I am having a following code where i kept no intervals but there is
extension part inside it u have ranges is it possible to deactivate that ranges option in the extension part so that u can have only single values .
select-option:s_bukrs for t001-bukrs no intervals.
Thanks&Regards
Bhaskar Rao.MHi Bhaskar,
Use the following definition:
SELECT-OPTIONS s_bukrs for t001-bukrs NO INTERVALS NO-EXTENSION.
Alternately u can define S_BUKRS as a parameter since the above clause will permit only 1 value.
Regards
Chetan
PS:Reward points if this helps. -
HI,
I have one field on Selection screen It's name is ZTEXT. My requirement is it should take input upto 90 characters but the system is allowing max 45 characters only.
I have tried like below.
Select-options : Ztext for adr6-SMTP_ADDR.
Here SMTP_ADDR lenght is 241 characters but eventhough it is accepting upto 45 characters input only in the selection screen.
could you please guide me how it will accept upto 90 characters input in the selection screen.
Thank you very much advacne.
-KumarYou can not do that in a selection screen. You will need to use a custom dynpro. The max for even a parameter in a selection screen is 79 I believe and the max screen size is 80.
REgards,
Rich Heilman -
Re : select-options in abap objects
Dear friends,
I want to give select-options in abap-objects program. How to give that.
Thanking You
with regards,
ManiHI Mani,
It's common mix ABAP Procedural with ABAP Objects in the same program.
You should use the same way used in ABAP procedural program as Marco Cerdelli sad.
But inside ABAP OBJECTS classes you can't use is these statement type.
Don't forget to close this thread and all yours previous when your question be answered ! In case of doubt read the [rules of engagement|https://forums.sdn.sap.com/].
Best Regards.
Marcelo Ramos -
Checking against Select-Options with "CP" using "IF value IN select_option"
Dear experts,
first of all: I'm sorry, if this question already should have been asked and answered!
I tried quite a lot of search terms but didn't find anything helpful.
We are using a statement like "IF value IN select_option" to perform comparisons after the Select-Options have been used in a SELECT statement. This logical expression fails (compared to the results of the DB-SELECT) whenever a select-option line contains the option CP (Contains Pattern). To be more specific: The case sensitivity of the LOW value doesn't seem to play a role any more. A variable with the value 'ABCD' would be positively checked against a select-option with OPTION 'CP' and LOW 'abc*', whereas this value wouldn't have been selected if the select-option had been used in a DB-SELECT.
Does anybody know a workaround?
Thanks in advance
AndreasDear Keshav,
it's an own field in an own table, defined as CHAR of length 140 (lowercase allowed), reflecting to a line of remittance info of an account statement. A regular Select-Option for this field is provided in a report which works perfectly fine regarding the case sensitivity. For reasons I don't want to point out in detail we need to check a value in this field against the select-option without selecting it from the db again.
Let's assume that a field remittance_info contains the value 'ABCD'.
A line of the select-option table looks like this:
select_option_table-SIGN = 'I'
select_option_table-OPTION = 'CP'
select_option_table-LOW = 'abc*'.
Then an ABAP statement such as
IF remittance_info IN select_option_table.
* would be true !!!
ENDIF.
but wouldn't deliver a result in a SELECT such as
SELECT * FROM my_table INTO TABLE my_internal_table WHERE remittance_info IN select_option_table.
because of the differences in lower/upper case.
regards
Andreas -
How to get all the values in the Select-option.
Hi,
I got the select-option field so_week, for eg. If I give 200923 to 200926 (year and week) in the selection screen and then I need to pass this value (200923) to the FM 'ZWEEK_GET_FIRST_DAY' to get the first day of the week.
My question is how can i get all the values from the select option, (i.e) i need to get 200923, 200924,200925, 200926.
Regards,
Anbu.Hello,
I will prefer Max's solution. But just for the sake of this req.
i need to get 200923, 200924,200925, 200926
i am proposing my soln:
DATA: V_WEEK TYPE RSCALWEEK.
SELECT-OPTIONS: S_WEEK FOR V_WEEK NO-EXTENSION OBLIGATORY.
AT SELECTION-SCREEN.
DATA:
V_COUNT TYPE I,
V_ADD TYPE I,
RT_WEEK TYPE RANGE OF RSCALWEEK,
RS_WEEK LIKE LINE OF RT_WEEK.
V_COUNT = ( S_WEEK-HIGH - S_WEEK-LOW ) + 1.
DO V_COUNT TIMES.
RS_WEEK-SIGN = 'I'.
RS_WEEK-OPTION = 'EQ'.
RS_WEEK-LOW = S_WEEK-LOW + V_ADD.
APPEND RS_WEEK TO RT_WEEK. "RT_WEEK--> Will contain the week values
CLEAR RS_WEEK.
V_ADD = V_ADD + 1.
ENDDO.
@Max: I was stupid enough not to think of your solution. Need to leave office
Cheers,
Suhas -
Hi experts,
In my alv report there is one field SERNR serial number, for this i have to put select option. My problem is this field doesn't exist in the table(Zmanifest) from where i'm fetching data. So i'm not able to mention this select option in my select query for that particular table. This field is existing in EQUI table and have no relation defined between zmanifest table & EQUI.
In my internal table i have all fields of zmanifest & this sernr; to fulfill this field logic is
Serial Number is combination of P_PREFIX-(dash)P_SERIAL fields in zmanifest. I have fetch all data including SERNR by above logic at my grid; but facing problem in defining SELECT-OPTIONS for Sernr.
Please help.
Points Sure.
AnshumanHi,
do like this.
take the lenght of P_PREFIX
take the lenght of P_SERIAL
add the length.
for exmaple :
P_PREFIX size is 4.
P_SERIAL size is 10
now declare the variable like this.
data : v_selop(15).
Note : 4101 = 15, so i declared the variable with lenght of 15.
select-options : so_field for v_selop.
now use off-set in your select query like this:
where PREFIX = v_selop+0(4)
and SERIAL = v_selop+5(10)
it will work if you are using variable v_selop as a parameter else if you are using select option you have to break v_selop into two different select option like this:
s_prefix type prefix,
s_serial type serial.
loop at v_selop.
s_prefix-* = v_selop-. " ( = sign, option)
s_serial-* = v_selop-*.
s_prefix-low = v_selop-low+0(4).
s_serial-low = v_selop-low+5(10).
s_prefix-high = v_selop-high+0(4).
s_serial-high = v_selop-high+5(10).
endloop.
now use following select query
where PREFIX in s_prefix
and SERIAL in s_serial.
it will surely wrok.
Regards-
Gagan Kumar
Plz Reward if need full. also close the question.
Edited by: Gagan Kumar on May 18, 2008 7:30 PM -
How can I re-display my selected option?
In my jsp, I gain option values for a list of 'types' and 'names'
If the currentType = null I do not show the form that accepts the 'names'.
When a type is selected the Action class calls the getMethod in the ActionForm
and upon success returns to the jsp page and presents the 'name' form.
Unfortunately the 'type' form redisplays the first type in the list and not the
currentType.
Question. How can I set the selected option in my form to display the currentType?
<!-- Access session bean for picklist types -->
<jsp:useBean
id="typesBean"
scope="session"
class="com.aaa.zzz.refdata.beans.CPartyTypesBean" >
<jsp:setProperty name="typesBean" property="*" />
</jsp:useBean>
<%
CPartyTypesBean typeBean = (CPartyTypesBean) session.getValue("typesBean");
String[] PicklistTypes = typeBean.getTypes();
%>
<!-- Access Form Bean (ActionForm) for current Name & Type -->
<jsp:useBean
id="pb"
scope="session"
class="com.aaa.zzz.refdata.beans.CPartyPicklistBean" >
</jsp:useBean>
<jsp:setProperty name="pb" property="*" />
<%
String currentType = pb.getType();
String currentName = pb.getName();
%>
<html:form action="/typeAction" focus="type">
<table>
<tr>
<td WIDTH="20%">
Picklist Type
</td>
<td WIDTH="30%">
<select name="type">
<%
for(int i=0; i<PicklistTypes.length; i++)
out.println("<option>" + PicklistTypes[i] + "</option>");
%>
</select>
</td>
<td WIDTH="20%">
<html:submit property="submit" value="GetType"/>
</td>
<td WIDTH="30%">
</td>
</tr>
</table>
</html:form>
<%
if (currentType != null)
%>
<html:form action="/nameAction" focus="name">Thanks Beattris, I guess 'selected' is the obvious answer but what I was looking for was
how to apply 'selected' to the loop that prints my options.
However I figured it out and did this:
<%
for(int i=0; i<PicklistTypes.length; i++)
String sel = null;
if(currentType != null && currentType.compareTo(PicklistTypes)==0)
sel = " SELECTED>";
else
sel = ">";
out.println("<option value=" + PicklistTypes[i] + sel + PicklistTypes[i]+"</option>");
%>
Maybe you are looking for
-
HT204492 The Apple remote doesn't open front row
I just bought this Apple remote from the Apple Store, the volume works on it but when I press the menu button nothing happens, no front row or anything. I have an iMac late 2009 model
-
Reg: View column datatype
Hi Team, While creating the views, column automatically converted into varchar2(81) data type from number datatype. but stage1 table has legacy_trx_number is number data type and statg2 table has header_num is number data type. Just i added the highl
-
Hi Experts, I want some invoices filtered with for Customer ID ,output type, billing type, partner. Please suggest me a table where i can extract the invoices
-
I'm trying to find a way for a 25 foot tall sculpture of Elvis standing in a jukebox to play one Elvis hit song randomly by being activated by a motion detector. Can the iPod Shuffle be activated to play just one song, then stop or turn off. Then be
-
How to integrate WD url in standard RFX response task
Hi Experts, we have set up a process controlled workflow for RFX response in SRM,The standard task used is 40007981,the problem is we have to integrate one webdynpro link inside the task,the process is to first determine the webdyn