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

Update in user exit.

Former Member
0 Likes
4,685

Hi all,

I have code in the User exit - EXIT_RFEBBU10_001 - which will be triggered by the transaction code FF.5.

My code is to update the Standard Database table FEBEP

My code is.

Update FEBEP

SET FWAER = ''

FWBTR = '0.00'

where KUKEY = i_febep-kukey AND

ESNUM = i_febep-esnum.

But this is not updating the database table with FWBTR as 0.00 and FWEAR as nothing, but SY-SUBRC is 0 while debugging.

I used the same code in a seperate executable program that time it is updating the table, but inside the User Exit it is not doing.

Please tell me how to solve this...

Points assured

Regards,

Prabhu

1 ACCEPTED SOLUTION
Read only

Sougata
Active Contributor
0 Likes
2,990

Hello Prabhu,

I'm sorry to say that your whole approach is incorrect i.e. everything you are doing in this user-exit from start to finish is incorrect and it is against SAP Best Practice!

Firstly, you are trying to modify (update) a SAP standard database table - which is not recommended in the first place but then again I see you are trying to change a database full with highly sensitive information (The Electronic Bank Statement Line Item table)!!! Not only you may land up in big trouble personally for doing this but also I don't think your client's system auditors will be too pleased about that. So, Never Do This

Then, you are wondering if you could use a Commit Work statement in your user-exit - which is again not recommended. Let the system take care of that after it leaves your exit and before completing the transaction. So, again, Never Do This

Now, to solve your issue, you should be first reading the documentation of SAP Enhancement FEB00001 because your user-exit function module is linked to this enhancement. This is well documented and shows you how to code this exit. I think if you require any changes in the line items you should make changes in the export parameter E_FEBEP because SAP allows you to change E_FEBEP and finally don't forget to set the export parameter E_UPDATE = 'X' after you have changed data in any structure or table parameters to confirm changes back to SAP.

Hope this helps.

Cheers,

Sougata.

Hi all,

I have code in the User exit - EXIT_RFEBBU10_001 - which will be triggered by the transaction code FF.5.

My code is to update the Standard Database table FEBEP

My code is.

Update FEBEP

SET FWAER = ''

FWBTR = '0.00'

where KUKEY = i_febep-kukey AND

ESNUM = i_febep-esnum.

But this is not updating the database table with FWBTR as 0.00 and FWEAR as nothing, but SY-SUBRC is 0 while debugging.

I used the same code in a seperate executable program that time it is updating the table, but inside the User Exit it is not doing.

Please tell me how to solve this...

Points assured

Regards,

Prabhu

9 REPLIES 9
Read only

Former Member
0 Likes
2,990

There can be multiple reasons, may be after you change the value SAP it self overrides the value which makes it zero. so when is this table populated during the same transaction or it is already there when this transaction is executed?

Read only

jaideepsharma
Active Contributor
0 Likes
2,990

Hi ,

Yes this can be a problem that value is been overwritten after update statement.

Also, try commit work statement after the update query.

Please reward points if it works.

Read only

0 Likes
2,990

Hi,

Can we use COMMIT WORK in the user exit.....

regards,

Prabhu

Read only

0 Likes
2,990

Try and avoid using COMMIT WORK in a user exit. This could also commit data to database which is not (yet) supposed to be stored. Maybe there are some checks that still need to be performed or whatever. Let SAP do the commit in this case, to make sure data remains consistent.

If problem is within COMMIT WORK, try and use a perform on commit, or use FM in update task.

Read only

0 Likes
2,990

Hi,

commit statement in userexit:

You should not do that.

After the user exits code is triggered, the transaction's own commits statements will commit the database anyway

Regards

Kiran Sure

Read only

Former Member
0 Likes
2,990

Hi,

after using the update statement to modify a table record u must use COMMIT WORK statement.

Regards,

Aravind M

Read only

Sougata
Active Contributor
0 Likes
2,991

Hello Prabhu,

I'm sorry to say that your whole approach is incorrect i.e. everything you are doing in this user-exit from start to finish is incorrect and it is against SAP Best Practice!

Firstly, you are trying to modify (update) a SAP standard database table - which is not recommended in the first place but then again I see you are trying to change a database full with highly sensitive information (The Electronic Bank Statement Line Item table)!!! Not only you may land up in big trouble personally for doing this but also I don't think your client's system auditors will be too pleased about that. So, Never Do This

Then, you are wondering if you could use a Commit Work statement in your user-exit - which is again not recommended. Let the system take care of that after it leaves your exit and before completing the transaction. So, again, Never Do This

Now, to solve your issue, you should be first reading the documentation of SAP Enhancement FEB00001 because your user-exit function module is linked to this enhancement. This is well documented and shows you how to code this exit. I think if you require any changes in the line items you should make changes in the export parameter E_FEBEP because SAP allows you to change E_FEBEP and finally don't forget to set the export parameter E_UPDATE = 'X' after you have changed data in any structure or table parameters to confirm changes back to SAP.

Hope this helps.

Cheers,

Sougata.

Read only

former_member59231
Discoverer
0 Likes
2,990

Good day

This is the piece of code i added to my user exit EXIT_RFEBBU10_001

IF I_FEBKO-KTONR = '01122387740019' AND I_FEBEP-TEXTS = 'FIMT' AND I_FEBEP-VGINT = 'ZR07'.

E_FEBEP-KOSTL = 'REGION1'.
E_FEBEP-GSBER = 'ZB14'.
E_UPDATE = 'X'.
COMMIT WORK.

endif.

The challenge now is the program is not updating the cost centre field and business area field returning an error

Error during update of table FEBEP

Kindly assist so that the cost centre field is update as these transaction are Bank charges and must include cost centre field not covered in the MT940 EBS file from the Bank

Regards

Phillip

Read only

moshenaveh
Community Manager
Community Manager
0 Likes
2,990

philpchingwaro


Hello, While we're happy that you've come to SAP Community to get an answer to your question, you posted your question as an answer in an old thread.
I've converted your answer to a comment, but even so -- posting in older threads is not the best way to get guidance.
If you're looking for help, you should ask a new question: https://answers.sap.com/questions/ask.html.
Here are some tips to help you craft an effective question for our community: https://community.sap.com/resources/questions-and-answers, https://developers.sap.com/tutorials/community-qa.html, https://groups.community.sap.com/t5/welcome-corner-discussions/advice-from-sap-champions-questions-a....
I encourage you to follow this guidance, as I'd really like to see you get a solution to your problem.
I hope you find this advice useful!