on 04-11-2006 4:56 PM - last edited on 02-03-2024 11:07 PM by postmig_api_4
hi,
I have written a se38 program to change the status o an activity in a complaint tcode CIC0. I have written the following coed. but then it doesn't work I am forwarding the code too. can you please cgeck and tell me where I am going wrong :
REPORT Z_CRMORDERREAD.
data : lt_header_guid type CRMT_OBJECT_GUID_TAB,
wa_header_guid type CRMT_OBJECT_GUID,
lt_doc_flow type CRMT_DOC_FLOW_WRKT,
wa_doc_flow type CRMT_DOC_FLOW_WRK,
lt_status type CRMT_STATUS_WRKT,
h_header type table of BAPIBUS2000110_HEADER_INS,
wah_header type BAPIBUS2000110_HEADER_INS, " work area
hx_header type table of bapibus2000110_header_insx,
wahx_header type bapibus2000110_header_insx, " work area
s_status type table of BAPIBUS20001_STATUS_INS,
was_status type BAPIBUS20001_STATUS_INS, " work area
sx_status type table of BAPIBUS20001_STATUS_INSX,
wasx_status type BAPIBUS20001_STATUS_INSX. " work area
data : return type table of BAPIRET2.
wa_header_guid = '443A2B18B2AA01D802000000888DE636'.
* 443A2B18B2AA01D802000000888DE636
append wa_header_guid to lt_header_guid.
CALL FUNCTION 'CRM_ORDER_READ'
EXPORTING
IT_HEADER_GUID = lt_header_guid
IMPORTING
ET_STATUS = lt_status
ET_DOC_FLOW = lt_doc_flow
.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*loop at lt_doc_flow into wa_doc_flow.
*write 😕 wa_doc_flow-objkey_b.
wah_header-GUID = wa_header_guid. "wa_doc_flow-objkey_b.
*was_status-ref_guid = wa_header_guid. "wa_doc_flow-objkey_b.
append wah_header to h_header.
*endloop.
wahx_header-GUID = 'X'.
append wahx_header to hx_header.
was_status-ref_guid = wa_doc_flow-objkey_b.
was_status-status = 'E0004'.
append was_status to s_status.
wasx_status-ref_guid = 'X'.
wasx_status-status = 'X'.
append wasx_status to sx_status.
CALL FUNCTION 'BAPI_ACTIVITYCRM_CHANGEMULTI'
TABLES
HEADER = h_header
HEADERX = hx_header
STATUS = s_status
STATUSX = sx_status
RETURN = return
.
commit work.
write sy-subrc.
*loop at return.
*
*endloop.
break-point.
Regards,
Vijay.
Hi Varun,
If you read documentation of FM 'BAPI_ACTIVITYCRM_CHANGEMULTI' it clearly says that you need follow it with a call FM BAPI_ACTIVITYCRM_SAVE.
After this, BAPI_TRANSACTION_COMMIT needs to be called.
This is the basic usage for any BAPI that works on Business transactions like avtivity, contracts, etc.
1. Change business transaction - using FM CRM_ORDER_MAINTAIN (All BAPIs like BAPI_ACTIVITYCRM_CHANGEMULTI eventually call CRM_ORDER_MAINTAIN).
2. Save the changed docuement -using CRM_ORDER_SAVE (again, all save BAPIs eventually call CRM_ORDER_SAVE)
3. Commit changs to DB using BAPI_TRANSACTION_COMMIT or simply commit work.
Please close the thread if this solves your problem.
Regards
Kaushal
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
If it is just the status you wish to maintain use function module CRM_ORDER_CHANGE_STATUS
You also need to call function module CRM_ORDER_SAVE after each service ticket change.
Please reward point if this works.
Cheers
Colin.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
sadly the documentation of the bapi is very poor.
But the BAPI works fine at all.
Try to fill the structures like this:
.....
*SET HEADER
ls_act_header_bapi-guid = 47568315A45.....
ls_act_header_bapi-handle = 1. "e.g.
APPEND ls_act_header_bapi TO lt_act_header_bapi.
CLEAR ls_input_bapi.
ls_input_bapi-ref_guid = 47568315A45.....
ls_input_bapi-ref_handle = 1.
ls_input_bapi-ref_kind = 'A'.
ls_input_bapi-objectname = 'ORDERADM_H'.
ls_input_bapi-logical_key = '0001'. "e.g.
APPEND ls_input_bapi TO lt_input_bapi.
*SET STATUS
ls_status_bapi-ref_handle = 1.
ls_status_bapi-ref_guid = 47568315A45.....
ls_status_bapi-ref_kind = 'A'.
ls_status_bapi-status = 'E0004'. "e.g.
ls_status_bapi-user_stat_proc = ..."enter your status sheme here
ls_status_bapi-activate = 'X'.
APPEND ls_status_bapi TO lt_status_bapi.
*Set the change fields
ls_statusx_bapi-status = 'X'.
ls_statusx_bapi-activate = 'X'.
ls_statusx_bapi-user_stat_proc = 'X'.
APPEND ls_statusx_bapi TO lt_statusx_bapi.
CLEAR ls_input_bapi.
ls_input_bapi-ref_guid = 47568315A45.....
ls_input_bapi-ref_handle = 1.
ls_input_bapi-ref_kind = 'A'.
ls_input_bapi-objectname = 'STATUS'.
ls_input_bapi-logical_key = '0001'. "e.g.
ls_input_bapi-fieldname = 'STATUS'.
APPEND ls_input_bapi TO lt_input_bapi.
ls_input_bapi-fieldname = 'USER_STAT_PROC'.
APPEND ls_input_bapi TO lt_input_bapi.
ls_input_bapi-fieldname = 'ACTIVATE'.
APPEND ls_input_bapi TO lt_input_bapi.
CALL FUNCTION 'BAPI_ACTIVITYCRM_CHANGEMULTI'
TABLES
HEADER = lt_act_header_bapi
STATUS = lt_status_bapi
STATUSX = lt_statusx_bapi
INPUT_FIELDS = lt_input_bapi
RETURN = lt_return2.
.....
then you call BAPI_ACTIVITYCRM_SAVE
and BAPI_TRANSACTION_COMMIT and it should work.
sorry. our customer has disabled the copy/paste function in the browser, so I only give you this snippet.
Try if it works, you perhaps have not to fill all fields but there are all mandatory fields mentioned. I use this programm to set the status after a migration of thousands of activitys and it works fine.
Hope it helps a little bit
Greetings
Chris
Hi,
I have a similar case. We are trying to change some partner id's from an activity as:
CALL FUNCTION 'BAPI_ACTIVITYCRM_CHANGEMULTI'
TABLES
PARTNER = lt_prtnr_set
PARTNERX = lt_prtnr_ch_flg
RETURN = lt_rtn.
in partnerx, REF_PARTNER_NO = 'X' (the only field that is updated) also, iam calling BAPI_TRANSACTION_COMMIT after CHANGEMULTI. Still, the changes are not being saved.
Also, should the no of lines in PARTNER and PARTNERX tables be same ? can you please comment on how to populate PARTNER and PARTNERX tables ?
Hi Christian,
I have a similar problem.
I am trying to create sales order transaction using BAPI
'BAPI_SLSTRANSACT_CREATEMULTI'.The BAPI creates the information for the object name 'ORDERADM_H' and 'ORDERADM_I'.When I tried to include the object 'ORGMAN' the BAPI return table RETURN shows the following message
A CRM_ORDER 017 An authorization check could not be executed
The input fields and ORGAMAN structure are as follows.
IT_INPUT_FIELDS-REF_HANDLE = V_HAND_O.
IT_INPUT_FIELDS-OBJECTNAME = 'ORGMAN'.
IT_INPUT_FIELDS-ref_kind = 'A'.
IT_INPUT_FIELDS-FIELDNAME = 'REF_HANDLE'.
APPEND IT_INPUT_FIELDS.
IT_INPUT_FIELDS-REF_HANDLE = V_HAND_O.
IT_INPUT_FIELDS-OBJECTNAME = 'ORGMAN'.
IT_INPUT_FIELDS-ref_kind = 'A'.
IT_INPUT_FIELDS-FIELDNAME = 'DIS_CHANNEL'.
APPEND IT_INPUT_FIELDS.
IT_INPUT_FIELDS-REF_HANDLE = V_HAND_O.
IT_INPUT_FIELDS-OBJECTNAME = 'ORGMAN'.
IT_INPUT_FIELDS-ref_kind = 'A'.
IT_INPUT_FIELDS-FIELDNAME = 'SALES_ORG'.
APPEND IT_INPUT_FIELDS.
IT_ORG-REF_HANDLE = V_HAND_O.
IT_ORG-DIS_CHANNEL = '10'.
IT_ORG-SALES_ORG = 'O 50000001'.
IT_org-ref_kind = 'A'.
APPEND IT_ORG.
The handle V_HAND_O was generated through FM 'CRM_PRP_IL_GET_HANDLE'.
Is this an authorization issue.
Thanks,
Chamu
try to use function module 'CRM_ORDER_MAINTAIN' to chage the status.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
5 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.