cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with Creation of CRM Order via Function Module Test

Former Member
0 Kudos

I am trying to check the order creation process from external systems by using the test function in Tcode SE37 with Function Module BAPI_BUSPROCESSND_CREATEMULTI.

I have created a Test Sequence of the following FMs:

BAPI_BUSPROCESSND_PROCSETTINGS

BAPI_BUSPROCESSND_CREATEMULTI

BAPI_PROCESS_SAVE

BAPI_TRANSACTION_COMMIT

All that I have been able to create so far is an order header without a Sold-to or Ship-to and no items. I am able to populate the Organization data, Header text and Appointments. The only partner function that is being populated is the one that is being automatically picked up from my user master.

For the BAPI_BUSPROCESSND_CREATEMULTI I am populating the following tables:

HEADER 1 entry

ITEM 2 entries

PARTNER 2 entries

ORGANISATION 1 entry

APPOINTMENT 2 entries

INPUT_FIELDS 41 entries

SCHEDULELINE 2 entries

I have created the entries based upon information gained through debugging function module CRM_ORDER_MAINTAIN during the creation of a service order.

It would be interesting to know if anybody has successfully created an order via the SE37 test function and if so, it would be useful to see the data in the relevant tables.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

HEllo ,

Write a wrapper to the function module CRM_ORDER_MAINTAIN.

To populate the Text use below code

ls_input_field_names-fieldname = 'REF_GUID'.

INSERT ls_input_field_names INTO TABLE lt_input_field_names.

ls_input_field_names-fieldname = 'REF_KIND'.

INSERT ls_input_field_names INTO TABLE lt_input_field_names.

ls_input_field_names-fieldname = 'TDID'.

INSERT ls_input_field_names INTO TABLE lt_input_field_names.

ls_input_field_names-fieldname = 'TDSPRAS'.

INSERT ls_input_field_names INTO TABLE lt_input_field_names.

ls_input_field_names-fieldname = 'TDSTYLE'.

INSERT ls_input_field_names INTO TABLE lt_input_field_names.

ls_input_field_names-fieldname = 'TDFORM'.

INSERT ls_input_field_names INTO TABLE lt_input_field_names.

ls_input_field_names-fieldname = 'LINES'.

INSERT ls_input_field_names INTO TABLE lt_input_field_names.

ls_input_field_names-fieldname = 'MODE'.

INSERT ls_input_field_names INTO TABLE lt_input_field_names.

CLEAR ls_input_fields.

ls_input_fields-ref_guid = attr_guid.

ls_input_fields-ref_kind = 'A'.

ls_input_fields-objectname = 'TEXTS'.

CONCATENATE 'CRM_ORDERH' order_guid INTO ls_input_fields-logical_key.

ls_input_fields-field_names = lt_input_field_names.

INSERT ls_input_fields INTO TABLE attr_t_inputfields.

  • Call Order maintain FM to create any order

CALL FUNCTION 'CRM_ORDER_MAINTAIN'

EXPORTING

it_text = lp_order->attr_t_text

it_partner = lp_order->attr_t_partner

IMPORTING

et_exception = et_exception

CHANGING

ct_orderadm_h = lp_order->attr_t_orderadm_h

ct_input_fields = lp_order->attr_t_inputfields

EXCEPTIONS

error_occurred = 1

document_locked = 2

no_change_allowed = 3

no_authority = 4

OTHERS = 5.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

Regards

Satish

Former Member
0 Kudos

Thanks DInesh;

What would that be exactly for???

My problem is that once i'm in the BAPI_BUSSPROCESSND_SAVE and i'm asked to fill in a GUID and a object type i don't really know what to fill in...I suppose my object_type is BUS0000116 because that's what i'.ve been trying to save but what's the GUI??? The Gui of the header?? how do i determine that if i don't fill in any gui in my simulation assuming that that guid would get created itself?

Thanks