cancel
Showing results for 
Search instead for 
Did you mean: 

Trying to create an activity using CRM_ORDER_MAINTAIN

Former Member
0 Kudos

Hello All,

I am trying to use the CRM_ORDER_MAINTAIN to create a new activity from my code .Do I also have to use ORDER_SAVE ??? WHAT data has to be passed onto the CRM_ORDER_MAINTAIN.Please reply.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

data : ls_orderadm_h type crmt_orderadm_h_com,

lt_orderadm_h1 type crmt_orderadm_h_comt.

ls_orderadm_h-guid = lv_header_guid.

insert ls_orderadm_h into table lt_orderadm_h1.

lv_product_i-ref_handle = '0000000001'.

lv_product_i-ref_guid = lv_header_guid.

insert lv_product_i into table lt_product_i.

ls_orderadm_i-header = lv_header_guid.

ls_orderadm_i-itm_type = 'ZCSA'.

ls_orderadm_i-number_int = '0000000001'.

ls_orderadm_i-ordered_prod = 'SLA_SRV_CS_A'.

ls_orderadm_i-handle = '0000000001'.

ls_orderadm_i-mode = 'A'.

ls_orderadm_i-itm_proc_ident = 'SRVC'.

insert ls_orderadm_i into table lt_orderadm_i.

clear ls_input_fields.

ls_input_fields-ref_handle = '0000000001'.

ls_input_fields-objectname = 'ORDERADM_I'.

clear ls_field_names.

ls_field_names-fieldname = 'HANDLE'.

append ls_field_names to ls_input_fields-field_names.

ls_field_names-fieldname = 'HEADER'.

append ls_field_names to ls_input_fields-field_names.

ls_field_names-fieldname = 'ITM_PROC_IDENT'.

append ls_field_names to ls_input_fields-field_names.

ls_field_names-fieldname = 'ITM_TYPE'.

append ls_field_names to ls_input_fields-field_names.

ls_field_names-fieldname = 'MODE'.

append ls_field_names to ls_input_fields-field_names.

ls_field_names-fieldname = 'NUMBER_INT'.

append ls_field_names to ls_input_fields-field_names.

ls_field_names-fieldname = 'ORDERED_PROD'.

append ls_field_names to ls_input_fields-field_names.

insert ls_input_fields into table lt_input_fields.

call function 'CRM_ORDER_MAINTAIN'

exporting

it_product_i = lt_product_i

changing

  • ct_orderadm_h = lt_orderadm_h1

ct_orderadm_i = lt_orderadm_i

ct_input_fields = lt_input_fields

Former Member
0 Kudos

data : ls_orderadm_h type crmt_orderadm_h_com,

lt_orderadm_h1 type crmt_orderadm_h_comt.

ls_orderadm_h-guid = lv_header_guid.

insert ls_orderadm_h into table lt_orderadm_h1.

lv_product_i-ref_handle = '0000000001'.

lv_product_i-ref_guid = lv_header_guid.

insert lv_product_i into table lt_product_i.

ls_orderadm_i-header = lv_header_guid.

ls_orderadm_i-itm_type = 'ZCSA'.

ls_orderadm_i-number_int = '0000000001'.

ls_orderadm_i-ordered_prod = 'SLA_SRV_CS_A'.

ls_orderadm_i-handle = '0000000001'.

ls_orderadm_i-mode = 'A'.

ls_orderadm_i-itm_proc_ident = 'SRVC'.

insert ls_orderadm_i into table lt_orderadm_i.

clear ls_input_fields.

ls_input_fields-ref_handle = '0000000001'.

ls_input_fields-objectname = 'ORDERADM_I'.

clear ls_field_names.

ls_field_names-fieldname = 'HANDLE'.

append ls_field_names to ls_input_fields-field_names.

ls_field_names-fieldname = 'HEADER'.

append ls_field_names to ls_input_fields-field_names.

ls_field_names-fieldname = 'ITM_PROC_IDENT'.

append ls_field_names to ls_input_fields-field_names.

ls_field_names-fieldname = 'ITM_TYPE'.

append ls_field_names to ls_input_fields-field_names.

ls_field_names-fieldname = 'MODE'.

append ls_field_names to ls_input_fields-field_names.

ls_field_names-fieldname = 'NUMBER_INT'.

append ls_field_names to ls_input_fields-field_names.

ls_field_names-fieldname = 'ORDERED_PROD'.

append ls_field_names to ls_input_fields-field_names.

insert ls_input_fields into table lt_input_fields.

call function 'CRM_ORDER_MAINTAIN'

exporting

it_product_i = lt_product_i

changing

  • ct_orderadm_h = lt_orderadm_h1

ct_orderadm_i = lt_orderadm_i

ct_input_fields = lt_input_fields

exceptions

error_occurred = 1

document_locked = 2

no_change_allowed = 3

no_authority = 4

others = 5.

Former Member
0 Kudos

Hello Hemant,

Thanks a lot for your reply.But the guid has to be ideally generated if I am right.., so what will lv_header_guid be populated as ? Please reply.

Former Member
0 Kudos

data : lv_header_guid type guid_32,

lv_header_guid16 type guid_16,

lv_item_guid type guid_32,

lv_sched_guid type guid_32,

lt_header_guid16 type

crmt_object_guid_tab,

wa_header_guid16 like lt_header_guid16,

result type char40,

result1 type char100,

l_cr(1) type c value

cl_abap_char_utilities=>newline,

wa_header_guid16_2 like line of lt_header_guid16.

Former Member
0 Kudos

call function GUID_CREATE

Former Member
0 Kudos

Hi Hemant,

Thank a lot for ur input .I also wanted to pass description for header,partner,docflow to be populated.I am sure i will have to pass these as a part of lt_input_fields table...Am not sure how to.I actually have to change the employee responsible as well..Can you please suggest ?

Former Member
0 Kudos

Hi Shakuntala,

What are all the data that you need to create an activity ? I mean to say what are all the Child structures that you need to pass like ( Item, Partners, Reference Objects, etc...)

The best way to work with Order maintain API is to debug the api from the SAP GUI. Just put a breakpoint in the API and create an activity with the necessary data and note down all the input structures as well as the lt_input_fields table. Now you can fill the details in your code and can create an activity.

And after you call order maintain, also call CRM_ORDER_SAVE and BAPI_TRANSACTION_COMMIT. Once the flow is maintained you need to call CRM_ORDER_INITIALIZE.

For the Document flow, you need to fill in the lt_doc_flow structure and need to pass on to order maintain.

Hope this helps.

Thanks,

Samantak.