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

Help on date format

Former Member
0 Likes
921

Hi Everyone,

I am reading date from a file which is in the form YYYYMMDD.

Is there any functional module that checks the user's date format and changes the format according to it.

for eg. if the user has a setting DD.MM.YYYY then YYYYMMDD should be converted to this format.

Helpful answeres will be certainly rewarded.

Thanks,

Sandeep

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
895

Use function module '/SAPDII/SPP05_CONVERT_DATE'.

Reward if found useful

8 REPLIES 8
Read only

former_member188829
Active Contributor
0 Likes
895

Hi,

Check this Example..

DATA:V_DATE(10).

concatenate sy-datum6(2)'.' sy-datum4(2)'.' sy-datum+0(4) into v_date.

Write:V_DATE.

Or Use the FM:

CONVERT_DATE_TO_INTERNAL

Read only

Former Member
0 Likes
895

hi

CONCATENATE p_date+6(2) '/'

p_date+4(2) '/'

p_date+0(4) INTO p_date1 .

regards

kk.

Read only

Former Member
0 Likes
895

Hi,

Use the function module CONVERT_DATE_TO_INTERNAL..

CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'

EXPORTING

DATE_EXTERNAL = V_DATE_EX

IMPORTING

DATE_INTERNAL = V_DATE.

Regards,

Satish

Read only

Former Member
0 Likes
895

hi sandeep

plz go to debugging

in that give sy-datum field in fields of the debugger

then u will be knowing the format of the date

then u can use the correct concatenation formula inorder to fit the format of the date in the sap.

if satisfied plz reward

regards

samarendra

Read only

Former Member
0 Likes
895

I dont think you need any FM in this case. Anyway SAP is going to store date in YYYYMMDD format internally.

So you can assign date value from file which is in YYYYMMDD with out any validations.

then after depending upon user setting date is going to dispaly. You need not do anything.

Read only

Former Member
0 Likes
895

Hi sandeep

There is a table USR01 where data format for current user is stored.

pass user name to 'BNAME' field

'DATFM' field value gives you the type of date format set.

then you can dynamically write code according to the date format set.

eg.

CASE DATFM

when '2'

concatenate sy-datum6(2)'.' sy-datum4(2)'.' sy-datum+0(4) into v_date.

when '

endcase.

I think this will solve your problem'

Please reward points if this solves ur problem

Sukhi.

Read only

Former Member
0 Likes
896

Use function module '/SAPDII/SPP05_CONVERT_DATE'.

Reward if found useful

Read only

Former Member
0 Likes
895

Hi

have you used SET COUNTRY.

i think it will work. try it.