Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Problem if Select-Option is INITIAL.

Former Member
0 Likes
3,465

HI all,

I have a question on how to handle to handle Select-Options.

IF some_value IN S_value.

Logic1.

ELSE.

Logic2.

ENDIF.

Problem here is when Select-Option S_value is Empty. It is true for all values in 'some_value'. Is there any easy way to handle it, WITHOUT explicitly checking if the Select-Option IS INITIAL or not, it make my code lot simpler.

Thanks in Advance,

Ravi.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,904

Without checking the initial condition, I don't think it is possible.


IF NOT s_value[] IS INITIAL
   AND some_value IN S_value.
  Logic1.
ELSE.
  Logic2.
ENDIF.

Just added the [] for s_value to check for the internal table not just the header.

7 REPLIES 7
Read only

Former Member
0 Likes
1,904

Hi Ravi,

Before your IF condition.You can always check for the values in S_value-low & S_value-high,to see whether it is initial or not & then go with your below IF condition.

Read only

Former Member
0 Likes
1,904

Hi,

Why do you want to avoid checking whether select-option is initial. That is the simplest way to handle this.

If you dont want that then my suggestion is use, describe table S_OPTION and get number of lines. You can check whether number of lines is zero or more than zero.

Ex:

data : l type i.

describe table s_option lines l.

if l = 0.

---

else.

---

endif.

Still checking for initial is the best option.

Regards,

Ramesh.

Read only

Former Member
0 Likes
1,904

Ravi,

There is no straight forward way of doing it. Probably you can append a dummy record in the SELECT OPTIONS, a blank record probably. However, you will get only those values that are blank.

Other than that you don't have an option other than checking the SELECT OPTIONS.

Regards,

Ravi

Note : Please reward the posts that help you.

Read only

Former Member
0 Likes
1,904

What are you Doing exactly...

Read only

Former Member
0 Likes
1,904

Hi

I think you can do it without to check th SO, if your SO is obligatory, if it isn't you should check your SO.

I believe the easier check is:

IF NOT SO[] IS INITIAL.

......

Max

Read only

Former Member
0 Likes
1,905

Without checking the initial condition, I don't think it is possible.


IF NOT s_value[] IS INITIAL
   AND some_value IN S_value.
  Logic1.
ELSE.
  Logic2.
ENDIF.

Just added the [] for s_value to check for the internal table not just the header.

Read only

Former Member
0 Likes
1,904

If it has to have some value, make it mandatory. You are not going to save anything or improve anything by not adding the INITIAL check.