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

update table

Former Member
0 Likes
1,174

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

9 REPLIES 9
Read only

Former Member
0 Likes
1,107

Hi,

Just use CONVERT_DATE_TO_INTERNAL to convert date.

Regards,

Atish

Read only

0 Likes
1,107

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

Read only

0 Likes
1,107

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

Read only

0 Likes
1,107

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.

Read only

0 Likes
1,107

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?

Read only

0 Likes
1,107

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

Read only

0 Likes
1,107

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.

Read only

former_member194669
Active Contributor
0 Likes
1,107

Hi,

Try to use fm CHANGE_POINTERS_STATUS_WRITE

aRs