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: 

Regarding BADI INVOICE_UPDATE, method CHANGE_AT_SAVE

alejandro_bindi
Active Contributor
0 Kudos

Hi there,

I'm implementing this Badi so i can make some checks at the time of saving an edited preliminary (parked) document. If the total of the invoice is higher than the old one, i do the checks (against a Z table, a Z function module, etc) and if i have to stop saving, i trigger an error message raising ERROR_WITH_MESSAGE exception. As the only method that gets called in all the cases I need, and allows me to trigger messages, is CHANGE_AT_SAVE, I use this one.

The okcodes that i'm interested in are:

<i>PARK (Save parked document)

COMP (Save as completed)

BU (Post)</i>

The problem is, to do all the processing, i compare the method parameters

S_RBKP_OLD vs. S_RBKP_NEW.

When the okcode is PARK or COMP it's ok, but <b>when posting (BU) the S_RBKP_OLD doesn't get populated</b>! Anyone knows why is that and what the workaround would be?

Update: i've searched throught OSS but there's no note related to this.

Thank you very much.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Try this..

In the importing S_RBKP_NEW-RBSTAT ..

Check if the value is '5' for posted.

Thanks,

Naren

3 REPLIES 3

Former Member
0 Kudos

Hi,

Try this..

In the importing S_RBKP_NEW-RBSTAT ..

Check if the value is '5' for posted.

Thanks,

Naren

0 Kudos

Hi Narendran, thanks for your help,

But my problem is that i need to compare the new total of the invoice (s_rbkp_new-rmwwr) versus the old one (s_rbkp_old-rmwwr), so that if the new one is higher, i check that the difference between them is not higher than a set limit, otherwise i must stop saving/posting.

I could retrieve the values from RBKP table itself (which should still be the "old" ones at the time the BADI executes) but then, what is s_rbkp_old for?

Edit: Requirements changed and now i need to do the checks for every changed line of the invoice. As in the original problem, when posting, TI_RSEG_NEW has all the new values but TI_RSEG_OLD is initial. I've been debugging a little and got to the MRM_DOCUMENT_CHANGE_PREPARE function, which is not calling the MRM_*_READ functions since i_xupda (update flag) is 'I' when posting, although no new line has been inserted.

PLEASE, if you implemented this BADi method before, post your comments or example code. Documentation is scarce and on the internet there isn't much info neither.

I've been also looking at exits but they don't seem to serve this purpose.

By the way, i'm on 4.6C.

Many thanks

alejandro_bindi
Active Contributor
0 Kudos

Closing thread: solved usign RSEG to get the initial values.