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: 

Problem at reusing change number by commiting an object from class CL_CHR_MAIN to the database

former_member480204
Discoverer
0 Kudos

Hello Experts,

I'm regarding your help according to a problem I encountered as I tried to change characteristics via a custom report.

I'm using instances of the class CL_CHR_MAIN to get characteristics and add/change characteristic values and characteristic value descriptions. To achieve this, I use the methods, which the class implements (set_values, set_valuedescriptions and post).

Up to this point I have no problems and when I debug the program everything looks fine to me (table-entry within the object is done and changed-flag is set)...

Now the problem:

We're using changing numbers for saving the modifications on characteristics. When I'm using the change numbers within the transaction CT04, I can use one change number several times to save modifications on one characteristic (for different characteristic values or their descriptions) and all changes get applied.

But if I'm running my program multiple times, all previous changes from the same change number get removed before saving the new value / value description. This problem occurs at the time, when I execute "commit work". The outcome is the same as if I would call transaction "CCUNDO" and then go to CT04 to apply new "first" changes for the combination of the change number with the characteristic.

I can't explain myself what I'm missing for applying the changes with a change number the same way that the transaction CT04 does.

Is there some step I miss before executing "commit work"?

Thanks in advance.

1 ACCEPTED SOLUTION

raymond_giuseppi
Active Contributor

Any reason you use direct call of this class which is behind many BAPI_CHARACT_* FM, and not those FM, did you compare your code with the code executed by a BAPI such as BAPI_CHARACT_CHANGE or CREATE?

2 REPLIES 2

raymond_giuseppi
Active Contributor

Any reason you use direct call of this class which is behind many BAPI_CHARACT_* FM, and not those FM, did you compare your code with the code executed by a BAPI such as BAPI_CHARACT_CHANGE or CREATE?

Hello Raymond,

thanks for your fast respond.

I tried to use these BAPIs before, but they didn't worked properly for me the first time. Then I went on using the class directly.

Anyway... As you mentioned the FM, I tried it again with BAPI_CHARACT_CHANGE and it went well - seems like I did some mistakes before at filling in the parameters.

Thank you very much!