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: 

MIGO BADIs

Former Member
0 Kudos

Hi,

I am posting a GR for a subcontracting PO. The movement for the parent is 101 and the component are 543 (out of vendor stock - stock type O).

I want to be able to change the value of the components as they post to value of the parent (field MSEG-DMBTR). Effectively, I want to control the valuation update before creating the accounting document.

I have tried the BADIS:

MB_DOCUMENT_UPDATE

MB_DOUCMENT_BADI

MB_MIGO_BADI

But I am not sure I am using them correctly.

Any advice is appreciated.

Thanks.

JP

1 ACCEPTED SOLUTION

christian_wohlfahrt
Active Contributor
0 Kudos

Hi JP,

since you got no other suggestions, here comes my idea, which might complicate the whole stuff:

You thought about changes in booking GR, I think about changing PO. In pricing of PO you can influence value of subtotal B (KOMP-WAVWR).

You might a) add a requirement to prevent adding the costs or b) add a formula to correct the value of KOMP-WAVWR directly.

By this way you avoid differences between PO / GR / invoice... I don't know, if there might be a problem - but better make some changes at the beginning, not at the end.

Maybe an other field has to be changed in your case, but without having an example I can't help much further. There are some routines in RV61AFZB in addition to normal pricing-UE for communication-structure filling.

Somewhere here also price control (moving average / standard) is used - perhaps switching temporarily to standard with amount 0.00 is easier to handle.

Good luck!

Christian

7 REPLIES 7

Former Member
0 Kudos

Jean could you explain with more detailsyour problem?

What is your problem exactly?

Regards,

Carlos

0 Kudos

Hi,

I will give you an example.

I have a subcontracting PO. The parent has 2 sub-items:

Sub-item A - moving average price $1 price control V

Sub-item B - moving average price $2 price control V

The subcontracting PO is flagged as free of charge, so when I post the GR, the cost of the sub-items (in this case $3 is posted to the parent)

In some cases I want to prevent the cost of sub-item A, from being posted to the cost of the parent. There is no 'free of charge' flag at sub-item level, so I was looking for a userexit or some other means to control this.

Let me know if you need any more information. Thanks for the initial response.

JP

christian_wohlfahrt
Active Contributor
0 Kudos

Hi JP,

since you got no other suggestions, here comes my idea, which might complicate the whole stuff:

You thought about changes in booking GR, I think about changing PO. In pricing of PO you can influence value of subtotal B (KOMP-WAVWR).

You might a) add a requirement to prevent adding the costs or b) add a formula to correct the value of KOMP-WAVWR directly.

By this way you avoid differences between PO / GR / invoice... I don't know, if there might be a problem - but better make some changes at the beginning, not at the end.

Maybe an other field has to be changed in your case, but without having an example I can't help much further. There are some routines in RV61AFZB in addition to normal pricing-UE for communication-structure filling.

Somewhere here also price control (moving average / standard) is used - perhaps switching temporarily to standard with amount 0.00 is easier to handle.

Good luck!

Christian

0 Kudos

Hi,

Thanks for the response. My subcontracting PO is marked as free of charge (no added cost other than the cost of the components), so I don't have access to the conditions and therefore I don't have access to the subtotal fields? I still want the cost of the component to be posted, so I need to have valuation (I can't use standard price of zero, as then no cost will be posted for the consumption of the component). Any other suggestions would be great.

Thanks.

JP

christian_wohlfahrt
Active Contributor
0 Kudos

Hi,

your right, condition approach can't work. Anyway, I misunderstood your requirement ('I want to be able to change value of component', I want to prevent the cost(s) of sub-item A ... being posted').

So you 'just' want to re-direct the costs from parent to somewhere else. (I can't imagine any other place as the parent, because that is the result of the production, but customers are very inventive in such tasks).

Sounds like (one of) the first two BADIs are correct place to do the changes.

It's not a smart solution, but perhaps more 'standard' way: create a correction booking.

To be able to create an additional document, you have to be outside of the GR booking.

To leave GR, create change pointers with FM CHANGE_POINTERS_CREATE_DIRECT (in MB_DOCUMENT_UPDATE)

and start a report with FM BP_EVENT_RAISE (this complicate way is needed to leave transaction without an (implicit) commit work). In the additional report you can make the correction booking. By this way you will have more documents in the system, but you won't get a mess with wrong bookings - separate documents should always be able to identify and changed if necessary.

Regards,

Christian

0 Kudos

Hi,

Thanks once again for the response. I can try this, but do you think there is any customer function/BADI/userexit that will allow me to control the value posting, without having to do a 'reversal posting'. I put break-points in most of these BADIs, did some manual changes, but they did not seem to be carried over to the calling functions. In the SD area, there are very distinct areas 'save_prepare' for example where you can make such changes.

Any more ideas?

Thanks.

JP

christian_wohlfahrt
Active Contributor
0 Kudos

Hi JP,

if you like to CHANGE XMKPF and XMSEG in MB_DOCUMENT_UPDATE, then you should have a look at the ABAP-help on assign->dynamical assign->variant 4a.

With a pointer linking to the variables of the calling program of this BADI, you can make value changes - from process point of view that's as bad as a modification (but you don't need object keys with your coding inside the BADI).

Regards,

Christian