Enterprise Resource Planning Blogs by Members
Gain new perspectives and knowledge about enterprise resource planning in blog posts from community members. Share your own comments and ERP insights today!
cancel
Showing results for 
Search instead for 
Did you mean: 
Prerequisite : Understanding of how different BADI methods of Enhancement Spot ES_CTE_FIN_POSTING_DATA works.

In SAP-Concur native Cloud Platform integration SAP has provided many enhancements of integration. In 2020 version of this integration SAP has provided enhancement for document Attachment, Posting Data Change, Amount field adjustment etc. Concur-SAP has standard mapping, and we have Custom Field at Report, Entry and Allocation level. So, it is quite easy to pass any additional data from Concur to SAP for accounting document during posting. Still in some cases we have the data available in some fields in JSON but not mapped to any Standard or Custom fields of SAP. In that case there is no option but to read the JSON file and map that to SAP fields. An example is Card Billing Date, which is not available in any mapping.
To achieve this requirement, we need to use methods of classes CL_CTE_FND_POST_HDL_FACTORY and CL_CTE_FND_POST_DOC_STORE. This will help to get the data from JSON file in an internal table LS_DATA as below.

 
DATA : ls_document_key TYPE cte_s_fnd_post_doc_key,
lo_doc_store_handler TYPE REF TO cl_cte_fnd_post_doc_store.

ls_document_key-system_key = '1'. "Generally Constant Value
ls_document_key-document_type = 'ER'. "For Expense Report
ls_document_key-revision_id = lv_revision_id. "Generally '001'
ls_document_key-document_id = lv_doc_id. "Concur Document ID
CALL METHOD cl_cte_fnd_post_hdl_factory=>get_doc_store_handler
EXPORTING
iv_document_type = ls_document_key-document_type
RECEIVING
rr_doc_store_handler = lo_doc_store.

CALL METHOD lo_doc_store_handler->get_document
EXPORTING
is_document_key = ls_document_key
IMPORTING
es_data = ls_data.



LS_DATA will have value as below:

{"employee":{"employeeOrgUnit3Code":null,"employeeOrgUnit4Code":null,"employeeOrgUnit5Code":null,"employeeOrgUnit6Code":null,"employeeOrgUnit1Value":null,"employeeOrgUnit2Value":null,"employeeOrgUnit3Value":null,"employeeOrgUnit4Value":null,"employeeOrgUn……….

The LS_DATA can be split at ’,’ to get the each field name and value in a single line of internal table. Now using the CS (Contain String) functionality every field and its value can be find and that can be mapped in Report, Entry or Allocation level BADI methods as below.

IF_BADI_CTE_FIN_POST_DT_CHANGE~MAP_REPORT_ADDITIONAL_DATA
IF_BADI_CTE_FIN_POST_DT_CHANGE~MAP_ENTRY_ADDITIONAL_DATA
IF_BADI_CTE_FIN_POST_DT_CHANGE~MAP_ALLOCATION_ADDITIONAL_DATA
METHOD if_badi_cte_fin_post_dt_change~map_entry_additional_data.

FIELD-SYMBOLS: <ls_entry> TYPE cte_s_additional_data.
APPEND INITIAL LINE TO et_entry_additional_data ASSIGNING
<ls_entry>.
IF <ls_entry> IS ASSIGNED.
<ls_entry>-name = 'CBDATE'.
<ls_entry>-value = lv_date.
ENDIF.
ENDMETHOD.

The values store in field of internal table are in below format

"employeeId":"60125678"
So that can be read and mapped accordingly in Additional Data field and can be used in ADJUST_POSTING_DOCUMENT of BADI BADI_CTE_FIN_POST_ADJUST_DOC.
METHOD if_badi_cte_fin_post_adj_doc~adjust_posting_document.
FIELD-SYMBOLS: <fs_accit> TYPE accit.
LOOP AT ct_accit ASSIGNING <fs_accit>.
ASSIGN ct_accrel[ posnr = <fs_accit>-posnr ] TO
FIELD-SYMBOL(<fs_accrel>).
IF <fs_accrel> IS ASSIGNED.
ASSIGN is_document_data-entry[ entry_id = <fs_accrel>-entry_id ]
TO FIELD-SYMBOL(<fs_entry>).
IF <fs_entry> IS ASSIGNED.
ASSIGN <fs_entry>-additional_data[ name = c_zuonr ] TO <fs_data>.
IF <fs_data> IS ASSIGNED.
<fs_accit>-zuonr = <fs_data>-value.
ENDIF.
ENDIF.
ENDIF.
ENDLOOP.
ENDMETHOD.

So once all those methods properly implemented, data will be mapped automatically from Concur to S4 Hana accounting document. In this case the Card Billing Date from Concur is mapped to Assignment (ZUONR) field of the accounting document. This will help the accounting team to expedite the payment process depending on the date. For this no custom field mapping to be change in Concur side and S4 can own the solution independently.
1 Comment
Labels in this area