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

function module to conver date to internal format

Former Member
0 Likes
2,929

Can anybody say what is the function module used to convert the format of the date which is taken from excel sheet to the sap format. If so pls tell me how to use that function module.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,285
REPORT YCHATEST.
 
TYPE-POOLS : KCDE.
 
DATA : V_DATE1 TYPE KCDE_INTERN_VALUE,
       V_DATE2 TYPE KCDE_INTERN_VALUE.
 
V_DATE1 = '23/02/2007'.
 
CALL FUNCTION 'KCD_EXCEL_DATE_CONVERT'
  EXPORTING
    EXCEL_DATE  = V_DATE1
    DATE_FORMAT = 'TMJ'
  IMPORTING
    SAP_DATE    = V_DATE2
  EXCEPTIONS
    OTHERS      = 0.
WRITE : V_DATE2.

here in TMJ , T for day , M for Month and J for for year
if in the excel ur date format is MM/DD/YYYY , the give it as MTJ
8 REPLIES 8
Read only

sreeramkumar_madisetty
Active Contributor
0 Likes
1,285

Hi

Use the FM:

CONVERT_DATE_TO_INTERN_FORMAT

Regards,

kumar

Read only

Former Member
0 Likes
1,285

Hi,

Use the FM:

<b>DATE_CONV_EXT_TO_INT</b> - user formatted date is converted to system date

Hope this helps.

Reward if helpful.

Regards,

Sipra

Read only

Former Member
0 Likes
1,285

Hi

Use the functions modules CONVERT_DATE_TO_EXTERNAL or CONVERT_DATE_TO_INTERNAL to convert the date. When converting to external format, the date format from the user's user profile will be used. When converting to internal format, the result will be in YYYYMMDD format

CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'
       EXPORTING
            DATE_EXTERNAL            = REC_DTL
       IMPORTING
            DATE_INTERNAL            = SPECTRO_ITAB-CAST_DATE
       EXCEPTIONS
            DATE_EXTERNAL_IS_INVALID = 1
            OTHERS                   = 2.

Regards

Sudheer

Read only

Former Member
0 Likes
1,285

Currently my date is getting printed in format 05262005.

I want the output as 26 May, 2005.

I have tried using Set date mask option but it is not picking up in the output.

Code:

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).

http://www.sap-img.com/abap/abap-program-output-of-date-format.htm

Read only

Former Member
0 Likes
1,285

DATE_CONV_EXT_TO_INT is easy n good

Read only

Former Member
0 Likes
1,285

Hi ,

Try FM <b>CONVERT_DATE_TO_INTERNAL</b>

reward if useful.

Read only

Former Member
0 Likes
1,286
REPORT YCHATEST.
 
TYPE-POOLS : KCDE.
 
DATA : V_DATE1 TYPE KCDE_INTERN_VALUE,
       V_DATE2 TYPE KCDE_INTERN_VALUE.
 
V_DATE1 = '23/02/2007'.
 
CALL FUNCTION 'KCD_EXCEL_DATE_CONVERT'
  EXPORTING
    EXCEL_DATE  = V_DATE1
    DATE_FORMAT = 'TMJ'
  IMPORTING
    SAP_DATE    = V_DATE2
  EXCEPTIONS
    OTHERS      = 0.
WRITE : V_DATE2.

here in TMJ , T for day , M for Month and J for for year
if in the excel ur date format is MM/DD/YYYY , the give it as MTJ
Read only

Former Member
0 Likes
1,285

Hi

Use the following function module

'CONVERT_DATE_TO_INTERNAL'

'CONVERT_DATE_TO_EXTERNAL'

Hope this helps.

Regds,

Seema