For the last few days, I was working on a requirement that required a CFIN FI posting interface to transfer Asset information data like ANLN1 and ANLN2 fields from one of the ECC systems, as it got deleted prior to posting in the Target system.
Challenge: To achieve this requirement, we were restricted from enhancing CFIN BADI in the source system to populate the additional field in the standard Include CI_CFIN_ACCIT_APP_EXT in (CFIN_ACCIT_APP) and bring over the information to CFIN to manipulate the value to achieve the outcome.
Gains: In this blog post, we will cover the steps to do this enhancement only at the Target system.
Steps for Resolution:
- Proceed for Enhancement spot ES_FINS_CFIN_INTERFACE.
Implement the BADI_FINS_CFIN_AC_INTERFACE if there is no implementation existing so far, as Multiple Use of this BADI is not possible.
(Images used are test data i have created free from any personal data & information)
- Provide BADI Implementation name & details and create a custom class corresponding to Interface as asked and land on the below screen.
- Here as per debugging made with /AIF/ERR, I get to understand the Asset information got cleared in method CL_FINS_CFIN_AC_DOC_AGENT~MANDATORY_PREPARATION and this gets triggered post IF_BADI_FINS_CFIN_AC_INTERFACE~GET_PROCESS_CONTROL, so this method would be the ideal point to transfer the required Asset information in buffer table.
- So, have created below buffer table within Types:
types:
BEGIN OF gts_asset_buffer,
bukrs TYPE bukrs,
belnr TYPE belnr_d,
gjahr TYPE gjahr,
buzei TYPE buzei,
anln1 TYPE anln1,
anln2 TYPE anln2,
END OF gts_asset_buffer .
types:
gtt_asset_buffer TYPE TABLE OF gts_asset_buffer .
- And Internal table within Attributes:
class-data GT_ASSET_BUFFER type GTT_ASSET_BUFFER.
- And within the method, GET_PROCESS_CONTROL implemented below source code
*" Loading the class-global table GT_ASSET_BUFFER created for data records
* If ANLN1 is initial, ANLN2 will be '0' as well - so no need to concatenate in that scenario as per requirement
*" Adding BUKRS, BELNR, GJAHR, BUZEI for key-field combination to later map the data as per them
gt_asset_buffer[] = VALUE #( FOR ls_data IN is_posting_data-accit_ext
WHERE ( anln1 IS NOT INITIAL )
( bukrs = ls_data-bukrs
belnr = ls_data-belnr
gjahr = ls_data-gjahr
buzei = ls_data-buzei
anln1 = ls_data-anln1
anln2 = ls_data-anln2
)
).
SORT gt_asset_buffer[]. " sort to read with Binary search
- Now preparing any data before posting the PREPARE_INPUT_DATA is the suitable method to update the Posting Data.
LOOP AT cs_posting_data-accit_ext ASSIGNING FIELD-SYMBOL(<ls_accit2>).
READ TABLE gt_asset_buffer ASSIGNING FIELD-SYMBOL(<ls_asset>)
BINARY SEARCH WITH KEY bukrs = <ls_accit2>-bukrs " sorted in GET_PROCESS_CONTROL
belnr = <ls_accit2>-belnr
gjahr = <ls_accit2>-gjahr
buzei = <ls_accit2>-buzei.
IF sy-subrc = 0.
<ls_accit2>-zztext2 = |{ <ls_asset>-anln1 }{ zif_fire_constants=>gc_hypen }{ <ls_asset>-anln2 }|.
UNASSIGN <ls_asset>.
ENDIF.
ENDLOOP.
Outcome:
Now, create a document in the Source system and per SLT handling, the document gets posted and check the same in /AIF/ERR in the Target CFIN system.
Source system:
Target System:
Reference links:
Point 1.5.3.1 Customizing Settings for Asset Documents
2543899 – Sending of Customer-Defined Data from Source Systems to Central Finance
Topic page:
ABAP Topic: https://community.sap.com/topics/abap,
post and answer questions https://answers.sap.com/tags/833755570260738661924709785639136.