This scenario applies when there is invoice issuance from SD (Sales and Distribution module). The functionalities of the package /EDGE/FC_SAPSD_INT should be used.
To initiate a business unit of this nature, the following steps must be followed:
- Configure the class /EDGE/CL_FC_START_PROCESS_EXT as an external start in the system's general parameters. Refer to the configuration in the chapter "Configuration of general parameters".
- Configure the specific business unit(s) in question. Review all the configuration in the chapter "Specific configuration for each process/business unit". Also, review the entire configuration process in "Functional configuration of the b+ Core Framework".
- Set up the automatic determination of business units. Refer to the chapter "Configuration automatic determination of business unit.".
- Configure the input channel for this functionality, which is implemented in the class /EDGE/CL_FC_SAPSD_INT_CHAN_IN. If additional data needs to be saved beyond what is stored by this functionality, a class can be created that inherits from this one and re-implements the method SAVE_INVOICE_ADDITIONAL_DATA. This method should call the superclass method first and then implement the additional data to be saved.
An example of this implementation can be found in the class /EDGE/CL_FC_CRVJL_SD_CHAN_IN. - When importing the package /EDGE/FC_SAPSD_INT, the implementation of the BADI SD_CIN_LV60AU02 was created in the system. This BADI is executed whenever any change is made to an SD invoice. In the implementation /EDGE/FC_BADI_IMP_SD, all the internal tables of the billing process that reach this point are obtained and sent to the external start process of business units.
In theory, no modifications need to be made to this implementation, as all the logic is already implemented. Only the functional configuration steps need to be performed to automatically determine the business unit.
The source code of the implementation is as follows:
METHOD if_ex_sd_cin_lv60au02~excise_invoice_create.
*----------------------------------------------------------------------*
* Descripción : Inicia procesos de facturación electrónica, de acuerdo
* a condiciones configuradas en /EDGE/FC_SPRO
* Desarrollador : Julián Andrés Sánchez Castro - JULIANS *
* Diseño y Arquitectura : Julián Andrés Sánchez Castro *
* Consultor Funcional : Julián Andrés Sánchez Castro *
* Fecha: 27/02/2018
*----------------------------------------------------------------------*
* LOG DE MODIFICACIONES *
*----------------------------------------------------------------------*
* Descripción : Detalle el objetivo del cambio *
* Funcional : Consultor Funcional. *
* Desarrollador : Nombre del programador y user *
* Fecha Modificación : DD.MM.YYYY *
* ID Componente : *
* Número de Req. : Ejemplo LN#### *
*----------------------------------------------------------------------*
FIELD-SYMBOLS: <fs_xvbrk> TYPE vbrk_tab,
<fs_xvbrp> TYPE vbrp_tab,
<fs_xvbpa> TYPE vbpa_tab,
<fs_xkomv> TYPE komv_tab.
DATA: lr_params TYPE REF TO /edge/cl_fc_start_process_para,
lt_data TYPE abap_trans_resbind_tab,
wa_data LIKE LINE OF lt_data,
lr_exc TYPE REF TO /edge/cx_fc_einvoice_exception,
lr_cxroot TYPE REF TO cx_root,
lr_cx2 TYPE REF TO cx_root,
lr_log TYPE REF TO /edge/cl_fc_einvoice_util_logs.
TRY .
wa_data-name = 'VBRK_TAB'.
CREATE DATA wa_data-value TYPE vbrk_tab.
ASSIGN wa_data-value->* TO <fs_xvbrk>.
<fs_xvbrk> = xvbrk.
APPEND wa_data TO lt_data.
wa_data-name = 'VBRP_TAB'.
CREATE DATA wa_data-value TYPE vbrp_tab.
ASSIGN wa_data-value->* TO <fs_xvbrp>.
<fs_xvbrp> = xvbrp.
APPEND wa_data TO lt_data.
wa_data-name = 'VBPA_TAB'.
CREATE DATA wa_data-value TYPE vbpa_tab.
ASSIGN wa_data-value->* TO <fs_xvbpa>.
<fs_xvbpa> = xvbpa.
APPEND wa_data TO lt_data.
wa_data-name = 'KOMV_TAB'.
CREATE DATA wa_data-value TYPE komv_tab.
ASSIGN wa_data-value->* TO <fs_xkomv>.
<fs_xkomv> = xkomv.
APPEND wa_data TO lt_data.
CREATE OBJECT lr_params
EXPORTING
pi_data = lt_data.
/edge/cl_fc_start_process_ext=>start_process_sync( EXPORTING pi_do_commit = abap_false
CHANGING pc_params = lr_params ).
CATCH /edge/cx_fc_einvoice_exception INTO lr_exc.
TRY .
CREATE OBJECT lr_log
EXPORTING
pi_object = /edge/cl_fc_constants=>log_object
pi_subobject = /edge/cl_fc_constants=>sublog_startp
pi_alprog = sy-cprog.
lr_log->add_messages_from_exception( lr_exc ).
CATCH cx_root INTO lr_cx2.
* Nothing to do!!!
ENDTRY.
CATCH cx_root INTO lr_cxroot.
TRY .
CREATE OBJECT lr_log
EXPORTING
pi_object = /edge/cl_fc_constants=>log_object
pi_subobject = /edge/cl_fc_constants=>sublog_startp
pi_alprog = sy-cprog.
lr_log->add_messages_from_exception( lr_cxroot ).
CATCH cx_root INTO lr_cx2.
* Nothing to do!!!
ENDTRY.
ENDTRY.
ENDMETHOD.