Hi,
I have a web-service for freight rates to which I need to pass tables of the delivery information per invoice when the user hits Collective Billing for a group of selected deliveries from VF04.
The user might select many deliveries, and then that info gets passed to USEREXIT_PRICING_PREPARE_TKOMP. Again, I only want to call the web-service for each invoice, not each delivery (though many deliveries can be bundled to one invoice by the config of Collective Billing).
I'm in USEREXIT_PRICING_PREPARE_TKOMP and I can use XVBRP for each pass through the user exit easily enough to identify when a delivery changes (XVBRP-VGBEL) but the only way I can find a way to determine when the invoice changes is that the table XVBRP[] appears to get cleared/refreshed and starts appending again for subsequent deliveries in the new invoice. I know the invoice number hasn't been assigned yet (XVBRP-VBELN = $0000000001 on every pass). I was hoping that number incremented for a new invoice, but that doesn't seem to be the case in debug. Instead, the table seems to get cleared and refreshed when the invoice changes.
Is checking when the XVBRP[] is initial a good way to identify, which deliveries belong to which invoices at this stage in the invoice creation? Is there a better way?
Thank you!
Jeremy