/
ABAP Development of Configured Steps.

ABAP Development of Configured Steps.

One of the main objectives of the b+ dgtal eInvoice and the business units is to provide flexibility for electronic invoicing processes, allowing the addition or removal of steps according to the regulations of each country's tax agencies and the business rules of clients. For this reason, in each electronic invoicing implementation, it is possible to create steps that implement specific required logic.

Below is an explanation of how each step should be created at the ABAP level:

  1. Understand the functional scenario for the step, i.e., know how the handling of the final state and error state was configured from the functional part. This is essential as it determines whether special logic is required to determine these states or if they are calculated based on standard configuration.

  2. The class implementing the step's logic should implement the interface /EDGE/IF_FC_INTERPRE_STEP. However, it is recommended to inherit from the abstract class /EDGE/CL_FC_GENERAL_STEP, as it contains logic that accelerates step development.
    For example, it includes logic to determine if the step should be executed or not, depending on its current state (MATCH_STATUS method), and it calculates the final state based on the functional configuration of the step (GET_FINAL_STATUS method).

  3. When inheriting from the class /EDGE/CL_FC_GENERAL_STEP, you only need to implement or redefine the EXECUTE_STEP method.

  4. Only reimplement or redefine the GET_FINAL_STATUS method, if the state in which the process should be after the execution of the step has not been defined by functional configuration; provided that it is not required to leave the process in the initial state in which the process was before executing the step.

  5. When implementing the EXECUTE_STEP method, you should consider the following premises:
    If the method completes successfully, you must return true in the PE_SUCCESS parameter, i.e., ABAP_TRUE.
    If the method does not complete successfully and you want to inform the product that the process should be set to an error state, you must raise an exception of type /EDGE/CX_FC_EINVOICE_EXCEPTION.
    If you need to indicate that the step has completed, but there is no need to change the state, you should raise the exception /EDGE/CX_FC_EINVOICE_SOFT_EXCE. This exception signifies that the process should not be stopped and should not be put into an error state

  6. The pc_context parameter contains the data of the current invoice being processed. This parameter is sent to all steps, allowing data to be passed between steps using this parameter and its data attribute. You can find process data in its attributes and a class for logging messages. You can access it using the following instruction: pc_context → einvoice → log.
    The log attribute is actually an instance of the class /EDGE/CL_FC_EINVOICE_UTIL_LOGS, which allows you to log various types of messages associated with the invoice. These messages are monitored in the /EDGE/FC_03 monitor

  7. It is possible to update the electronic invoice data using the following rules:
    Declare a work area: wa_invoice TYPE /edge/fc_tb901. 
    Assign the current invoice data to the work area::  pc_context → einvoice → header. 
    Make changes to the fields in the work area.
    Update the invoice using the method:  /edge/cl_fc_einvoice_util=>update_invoice_dbEXPORTING pi_tb_invoice wa_invoice
                                                        CHANGING pc_einvoice   pc_context->einvoice ).


The class diagram for the step implementation is as follows:

Avvale 2024