2009 Jan 09 7:58 AM
hi to all experts
my requirement is when the user inputs values in select options . i need to get all the other values excluding the range the user inputted. example if the range of total values are from a to z and user is inputting g to h . i want all other values in an internal table.
2009 Jan 09 8:06 AM
Hi,
In the select query, in WHERE clause where you are comapring the field with the select-option values, use NOT IN.
eg.
SELECT *
FROM sbook
INTO TABLE sbook_tab
WHERE class NOT IN <select-option>.
IF sy-subrc = 0.
ENDIF.
Hope this will help you.
Regards
Natasha Garg
2009 Jan 09 8:01 AM
If supposing S_Matnr is your input.
Then
select * from Mara into it_mara where Your fields name NOT IN S_Matnr..
This fetches all the other records except the input fields.
Hope this is what you are looking for ..
2009 Jan 09 8:01 AM
modify the range table with "SIGN" field having value 'E'
fieldname-SIGN = E
fieldname-OPTION = BT
fieldname-LOW = g
fieldname-HIGH = h
Edited by: mrugesh phatak on Jan 9, 2009 9:02 AM
2009 Jan 09 8:04 AM
Hi,
First you have to fechth all the possible values of that filed.
ex:s_plant
select werks from T001W in to table it_table.
loop at it_table into wa_Table
where wa_Table-werks Not in s_plant
wa_finalplant-werks = wa_tablem-werks
append wa_finalplant to it_finalplant
clear wa_finalplant.
endloop.
or else you can do directyly
select werks from T001W into table where werks not in s_plant.
this solves your problem.
Thanks
2009 Jan 09 8:06 AM
Hi,
In the select query, in WHERE clause where you are comapring the field with the select-option values, use NOT IN.
eg.
SELECT *
FROM sbook
INTO TABLE sbook_tab
WHERE class NOT IN <select-option>.
IF sy-subrc = 0.
ENDIF.
Hope this will help you.
Regards
Natasha Garg
2009 Jan 09 8:08 AM
Hi Mohammed,
Please find a dummy program using Select-Options functionality below:
REPORT ZUINPUT NO STANDARD PAGE HEADING .
*USING "PARAMETER" KEYWORD TO ACCEPT USER INPUT:
TABLES : KNA1.
*parameters: a type i,b type i.
*data: result type i.
*
*result = a + b.
*write:/ 'The addition of a and b is :', result.
*----
*USING "SELECT-OPTIONS" KEYWORD
write 😕 'KNA1-KUNNR',20 'KNA1-NAME1',60 'kna1-name2',100 'kna1-land1'.
uline.
select-options: cno for KNA1-KUNNR.
select * from KNA1 where KUNNR in cno.
WRITE 😕 KNA1-KUNNR,20 KNA1-NAME1,60 kna1-name2,100 kna1-land1.
endselect.
uline.
write 😕 cno-low. "Gives lower range of value.
write 😕 cno-high . "Gives upper range of value.
write 😕 cno-sign. "Gives sign whether it is inclusive or exclusive.
write 😕 cno-option. "outputs whether between or not between the rang.
Hope it helps you.
Regards Mansi