on 08-17-2015 1:02 PM
Hello.
I'm using FM "AGS_SD_GDAPI_IF_WS_UPDATE" to add text of type SU99 to a Solman Incident.
That is working fine.
But i don't know how to achieve this goal for a Solman Change Request. GUID is found by
FM CMS_ORDERADM_H_READ.
But using FM "AGS_SD_GDAPI_IF_WS_UPDATE" for the Change Request leads to the
message "Process type & is no incident or is not maintained in DNO_CUST04" (AGS_SD_GDAPI/037)
According Transaction type ZMCR is customized in DNO_CUST04, but assigned to "CHANGE_REQUEST_NEW".
data :
lt_return type bapiret2_t,
ls_return type bapiret2,
lt_messages type zbc_message_text_t,
ls_message type zbc_message_text,
lt_text type comt_text_lines_t,
ls_line type tline,
l_guid(32) type c.
clear lt_return.
refresh lt_return.
ls_line-tdformat = '*'.
ls_line-tdline = i_transport_request.
append ls_line to lt_text.
* determine whether ticket is incident or CR
if go_model->request_ticket_number+0(1) = '7'.
ls_message-tdid = 'ZTRA'.
ls_message-tdspras = 'DE'.
ls_message-lines = lt_text.
append ls_message to lt_messages.
else.
ls_message-tdid = 'SU99'.
ls_message-tdspras = 'DE'.
ls_message-lines = lt_text.
append ls_message to lt_messages.
endif.
try.
clear l_guid.
l_guid = go_model->guid_ticket.
call function 'AGS_SD_GDAPI_IF_WS_UPDATE' destination 'PFAMDT100'
exporting
iv_guid = l_guid
* IS_MESSAGE_DATA =
* IT_PARTNER =
it_text = lt_messages
* IT_ATTACHMENTS =
importing
et_return = lt_return.
call function 'BAPI_TRANSACTION_COMMIT' destination 'PFAMDT100'
exporting
wait = space
importing
return = ls_return.
call function 'RFC_CONNECTION_CLOSE'
exporting
destination = 'PFAMDT100'
* TASKNAME =
exceptions
destination_not_open = 1
others = 2.
if sy-subrc <> 0.
endif.
catch cx_root.
endtry.
Any ideas what to do to get the text added in a Change Request object ?
Thanks a lot,
Sebastian
Hi Sebastian,
the best way is to use function module CRM_ORDER_MAINTAIN to add a text.
Since it is rather complicated to use, please check the example from class CL_HF_HELPER, method HANDLE_NOTICE to get an idea how it works.
Best Regards,
Christoph
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Christoph,
great idea. I adapted my coding to your suggestion.
I try to add the some lines to text-object "ZTRA" (=Description Text of the CR). But it does not work. I'm using this coding.
Do you have an idea, what i'm missing ?
include crm_object_names_con.
constants: begin of gc_object_kind,
orderadm_h type crmt_object_kind value 'A',
orderadm_i type crmt_object_kind value 'B',
extension_h type crmt_object_kind value 'C',
extension_i type crmt_object_kind value 'D',
set type crmt_object_kind value 'E',
end of gc_object_kind.
data:
lt_notice type crmt_text_comt,
ls_notice type CRMT_TEXT_COM,
lt_orderadm_h_maint type crmt_orderadm_h_comt,
ls_orderadm_h_maint type crmt_orderadm_h_com,
ls_input_fields type crmt_input_field,
lt_input_fields type crmt_input_field_tab,
lt_exception type crmt_exception_t,
lt_guids type crmt_object_guid_tab,
ls_guid type crmt_object_guid,
lt_orderadm_h_read type crmt_orderadm_h_wrkt,
ls_orderadm_h_read type crmt_orderadm_h_wrk,
lt_field_names type crmt_input_field_names_tab,
ls_field_names type crmt_input_field_names,
lt_lines type COMT_TEXT_LINES_T,
ls_line type TLINE.
call function 'Z_BC_CHECK_AIM_TICKET'
exporting
iv_object_id = i_ticketnumber
importing
e_guid = ls_guid.
append ls_guid to lt_guids.
clear lt_orderadm_h_read.
refresh lt_orderadm_h_read.
call function 'CRM_ORDER_READ'
exporting
it_header_guid = lt_guids
importing
et_orderadm_h = lt_orderadm_h_read.
read table lt_orderadm_h_read into ls_orderadm_h_read index 1.
move-corresponding ls_orderadm_h_read to ls_orderadm_h_maint. "#EC ENHOK
insert ls_orderadm_h_maint into table lt_orderadm_h_maint.
ls_input_fields-ref_guid = ls_orderadm_h_read-guid.
ls_input_fields-ref_kind = gc_object_kind-orderadm_h.
ls_input_fields-objectname = gc_object_name-texts.
ls_field_names-fieldname = 'LINES'.
ls_line-tdline = 'Hello World!'.
append ls_line to lt_lines.
ls_notice-ref_guid = ls_orderadm_h_read-guid.
ls_notice-TEXT_OBJECT = 'ZTRA'.
ls_notice-lines = lt_lines.
append ls_notice to lt_notice.
call function 'CRM_ORDER_MAINTAIN'
exporting
it_text = lt_notice
importing
et_exception = lt_exception
changing
ct_orderadm_h = lt_orderadm_h_maint
" 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.
endif.
commit work and wait.
Thanks a lot,
Sebastian
Hello Sebastian,
seems like your lt_input_fields table is not filled. You are filling ls_field_names and ls_input_fields, but are not inserting them into the right tables.
See method HANDLE_NOTICE, lines 47 - 49.
Another important information:
If you are using the code outside of the PPF framework, you have to execute the save manually.
This can be done by function module CRM_ORDER_SAVE.
Best Regards,
Christoph
Hello Christoph,
it's nearly done. I debugged FM CRM_TEXT_MAINTAIN_OW and all input vars are the same when calling my program compared to a manual text update via WebUI.
But my text is not getting updated. Am i missing something in my coding or parameters passed to FM CRM_ORDER_MAINTAIN ? There are no exceptions returned from FM Call.
Thanks for your patience. 🙂
BR,
Sebastian
function z_bc_update_aim_ticket.
*"----------------------------------------------------------------------
*"*"Lokale Schnittstelle:
*" IMPORTING
*" VALUE(I_TICKETNUMBER) TYPE CRMT_OBJECT_ID
*"----------------------------------------------------------------------
include crm_object_names_con.
constants: begin of gc_object_kind,
orderadm_h type crmt_object_kind value 'A',
orderadm_i type crmt_object_kind value 'B',
extension_h type crmt_object_kind value 'C',
extension_i type crmt_object_kind value 'D',
set type crmt_object_kind value 'E',
end of gc_object_kind.
data:
lt_notice type crmt_text_comt,
ls_notice type crmt_text_com,
lt_orderadm_h_maint type crmt_orderadm_h_comt,
ls_orderadm_h_maint type crmt_orderadm_h_com,
ls_input_fields type crmt_input_field,
lt_input_fields type crmt_input_field_tab,
lt_exception type crmt_exception_t,
lt_guids type crmt_object_guid_tab,
ls_guid type crmt_object_guid,
lt_orderadm_h_read type crmt_orderadm_h_wrkt,
ls_orderadm_h_read type crmt_orderadm_h_wrk,
lt_field_names type crmt_input_field_names_tab,
ls_field_names type crmt_input_field_names,
lt_lines type comt_text_lines_t,
ls_line type tline.
call function 'Z_BC_CHECK_AIM_TICKET'
exporting
iv_object_id = i_ticketnumber
importing
e_guid = ls_guid.
append ls_guid to lt_guids.
clear lt_orderadm_h_read.
refresh lt_orderadm_h_read.
call function 'CRM_ORDER_READ'
exporting
it_header_guid = lt_guids
importing
et_orderadm_h = lt_orderadm_h_read.
read table lt_orderadm_h_read into ls_orderadm_h_read index 1.
move-corresponding ls_orderadm_h_read to ls_orderadm_h_maint. "#EC ENHOK
insert ls_orderadm_h_maint into table lt_orderadm_h_maint.
ls_input_fields-ref_guid = ls_orderadm_h_read-guid.
ls_input_fields-ref_kind = gc_object_kind-orderadm_h.
ls_input_fields-objectname = gc_object_name-texts.
ls_field_names-fieldname = 'LINES'.
insert ls_field_names into table lt_field_names.
ls_field_names-fieldname = 'TDFORM'.
insert ls_field_names into table lt_field_names.
ls_field_names-fieldname = 'TDID'.
insert ls_field_names into table lt_field_names.
ls_field_names-fieldname = 'TDSPRAS'.
insert ls_field_names into table lt_field_names.
ls_field_names-fieldname = 'TDSTYLE'.
insert ls_field_names into table lt_field_names.
ls_input_fields-field_names = lt_field_names.
insert ls_input_fields into table lt_input_fields.
ls_line-tdformat = '*'.
ls_line-tdline = 'Hello World on Thursday!!!!!!'.
append ls_line to lt_lines.
ls_notice-ref_guid = ls_orderadm_h_read-guid.
ls_notice-ref_kind = 'A'.
ls_notice-text_object = 'CRM_ORDERH'.
ls_notice-tdid = 'ZTRA'.
ls_notice-tdform = 'SYSTEM'.
ls_notice-tdstyle = 'SYSTEM'.
ls_notice-tdspras = sy-langu.
ls_notice-tdtexttype = 'A'.
ls_notice-mode = 'A'.
ls_notice-lines = lt_lines.
append ls_notice to lt_notice.
call function 'CRM_ORDER_MAINTAIN'
exporting
it_text = lt_notice
importing
et_exception = lt_exception
changing
ct_orderadm_h = lt_orderadm_h_maint
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.
endif.
clear lt_exception.
refresh lt_exception.
call function 'CRM_ORDER_SAVE'
exporting
it_objects_to_save = lt_guids
* IV_UPDATE_TASK_LOCAL = FALSE
* IV_SAVE_FRAME_LOG = FALSE
* IV_NO_BDOC_SEND = FALSE
* IT_ACTIVE_SWITCH =
importing
* ET_SAVED_OBJECTS =
et_exception = lt_exception
* ET_OBJECTS_NOT_SAVED =
* changing
* CV_LOG_HANDLE =
* ct_nocheck_before_save = 'X'
exceptions
document_not_saved = 1
others = 2.
if sy-subrc <> 0.
endif.
call function 'CRM_ORDER_DEQUEUE'
exporting
iv_guid = ls_guid
* IV_COLLECT = ' '
* IV_ENQUEUE_MODE = 'E'
* IV_FROM_INIT = FALSE
.
endfunction.
Hello Sebastian,
CRM_ORDER_MAINTAIN seldom returns any usefull information, even if to actually runs into an error.
But if you are getting to FM CRM_TEXT_MAINTAIN_OW and it is executed as you described, than your call of CRM_ORDER_MAINTAIN has to be correct (means the buffer is filled with your text).
So i can only guess that the save of the ticket (buffer to db) does not work.
You can try to call FM BAPI_TRANSACTION_COMMIT after your CRM_ORDER_SAVE (assuming you are not in an PPF-Action where COMMIT_WORK is forbidden).
Best Regards,
Christoph
User | Count |
---|---|
95 | |
11 | |
11 | |
10 | |
9 | |
8 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.