Application Development 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: 

how to update standard field in transaction

Former Member
0 Kudos

Hi Expert,

       I am working on a enhancement and facing a weird issue.need suggestions, please help.

1. I need to update a standard SAP fields of a particular transaction code lets suppose X.

2. There is no Exit/BADI available which I can use to update it. But I have a BADI which trigger when user save transaction code X.

3. I found there is BAPI Y for same transaction code. This BAPI also does the same things which this transaction code does.

4. Since I need to update that standard fields based on user input provided in one of custom screen fields and I won't have any other option. I don't want to go for Enhancement point.

4. Can I call the SAME transaction BAPI in SAVE of that transaction to update that fields.

I checked this, its working fine...just want to know  "Is it a correct approach"?

Regards,

Swati

Message was edited by: Matthew Billingham - meaningful title

7 REPLIES 7

Former Member
0 Kudos

Hi Swati,

Considering the explanation made by you the BAPI approach is much better than the implicit enhancement because BAPI 's behavior is controlled and it takes care of dependency of populating data amongst various associated tables in SAP. Also BAPIs are supported by SAP in upgrades too.

You are correct in your approach.

BR,

Ankit.

Former Member
0 Kudos

Hi Swati,

I doubt if you can use a BAPI inside a SAVE logic of a similar transaction. When you are in the transaction the document/object would be locked and the BAPI update won't work. If there is no other option, there is nothing wrong in going for an enhancement - be it Explicit or implicit.

Regards,

Karthik

0 Kudos

Well I am not facing locked issue and its normal as I am using the same bapi in same transaction code.

Any Other comment. I won't prefer to go for enhancement point. although I search and I won't find any implicit enhancement point. Going for a explicit is not a good idea....

Any suggestion...

Regards,

Swati..

Former Member
0 Kudos

Hi guys..

  Any other idea... or suggestion.....

0 Kudos

I suggest you to provide more information about your problem: wich transaction you are working with, why do you want to try enhancements and why you cannot make a new Z-program, the kind of data you want to save...

I shall suggest you to edit the subject of the thread to allow people who (maybe) can help you to feel interested about your current problem (with that secret transaction).

If you want to modify the value of an SAP object in its save method, you should look for an enhancement (i.e. if you are talking about a classical transaction, you should look for a User-Exit) that allows you to do that.

If you want to just modify the values of an SAP object at any time, I should try the "make your own Z-program" approach.

If you want to modify a lot of instances of an SAP object at any time, I should try the "LSMW" approach.

What's your problem? In fact, you did not explained us as clear to allow us to help you. The Cold War is (supposedly) finished, all this secrecy leads just to failures.

Former Member
0 Kudos

Have you explored the Event Option?

You can create an event using SM62, then you can raise that event in the BAPI/BADI using the function : 'BP_EVENT_RAISE' IN UPDATE TASK, then write a program which will update your data and schedule a background job against that event using SM36...so once the event is raised, the background job will start immediately and will update your data.

Regards,

Gopal

raymond_giuseppi
Active Contributor
0 Kudos

Usually in SAVE methods of BAdI it is no longer allowed to call a BAPI (and the associated COMMIT WORK) and calling a BAPI that manage same data can put the memory storage in a mess (like reloading from database some data changed by transaction and the like)

You could create a function module RFC enabled to execute the BAPI, in this FM call the BAPI and commit the work, you will call this FM in BACKGROUND TASK in the SAVE/POST/AFTER SAVE method so it will execute after update task of the main transaction is executed.

  • You may try to manage the lock in this RFC FM, trigger an error message in the FM if not able to lock the object again (or if BAPI fails too)  so SM58 will enable a new execution of the failed call.
  • You must insure that no infinite call will be executed, so the BAPI call should not trigger itself, check data has already correct value, or check there is no BAPI FM in call stack.

Regards,

Raymond