Skip to Content
author's profile photo Former Member
Former Member

Problem in CRM_ORDER_MAINTAIN

Dear Experts.

I am facing a problem with CRM_ORDER_MAINTAIN in this i want to change the date.

And i am using the below code it do not have any error but the dateu2019s are not changing.

I am send in the code please advice me.

Thanks

Pramod

--


FOR DATE CHANGEING--

LS_FIELD_NAMES-FIELDNAME = 'REF_KIND'.

LS_FIELD_NAMES-CHANGEABLE = 'X'.

INSERT LS_FIELD_NAMES INTO TABLE LS_INPUT_FIELDS1-FIELD_NAMES.

LS_FIELD_NAMES-FIELDNAME = 'APPT_TYPE'.

LS_FIELD_NAMES-CHANGEABLE = 'X'.

INSERT LS_FIELD_NAMES INTO TABLE LS_INPUT_FIELDS1-FIELD_NAMES.

LS_FIELD_NAMES-FIELDNAME = 'TIMESTAMP_FROM'.

LS_FIELD_NAMES-CHANGEABLE = 'X'.

INSERT LS_FIELD_NAMES INTO TABLE LS_INPUT_FIELDS1-FIELD_NAMES.

LS_FIELD_NAMES-FIELDNAME = 'TIMEZONE_FROM'.

LS_FIELD_NAMES-CHANGEABLE = 'X'.

INSERT LS_FIELD_NAMES INTO TABLE LS_INPUT_FIELDS1-FIELD_NAMES.

LS_FIELD_NAMES-FIELDNAME = 'TIMESTAMP_TO'.

LS_FIELD_NAMES-CHANGEABLE = 'X'.

INSERT LS_FIELD_NAMES INTO TABLE LS_INPUT_FIELDS1-FIELD_NAMES.

LS_FIELD_NAMES-FIELDNAME = 'TIMEZONE_TO'.

LS_FIELD_NAMES-CHANGEABLE = 'X'.

INSERT LS_FIELD_NAMES INTO TABLE LS_INPUT_FIELDS1-FIELD_NAMES.

*LS_FIELD_NAMES-fieldname = 'TIME_UNIT'.

*LS_FIELD_NAMES-CHANGEABLE = 'X'.

  • INSERT LS_FIELD_NAMES INTO TABLE LS_INPUT_FIELDS1-FIELD_NAMES.

LS_INPUT_FIELDS1-REF_HANDLE = '0000000000'.

LS_INPUT_FIELDS1-REF_GUID = GUID.

LS_INPUT_FIELDS1-OBJECTNAME = 'APPOINTMENT'.

LS_INPUT_FIELDS1-FIELD_NAMES = LS_INPUT_FIELDS1-FIELD_NAMES[].

INSERT LS_INPUT_FIELDS1 INTO TABLE GIT_INPUT_FIELDS.

*Set up the values for the fields to be updated.

WA_APPOINTMENT-REF_HANDLE = '0000000000'.

WA_APPOINTMENT-REF_GUID = GUID.

WA_APPOINTMENT-REF_KIND = 'A'.

WA_APPOINTMENT-APPT_TYPE = 'ORDERACTUAL'.

WA_APPOINTMENT-TIMESTAMP_FROM = 20091010101212.

WA_APPOINTMENT-TIMEZONE_FROM = TZONE.

WA_APPOINTMENT-TIMESTAMP_TO = 20091010101212.

WA_APPOINTMENT-TIMEZONE_TO = TZONE.

*WA_APPOINTMENT-time_unit = 20091010101212.

INSERT WA_APPOINTMENT INTO TABLE GIT_APPOINTMENT.

CALL FUNCTION 'CRM_ORDER_MAINTAIN'

EXPORTING

*IT_PARTNER = git_patner

*it_partner = lt_partner

IT_STATUS = GIT_MODIFY_STATUS

IT_APPOINTMENT = GIT_APPOINTMENT

IT_TEXT = LT_TEXTS

CHANGING

CT_INPUT_FIELDS = GIT_INPUT_FIELDS

EXCEPTIONS

ERROR_OCCURRED = 1

DOCUMENT_LOCKED = 2

NO_CHANGE_ALLOWED = 3

NO_AUTHORITY = 4

OTHERS = 5.

CHECK SY-SUBRC EQ 0.

CALL FUNCTION 'CRM_ORDER_SAVE'

EXPORTING

IT_OBJECTS_TO_SAVE = GIT_HEAD_TO_SAVE

EXCEPTIONS

DOCUMENT_NOT_SAVED = 1

OTHERS = 2.

*Commit the data in the buffer

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

WAIT = 'X'.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Dec 17, 2008 at 11:54 AM

    Hi Pramod,

    do the following changes in your code and try.

    -


    FOR DATE CHANGEING----


    LS_FIELD_NAMES-FIELDNAME = 'APPT_TYPE'.

    LS_FIELD_NAMES-CHANGEABLE = 'X'.

    INSERT LS_FIELD_NAMES INTO TABLE LS_INPUT_FIELDS1-FIELD_NAMES.

    clear LS_FIELD_NAMES.

    LS_FIELD_NAMES-FIELDNAME = 'TIMESTAMP_FROM'.

    LS_FIELD_NAMES-CHANGEABLE = 'X'.

    INSERT LS_FIELD_NAMES INTO TABLE LS_INPUT_FIELDS1-FIELD_NAMES.

    clear LS_FIELD_NAMES.

    LS_INPUT_FIELDS1-REF_GUID = GUID.

    LS_INPUT_FIELDS1-ref_kind = 'A'..

    LS_INPUT_FIELDS1-logical_key = 'ORDERACTUAL'.

    LS_INPUT_FIELDS1-OBJECTNAME = 'APPOINTMENT'.

    LS_INPUT_FIELDS1-FIELD_NAMES = LS_INPUT_FIELDS1-FIELD_NAMES[].

    INSERT LS_INPUT_FIELDS1 INTO TABLE GIT_INPUT_FIELDS.

    *****************************************************************************************

    *Set up the values for the fields to be updated

    Use the below function module to get the system time zone

    *get the system timezone

    call function 'GET_SYSTEM_TIMEZONE'

    importing

    timezone = w_timezone

    exceptions

    customizing_missing = 1

    others = 2.

    *get the system time

    w_time = sy-uzeit.

    *get the date that needs to changed

    w_date = sy-datum.

    *convert the date into timestamp

    convert date w_date time w_time into time stamp w_timestamp_from time zone w_timezone.

    WA_APPOINTMENT-REF_GUID = GUID.

    WA_APPOINTMENT-REF_KIND = 'A'.

    WA_APPOINTMENT-APPT_TYPE = 'ORDERACTUAL'.

    WA_APPOINTMENT-TIMESTAMP_FROM = w_timestamp_from.

    INSERT WA_APPOINTMENT INTO TABLE GIT_APPOINTMENT.

    CALL FUNCTION 'CRM_ORDER_MAINTAIN'

    EXPORTING

    *IT_PARTNER = git_patner

    *it_partner = lt_partner

    IT_STATUS = GIT_MODIFY_STATUS

    IT_APPOINTMENT = GIT_APPOINTMENT

    IT_TEXT = LT_TEXTS

    CHANGING

    CT_INPUT_FIELDS = GIT_INPUT_FIELDS

    EXCEPTIONS

    ERROR_OCCURRED = 1

    DOCUMENT_LOCKED = 2

    NO_CHANGE_ALLOWED = 3

    NO_AUTHORITY = 4

    OTHERS = 5.

    CHECK SY-SUBRC EQ 0.

    w_header_guid = GUID.

    INSERT w_header_guid INTO TABLE GIT_HEAD_TO_SAVE.

    CALL FUNCTION 'CRM_ORDER_SAVE'

    EXPORTING

    IT_OBJECTS_TO_SAVE = GIT_HEAD_TO_SAVE

    EXCEPTIONS

    DOCUMENT_NOT_SAVED = 1

    OTHERS = 2.

    *Commit the data in the buffer

    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

    EXPORTING

    WAIT = 'X'.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.