2023 Jul 04 11:17 PM
Hello,
I have a custom program that first creates a purchase order (that can be seen in ME21N) and then a material document (that can be seen in MIGO).
In both of these cases the G/L account has a correct value. So there's nothing wrong here.
BUT when MRRL is then used to create an invoice (based on the material document), then suddenly G/L account assumes a weird random value. It is difficult for me to properly debug my way through MRRL as it is a standard SAP transaction. All I know is up until the point of using it - everything is fine. It was suggested to me that the problem occures due to the "Profitability segment".
I am using it at the stage of creating a purchase order (for ME21N) - by providing the BAPI_PO_CREATE1 function module with the POACCOUNTPROFITSEGMENT structure which is populated as follows ("result_object" is what I called my implementation of POACCOUNTPROFITSEGMENT)
gwa_result_object-po_item = gwa_poitem-po_item.
gwa_result_object-serial_no = 'S'.
gwa_result_object-fieldname = 'RKAUFNR'.
gwa_result_object-value = gwa_tab_imp-order_id.
APPEND gwa_result_object TO gt_result_object.
In ME21N at first the order's value was only "outside" the Profitability Segment (within the "Account Assignment" tab). Later on I was asked that the order be present both "outside" and inside the Profitability Segment.
I THINK that the problem started occuring after that - after I made it that the ORDER is both inside and outside the Profitability Segment.
Is that enough to determine what could be the problem? Why would the G/L account be wrong after the invoice is created in MRRL if it's fine at the purchase order stage (ME21N) and material document stage (MIGO)?
The wrong value of G/L account can be seen in MIR7, not sure if that's relevant.
Kind Regards,
Bartosz