CRM Sample code for mobile application
method IF_EX_CRM_ACT_MOB_ SMARTPHONE~CRM_BADI_ACT_ MOBILE_CHANGE.
*CT_ACTIVITY_H Changing Type CRMS_ACTIVITY_ MOBILE_H Header Structure for Activity Management of Mobile Apps
*CT_ACTIVITY_PARTNER Changing Type CRMT_ACTIVITY_ MOBILE_PARTNER CRM Mobile: Activity Partners
*CT_ACTIVITY_NOTES Changing Type CRMT_ACT_ MOBILE_NOTES CRM Mobile: Activity Notes
*CT_ACTIVITY_ATTACH Changing Type CRMT_ACTIVITY_ MOBILE_ATTACH CRM Mobile: Activity Attachment
*CT_CE_ACTIVITY_H Changing Type CRMS_MOBILE_ CUST_ENHANCE_1O_T Crm Mobile: Oppt header enhancement
*CT_CE_ACTIVITY_PARTNER Changing Type CRMS_MOBILE_ CUST_ENHANCE_1O_T Crm Mobile: Partner Enhancement
*CT_CE_ACTIVITY_NOTES Changing Type CRMS_MOBILE_ CUST_ENHANCE_1O_T Crm Mobile: Enhancement note
*CT_CE_ACTIVITY_ATTACH Changing Type CRMS_MOBILE_ CUST_ENHANCE_1O_T Crm Mobile: Enhancement for attachments for oppt
*CT_RETURN Changing Type CRMT_MOBILE_ CUST_BAPIRET2 Crm Mobile: Return tabletype
data :
lt_input_fields type CRMT_INPUT_FIELD_NAMES_TAB,
lt_object_tab type crmt_object_guid_tab.
data:
LS_CE_ACTIVITY_H type CRMS_MOBILE_CUST_ENHANCE_1O,
ls_activity_h_com type CRMT_ACTIVITY_H_COM,
ls_input_fields type crmt_input_field_names.
data:
lv_bool type C RMT_BOOLEAN VALUE 'X'.
clear ls_activity_h_com.
ls_activity_h_com-ref_ guid = CT_ACTIVITY_H-objec t_guid.
** IC Project
clear LS_CE_ACTIVITY_H.
read table ct_CE_ACTIVITY_ H into LS_CE_ACTIVITY_H with k ey FIELD_NAME = 'ZZFLD00000K'.
ls_activity_h_com-zzfld000 00k = ls_ce_ACTIVITY_H-field_ value .
** Sales Project
clear LS_CE_ACTIVITY_H.
read table Ct_ce_ACTIVITY_ H into LS_CE_ACTIVITY_H with k ey FIELD_NAME = 'ZZFLD00000U'.
ls_activity_h_com-zzfld000 00u = ls_ce_ACTIVITY_H-field_ value .
refresh lt_input_fields.
clear ls_input_fields.
ls_input_fields-fieldname = 'ZZFLD00000K'.
ls_input_fields-changeable = 'X'.
ls_input_fields-inactive = ' '.
append ls_input_fields to lt_input_fields.
clear ls_input_fields.
ls_input_fields-fieldname = 'ZZFLD00000U'.
ls_input_fields-changeable = 'X'.
ls_input_fields-inactive = ' '.
append ls_input_fields to lt_input_fields.
**
call function 'CRM_ACTIVITY_ H_CHANGE_OW'
exporting
IS_ACTIVITY_H_COM = ls_activity_h_com
IV_EXTERNAL_CALL = lv_bool
CHANGING
CT_INPUT_FIELD_NAMES = lt_input_fields
EXCEPTIONS
FILL_ERROR = 1
PUT_ERROR = 2
PUBLISH_ERROR = 3
READ_ERROR = 4
OTHERS = 5.
*** No need double assignment as sample
refresh lt_object_tab.
append ls_activity_h_com- ref_guid to lt_object_tab.
*
call function 'CRM_ORDER_ SAVE'
exporting
it_objects_to_save = l t_object_tab
exceptions
document_not_saved = 1
others = 2 .
if sy-subrc = 0.
call function 'BAPI_ TRANSACTION_COMMIT'
exporting
wait = 'X'.
endif.
endmethod.
*CT_ACTIVITY_H
*CT_ACTIVITY_PARTNER
*CT_ACTIVITY_NOTES
*CT_ACTIVITY_ATTACH
*CT_CE_ACTIVITY_H
*CT_CE_ACTIVITY_PARTNER
*CT_CE_ACTIVITY_NOTES
*CT_CE_ACTIVITY_ATTACH
*CT_RETURN
data :
lt_input_fields type
lt_object_tab type
data:
LS_CE_ACTIVITY_H type
ls_activity_h_com type
ls_input_fields type
data:
lv_bool type C
clear ls_activity_h_com.
ls_activity_h_com-ref_
** IC Project
clear LS_CE_ACTIVITY_H.
read table ct_CE_ACTIVITY_
ls_activity_h_com-zzfld000
** Sales Project
clear LS_CE_ACTIVITY_H.
read table Ct_ce_ACTIVITY_
ls_activity_h_com-zzfld000
refresh lt_input_fields.
clear ls_input_fields.
ls_input_fields-fieldname
ls_input_fields-changeable
ls_input_fields-inactive =
append ls_input_fields to
clear ls_input_fields.
ls_input_fields-fieldname
ls_input_fields-changeable
ls_input_fields-inactive =
append ls_input_fields to
**
call function 'CRM_ACTIVITY_
exporting
IS_ACTIVITY_H_COM
IV_EXTERNAL_CALL
CHANGING
CT_INPUT_FIELD_NAMES
EXCEPTIONS
FILL_ERROR
PUT_ERROR
PUBLISH_ERROR
READ_ERROR
OTHERS
*** No need double assignment
refresh lt_object_tab.
append ls_activity_h_com-
*
call function 'CRM_ORDER_
exporting
it_objects_to_save = l
exceptions
document_not_saved = 1
others = 2
if sy-subrc = 0.
call function 'BAPI_
exporting
wait = 'X'.
endif.
endmethod.
****************************** ****************************** ***************************** 88
method IF_EX_CRM_ACT_MOB_ SMARTPHONE~CRM_BADI_ACT_ MOBILE_GETDETAIL.
data :
LT_HEADER type CRMT_ ACTIVITY_MOBILE_H, " Entity Specific(Header)
LT_CE_ACTV_HDR type CRMS_ MOBILE_CUST_ENHANCE_1O_T. " Entity Specific(Header Enhancement)
data:
LW_HEADER type CRMS_ ACTIVITY_MOBILE_H, " Entity Specific(Header)
LW_CE_ACTV_HDR type CRMS_ MOBILE_CUST_ENHANCE_1O," Entity Specific(Header Enhancement)
LW_ACTV_H_COM type CRMT_ ACTIVITY_H_COM.
data:
lv_raw_guid type CRMT_ OBJECT_GUID. "RAW(16)
LT_HEADER[] = CT_ACTIVITY_H[ ].
loop at LT_HEADER into LW_ HEADER.
clear lv_raw_guid.
lv_raw_guid = LW_HEADER-OB JECT_GUID.
call function 'CRM_ ACTIVITY_H_READ_OB'
exporting
IV_GUID = Lv_raw_guid
importing
ES_ACTIVITY_H_COM = LW_ACTV_H_COM
exceptions
PARAMETER_ERROR = 1
RECORD_NOT_FOUND = 2
AT_LEAST_ONE_RECORD_ NOT_FOUND = 3
others = 4.
if SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY- MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY- MSGV2 SY-MSGV3 SY-MSGV4.
else.
lw_ce_actv_hdr-OBJECT_ GUID = LW_HEADER-OBJECT_GUID.
lw_ce_actv_hdr-field_name = 'ZZFLD00000K'.
lw_ce_actv_hdr-field_text = 'IC-Project'.
lw_ce_actv_hdr-data_type = 'CHAR'.
lw_ce_actv_hdr-data_ length = '20'.
lw_ce_actv_hdr-decimals = '0'.
lw_ce_actv_hdr-field_ value = LW_ACTV_H_COM-ZZFLD000 00K.
append lw_ce_actv_hdr to l t_ce_actv_hdr.
clear lw_ce_actv_hdr.
*
lw_ce_actv_hdr-OBJECT_ GUID = LW_HEADER-OBJECT_GUID.
lw_ce_actv_hdr-field_name = 'ZZFLD00000U'.
lw_ce_actv_hdr-field_text = 'Sales-Project'.
lw_ce_actv_hdr-data_type = 'CHAR'.
lw_ce_actv_hdr-data_ length = '20'.
lw_ce_actv_hdr-decimals = '0'.
lw_ce_actv_hdr-field_ value = LW_ACTV_H_COM-ZZFLD000 00U.
append lw_ce_actv_hdr to l t_ce_actv_hdr.
clear lw_ce_actv_hdr.
endif.
endloop.
CT_CE_ACTIVITY_H[] = LT_CE_ ACTV_HDR.
endmethod.
data :
LT_HEADER type CRMT_
LT_CE_ACTV_HDR type CRMS_
data:
LW_HEADER type CRMS_
LW_CE_ACTV_HDR type CRMS_
LW_ACTV_H_COM type CRMT_
data:
lv_raw_guid type CRMT_
LT_HEADER[] = CT_ACTIVITY_H[
loop at LT_HEADER into LW_
clear lv_raw_guid.
lv_raw_guid = LW_HEADER-OB
call function 'CRM_
exporting
IV_GUID
importing
ES_ACTIVITY_H_COM
exceptions
PARAMETER_ERROR
RECORD_NOT_FOUND
AT_LEAST_ONE_RECORD_
others
if SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-
* WITH SY-MSGV1 SY-
else.
lw_ce_actv_hdr-OBJECT_
lw_ce_actv_hdr-field_name
lw_ce_actv_hdr-field_text
lw_ce_actv_hdr-data_type =
lw_ce_actv_hdr-data_
lw_ce_actv_hdr-decimals =
lw_ce_actv_hdr-field_
append lw_ce_actv_hdr to l
clear lw_ce_actv_hdr.
*
lw_ce_actv_hdr-OBJECT_
lw_ce_actv_hdr-field_name
lw_ce_actv_hdr-field_text
lw_ce_actv_hdr-data_type =
lw_ce_actv_hdr-data_
lw_ce_actv_hdr-decimals =
lw_ce_actv_hdr-field_
append lw_ce_actv_hdr to l
clear lw_ce_actv_hdr.
endif.
endloop.
CT_CE_ACTIVITY_H[] = LT_CE_
endmethod.
****************************** ****************************** **********************8
method IF_EX_CRM_ACT_MOB_ SMARTPHONE~CRM_BADI_ACT_ MOBILE_CREATE.
*CT_ACTIVITY_H Changing Type CRMS_ACTIVITY_ MOBILE_H Header Structure for Activity Management of Mobile Apps
*CT_ACTIVITY_PARTNER Changing Type CRMT_ACTIVITY_ MOBILE_PARTNER CRM Mobile: Activity Partners
*CT_ACTIVITY_NOTES Changing Type CRMT_ACT_ MOBILE_NOTES CRM Mobile: Activity Notes
*CT_ACTIVITY_ATTACH Changing Type CRMT_ACTIVITY_ MOBILE_ATTACH CRM Mobile: Activity Attachment
*CT_CE_ACTIVITY_H Changing Type CRMS_MOBILE_ CUST_ENHANCE_1O_T Crm Mobile: Oppt header enhancement
*CT_CE_ACTIVITY_PARTNER Changing Type CRMS_MOBILE_ CUST_ENHANCE_1O_T Crm Mobile: Partner Enhancement
*CT_CE_ACTIVITY_NOTES Changing Type CRMS_MOBILE_ CUST_ENHANCE_1O_T Crm Mobile: Enhancement note
*CT_CE_ACTIVITY_ATTACH Changing Type CRMS_MOBILE_ CUST_ENHANCE_1O_T Crm Mobile: Enhancement for attachments for oppt
*CT_RETURN Changing Type CRMT_MOBILE_ CUST_BAPIRET2 Crm Mobile: Return tabletype
data :
lt_input_fields type CRMT_INPUT_FIELD_NAMES_TAB,
lt_object_tab type crmt_object_guid_tab.
data:
LS_CE_ACTIVITY_H type CRMS_MOBILE_CUST_ENHANCE_1O,
ls_activity_h_com type CRMT_ACTIVITY_H_COM,
ls_input_fields type crmt_input_field_names.
data:
lv_bool type C RMT_BOOLEAN VALUE 'X'.
clear ls_activity_h_com.
ls_activity_h_com-ref_ guid = CT_ACTIVITY_H-objec t_guid.
** IC Project
clear LS_CE_ACTIVITY_H.
read table ct_CE_ACTIVITY_ H into LS_CE_ACTIVITY_H with k ey FIELD_NAME = 'ZZFLD00000K'.
ls_activity_h_com-zzfld000 00k = ls_ce_ACTIVITY_H-field_ value .
** Sales Project
clear LS_CE_ACTIVITY_H.
read table Ct_ce_ACTIVITY_ H into LS_CE_ACTIVITY_H with k ey FIELD_NAME = 'ZZFLD00000U'.
ls_activity_h_com-zzfld000 00u = ls_ce_ACTIVITY_H-field_ value .
refresh lt_input_fields.
clear ls_input_fields.
ls_input_fields-fieldname = 'ZZFLD00000K'.
ls_input_fields-changeable = 'X'.
ls_input_fields-inactive = ' '.
append ls_input_fields to lt_input_fields.
clear ls_input_fields.
ls_input_fields-fieldname = 'ZZFLD00000U'.
ls_input_fields-changeable = 'X'.
ls_input_fields-inactive = ' '.
append ls_input_fields to lt_input_fields.
**
call function 'CRM_ACTIVITY_ H_CHANGE_OW'
exporting
IS_ACTIVITY_H_COM = ls_activity_h_com
IV_EXTERNAL_CALL = lv_bool
CHANGING
CT_INPUT_FIELD_NAMES = lt_input_fields
EXCEPTIONS
FILL_ERROR = 1
PUT_ERROR = 2
PUBLISH_ERROR = 3
READ_ERROR = 4
OTHERS = 5.
*** No need double assignment as sample
refresh lt_object_tab.
append ls_activity_h_com- ref_guid to lt_object_tab.
*
call function 'CRM_ORDER_ SAVE'
exporting
it_objects_to_save = l t_object_tab
exceptions
document_not_saved = 1
others = 2 .
if sy-subrc = 0.
call function 'BAPI_ TRANSACTION_COMMIT'
exporting
wait = 'X'.
endif.
ENDMETHOD.
*CT_ACTIVITY_H
*CT_ACTIVITY_PARTNER
*CT_ACTIVITY_NOTES
*CT_ACTIVITY_ATTACH
*CT_CE_ACTIVITY_H
*CT_CE_ACTIVITY_PARTNER
*CT_CE_ACTIVITY_NOTES
*CT_CE_ACTIVITY_ATTACH
*CT_RETURN
data :
lt_input_fields type
lt_object_tab type
data:
LS_CE_ACTIVITY_H type
ls_activity_h_com type
ls_input_fields type
data:
lv_bool type C
clear ls_activity_h_com.
ls_activity_h_com-ref_
** IC Project
clear LS_CE_ACTIVITY_H.
read table ct_CE_ACTIVITY_
ls_activity_h_com-zzfld000
** Sales Project
clear LS_CE_ACTIVITY_H.
read table Ct_ce_ACTIVITY_
ls_activity_h_com-zzfld000
refresh lt_input_fields.
clear ls_input_fields.
ls_input_fields-fieldname
ls_input_fields-changeable
ls_input_fields-inactive =
append ls_input_fields to
clear ls_input_fields.
ls_input_fields-fieldname
ls_input_fields-changeable
ls_input_fields-inactive =
append ls_input_fields to
**
call function 'CRM_ACTIVITY_
exporting
IS_ACTIVITY_H_COM
IV_EXTERNAL_CALL
CHANGING
CT_INPUT_FIELD_NAMES
EXCEPTIONS
FILL_ERROR
PUT_ERROR
PUBLISH_ERROR
READ_ERROR
OTHERS
*** No need double assignment
refresh lt_object_tab.
append ls_activity_h_com-
*
call function 'CRM_ORDER_
exporting
it_objects_to_save = l
exceptions
document_not_saved = 1
others = 2
if sy-subrc = 0.
call function 'BAPI_
exporting
wait = 'X'.
endif.
ENDMETHOD.
Post a Comment