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

reg sy-datum problem

Former Member
0 Likes
502

hi all,

Parameter: p_peri2(2) TYPE n DEFAULT sy-datum+4(2).

In this parameter it shows 09(which is September).

My requirement is, i could run my program for the selected month & for previous month alone but when other months are selected it should raise a error message "Cannt be performed for selected period". Help me in coding.

Thanks in advance.

Prem.

4 REPLIES 4
Read only

Former Member
0 Likes
472

Hi,

In the start of selction event you can write the code


data: Var(2) type c.

START-OF-SELECTION.
var = Sy-Datum+4(2).
var = var - 1.

 IF p_peri <> Sy-Datum+4(2) or
     p_peri <> VAR.
* Give the error message  
 Endif.

Regards

Sudheer

Read only

0 Likes
472

hi sudheer,

but when selected 01(january) month u 1-1 = 0. but i need 12 ,can u still help me

thanks in advance

prem

Read only

0 Likes
472

Extending Sudheer's code

data: Var(2) type c.
 
START-OF-SELECTION.
var = Sy-Datum+4(2).
var = var - 1.
 
 IF p_peri <> Sy-Datum+4(2) or
     p_peri <> VAR.
* Give the error message  
 Endif.

if VAR = '0'.
VAR = '12'.
endif.

Regards

Aneesh.

Read only

Former Member
0 Likes
472

HI,

At selection-screen on p_peri2.

l_date = sydatum-00001000.

if p_peri24(2) NE sy-datum4(2) OR p_peri24(2) NE l_date4(2)

message << error message>>

endif.