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: 

Posting date from & to should belong to the same period of the same fisc y

Former Member
0 Kudos

Hi Exerpts,

Could you please tell me answer of below issue.

how we can find The Posting date from & to ( selection screen one select-option)should belong to the same period of the same fiscal year?

the two dates are select-options in selection screen.

this is very urgent.

Thanks

Jaya

3 REPLIES 3

Former Member
0 Kudos

Hi

declare the select-options

Select-options: s_budat for bkpf-budat.

so both the dates should be in the same month(period)

and in the same year means similar to sy-datum+0(4).

in the validation you should write that

if s_budat-low4(2) ne s_budat-high4(2).

if ( s_budat-low0(4) ne sy-datum0(4) or s_budat-high0(4) ne sy-datum0(4) )

error message....

endif.

endif.

Regards

Anji

former_member198275
Active Contributor
0 Kudos

post with example...

Former Member
0 Kudos

SEE THE CODE BELOW, I THINK IT WILL SERVE YOUR PURPOSE...

TABLES BKPF.

SELECT-OPTIONS:

S_BUDAT FOR BKPF-BUDAT.

AT SELECTION-SCREEN.

IF SY-UCOMM EQ 'ONLI' OR SY-UCOMM EQ 'PRIN'.

LOOP AT S_BUDAT.

IF S_BUDAT-HIGH IS NOT INITIAL AND S_BUDAT-HIGH0(6) NE S_BUDAT-LOW0(6).

MESSAGE 'period in From and To is not same' type 'I'.

LEAVE TO SCREEN 1000.

ENDIF.

ENDLOOP.

ENDIF.

Reward points if useful, get back in case of query...

Cheers!!!