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: 

Populating custom table in a userexit

Former Member
0 Kudos

Hi,

In a userexit we are trying to populate a custom table. After the insert statement, sy-subrc is 0, but the custom table is not populated.

So how do we populate the custom table in a user exit, since we cannot use a commit statement in a user exit?

Thanks in advance.

Mick

7 REPLIES 7

Sm1tje
Active Contributor
0 Kudos

maybe you can try and use a function module (for insert / update of custom table) and execute it in update task.

call function 'XXXX" in update task.

ThomasZloch
Active Contributor
0 Kudos

What is the value of sy-dbcnt immediately after your insert? Should be > 0.

Depending on the application, maybe you'll have to register your insert using PERFORM ... ON COMMIT.

It's worth a try.

Cheers

Thomas

Former Member
0 Kudos

You could try calling a function module that updates your Z table from inside the user exit. Using one of the following optional parameter:

- CALL FUNCTION func STARTING NEW TASK taskname.

- CALL FUNCTION func IN UPDATE TASK.

That would start the update in a different task and should not effect the SAP code that hasn't been updated yet. (IE you can do the commit outside of the user exit.)

0 Kudos

Thanks Michelle and Micky.

Your answers seem very promising. Will try it out and keep you posted. Points awarded.

If there are some other suggestions they are most welcome.

Mick

0 Kudos

Hi,

Have tried using CALL FUNCTION func IN UPDATE TASK, but the data is not inserted in the custom table.

Please help !!!!!!!!!!!

Mick

0 Kudos

This probably means there's is not COMMIT. When is this user exit called? Maybe you'll have to find another user exit / BAdI which is called upon SAVE and after which the COMMIT WORK will be 'triggered'. This is the only thing I can think of right now.

The problem you might be facing is that you do not have the proper data available to update your custom table. Maybe ASSIGN statement can help you out there (ASSIGN (<PROG_NAME_VARIABLE>).

Sorry, I'm out of ideas. Good luck.

0 Kudos

although you ignored my first answer, I'll give it another try. Are you sure you have inserted any records successfully at all? Is the value of SY-DBCNT greater than 0 immediately after the insert statement?

Other than that, you should post your actual code here and the context of the user exit, then there might be a chance to help.

Greetings

Thomas