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

Internal table and validation query

Former Member
0 Likes
556

Hi,

i have the foll problem:

I have a parameter on the selection screen called P_tarea and slect-options called s_date.i have done validations on the date to check that the from and to dates are having a gap of 5 days. i have to check the following conditions:

if the p_tarea field is initial. i have to fetch all the records from internal table (for the mentioned dates at selection screen) which have an entry in the davgte field of the same table.

plz reply.

4 REPLIES 4
Read only

Former Member
0 Likes
500

Hi

*to validate date

If s_date-high - s_date-low < 5.

message..

endif.

*to retrive data

If p_area[] is not initial.

retrieve data.

endif.

Regards

Aditya

Read only

Former Member
0 Likes
500

HI,

You have to loop at the internal table from which you have to fetch ur data. Please refer to the sample code below.

Loop at <internal table> into <workarea> where davgte LE sdate-high and davgte GE sdate-low.

*Fetch ur data from <workarea>.

EndLoop.

Regards,

Gaurav

Read only

Former Member
0 Likes
500

Hi anand chidambaram,

You can diclare P_tarea is also as a select-options.

See the following code

select-options:
               s_tarea for dtab-tarea NO-EXTENSION
                                                    NO INTERVALS,
                s_date for sy-datum.

Data w_no type i.

AT SELECTION-SCREEN.

loop at s_date.
  w_no = s_date-high - s_date-low.

  if w_no < 5.
     message e999 with 'Lessthan 5 day'.
  endif.

endloop.

Note : There is no need to chech either s_tarea is initial or not because i declared it as select-options so by default if it is initial it fetch all the records.

Reward if it is useful,

Mahi.

Read only

Former Member
0 Likes
500

Hi,

if p_tarea field is initial.

loop at internal table

if wa-davgte not initial.

append wa to another internal table.

endif.

endloop.

endif.

Now your second internal table will have the required data.

Hope this will help you.

Regards

Shibin