Trigger repricing of an outbound delivery in ABAP

Hi All, 

I needed to reprice the transport cost conditions on an outbound delivery and found out it was not so straight forward. Probably because most of the time the repricing of a preceding Sales Order would take care of this, SAP never provided a nice FM or BAPI for this.

But sometimes you need to trigger the pricing yourself. For example, in an STO scenario where the preceding document is a PO.

Once I figured it out, I decided to create this little post as there is not much out here on this subject.
Also, this post will serve as my personal paper memory for when I need it again 😉

PERFORM lieferungsupdate_extern_init(sapmv50a). “prevent early abort by LEAVE statement in BELEG_SICHERN_POST
PERFORM transaktion_init(sapmv50a) USING ‘VL02’. “we fake being in VL02
PERFORM beleg_lesen_simple(sapmv50a) USING <lg_obd>. “read delivery
PERFORM preisfindung_gesamt(sapmv50a) USING ‘B’. “trigger pricing
PERFORM beleg_sichern(sapmv50a) USING abap_true. “save

Please feel free to discuss my soltion

 

Scroll to Top