‎2008 Jan 17 9:31 AM
Hello Gurus,
I have one probelm with conversion of the date.
PDATE1 TYPE D.
PDATE1 = SY-DATUM.
WRITE : PDATE1.
my problem is SY-DATUM = 17.01.2007 and i am getting pdate1 is 17012008.
any method or function module is there to convet 17012008 to 17.01.2008.
Thanks in advance.
Best Regds,
zubera
‎2008 Jan 17 9:39 AM
Use
WRITE PDATE1 USING EDIT MASK '__.__.____'.
Vinodh Balakrishnan
‎2008 Jan 17 9:41 AM
Hi,
One way is by manually converting it.
Take a variable of type c length 10.
Now your date is in the format 17012008.
Now write the following code :
DATA: d_date(10) TYPE c.
CONCATENATE sy-datum+0(2) d_date INTO d_date.
CONCATENATE d_date '.' INTO d_date.
CONCATENATE d_date sy-datum+2(2) INTO d_date.
CONCATENATE d_date '.' INTO d_date.
CONCATENATE d_date sy-datum+4(4) INTO d_date.
I think this will help.
Regards,
Sagar
‎2008 Jan 17 9:43 AM
Hello Vinod ,
Thanks for your reply.
my problem is i dont want to write the date formate.
i want to input the date formate in the BDC screen.
I want to take PDATE1 = SY-DATUM and input in the form '17.01.2008' BDC Screen.
Thanks in advance.
best regds,
zub
‎2008 Jan 17 9:43 AM
data : date(10) type c value '01122004'.
write 😕 date using edit mask '__/__/____'.
output is : 01.12.2004.
‎2008 Jan 17 9:55 AM
‎2008 Jan 17 10:01 AM
Hi,
Ignore my first reply.
Try this out
Take a variable of type c length 10.
Now your date is in the format 17012008.
Now write the following code :
DATA: d_date(10) TYPE c.
CONCATENATE pdate1+0(2) d_date INTO d_date.
CONCATENATE d_date '.' INTO d_date.
CONCATENATE d_date pdate1+2(2) INTO d_date.
CONCATENATE d_date '.' INTO d_date.
CONCATENATE d_date pdate1+4(4) INTO d_date.
It works Please try it out.
Regards,
Sagar
‎2008 Jan 17 10:02 AM
Thanks for your reply.
it is not working . it is giving in some other formate.
‎2008 Jan 17 10:13 AM
Try the function module. Are you sure your sy-datum is in th eformat 17.01.2008, if pdate1 is in the format 17012008. Because I assigned the value 17012008 to pdate1 and it works.
Can you please confirm the formats again by debugging.
Regards,
Sagar
‎2008 Jan 17 10:17 AM
Hi Sagar,
Thanks for your reply.
SY-DATUM formate is 17.01.2008.
PDATUM TYPE D.
PDATUM = SYDATUM.
Insteade of stroring PDATU as 17.01.2008 it stores 17012008.
So i want to take the sy-datum field in the formate 17.01.2008 and enter in to input screen of BDC.
‎2008 Jan 17 10:20 AM
Hi,
Instead of the type D, you should have used sy-datum.
Your problem can be solved with CONVERT_DATE_TO_EXTERNAL.
FYI :
Check out this code :
DATA:
v_date LIKE sy-datum,
v_date_o(10).
v_date = sy-datum.
WRITE : / 'Today : ' , v_date.
CALL FUNCTION 'DATE_STRING_CONVERT'
EXPORTING
date_format = '1'
date_string = sy-datum
IMPORTING
result_date = v_date.
v_date_o = v_date.
WRITE:/ 'Converted : ', v_date_o.
Where date_format takes :
1 - DD.MM.YYYY
2 - MM/DD/YYYY
3 - MM-DD-YYYY
4 - YYYY.MM.DD
5 - YYYY/MM/DD
6 - YYYY-MM-DD
Also check out the Function module :
CONVERT_DATE_TO_INTERNAL
Regards,
Remi
Plz reward points if useful
‎2008 Jan 17 10:38 AM
it is giving same formate which i mentioned earlier. 01172008.
I think it is not working acording to my requirement.
‎2008 Jan 17 10:48 AM
Hi,
declare pdatum like:
pdatum TYPE dats..
regards,
Renjith Michael.
‎2008 Jan 17 10:53 AM
‎2008 Jan 17 11:29 AM
Hello Michel,
It si working fine when output.
But again problem when giving input to BDC screen field. it take same formate of 20081701.
Pleasse let me know any method is there to change.
‎2008 Jan 17 11:38 AM
Hi,
Before bdc do it like:
DATA: date_string(10) TYPE c.
data : date_c(2) type c, month_c(2) type c, year_c(4) type c, e(20) type c, f(30) type c.
date_c = pdatum+6(2).
month_c = pdatum+4(2).
year_c = pdatum+0(4).
concatenate date_c '. ' month_c '. ' year_c into date_string .
and pass this date_string to your BDC.
Regards,
Renjith Michael.
Edited by: Renjith Michael on Jan 17, 2008 5:16 PM
‎2008 Jan 17 12:04 PM
ya exactly i have hard coded and it is working fine.
thanks