cancel
Showing results for 
Search instead for 
Did you mean: 

How to change the reason in a ICWC-followup-process with the copying-BAdI?

Former Member
0 Kudos

Hi all,

I want to use the followup- and docflow-functionality in ICWC to copy most of the information from one process to another.

I made the definition of a copying control in the customizing -> working with a new BAdI and the copying routine. Everything works fine so far: I can get/change the description in the BAdIs ORDERADM_H method or the ibase information REFOBJ method for examples.

The question is now how to get/change the reason of the process?

Working with the genil_model_browser the reason is located in BTOrderHeader->BTHeaderBOSSet->BTSubjectSet_F->BTSubject_A1. Where can I find the reason in the BAdI methods?

Thanks for your help.

Regards,

Benjamin

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

you can use fm 'CRM_ORDER_READ' to read reason:

CALL FUNCTION 'CRM_ORDER_READ'

EXPORTING

it_header_guid = lt_header_guid_wrk

IMPORTING

et_service_os = lt_service_os_wrk

.

  • get record

READ TABLE lt_service_os_wrk INTO ls_service_os_wrk INDEX 1.

  • get Lead subject profile set

READ TABLE ls_service_os_wrk-osset INTO ls_osset_wrk WITH KEY profile_type = 'L'.

  • reasons internal table: ls_osset_wrk-subject

Former Member
0 Kudos

Hi,

you describe the way how to read the reason of a process. That is/was not my problem. The problem is to change the reason.

I also tried to read (with ORDER_READ) and afterwards write (with ORDER_MAINTAIN) the data. But that does not work because therefor you call the ORDER_MAINTAIN within the ORDER_MAINTAIN calling. These sequence causes an error.

Thanks for your help anyway.

darren_bambrick2
Active Participant
0 Kudos

Hi

Put a break point in crm_order_maintain to see what structures and fields you need to fill out. Then change the reason code in crm online, you will have all the data you need.

Here is some code I used in the he badi order_save, method prepare.

data:

IV_REF_HANDLE TYPE CRMT_HANDLE,

IV_REF_GUID TYPE CRMT_OBJECT_GUID,

IV_REF_KIND TYPE CRMT_OBJECT_KIND,

IS_SRV_OSSET_COM TYPE CRMT_SRV_OSSET_COM2,

IT_SRV_REFOBJ_COM TYPE CRMT_SRV_REFOBJ_COMT,

IT_SRV_SUBJECT_COM TYPE CRMT_SRV_SUBJECT_COMT,

is_srv_subject_com type CRMT_SRV_SUBJECT_COM,

ET_SRV_OSSET_COMT TYPE CRMT_SRV_OSSET_COMT,

LT_SRV_OSSET_COMT TYPE CRMT_SRV_OSSET_COMT,

ET_INPUT_FIELDS TYPE CRMT_INPUT_FIELD_TAB,

ET_EXCEPTION TYPE CRMT_EXCEPTION_T,

tab_osset type CRMT_SRV_OSSET_COMT1,

wa_osset like line of tab_osset,

wa_srv like line of ET_SRV_OSSET_COMT,

new_srv type CRMT_SRV_OSSET_COMT,

call_list_name type char50,

query_text(80).

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

refresh: ET_INPUT_FIELDS,

IT_SRV_SUBJECT_COM.

clear: is_srv_subject_com,

IS_SRV_OSSET_COM.

IV_REF_KIND = 'A'.

iv_ref_guid = iv_guid.

IS_SRV_OSSET_COM-SUBJECT_PROFILE = 'Z00000002'.

IS_SRV_OSSET_COM-PROFILE_TYPE = 'F'.

is_srv_subject_com-ref_handle = '0000000002'.

is_srv_subject_com-KATALOGART = 'A1'.

is_srv_subject_com-CODEGRUPPE = 'Z0000002'.

is_srv_subject_com-CODE = 'ZAA'.

is_srv_subject_com-DEFQUANTITY = 0.

is_srv_subject_com-MODE = 'A'.

append is_srv_subject_com to IT_SRV_SUBJECT_COM.

CALL FUNCTION 'CRM_SERVICE_OS_SET_DATA'

EXPORTING

IV_REF_GUID = iv_ref_guid

IV_REF_KIND = 'A'

IS_SRV_OSSET_COM = IS_SRV_OSSET_COM

IT_SRV_SUBJECT_COM = IT_SRV_SUBJECT_COM

IMPORTING

ET_SRV_OSSET_COMT = et_srv_osset_comt

EXCEPTIONS

ERROR_OCCURRED = 1

INVALID_GUID = 2

NO_RECORD_EXIST = 3

OTHERS = 4.

IF SY-SUBRC <> 0.

ENDIF.

CALL FUNCTION 'CRM_SERVICE_OS_PUT_DATA'

IMPORTING

ET_SRV_OSSET_COM = et_srv_osset_comt

ET_INPUT_FIELDS = ET_INPUT_FIELDS.

read table LT_SRV_OSSET_COMT index 1 into wa_srv.

if sy-subrc = 0.

tab_osset[] = wa_SRV-osset[].

endif.

loop at ET_SRV_OSSET_COMT into wa_srv.

append lines of tab_osset to wa_srv-osset.

endloop.

append wa_srv to new_srv.

else.

new_srv[] = LT_SRV_OSSET_COMT[].

endif.

CALL FUNCTION 'CRM_ORDER_MAINTAIN'

EXPORTING

IT_SERVICE_OS = new_srv

IMPORTING

ET_EXCEPTION = et_exception

CHANGING

CT_INPUT_FIELDS = ET_INPUT_FIELDS

EXCEPTIONS

ERROR_OCCURRED = 1

DOCUMENT_LOCKED = 2

NO_CHANGE_ALLOWED = 3

NO_AUTHORITY = 4

OTHERS = 5.