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: 

Character - Date

Former Member
0 Kudos

I have field which is Char type. The input to this field will be date format. How to convert to the date input to CHAR or make to CHAR to accept DATE as input.

4 REPLIES 4

Former Member
0 Kudos

It would be better to define a field of type date.

You can declare a field like:

Parameters : p_date like sy-datum.

And then convert it into char field.

write p_date to v_char.

Or

<b>If you want to convert char field to date, you can use function CONVERSION_EXIT_IDATE_INPUT</b>

0 Kudos

The field is under select options we can enter a range....

How to acheive it.

0 Kudos

<b>select-options : s_date for sy-datum.</b>

And then convert it into char field.

write s_date-low to v_char.

or if you have multiple dates then.

loop at s_date.

write s_date-low to ..

write s_date-high to...

endloop.

or if you still want to go with the character field on the screen.

LOOP AT S_DATE.

CALL FUNCTION CONVERSION_EXIT_IDATE_INPUT

EXPORTING INPUT = S_DATE-LOW

IMPORTING OUTPUT = V_DATE1.

CALL FUNCTION CONVERSION_EXIT_IDATE_INPUT

EXPORTING INPUT = S_DATE-HIGH

IMPORTING OUTPUT = V_DATE2.

<b>* Here may you be you can write code to append these 2 fields to other internal table.</b>

ENDLOOP.

Can you give me the exact logic, how you want to use these fields.

0 Kudos

Why can't your select option be changed to a date type?