Posted: Fri Aug 22, 2014 5:46 pm Post subject: CRM ORDER change
Code:
data: lt_status type CRMT_STATUS_COMT,
ls_status like line of lt_status.
data: ch_inputfields type CRMT_INPUT_FIELD_TAB,
lt_sorted type CRMT_INPUT_FIELD_NAMES_TAB,
ls_sorted like line of lt_sorted,
ls_inputfields like line of ch_inputfields.
data: lt_header_guid type crmt_object_guid_tab,
ls_header_guid type crmt_object_guid,
lt_appointment_wrk type crmt_appointment_wrkt,
ls_appointment_wrk type crmt_appointment_wrk,
lt_appointment type crmt_appointment_comt,
ls_appointment type crmt_appointment_com.
data: ls_input_fields type crmt_input_field,
lt_input_fields type crmt_input_field_tab,
ls_input_field_names type crmt_input_field_names,
lt_input_field_names type crmt_input_field_names_tab.
ls_header_guid = '52678085A0265C9EE1000000AC19665E'.
insert ls_header_guid into table lt_header_guid.
LOOP AT lt_appointment_wrk into ls_appointment_wrk.
MOVE-CORRESPONDING ls_appointment_wrk to ls_appointment.
ls_appointment-appt_type = 'ORDERACTUAL'.
append ls_appointment to lt_appointment.
ENDLOOP.
BREAK-POINT.
CALL FUNCTION 'CRM_ORDER_MAINTAIN'
EXPORTING
IT_APPOINTMENT = lt_appointment
CHANGING
CT_INPUT_FIELDS = lt_input_fields
EXCEPTIONS
ERROR_OCCURRED = 1
DOCUMENT_LOCKED = 2
NO_CHANGE_ALLOWED = 3
NO_AUTHORITY = 4
OTHERS = 5.
IF SY-SUBRC <> 0.
BREAK-POINT.
write:/ 'Fehler Maintain', sy-subrc.
else.
data: lt_save_guid type crmt_object_guid_tab,
ls_save_guid type crmt_object_guid,
lt_saved_objects type crmt_return_objects,
lt_not_saved_objects type crmt_object_guid_tab,
ls_saved_objects type crmt_return_objects_struc,
lv_update_task_local type boolean.
BREAK-POINT.
ls_save_guid = ls_header_guid.
append ls_save_guid to lt_save_guid.
CALL FUNCTION 'CRM_ORDER_SAVE'
EXPORTING
IT_OBJECTS_TO_SAVE = lt_save_guid
IV_UPDATE_TASK_LOCAL = lv_update_task_local
IMPORTING
ET_SAVED_OBJECTS = lt_saved_objects
ET_OBJECTS_NOT_SAVED = lt_not_saved_objects
EXCEPTIONS
DOCUMENT_NOT_SAVED = 1
OTHERS = 2.
IF sy-subrc <> 0.
BREAK-POINT.
ENDIF.
IF SY-SUBRC <> 0.
write: 'Fehler ORDER SAVE'.
else.
data: lt_return type BAPIRET2.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'
IMPORTING
RETURN = lt_return.
ENDIF.
ENDIF.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum
All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG. SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG. Every effort is made to ensure content integrity. Use information on this site at your own risk.