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

dates

Former Member
0 Likes
1,451

Hi frnds,

i want to use conversion exit for dates.

any program will be helpful.

kamal

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,413

u can use

Write <date1> to <date2> MM/DD/YYYY.

8 REPLIES 8
Read only

Former Member
0 Likes
1,413

hi,

Chk this.

CONVERSION_EXIT_IDATE_OUTPUT

data:lcdate(11).
 
call function 'converstion_exit_idate_output'
exporting
input = sy-datum
importing
output = lcdate.
 
concatenate lcdate(2) lcdate+2(3) lcdate+5(4) into lcdate seperated by '-'.
 
--lcdate is your required format.
 
sample data ..sy-datum = 20060830
lcdate = 30-AUG-2006

inverted _date
**************************

CALL FUNCTION 'CONVERSION_EXIT_INVDT_OUTPUT'
EXPORTING
input = '79948992'
IMPORTING
OUTPUT = d_date.
write d_date.

Output:10/07/2005

or

CONVERT INVERTED-DATE TCURR-GDATU INTO DATE VALID_FROM_DATE.

data c_date(8).

"Adding to Above


CONVERSION_EXIT_PDATE_INPUT Conversion Exit for Domain GBDAT: DD/MM/YYYY -> YYYYMMDD 
CONVERSION_EXIT_PDATE_OUTPUT Conversion Exit for Domain GBDAT: YYYYMMDD -> DD/MM/YYYY 

SCA1 Date: Conversion 
CONVERSION_EXIT_IDATE_INPUT External date INPUT conversion exit (e.g. 01JAN1994) 
CONVERSION_EXIT_IDATE_OUTPUT External date OUTPUT conversion exit (e.g. 01JAN1994) 
CONVERSION_EXIT_LDATE_OUTPUT Internal date OUTPUT conversion exit (e.g. YYYYMMDD) 
CONVERSION_EXIT_SDATE_INPUT External date (e.g. 01.JAN.1994) INPUT conversion exit 
CONVERSION_EXIT_SDATE_OUTPUT Internal date OUTPUT conversion exit (e.g. YYYYMMDD) 

TB01_ADDON 
CONVERSION_EXIT_DATEX_INPUT 
CONVERSION_EXIT_DATEX_OUTPUT

CONVERT_DATE_TO_INTERN_FORMAT


********************************

DATA: V_DATE_IN(10) TYPE C,
V_DATE_SAP TYPE SY-DATUM.

V_DATE_IN = '01.01.2005.'.

CONCATENATE V_DATE_IN+6(4) "<--for Year
V_DATE_IN+3(2) "<--for month
V_DATE_IN+0(2) "<--for Day
INTO V_DATE_SAP.

now V_DATE_SAP will have value like 20060101.


Rgds

Reshma

Read only

0 Likes
1,413

Hi

This code yields as 12 march 2006.

DATA: ZTEMP(9).  

CLEAR: ZTEMP, ZDD, ZMMM, ZYYYY.  

CALL FUNCTION 'CONVERSION_EXIT_IDATE_OUTPUT'  
EXPORTING  
INPUT = IS_DLV_DELNOTE-HD_GEN-CREA_DATE  
IMPORTING  
OUTPUT = ZTEMP.  

ZDD = ZTEMP+3(2).  
ZMMM = ZTEMP+0(3).  
ZYYYY = ZTEMP+5(4).

Reward all helpfull answers

Regards

Pavan

Read only

Former Member
0 Likes
1,414

u can use

Write <date1> to <date2> MM/DD/YYYY.

Read only

sumit_shah
Product and Topic Expert
Product and Topic Expert
0 Likes
1,413

Hi Kamal,

You can use following function modules to convert date.

CONVERSION_EXIT_INVDT_INPUT

CONVERSION_EXIT_INVDT_OUTPUT

the simple logic is in the conversion routine is:

output = 99999999 - input.

Reward if it is useful.

Regards,

Sumit

Read only

Former Member
0 Likes
1,413

Hi kamal.

check it out it may be helpful.

<code> &----


*& Report ZDATE *

*& *

&----


*& *

*& *

&----


report zdate no standard page heading.

parameters: p_date like sy-datum.

data: p_output(20).

data: p_output2(20).

data: p_output3(20).

call function 'CONVERSION_EXIT_LDATE_OUTPUT'

exporting

input = p_date

importing

output = p_output.

  • REPLACE ALL OCCURRENCES OF '.' IN p_output WITH '-'.

write:/ p_output.

call function 'CONVERSION_EXIT_IDATE_OUTPUT'

exporting

input = p_date

importing

output = p_output2.

replace all occurrences of '.' in p_output2 with '-'.

write:/ p_output2.

call function 'CONVERSION_EXIT_SDATE_OUTPUT'

exporting

input = p_date

importing

output = p_output3.

replace all occurrences of '.' in p_output3 with '-'.

write:/ p_output3.</code>

Reward points if u find helpful

Thanks & Regards,

Rajesh

Read only

Former Member
0 Likes
1,413

Use FM CONVERSION_EXIT_INVDT_INPUT.

Just go to the Domain of the field GDATU which is DATUM_INV.Now if you see the definition tab,you will find a field Conversion Routine as INVDT.Double click on that,it will give you the conversion routine Function modules to be used.

CALL FUNCTION 'CONVERSION_EXIT_INVDT_OUTPUT'

EXPORTING

input = '79948992'

IMPORTING

OUTPUT = d_date.

write d_date.

data c_date(8).

CALL FUNCTION 'CONVERSION_EXIT_INVDT_INPUT'

EXPORTING

input = '07/10/2005'

IMPORTING

OUTPUT = c_date.

write c_date.

Read only

Former Member
0 Likes
1,413

Kamal,

For a lot of conversions it is easy to find the conversion function modules...

Example:-

Go to SE11 and display table VBAK.

Double click on field VBELN.

In the pop-up, double click on the data element VBELN_VA.

In the next screen double click on the domain VBELN.

Choose the Definition tab and at the bottom will be a field called "Convers. Routine" If this has an entry then that particular domain has a conversion function against it - double click on this field and a pop-up will appear listing any conversion function modules.

Hope this helps,

Gareth.

Read only

Former Member
0 Likes
1,413

HELPFUL ANSWERS.

THANKS

KAMAL