Application Development 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: 

Validation for select option holding date value

0 Kudos

Hi everyone,

I have to validate the entry in select-option(s_conft here) to an internal table field holding date ( detltab-conf_date_time+11(8) here) in

format  e.g: 11:11 AM.

the select option field is holding the value in IEQ111100000000 format.

To achieve this functionality,i did the following coding

IF s_conft IS NOT INITIAL.

      lv_tim = detltab-conf_date_time+11(8).

       IF lv_tim+6(2) EQ 'PM'.

         lv_hr1 = lv_tim+0(2) + 12.

       ELSE.

         lv_hr1 = lv_tim+0(2).

       ENDIF.

       lv_hr2 = lv_tim+3(2).

       CONCATENATE lv_hr1 lv_hr2 INTO lv_tim_final.

       IF NOT lv_tim_final IN s_conft.

         DELETE detltab.

         CONTINUE.

       ENDIF.

     ENDIF.


But this piece of code is not working.

Please help me out with this.

I need to delete entries from internal table if its date entry doesn't match the date entry in selection screen .

10 REPLIES 10

jay_kumar8
Active Participant
0 Kudos

You can try like this.

if lv_tim_final ne s_conft-low.

delete detltab.

endif.

Regards

Raj

0 Kudos

I think the problem with this approach would be: if the user enters high value for the select option,then that would not be validated.

Please correct me if i am wrong.

Thanks.

0 Kudos

When you need to delete...

whether if low and high value is not equal then delete?

Regards

Raj

0 Kudos

i need to delete the entry when the time stored in internal table does not matches the entry entered by user in select option .

0 Kudos

you can do like this...

if lv_tim_final ne s_conft-low or lv_tim_final ne s_conft-high.

delete detltab.

endif.

Regards

Raj

RicardoRomero_1
Active Contributor
0 Kudos

Hi Roshan,

You are concatenating only 4 characters, like 1111, and comparing with 111100. You missed the seconds.


Add '00' in your concatenate.

Like:

CONCATENATE lv_hr1 lv_hr2 '00' INTO lv_tim_final


Regards.

0 Kudos

Hi Richard,

When a value is provided to select option, it stores value in the following format:

s_conft-sign = I.

s_conft-option = EQ      (if high value is provided it becomes BT)

s_conft-low = 111100     (last two are 0 since time is provided as 11:11:00)

s_conft-high = 000000   (0 as no value provided)


Therefore, s_conft value shows up to be IEQ111100000000.


If i am concatenating like this:

CONCATENATE lv_hr1 lv_hr2 s_conft+7(2) INTO lv_tim_final.


then ,its low value matches and program execute as pretended.


But what if user enters a high value for the select-options.

That i am unable to do.

Thanks.

0 Kudos

Hi,


I think I'm not understanding well your problem...

You have a value like '11:11 AM' always without seconds, haven't you?

I think you should concatenate always the literal '00' at the end.

With the high value in the select options will still work.

former_member197132
Participant
0 Kudos

What is the type of s_conft  ?

Jelena
Active Contributor
0 Kudos

I'm quite a bit confused by this post too. "11:11 AM" is the time format, not date format, so what exactly are you doing?

Kindly add more information, such as the variable definitions and some specific data examples. To be honest though I'm not sure why an answer to this can't be simply found in debugger...