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

Data format

Former Member
0 Likes
926

Hi Friends,

I have to change the format in the form

It is displaying in this formart

value = 20.000

data = 20.10.2006

I want to display in this format

value = 20

data = 20/10/2006

Thanx in advance,

Venu

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
893

Hope this gives you some idea:

data: l_date(10) type c.
CALL FUNCTION 'CONVERSION_EXIT_PDATE_OUTPUT'
  EXPORTING
    INPUT         = sy-datum
 IMPORTING
   OUTPUT        = l_date.

write:/ l_date.

Alternatively, you can change the date as
  concatenate sy-datum+6(2) sy-datum+4(2) sy-datum(4) into l_date separated by '/'.
write:/ l_date.

data: l_dec(6) type p decimals 2 value 2.
data: l_int type i.

write:/ l_dec.
l_int = l_dec.
write:/ l_int.

Kind Regards

Eswar

8 REPLIES 8
Read only

Former Member
0 Likes
893

&value&(.0)

/: SET DATE MASK = 'DD/MM/YYYY'

&DATE&

Read only

0 Likes
893

Hi,

The date format is fine, but I am unable to get the value in the proper format(Ex:20) It is displaying 20.000

Thanx in advance,

Venu

Read only

0 Likes
893

Have you tried moving the value to integer and display the same.

Alternatively, you can use WRITE statement with addition

DECIMALS

<b>write:/ l_dec DECIMALS 0.</b>

Kind Regards

Eswar

Read only

0 Likes
893

as u rewared the point i think ur using sapscript.han use like that.

<b>&value(.0)&</b>

Read only

Former Member
0 Likes
893

declare

data: value(16) type p.

and for date.

use fm.

<b>CONVERSION_EXIT_PDATE_OUTPUT</b>

or

<b>DATA formatted_text TYPE c LENGTH 50.

WRITE sy-datum TO formatted_text MM/DD/YYYY.</b>

Read only

Former Member
0 Likes
894

Hope this gives you some idea:

data: l_date(10) type c.
CALL FUNCTION 'CONVERSION_EXIT_PDATE_OUTPUT'
  EXPORTING
    INPUT         = sy-datum
 IMPORTING
   OUTPUT        = l_date.

write:/ l_date.

Alternatively, you can change the date as
  concatenate sy-datum+6(2) sy-datum+4(2) sy-datum(4) into l_date separated by '/'.
write:/ l_date.

data: l_dec(6) type p decimals 2 value 2.
data: l_int type i.

write:/ l_dec.
l_int = l_dec.
write:/ l_int.

Kind Regards

Eswar

Read only

Former Member
0 Likes
893

Hi Venu,

The date format inside the field is always YYYYMMDD.

The default format (for display purpose)is based upon user settings.

If we want in some other format,

then we need to write extra code for it

using OFFSET

eg. mm/dd/yyyy

CONCATENATE MYDATE4(2) '/' MYDATE6(2) '/' MYDATE(4)

INTO DTS.

For 20.000, store this value into a variable which is of Interger Type.

*REWARD for all helpful answers

Message was edited by: Palak Limbachiya