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

Regarding Changing Date Format

Former Member
0 Likes
712

hi guys,

i just got a requirement where i need to take date from BEDAT field in EKKO and

build a date in this format.

MM.YYYY in the selection screen but when user enter date in selection screen say:

ex: 02.2007 it should be stored as 01.02.2007 in data base ( that is, it should take first day i.e 1 of that particular month.)

can any one please give me a piece of code for this.

Thank you

pavan

1 ACCEPTED SOLUTION
Read only

rahulkavuri
Active Contributor
0 Likes
676

hi for this u need to write some piece of code like this

you cannot declare a parameter in selection screen of sy-datum as it will give it as an invalid date

suppose that ur parameter in selection screen contains this 02.2007 then declare v_date field.

parameter: v_date(10).

concatenate '01.' v_date0(3) v_date4(5) into v_date.

this will do ur work seperated by dots.

<b>

award points if found helpful</b>

Message was edited by:

Rahul Kavuri

5 REPLIES 5
Read only

rahulkavuri
Active Contributor
0 Likes
677

hi for this u need to write some piece of code like this

you cannot declare a parameter in selection screen of sy-datum as it will give it as an invalid date

suppose that ur parameter in selection screen contains this 02.2007 then declare v_date field.

parameter: v_date(10).

concatenate '01.' v_date0(3) v_date4(5) into v_date.

this will do ur work seperated by dots.

<b>

award points if found helpful</b>

Message was edited by:

Rahul Kavuri

Read only

Former Member
0 Likes
676

parameters: dats(6) type c.

data: dats1(10).

dats1+0(2) = '01'.

dats1+2(6) = dats.

write: dats1 using edit mask '__/__/____'.

Cheers.

Read only

Former Member
0 Likes
676

hi,

user entered 02.2007 .this is a parameter declaration .

parameter :p_date(10) type c. (where p_date = 02.2007)

concatenate '01.' p_date into a. (where a is some variable )

then u can update the d/b using a.

<b>reward pts if useful.</b>

Read only

Former Member
0 Likes
676

RS_VARI_V_1_ACTUAL_MONTH

RS_VARI_V_1_LAST_MONTH

RS_VARI_V_1_NEXT_MONTH Returns first day of the actual/last/next month.

RS_VARI_V_ACTUAL_MONTH

RS_VARI_V_LAST_MONTH Returns selection range for the actual/last month.

Output: 1st line in table P_DATETAB

Read only

Former Member
0 Likes
676

execute the code .

parameters : p_date(7) type c. " RSCALMONTH.
initialization.

concatenate sy-datum+4(2) sy-datum+0(4) into p_date separated by '.'.
data : date  like sy-datum.

start-of-selection.
concatenate  sy-datum+0(4) sy-datum+4(2) '01' into date .
write:/ date.

"exchange this filed to ur table .

regards,

vijay