cancel
Showing results for 
Search instead for 
Did you mean: 

MBO and Create Operation

Former Member
0 Kudos

Hi there,

Let's say we have two BAPI/RFC operation:

Z_PARTNER_LIST - reads the list of available business partners from backend SAP.

Z_PARTNER_Create - creates a new business partner in backend SAP.

I've created a MBO with the schema based on Z_PARTNER_LIST. So far so good.

I've added  a "Create" operation that is based on Z_PARTNER_Create BAPI

All output fields of "create" operation are mapped to the MBO fields.(including the primary key field)

If I execute the "Create" operation new business partner gets created. Everything looks good except that I cannot get the output values back.

For Instance, I want to get a new business Partner ID after a call.

The ID itself is generated on the SAP side and sent as a result of BAPI operation.

This is what I am doing on the Client side(App Side):

BPShortInfo is MBO.


var item = new BPShortInfo();

item.LastName = "sup test";

item.FirstName = "SUP test";

item.Create();

item.SubmitPending();

BusinessPartnersDataDB.Synchronize();             

I expected that after the Synchronize I would get the generated ID from SAP.

But it's not the case. It's empty. I would appreciate any ideas.

and the second thing:

Let's say that the BAPi operation that is used for "Create" operation has in addition to all output data one output parameter(e.g. STATUS) that doesn't exist in MBO because the BAPI that was used to create a MBO doesn't have this field either.

STATUS says us ,whether the operation was successful or not, by setting it to -1 or 0.

I cannot map this field to MBO, because I don't have a field for it. I can add it to MBO... and then map it.

In general this field makes no sense to the MBO itself it is only valid for the "create" operation.

How is this supposed to be handled?

Thanks in advance.

Accepted Solutions (0)

Answers (1)

Answers (1)

midhun_vp
Active Contributor
0 Kudos

Understand one thing that is SUP is developed to work in an occasionally connected environment so once you perform an update operation the response from the operation should not be expected.

Don't worry, there is a workaround for this.

Instead of creating an operation in an MBO. Create an MBO using the the RFC you used for operation. To make a call to this MBO you can keep this MBO in a separate sync group. Lets say "Operation" keep the MBO in on demand with interval 0 and sync interval in the sync group as 1 sec.

And use this code to call the operation.

MyDB.synchronize("Operation");

After this call make a findall query on the MBO you created. It will have the response from the operation.

- Midhun VP

Former Member
0 Kudos

Thank you for the answer.

Just to summarize the things.

I cannot use any of output parameters that were exposed by "Create", "Update" operations.

This is always a one way operation. because the data I synchronize is synchronized between the device and CDB. right? there is no guarantee that SAP back end system is available and we can perform the operation at the exact same moment as this operation is executed.

well, I can live with that.

Side question, how can I get errors that potentially can occur during the synchronization between CDB and SAP back end?

If I create an MBO based on RFC that creates a new business partner then I have to define synchronization parameters for all input parameters in this MBO. In order to provide the actual data before the MyDB.synchronize("Operation"); will be called.

right? We wouldn't call it an elegant solution, would we?

Is this an only option that is available?

Is there a way to set up the MBO so it can perform in "online" mode?

Thanks.

midhun_vp
Active Contributor
0 Kudos

As I mentioned before the output of an operation is not supported by SUP straight away since the product is designed to work on occasionally connected environment. I have provided with a workaround for you which I had implemented.

Is this an only option that is available?

I am not sure about other workaround.

how can I get errors that potentially can occur during the synchronization between CDB and SAP back end?

When you are performing an operation call the method inside a try catch loop hence it will get all the exceptions and you can show that in an alert in the device.

If I create an MBO based on RFC that creates a new business partner then I have to define synchronization parameters for all input parameters in this MBO.

It depends your requirement. You can use PK also here.

We wouldn't call it an elegant solution, would we?

As I mentioned before there is no straight forward way to get the output of an operation. But the solution I have provided will satisfy your requirement.

Is there a way to set up the MBO so it can perform in "online" mode?

Online is not supported in native apps.

- Midhun VP