Uno de los objetivos principales del b+ Core Framework y los intérpretes es brindar la flexibilidad para los procesos de facturación electrónica, permitiendo adicionar o quitar pasos según las normativas de las agencias tributarias de cada país y según las reglas de negocio de los clientes. Por esta razón, en cada implementación de facturación electrónica es posible crear pasos que implementen cierta lógica requerida.
A continuación, se explica cómo se deben crear a nivel ABAP cada paso:
...
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:
- 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.
- The class implementing the step's logic should implement the interface /EDGE/IF_FC_INTERPRE_STEP. Sin embargo, se recomienda que se herede de la clase abstracta However, it is recommended to inherit from the abstract class /EDGE/CL_FC_GENERAL_STEP; ya que esta última contiene lógica que acelera el desarrollo del paso.
Por ejemplo, contiene la lógica para determinar si el paso se ejecuta o no, dependiendo del estado en que se encuentra el paso (método MATCH_STATUS), también calcula el estado final dependiendo de la configuración funcional del paso (método , 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). - Al heredar de las clase When inheriting from the class /EDGE/CL_FC_GENERAL_STEP, solo se debe implementar o redefinir el método EXECUTE_STEP.
Solo se debe reimplementar o redefinir el método GETyou only need to implement or redefine the EXECUTE_STEP method. - Only reimplement or redefine the GET_FINAL_STATUS , si no se definió por configuración funcional el estado en el que debe quedar el proceso luego de la ejecución del paso; siempre y cuando no se requiera dejar el proceso en el estado inicial en el que estaba el proceso antes de ejecutar el paso.
Al implementar el método EXECUTE_STEP, se deben tener en cuenta las siguientes premisas:
Si el método termina en estado satisfactorio, se debe retornar en el parámetro returning PE_SUCCESS un true, es decir un ABAP_TRUE.
Si el método no termina en estado satisfactorio y se quiere hacer saber al producto que debe colocar el proceso en estado error, entonces se debe lanzar una excepción tipo 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. - 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.
Si se requiere indicar que el paso terminó pero no se requiere cambiar el estado, entonces se debe lanzar la excepción 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. Con esta excepción, se identifica que el proceso no se debe detener y que no debe quedar en estado error.
En el parámetro pc_context se encuentran los datos de la factura que actualmente se está procesando (esta parámetro se envía todos los pasos, por lo tanto se pueden enviar datos entre los pasos utilizando este parámetro y su atributo data). Allí se pueden encontrar en sus atributos los datos del proceso, al igual que una clase para realizar el log de los mensajes. Para acceder a ésta solo basta con utilizar la siguiente instrucción: pc_context->einvoice→log.
Con la atributo log que en realidad es la instancia de la clase This exception signifies that the process should not be stopped and should not be put into an error state - 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, se pueden logear muchas clases de mensajes; y estos mensajes van quedando asociados a la factura, de tal forma que se pueden monitorear en el monitor which allows you to log various types of messages associated with the invoice. These messages are monitored in the /EDGE/FC_03 .
Es posible actualizar los datos de la factura electrónica, esto se hace siguiendo las siguientes reglas:
Declarar un work area: wa_invoice TYPE monitor - It is possible to update the electronic invoice data using the following rules:
Declare a work area: wa_invoice TYPE /edge/fc_tb901.
Asignarle al work area los datos actuales de la facturaAssign the current invoice data to the work area:: pc_context->einvoice->context → einvoice → header.
Realizar los campos sobre el Make changes to the fields in the work area.
Actualizar la factura con el métodoUpdate the invoice using the method: /edge/cl_fc_einvoice_util=>update_invoice_db( EXPORTING pi_tb_invoice = wa_invoice
CHANGING pc_einvoice = pc_context->einvoice ).
El diagrama de clases para la implementación de los pasos es el siguienteThe class diagram for the step implementation is as follows: