cancel
Showing results for 
Search instead for 
Did you mean: 

How to make a bapi to wait for Java's answer to finish the execution?

Former Member
0 Kudos

Hello,

We are programming a connection between SAP and an Oracle table, using a Java RFC Connector.

We created a BAPI in Sap, which gives some data into a table parameter, a Java connector executes the BAPI, reads data from the bapi table parameter and updates an Oracle table.

The problem is that Java must tell the Bapi function from SAP if the records from the table are sent successfuly to Oracle.

We think we should use a column into the table parameter (eg. "transmited_corectlly" with values true or false) and to fill that column from Java.

My problem is how to make the Bapi function to read that column after Java call.

So, the algorithm will be as follows:

- java calls bapi which gives some data into a table

- java gets the data and puts into an Oracle table

- java returns to the same bapi and fills the column "transmited_corectlly" with true or false;

- bapi continues to run and make the changes in sap according to the value in "transmited_correctly".

I know how to call a bapi, to put data in Oracle, I know how to fill the value of the transmited_corectlly, but I don't know how to do that the bapi should wait for Java's answer to finish the execution.

Could you help me with a suggestion?

Thanks in advance,

Maricica

Accepted Solutions (1)

Accepted Solutions (1)

robertot4s
Active Participant
0 Kudos

Hi Maricica,

I don't know if I have understood your problem...

I think your algorithm is impossible to implement:

- java calls bapi which gives some data into a table. The bapi have finished its execution, it's impossible to continue with the same bapi...

- java gets the data and puts into an Oracle table

- java returns to the same bapi and fills the column "transmited_corectlly" with true or false; As I've said, you cannot use the same bapi, you have to use a different bapi to send this information.

- bapi continues to run and make the changes in sap according to the value in "transmited_correctly".

Regards,

Roberto

Former Member
0 Kudos

Hi, Roberto,

We are not very optimistic either, and we thought about using a different bapi for returning results.

But, I'm hoping that, maybe, there is a chance to make the bapi not to finish his execution and to wait for Java's response.

Regards,

Maricica

robertot4s
Active Participant
0 Kudos

Hi,

If the java application begins the communication calling the bapi, the bapi will always finish the execution when returning the data...

Regards,

Roberto

hofmann
Active Contributor
0 Kudos

make the bapi not to finish his execution and to wait for Java's response.

Why should a BAPI wait for another external system to finish something?

It should only be possible to implement your case using another BAPI that triggers the final execution of the first one, like saving the data first in a temp table and 2nd BAPI is using the temp table data to make the change persistent.

Former Member
0 Kudos

We have to transfer data from SAP to Oracle. But we have to transfer only differences, what's new in SAP.

So, the SAP team thought that they should use a Z-table to find out differences. Once the differences are transferred in Oracle, the data that were transferred in Oracle are put into the Z-table too. So, using the Z-table they will make the comparison between what it is in SAP and what was already transferred, and they will know what to send to Oracle.

The problem is that, after sending data to Java, SAP cannot know if the data were sent correctly to Oracle (e.g. the connection is interrupted with Oracle DB). If the data didn't get to Oracle, the Z-table shouldn't be updated in SAP. The Z-table should be updated only if data were transferred successfully in Oracle.

What do you mean by temp table? (Can Java access such a temp table? If so, give me a clue).

Regards,

Maricica

hofmann
Active Contributor
0 Kudos

temp table == a table created by you to store data temporarily

Answers (0)