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 format in Parameters

Former Member
0 Likes
3,916

Hi,

I have a Parameter of type date

ppdat LIKE sy-datum

which gets passed to a function, but when I pass it to the function, like this:

ftpost-fvalu = ppdat.

but when it does this the format gets mixed up, how can ensure it is in the format I want?

Thanks

1 ACCEPTED SOLUTION
Read only

vinod_gunaware2
Active Contributor
0 Likes
2,816

Convert Useing <b>WRITE INTO</b>

<b>WRITE .... <f> <option>.</b>

Formatting options for all data types

Formatting options for date fields

Option

Function

DD/MM/YY

Separators as defined in user’s master record.

MM/DD/YY

Separators as defined in user’s master record.

DD/MM/YYYY

Separators as defined in user’s master record.

MM/DD/YYYY

Separators as defined in user’s master record.

DDMMYY

No separators.

MMDDYY

No separators.

YYMMDD

No separators.

WRITE: sy-datum,

/ sy-datum yymmdd.

27.06.1995

950627

regards

vinod

9 REPLIES 9
Read only

Former Member
0 Likes
2,816

Hi sims,

1. Internally the dates are always stored and passed

in YYYYMMDD format only.

2. If your field ftpost-fvalu

is also of type DATE,

then no need to worry.

regards,

amit m.

Read only

Former Member
0 Likes
2,816

check the fm which format (type char or date) it takes date .

change date parameter to that perticular format

Read only

Former Member
0 Likes
2,816

Hi,

how have you declared the parameter in the function.

Make sure that the declaration is same in both the places.

Declare the parameter in the function of type like sy-datum.

Hope that helps.

Regards,

Tanveer.

<b>Please mark helpful answers</b>

Read only

Former Member
0 Likes
2,816

Hi Sims,

Please ensure that the <b>ftpost-fvalu</b> is also of type sy-datum. If thats the case then there is no problem, else if it is of type char then the format will be changed and for using that particular value there will be some complications.

Regards,

Tushar

Read only

Former Member
0 Likes
2,816

Hello Sims,

I assume that the interface parameter for your function module is of a character data type.

Also, it seems to me that you want the format (the separators) to be preserved when you pass the parameter to the function module.

you can do the following -

parameters ppdat like sy-datum.

data : lv_char_date(10).

start-of-selection.

  write ppdat to lv_char_date.
  
  call function '.....'
    exporting 
      ftpost-fval = lv_char_date.

The WRITE..TO statement ensures that the correct separators are put in place.

Regards,

Anand Mandalika.

Read only

vinod_gunaware2
Active Contributor
0 Likes
2,817

Convert Useing <b>WRITE INTO</b>

<b>WRITE .... <f> <option>.</b>

Formatting options for all data types

Formatting options for date fields

Option

Function

DD/MM/YY

Separators as defined in user’s master record.

MM/DD/YY

Separators as defined in user’s master record.

DD/MM/YYYY

Separators as defined in user’s master record.

MM/DD/YYYY

Separators as defined in user’s master record.

DDMMYY

No separators.

MMDDYY

No separators.

YYMMDD

No separators.

WRITE: sy-datum,

/ sy-datum yymmdd.

27.06.1995

950627

regards

vinod

Read only

0 Likes
2,816

The parameter is going into a char32 type field, it's a BDC name and value field, and thats what the problem is.

What I need is to store it in the char as

310506 - to represent 31 may 2006

but it stores it in the reverse way.

Read only

0 Likes
2,816

Hi Sims,

Try as follows.

<b>WRITE PPDAT DDMMYY TO ftpost-fvalu.</b>

If your PPDAT as <b>20060531</b> then it will be stored in ftpost-fvalu as <b>310506.</b>

Thanks,

Vinay

Read only

0 Likes
2,816

Hello Sims,

Have you checked my answer above ? Did it not help?

Regards,

Anand Mandalika.