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 field logic

Former Member
0 Likes
729

Hi,

i have a requirement .... in that I should add a variable which is declared as type N to the sy-datum ....so that I shud get the next corresponding date

for example

sy-datum + num = the next corresponding date.

where num is of type N and value = 1.

but in this i am not getting the correct value for date , instead of some junk value i am getting.

pls let me know of what type i shud declare the variable num to get the corresponding value for date after adition.

regards

Saravan

8 REPLIES 8
Read only

Former Member
0 Likes
706

hi

type i.

Cheers

Snehi

Read only

0 Likes
706

Hi

type i is also not working

rgds

saravan

Read only

Former Member
0 Likes
706

Num should be of type I

or U can directly add 1 to the date ..

Read only

0 Likes
706

Hi,

type i is also not working

Read only

0 Likes
706

The following works perfectly ..

data : v_date like sy-datum.

data : v_i type i value 1..

v_date = sy-datum.

v_date = v_date + v_i.

write 😕 v_date.

Read only

Former Member
0 Likes
706

Hi,

Check this sample code,

PARAMETERS:
  p_date TYPE sy-datum.

DATA: 
  w_date TYPE sy-datum,
  w_var  TYPE i VALUE 1.

w_date = p_date + w_var.
WRITE: w_date.

or

PARAMETERS:
  p_date TYPE sy-datum.

DATA:
  w_date TYPE sy-datum.

w_date = p_date + 1 .
WRITE: w_date.

Regards

Adil

Read only

Former Member
0 Likes
706

Hi,

Do like this


REPORT z_sdn.

PARAMETERS:
  p_date TYPE sy-datum.

DATA:
  w_num(2) TYPE n VALUE '1',
  w_num1 TYPE i.


START-OF-SELECTION.

w_num1 = w_num.


p_date = p_date + w_num1.

WRITE:
  p_date.

Regards

Abhijeet

Read only

Former Member
0 Likes
706

Hi Saravan,

Try to execute this code.

Data :
  num type sy-datum.

w_num+6(1) = sy-datum+6(1).

write w_num.

You will be getting the appropriate answer.

Please mark your threads as questions. Then it will be encouraging and you will get more post. 
For this ---- when you are posting the question there is a check box " Mark this thread as question " you have to check this box

Regards,

Swapna.