Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

BAPI data required at runtime before commit

Former Member
0 Likes
1,333

Hi Experts

I am using BAPI_EQUI_CREATE_BY_REFERENCE, I need to update certain custom fields in the newly created equipment(BASED ON THE NEWLY CREATED EQUIPMENT NUMBER) <b>before committing the BAPI</b> & block the commit if certain logic fails!.

Can someone please tell me a way to <b><i>access the newly created data by BAPI before committing it</i></b>. Any help in this regard will be generously credited.

Regards

Sudhir

5 REPLIES 5
Read only

Former Member
0 Likes
834

Hi sudhir,

1. After calling the BAPI,

u can use

COMMIT WORK AND WAIT.

regards,

amit m.

Read only

Former Member
0 Likes
834

Hi Sudhir,

The bapi will not get committed until you use the bapi_transaction_commit.

Before calling the bapi_transaction_commmit , you can check if the bapi was succesful(Based on the return table) and then conditionally commit or rollback using the bapi bapi_transaction_rollback).

Regards,

ravi

Read only

Clemenss
Active Contributor
0 Likes
834

Hi sudhir,

this is not possible, not before commit.

Reason is that BAPIs make use of PERFORM ... ON COMMIT. In those forms global tables are evaluated, processed and data gets stored in the database.

You could search for a userexit or badi shortly before data save takes place. At this point you may be able to see the data before they are committed.

Dynamic assign of global BAPI fields might also lead to a result.

Please explain your situation in detail: What (business) process will be controlled by the not-yet-and-maybe-never existing data?

Regards,

Clemens

Read only

Former Member
0 Likes
834

Its not about commit or rollback guys, I can get the data that was created by the BAPI's return structures, but I need to change certain data before commiting the BAPI. Now how do I access & change the data that will be committed to the database!!??, any thoughts??.

Regards

Sudhir

Read only

0 Likes
834

Hi again,

1. how do I access & change the data

Indirectly, there might be some user-exit or BADI,

which will be called before the transaction is saved,

(either manually, OR either thru BAPI).

2. There we can access/change the data.

3. Otherwise, there is no option.

regards,

amit m.