2008 Jun 18 1:27 PM
Hi experts,
I have doubt in select-options. Please see the below code.
TABLES: ekko.
SELECT-OPTIONS: s_bukrs FOR ekko-bukrs.
DATA: flag TYPE i.
flag = 0.
AT SELECTION-SCREEN.
IF NOT s_bukrs IS INITIAL.
LOOP AT s_bukrs.
IF s_bukrs EQ '1000' OR s_bukrs EQ '0009'.
IF sy-subrc EQ 0.
flag = 1.
ENDIF.
ENDIF.
ENDLOOP.
ENDIF.
During execution in the selection screen I am entering 1000,
0009, CRAB, TRN1 for s_bukrs.
But the If condition IF s_bukrs EQ '1000' OR s_bukrs EQ '0009'. is getting failed. Please let me know the correct syntax. i.e if s_bukrs is either 1000 or 0009 the variable flag should be set to 1. But its not happening.
Thanks & Regards,
Neethu.
2008 Jun 18 1:29 PM
write as :
LOOP AT s_bukrs.
IF s_bukrs-low EQ '1000' OR s_bukrs-low EQ '0009'.IF sy-subrc EQ 0.
flag = 1.
ENDIF.
ENDIF.
ENDLOOP.
2008 Jun 18 1:29 PM
write as :
LOOP AT s_bukrs.
IF s_bukrs-low EQ '1000' OR s_bukrs-low EQ '0009'.IF sy-subrc EQ 0.
flag = 1.
ENDIF.
ENDIF.
ENDLOOP.
2008 Jun 18 1:29 PM
Hi,
you forgot to specify the field for the value in select-option header line:
LOOP AT s_bukrs.
IF s_bukrs-low EQ '1000' OR s_bukrs-low EQ '0009'.
* IF sy-subrc EQ 0.
flag = 1.
* ENDIF.
ENDIF.
ENDLOOP.
By the way: A usual select option has got two value fields (LOW and HIGH). If you want to use the code above it could be better to restrict the select option e.g. with NO INTERVALS.
[Restricting Entry to Single Fields|http://help.sap.com/saphelp_nw70/helpdata/EN/9f/dba76d35c111d1829f0000e829fbfe/frameset.htm|]
Regards Rudi
2008 Jun 18 1:29 PM
hi
do this to ur code
TABLES: ekko.
SELECT-OPTIONS: s_bukrs FOR ekko-bukrs.
DATA: flag TYPE i.
flag = 0.
AT SELECTION-SCREEN.
IF NOT s_bukrs IS INITIAL.
LOOP AT s_bukrs.
IF s_bukrs-low EQ '1000' OR s_bukrs-high EQ '0009'.IF sy-subrc EQ 0.
flag = 1.
ENDIF.
ENDIF.
ENDLOOP.
ENDIF.
cheers
snehi
2008 Jun 18 1:30 PM
Hi,
Try this -
at selection-screen on s_bukrs.
if '1000' in s_bukrs or '0009' in s_bukrs.
flag = 1.
endif.
Cheers.
...Reward if useful
2008 Jun 18 1:31 PM
Hi,
Try this -
at selection-screen on s_bukrs.
if '1000' in s_bukrs or '0009' in s_bukrs.
flag = 1.
endif.
Cheers.
...Reward if useful
2008 Jun 18 1:31 PM
Hi ,
Use the following code.
U need to use s_bukrs-low instead of s_bukrs
TABLES: ekko.
SELECT-OPTIONS: s_bukrs FOR ekko-bukrs.
DATA: flag TYPE i.
flag = 0.
AT SELECTION-SCREEN.
IF NOT s_bukrs IS INITIAL.
LOOP AT s_bukrs.
IF s_bukrs-low EQ '1000' OR s_bukrs-low EQ '0009'.
IF sy-subrc EQ 0.
flag = 1.
ENDIF.
ENDIF.
ENDLOOP.
ENDIF.
2008 Jun 18 1:38 PM
Hi,
TABLES: ekko.
SELECT-OPTIONS: s_bukrs FOR ekko-bukrs.
DATA: flag TYPE i.
flag = 0.
AT SELECTION-SCREEN.
IF NOT s_bukrs IS INITIAL.
LOOP AT s_bukrs where s_bukrs-low = '1000'
or s_bukrs-low = '0009'.
flag = 1.
ENDLOOP.
ENDIF.
Hope it helps u.
regards.
Manjari.
2008 Jun 18 1:38 PM
Hi,
TABLES: ekko.
SELECT-OPTIONS: s_bukrs FOR ekko-bukrs.
DATA: flag TYPE i.
flag = 0.
AT SELECTION-SCREEN.
IF NOT s_bukrs IS INITIAL.
LOOP AT s_bukrs where s_bukrs-low = '1000'
or s_bukrs-low = '0009'.
flag = 1.
ENDLOOP.
ENDIF.
Hope it helps u.
regards.
Manjari.
2008 Jun 18 1:47 PM
Hi neethu
U r working with select options and many of our people has given replyes. But u need to consider the S_BUKRS-SIGN also while searching for the bukrs. There can be I -> INCLUDE E->EXCLUDE.
So instead of doing all these validations take an internal table with field bukrs and hit the table t001 and get the company codes which can be considered. Then loop through that table and check for your company code and set the flag.
This would be best solution.
Reward points if useful.
Venkat.