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 variable

Former Member
0 Likes
1,127

Hi,

I have a fiscal year period 2005004 in one s1( variable) and iam taking 004 in s2 , which is become 4 and llater iam adding 1 to 4 which means it become 5 but i wnat to add 00 to s2 how to do that.. eg

s1 = 2005004

s2 = s1+4(3) that means it is 004]

s2 = s2 + 1 it becomes 5 not 005

i wnat s2 should be 005 how to add 00 to s1 please if anyone can give me step that would be appreciable.

Thanks

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,102

data: s2(3) type n

s1 = 2005004

s2 = s1+4(3) that means it is 004

s2 = s2 + 1 it becomes 005

11 REPLIES 11
Read only

Former Member
0 Likes
1,102

I f your variable is of type date then just add 1 to your variable

Read only

JozsefSzikszai
Active Contributor
0 Likes
1,102

to give a perfect answer, would be great to know, what are the types of the variables.

until that:

CONCATENATE '00' s2 INTO s2.

Read only

0 Likes
1,102

Hi ,

I have used concatenate function but it retrieve 0 as the results but i want my out as 004.

Thanks.

Read only

0 Likes
1,102

as told, it is necessary to know, how did you declare the variables. And the bad display is on the screen? If yes, how did you display? WRITE, ALV...?

Read only

Former Member
0 Likes
1,102

Hi,

Declare s2 as follows :


data s2(3) type n. 
s2 = 4.
add 1 to s2.
write s2.

regards,

Advait

Read only

Former Member
0 Likes
1,102

Hi,

Declare S2 as below;

DATA S2(3) type N.

No need for any other change in the code.

This will solve your problem.

Regards

Karthik D

Read only

Former Member
0 Likes
1,103

data: s2(3) type n

s1 = 2005004

s2 = s1+4(3) that means it is 004

s2 = s2 + 1 it becomes 005

Read only

0 Likes
1,102

As per your suggestion i declare s2 as s2(3) but the problem is

if the s1 is 2005005 in the next increment it is incrementing the 005 of year even though i specified replace s1+4(3) in s1 with s2.

Thanks adveit and amit..

i have given the marks Please could you tell me how to replavce the month only in the above stament even though it is +4(3) its taking year not month

Thanks

Read only

0 Likes
1,102

How did you declrae s1 ? and how do get the value 2005005 ?

Change

replace s1+4(3) in s1 with s2

to


replace s1+4(3) in s1+4(3) with s2

regards,

Advait

Read only

0 Likes
1,102

Thanks Advait, it is resolve but i have this statement in userexit..

read table I_T_VAR_RANGE into v_var_range

with key VNAM = 'ZFYPJM'

while is taking the variable but V_var_range is accepting the Between value and i_t_var_range does

i tried to check these table but it says it does not exit and it is not declare anywhere..

How to check this

I have allocated the points to you

Thanks

Read only

0 Likes
1,102

May be you can try;

s1+4(3) = s2.

Regards

Karthik D

P.S.: Dont ask more than one question per thread, better open a new one.

Edited by: Karthik D on Nov 24, 2008 7:04 PM