We had an issue this week where it was difficult for our accounts payable department to properly pay freight forwarder invoices for foreign shipments (and customs invoices) in SAP ECC 6.0 MIRO screen. The solution was simple.
In MIRO, the Delivery ID field was blank since freight forwarder invoices are received via VL32N and not MIGO. Since we receive shipments from various factories via the same forwarder, without the delivery note field being populated, trying to figure out which freight forwarder line belonged to which factory vendor turned out to be an hours long process and ended up in tears since every unpaid delivery from each vendor via the same customs vendor would appear jumbled in a lump together.
Our process flows basically this way — > ME21N (PO) –> VL31N (Delivery) –> VT01N (Shipment) –> VI01 (Shipment Costs) –> VL32N (Delivery Receipt) –> MIRO (AP)
I resolved the issue in two different ways. The first was an enhancement that I put on the last line of MRM_ASSIGNMENT function module that populated the delivery numbers automatically (as what you would normally see when MIGO is used to do the receipt). I will include the code at the end of this article. However, since customizations require more labor as time moves forward, there is a way to have this work in the software natively.
I found an extremely simple solution: populate the Bill Of Lading ID on the shipment header and the external delivery ID field in VL32N to be the same as the delivery number. If that is populated, you can even use the bill of lading filter in MIRO to choose only the delivery number from the vendor in question and not multiple vendors.
After delivery created, go to VL32N and put inbound delivery ID in both Bill of Lading and External ID reference fields (if appropriate to your business process and not in use)
Now, in MIRO, presto! The delivery numbers show up and you can use the bill of lading filter to zoom directly into the specific delivery you’re looking for:
Works great. However, if you’re looking for a programmatic way of doing this, you can use SE37 to add the following enhancement to the end of MRM_ASSIGNMENT to automatically populate the delivery numbers. Caution, use this code at your own risk and after environment testing:
“””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””””$”$\SE:(1) Function Module MRM_ASSIGNMENT, End A
*$*$-Start: (1)———————————————————————————$*$*
ENHANCEMENT 4 ZMME_MRM_ASSIGNMENT. “active version
data: ltmp_xblnr type xblnr.
if sy–tcode = ‘MIRO’.
loop at t_drseg.
if t_drseg–xblnr is initial.
clear ltmp_xblnr.
data: x_ekbeh type c,
bet type standard table of EKBE,
wa_bet type ekbe.
CALL FUNCTION ‘MMPUR_EKBE_READ_EBELN_EBELP’
EXPORTING
pi_ebeln = t_drseg–ebeln
pi_ebelp = t_drseg–ebelp
“pi_bypassing_buffer = ” “359665
“pi_refresh_buffer = ” “359665
pi_lfgja = t_drseg–lfgja
pi_lfbnr = t_drseg–lfbnr
pi_lfpos = t_drseg–lfpos
pi_ekbeh = ‘X’ ” ??
“pi_webre
“IMPORTING
“pe_ekbeh =
TABLES
pto_ekbe_po = bet
* MAA EhP4 -Start “MAA EhP4
“pto_ekbe_ma_po = bet_ma “MAA EhP4
* MAA EhP4 -end “MAA EhP4
“pti_ref_rseg = t_ref_rseg
“EXCEPTIONS
” no_records_requested = 1
“OTHERS = 2.
.
IF sy–subrc = 0.
loop at bet into wa_bet where xblnr is not initial.
t_drseg–xblnr = wa_bet–xblnr.
modify t_drseg.
endloop.
ENDIF.
endif.
endloop.
endif.
ENDENHANCEMENT.
*$*$-End: (1)———————————————————————————$*$*
ENDFUNCTION.
As always, I’m interested in constructive criticism and further knowledge, so feel free to post back! =)
— Stu Osborne 5/18/2015
Pingback: SAP ECC 6: Copying VL31N (Inbound delivery) ID number to Bill of Lading ID via ABAP | Stewart Mason Osborne