Financial Management Blogs by Members
Dive into a treasure trove of SAP financial management wisdom shared by a vibrant community of bloggers. Submit a blog post of your own to share knowledge.
cancel
Showing results for 
Search instead for 
Did you mean: 
d4449
Explorer
0 Kudos

Requirement

In Mexico, it is necessary that all companies receive tax authority validated XML and PDF files that contain the details of the payment made to vendors.

Its mandatory to extract the UUID number from the file that is received from the vendors and save it in a way that makes it easily accessible, in S4 it would be easier to store it in a custom table.

The importance of this interface is to store UUID in S4 system in order to facilitate users identify which invoices were payed to which vendors as well as reconciliation between EDICOM Portal and S4 system. The risk of not having this interface, is that files (PDF and XML) and UUID data will only be stored in EDICOM Portal and reconciliation to corresponding payments would be time consuming for users.   

Technical Requirement

Interaction of SAP with EDICOM portal where SAP CPI is the middleware which sends the XML, PDF to S4. The technical requirement was to create a ODATA which can receive XML and PDF, also should extract UUID details from XML structure and update it to the respective document.

Simple flow chart:

d4449_0-1710394374539.jpeg

Detailed Flow chart:

                  

Technical Solution

To receive and extract the details from XML file, ODATA interface is developed and the received XML and PDF files are attached to the respective FI document.

XML and PDF files are sent in base64 encoded format from SAP CPI then in S4 we make use of various function modules to convert it and make the attachment.

Created ODATA service in tcode SEGW - ZFI_PAYMENT_COMPLEMENT_002

d4449_1-1710394472271.png

In Data model the custom table ZFI_IF020_PAYCOM is used to give ODATA the reference structure. The last two fields ZPDF & ZXML are created in RAWSTRING format to store the XML and PDF files.

d4449_2-1710394501348.png

d4449_3-1710394536606.png

Regenerate the Runtime Artifact ZCL_ZFI_PAYMENT_COM_01_DPC_EXT

d4449_4-1710394558273.png

This gives us the class where we can write the required logic, here we have redefined the method PAY_COMPSET_CREATE_ENTITY – holds the logic to validate the inputs received from SAP CPI and the logic to add PDF and XML to the FI document.

d4449_5-1710394576668.png

FI_DOCUMENT_CHANGE FM is used to update UUID to the respecting FI document.

The above FM is passed with the required importing parameters.

PDF Attachment:

PDF file is sent in Base64 format from CPI to S4.

  • SCMS_XSTRING_TO_BINARY – using this FM the received base64 format is converted to binary
  • ARCHIV_CREATE_TABLE – using this FM the converted binary file is attached to the FI document

XML Attachment:

XML is also sent in Base64 format from CPI to S4.

  • SCMS_XSTRING_TO_BINARY – using this FM the received base64 format is converted to binary
  • SO_CONVERT_CONTENTS_BIN – to get the binary file in tab format
  • SO_FOLDER_ROOT_ID_GET – this FM is used to fetch the folder ID
  • SO_OBJECT_INSERT – used to insert the converted XML file
  • BINARY_RELATION_CREATE_COMMIT – create relation between attachment and the document (Reference code is attached)

If there is any error in the attachment the file is sent to AL11.

All the received inputs including XML and PDF are saved in a custom table.

Report:

Tcode - ZFI_PAYCOMP_MONITOR

A report is created to display the details received using custom table in which the entries made through ODATA Service and displayed in ALV format.

d4449_6-1710394659675.png

User can view the error details in description and also can select and reprocess the particular file after updating the missed details.

Created and activated the service ZFI_PAYMENT_COMPLEMENT_002_SRV in following tcode /n/iwfnd/maint_service

d4449_7-1710394683788.png

The ICF Node should be in active status as shown in the screenshot.

Hope this helps someone! 😊

 

OData NW ABAP Gateway (OData)  

Top kudoed authors