Application Development 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: 

add a default mask to a data element

Former Member
0 Kudos

Hi,

I'm creating a data element and I want it to have a default mask when I use a write statement. eg. sy-datum, when you use write it is printed like 30.10.2007. I know I could use "mask" addition but I'd like to do it automatically.

Thanks in advance,

1 ACCEPTED SOLUTION

naimesh_patel
Active Contributor
0 Kudos

Hello ...

you can create a conversion routine at the domain level.

Try to cretae one for you data element's domain.

Regards,

Naimesh Patel

2 REPLIES 2

naimesh_patel
Active Contributor
0 Kudos

Hello ...

you can create a conversion routine at the domain level.

Try to cretae one for you data element's domain.

Regards,

Naimesh Patel

Former Member
0 Kudos

Hi Josie,

I think this will be helpfull to you...

see this

Effect

If a conversion routine is assigned to the data object dobj by refering to a domain in the ABAP Dictionary, two equals signs "==" precede the name of the conversion routine and the result is assigned to the data object mask. If no conversion routine is assigned to the data object, mask is initialized. A character-type data object is expected for mask.

Note

If a data object mask meets these requirements, you can use it in the addition USING EDIT MASK of the statement WRITE to call the conversion routine.

Example

Since the data element S_FLTIME in the ABAP Dictionary is associated with the conversion routine SDURA due to the domain S_DURA, msk contains the value "==SDURA" after DESCRIBE FIELD and the statement WRITE returns the value "5:33" after the conversion from seconds into minutes.

DATA: time TYPE s_fltime,

seconds TYPE i,

msk TYPE string.

DESCRIBE FIELD time EDIT MASK msk.

seconds = 333.

WRITE seconds USING EDIT MASK msk.