cancel
Showing results for 
Search instead for 
Did you mean: 

How to execute create BAPI Wrapper

samantha_nez
Participant
0 Kudos

Hi,

We are developing our first mobile application for laptops with NWDS 7.1. We have followed the following links:

[Building Queries in Netweaver Mobile 7.1 - Laptop Perspective|http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/16797] [original link is broken] [original link is broken] [original link is broken];

[Consuming Queries in Netweaver Mobile 7.1 - Laptop Perspective|http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/16991] [original link is broken] [original link is broken] [original link is broken];

So we are able to get data from backend once we have synchronized our laptop device.

Our next step is to create data (orders) from mobile device (our mobile application) to backend. However, we do not know how to execute the create BAPI wrapper for it despite the fact that the model is configured as bidirectional in the DOE.

Is there any blog or documentation where this procedure is explained?

Thanks in advance,

Samantha.

Accepted Solutions (0)

Answers (2)

Answers (2)

asdasd_asdasd
Active Participant
0 Kudos

Please check this:http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/60bac0a0-bbed-2a10-a58e-efdf832a96c9

Page 9.

christoph_kurtz2
Participant
0 Kudos

Hi Samantha!<br>

<br>

I can't provide a link to a blog or something similar. But in my experience, you can try the following:<br><br>

- create an instance of the DO which is related to the create BAPI

coding:<br>

<yourModel> model = (<yourModel>)OcaRoot.getInstance().getModel(<yourModel>.class)<br>

<yourDO>ETop header = model.create<yourDO>ETop();<br>

<set the attributes for the DO header><br>

<yourDO>T010 item = header.create<yourDO>T010s();<br>

<set the attributes for the DO children>

header.addToT010s(item);<br>

OcaRoot.getInstance().commit();<br><br>

- sync the application with DOE<br><br>

- check if created instance is now in backend table<br>

<br>

I hope that this is understandable and helps you.<br>

<br>

Best regards,<br>

<br>

Christoph

samantha_nez
Participant
0 Kudos

Hi Christoph,

We have tried to add the code that you say into a method onAction (into our view) but OcaRoot cannot be resolved into the code. We have tried to add import com.sap.tc.mobile.sf.ocaroot but sf does not exist.

Do we need any library more? If so, where can we find it?

Thanks in advance,

Samantha.

christoph_kurtz2
Participant
0 Kudos

Hi Samantha!<br>

<br>

Sorry for the confusion: I have posted the solution for handheld perspective.<br>

I have not developed for laptop application so far, but I can imagine that the solution will be similar. So try the following:<br>

<yourModel> model = <yourModel>.getInstance();<br>

<yourDO>ETop header = model.create<yourDO>ETop();<br>

<set the attributes for the DO header><br>

<yourDO>T010 item = header.create<yourDO>T010s();<br>

<set the attributes for the DO children><br>

header.addToT010s(item);<br>

model.commit();<br>

<br>

I am not sure if this is correct.<br>

<br>

Best regards,<br>

<br>

Christoph

samantha_nez
Participant
0 Kudos

Hi,

Creating is not working. Besides, I now get the following error when other BAPI wrappers are executed:

Caused by: com.sap.dbtech.jdbc.exceptions.ObjectIsClosedException: SAP DBTech JDBC: Object is closed.

at com.sap.dbtech.jdbc.ResultSetSapDB.assertNotClosed(ResultSetSapDB.java:2764)

at com.sap.dbtech.jdbc.ResultSetSapDB.next(ResultSetSapDB.java:374)

at com.sap.dbtech.jdbc.trace.ResultSet.next(ResultSet.java:919)

at com.sap.tc.mobile.cfs.pers.jdbc.core.JDBCObjectIterator.hasNext(JDBCObjectIterator.java:144)

I have looked for the reason for this error. I really do not understand why now close method is called before finishing the execution.

Any idea?

Thanks in advance,

Samantha.