‎2007 Jul 12 2:44 AM
Hi all,
I am updating a table 'bdcp2'. We want to fix process = y.
where condition are cretime < sy-datum - 7
and mestype = ' '
But cretime(creation of date) is character type. But update in oracle database may not accept that. So we need to change character type to date type.
Can you pls help me, its urgent.
I will reward.
Thanks
‎2007 Jul 12 2:49 AM
Hi,
Just use CONVERT_DATE_TO_INTERNAL to convert date.
Regards,
Atish
‎2007 Jul 12 3:03 AM
Hi Atish,
can u pls tell me what should I put in export and import in CONVERT_DATE_TO_INTERNAL . I mean in my case what should be export and what should ne import.
Thanks
Message was edited by:
sulogna Chatterjee
‎2007 Jul 12 3:11 AM
it_data is the table which has your date in character type
it_tab is the table in which your date should be in sy-datum type
declare in your it_tab like this
date like sy-datum
CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'
EXPORTING
input = it_data-value " the value in Character type
IMPORTING
output = it_tab-date. " the value in SY-DATUM type
Regards
Gopi
‎2007 Jul 12 3:17 AM
Instead of FM you can directly copy it to Date type.
data : v_char(8) type c value '20060909',
v_dats type dats.
v_dats = v_char.
or use WRITE to do this -
DATA : datec(8) TYPE c VALUE '20061230',
dated TYPE d.
WRITE datec TO dated.
or use MOVE for this -
DATA: CHAR_DATE(8) TYPE C value '20061230',
DATUM_DATE LIKE SY-DATUM.
MOVE CHAR_DATE TO DATUM_DATE.
Also, here is the FM -
DATA : datec(8) TYPE c VALUE '20061230',
dated TYPE d.
CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'
EXPORTING
date_external = datec
IMPORTING
date_internal = dated
EXCEPTIONS
date_external_is_invalid = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
Regards,
Amit
reward all helpful replies.
‎2007 Jul 12 3:26 AM
my table is bdcp2. the field is cretime. And this field in sap standard is in character type. I want to convert this in date type. is 'CONVERT_DATE_TO_INTERNAL' is applicable or 'CONVERT_DATE_TO_EXTERNAL' is applicable?
Do I need to declare a internal table Gopi?
‎2007 Jul 12 3:39 AM
Actually speaking your requirment is to change the date format from Character to Date format. Right?
for that you use this FM : CONVERSION_EXIT_IDATE_INPUT
Goto SE37 and see its documentation. You will have an example also.
regd internal table since you said that you have to update the table BDCP2, fetch the records frm that table and store in internal table and in loop apply the Function module.
ex :
data : begin of it_bdcp2 occurs 0,
<fieldss>....
date type c,
end of it_bdcp2.
data : begin of itab occurs 0,
<fields>....
date like sy-datum
end of itab
loop at it_bdcp2.
call function 'CONVERSION_EXIT_IDATE_INPUT'
exporting
input = it_bdcp2-date " date in char format
importing
output = it_tab-date. " date in date format
clear itab.
endloop.Regards
Gopi
‎2007 Jul 12 5:25 AM
bdcp2 is a change pointer table. I need to update that. can u pls tell me what exactly I need to do in function module change_pointer_status_write.
can u pls explain me in details code.
pls its urgent.
‎2007 Jul 12 2:51 AM
‎2007 Jul 12 5:36 AM
Hi,
check this
CHANGE_POINTERS_STATUS_WRITE - mark change pointers as processed
http://www.bgs.dk/public/Artikler/Programmering/changepointers.pdf
http://www.jt77.com/development1/programming-22729.html
aRs