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

Date Validation

Former Member
0 Likes
919

Hi All,

I'm working on consumption report. User needs month-wise consumption.

table MKPF contains data date wise.(eg- 01.03.08 ......)

i should pass only month (eg.. 03) then it should pick the values from (01.03.08 to 31.03.08).

how to validate this one.

Regards

Suprith

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
850

Hi,

Use this.

data: date(10) type c value '01.03.1982',

month_value type i.

IF month_value = date3(2).

..write code here.

ENDIF

7 REPLIES 7
Read only

Former Member
0 Likes
851

Hi,

Use this.

data: date(10) type c value '01.03.1982',

month_value type i.

IF month_value = date3(2).

..write code here.

ENDIF

Read only

Former Member
0 Likes
850

HI,

Check this code..

To validate the Month..

IF NOT p_month IS INITIAL.

IF NOT ( p_month(2) BETWEEN '01' AND '12' ).

MESSAGE e016(pn) WITH 'Enter Valid Month'(e06).

ENDIF.

ENDIF.

To build the dates

From date

CONCATENATE sy-datum(4) p_month(2) '01' INTO g_begda.

To Date

CALL FUNCTION 'LAST_DAY_OF_MONTHS' "#EC

EXPORTING

day_in = g_begda

IMPORTING

last_day_of_month = g_endda

EXCEPTIONS

day_in_no_date = 1

OTHERS = 2.

Read only

GauthamV
Active Contributor
0 Likes
850

hi,

use ranges and append the values.

Read only

Former Member
0 Likes
850

Hi suprith,

Just try with this it may help u.

you use date4(2) for month, and date6(2) for dayfor day.

Regards,

vasavi.v

Read only

0 Likes
850

In Selection screen user will be entering only month

Eg- 03.

how to capture this n pass into MKPF-budat

Read only

Former Member
0 Likes
850

[This is Morning breakfast for you|;

Read only

i048168
Product and Topic Expert
Product and Topic Expert
0 Likes
850

Hi,

You can use the 'LIKE' statement in the where clause of the select statement.

1. Get the current year.

2. Concatenate current year and month ( input ) - YYYYMM.

3. Use select statement like this:

SELECT * FROM MKPF .....

.......

WHERE BUDAT LIKE 'YYYYMM_ _'.

Regards,

Vadivelan B

Edited by: Vadivelan B on Dec 10, 2008 6:24 AM