cancel
Showing results for 
Search instead for 
Did you mean: 

Database table not being updated

Former Member
0 Kudos

Hi,

In implementation of BADI BBP_DOC_SAVE_BADI, I am calling the PUT_DATA and GET_DATA method of implementaion of BADI BBP_CUF_BADI.

In the parameters of the GET_DATA method, I can see the changed values of the customized screen. But these values are not getting updated in the database.

As per documentation of badi BBP_CUF_BADI, I have created the required structures.

1) Is BBP_PDHSC the table where the data will be updated? Or is there some other table?

2) Why are the values not getting updated in the database, assuming that table BBP_PDHSC is the table where the data will be updated?

Thanks and Regards,

Mick

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Mick,

BADI BBP_DOC_SAVE_BADI is used to trigger own process after the system tasks are completed.

If you want to update the data, you will have to handle it by yourself (BBP_PD_XX_UPDATE /SAVE / COMMIT).

Calling methods from BADI BBP_CUF_BADI alone won't do anything...

Else use BADI BBP_DOC_CHANGE_BADI to change the data, and let the system process & save it.

Rgds

Christophe

Former Member
0 Kudos

Thanks Christophe.

Let me describe the scenario in a little more detail.

when we are creating a Purchase Order, we are getting a customized screen. BADI BBP_CUF_BADI has been implemented to get this customized screen. We want this customized screen to be displyed on the click of the order button. But since BBP_CUF_BADi is not being called on the click of the order button we used implementation of BBP_DOC_SAVE_BADI to call the implementation of BBP_CUF_BADI.

Please let me know what should be my approach? I am not sure that I understand, what you meant by " you will have to handle it by yourself (BBP_PD_XX_UPDATE /SAVE / COMMIT)" in your reply. Would appreciate if you could clarify in detail.

Thanks,

Mick

Former Member
0 Kudos

Mick,

BADI description:

You can use the Business Add-In BBP_DOC_SAVE to update own data and tables in the same Logical Unit of Work when saving a document to the database. This facility is especially intended for update of customer-specific statistics.

I am surprised that you could call your custom screen from this BADI (via BBP_CUF_BADI) as for me this BADI should not have any impact on the UI.

After the BBP_DOC_SAVE_BADI call, the document is updated and stored in the database, via a COMMIT instruction.

If you continue the process and call your custom screen, you might be in a "no man's land", I mean the transaction if finished from an SRM point of view.

So you have to handle the data by yourself (with update/save functions and a commit).

Your approach is inovating, but risky...

Rgds

Christophe

Former Member
0 Kudos

Thanks Christophe.

What I have done so far is that in BADI BBP_DOC_SAVE, I am calling the PUT_DATA and GET_DATA methods of the BADI BBP_CUF_BADI. The BADI BBP_CUF_BADI is used to display the customized screen (you may refer to the documantation for BBP_CUF_BADI in SE18). After the GET_DATA is called, I can see the IS_HEADER having the values that I selected on the customized screen. After GET_DATA method of BBP_CUF_BADI has been executed the BBP_DOC_SAVE is completed and the PO is created in the database.

But as I mentioned earlier, the values that were selected on the customized screen are not there in the database.

So where do I fire a commit? As you mentioned after the BBP_DOC_SAVE_BADI call the PO is stored in the database via a commit instruction. So is there any need for me to fire an explicit commit? If so where?

Thanks,

Mick

Former Member
0 Kudos

Mick,

when you update data with BADI BBP_DOC_SAVE --> BBP_CUF_BADI, it is too late.

The "to-be-updated and saved" data has already been sent to the application memory (look at BBP_PROCDOC_UPDATE).

That's why you don't find your data in the DB.

If you just use BBP_CUF_BADI, this is only updating some data somewhere in the memory. You can commit as you want, but as there is nothing to commit, nothing occurs.

So once again, and for the last time: use BBP_PD_PO_GETDETAIL, UPDATE, SAVE and commit your changes.

Rgds

Christophe

Former Member
0 Kudos

Hi Christophe,

I am new to SRM and have the same problem as Mick. Just to summarise, are you saying that in BADI BBP_DOC_SAVE after calling the methods of BBP_CUF_BADI (PUT_DATA and GET_DATA), call the function module BBP_PD_PO_GETDETAIL to save the data to the database table?

I have tried firing a direct insert on the table BBP_PDHSC. The data is stored in the table, but when I go to change mode for the same PO, the selections made on the customized screen are not displayed. Why is the data not being retrieved from the databse table?

Also I assume the table that should hold the data for the selections made on the customized screen is BBP_PDHSC.

Regards,

Jayesh

Former Member
0 Kudos

Hi,

if you want to change the data in BADI BBP_DOC_SAVE (and not in BADI BBP_DOC_CHANGE), you have to call:

BBP_PD_PO_GETDETAIL

BBP_PD_PO_UPDATE (with changed data, else no change detected by the system)

BBP_PD_PO_SAVE

COMMIT.

Rgds

Christophe

Former Member
0 Kudos

Hi Christophe,

I want to award points for you answer, but I do not see the option on the left hand side below your name.Is it because the thread was started by someone else?

I am going to try the solution you have suggested, using the function modules in BADI BBP_DOC_SAVE.

Also I noticed one thing. If I use BBP_DOC_CHANGE, the export parameter, ES_HEADER, for method BBP_PO_CHANGE, does not have the "Z" fields that I have created using include INCL_EEW_PD_HEADER_CSF.

So if I use the BADI BBP_DOC_CHANGE, will it update the "Z" fields of the PO in table BBP_PDHSC?

Thanks,

Jayesh

Former Member
0 Kudos

Hi Jayesh,

you should have open your own question/thread.

Only the owner can award points.

In BBP_DOC_CHANGE_BADI, method BBP_PO_CHANGE, customer fields are handled in tables IT_HCF, IT_ICF, ET_HCF, ET_ICF.

Rgds

Christophe

Answers (0)