Process Billing Document Output by ABAP Code
ABAP programmer can use sample code shared in this tutorial to process billing document output messages individually by ABAP code instead of VF31 SAP transaction. SAP user can add the output message using VF02 transaction Header Outputs screen too. But in case SAP user fail to add new invoice output message and process it successfully, ABAP developers can use following codes in order to create and process outputs for selected billing document.
Here is ABAP program code which takes the billing document or invoice number and the output message type as input values from the user. I used a basic ABAP Selection Screen code for this task where the SAP user can provide the invoice number and the output type.
As seen in below ABAP code, the program is formed of a few seperate blocks.
First comes the selection screen block, then an ABAP Select command on NAST database table which returns the output message data in a local structure value. This SELECT statement requires an existing output with status either processed or ready for process. It is enough to add manually the specific invoice output using VF02 and leave it unprocessed by setting its dispatch time to 3 (highlight output then press Further data button).
An other code block changes and updates the message status field values for the new process which will take soon.
Update is done by calling ABAP function module RV_MESSAGE_UPDATE_SINGLE
The last ABAP code block process the target output record using ABAP function module WFMC_MESSAGES_PROCESS
After ABAP programmer executes above ABAP report to process a specific billing document (invoice) number and for a specific output message, if it runs successfully a green output record will be displayed on VF03 (Goto > Header > Output) Outputs screen.