cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Creating sales order in CRM using web services and unable to save

BL7
Explorer
0 Kudos
283

Hello Experts,

I have designed a web service for creating sales order which will be triggered from legacy system passing the required information from legacy system to web servcie.

Web service is created with help of WS_DESIGN_TOOL.It generated the create function module to create order

When I try to test the FM passing all the data, i'm unable to save it. I checked in debugging and found that it was calling rollback because of objects failed to save. Further debugging i got to know that SAP has made a hardcode check on business objects for Sales order 'BUS2000115', (Line 105 for MAINTAIN_ORDERS (CL_CRM_INTLAY_BTIL)) which will modify the changed objects including all the related objects which changed. Then for every entry corresponding to header data, it changes the object type to BTOrder. Now in changed objects or objects to save list, we have 3 duplicate entries. And order_save saves 1 and fails other two thus causing rollback.

Everything happening is standard with no custom code at all.

What should be done to save the order in DB? Kindly help.

Thanks in advance.

Best Regards,

Latif Bansal

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

     "When I try to test the FM passing all the data, i'm unable to save it."

means i think u have error in FM it self.

put break point in CRM_ORDER_MAINTAIN

create the sales order using CRMD_ORDER t-code

fill the data in your FM based on debugger.

Once the order is saving through FM, it should also save through web service.

Thanks

Suresh

BL7
Explorer
0 Kudos

Hi Suresh,

When i try to create order from CRMD_ORDER t-code, although the values passed to CRM_ORDER_MAINTAIN is same as in the other FM, but i get entirely different call stack.In the FM generated by web services, the CRM_ORDER_MAINTAIN is called twice, once for create_root_object and other is modify_root_object.

In modify_root_objects, we have a hardcoded standard code which checks the changed objects, only for Sales order object type. and we get ORDERADM_H, SERVICE_OS and STATUS as changed objects. and for each changed objects, th eobject name is replaced by BTOrder in maintain_orders. Thus we get 3 duplicate entries which fails to save.

For reference, the standard code is in method MAINTAIN_ORDERS (CL_CRM_INTLAY_BTIL) at line 106.An at line 118 same method, export data is filled with object name BTOrder in all the 3 entires.

Please help.