17
SAP Integration with Magento Confidential By: Aman Agarwal

Magento meetup march-2017

Embed Size (px)

Citation preview

Page 1: Magento meetup  march-2017

SAP Integration with Magento

Confidential

By: Aman Agarwal

Page 2: Magento meetup  march-2017

Confidential

Agenda

❏ Things we can integrate between SAP & MAGENTO

❏ Process to Integrate.

❏ Sample Code From Live Project

Page 3: Magento meetup  march-2017

Confidential

Things We Can Integrate?

❏ SAP is arguably one of the most powerful ERP platforms available on the market, offering a

plethora of product, customer, resource, and reporting management to its customers.

❏ Integrating Magento with SAP provides a powerful unification of your business channels,

without the stress or potential error of manual processes

❏ We can integrate SAP with 3rd party systems through below process:

❏ SOAP APIS

❏ FTP based method

Page 4: Magento meetup  march-2017

Confidential

Things We Can Integrate?

❏ We can do many integration between Magento and SAP like:

❏ Order Processing

❏ Fulfillment Management

❏ CRM synchronization

❏ Product Management:

■ Product Upload from SAP to Magento

■ Product Price Update from SAP to Magento

■ Inventory Management

Page 5: Magento meetup  march-2017

Confidential

Approach to Integrate Inventory Management

FTP Based Approach:

■ 2 files required for Magento <> Sap Integration:

❏ So.txt file -> Order export from Magento to SAP

❏ Atp.txt -> Inventory update from SAP to Magento

■ There will be a common FTP where both the system will exchange their files.

■ Need to create one custom module in Magento to Integrate with SAP so that we

can use it in other Magento systems also by just making some minor change.

Page 6: Magento meetup  march-2017

Confidential

Process to Integrate?

Page 7: Magento meetup  march-2017

Confidential

MAGENTO TO SAP

❏ Order file will have the following format:

❏ Filename: so_<Magento_Order_Id>.txt

❏ File Format: txt (Text-flat file)

❏ Column headers: Included

❏ Column separator: Tabulation

❏ Magento will write the SO file it to its own folder var/sap/so/

❏ After the file is processed (i.e. sent to the FTP server), it will be relocated locally to

var/sap/so/archived/

❏ File will includes:

❏ 1 line for each product order

❏ 1 line for the shipping method

Page 8: Magento meetup  march-2017

Confidential

MAGENTO TO SAP

❏ Sample File:

❏ The SO extract will be triggered dynamically when the shipment is created for the order

(please refer to Order flow section). The file will be stored locally in Magento server (folder

to be configured in Backend ‘Local SO relative file location’), then uploaded to the FTP

server.

❏ Create below DB table :

Table : SAP_SO_FILE

❏ Fields:

Page 9: Magento meetup  march-2017

Confidential

MAGENTO TO SAP

❏ Fields:

❏ SAP_SO_FILE_ID

❏ SAP_SO_FILE_NAME

❏ GEN_TYPE : Automatic or Manual

❏ GEN_TIMESTAMP

❏ COMPLETION_TIMESTAMP

❏ SAP_SO_FILE_LOG : FTP error, Read/Write error or File not found error.

❏ Error During FTP connection:

❏ If the file can’t be sent to the FTP server, then the field

SAP_SO_FILE.COMPLETION_TIMESTAMP remains empty.

Page 10: Magento meetup  march-2017

Confidential

MAGENTO TO SAP

❏ During each script execution, it will go through the table SAP_SO_FILE and check for

unsent files:

■ GEN_TYPE: ‘A’

■ GEN_TIMESTAMP: value filled

■ COMPLETION_TIMESTAMP: value empty

❏ The script will then send these files 1 by one, and if sent successfully, will update their

SAP_SO_FILE.COMPLETION_TIMESTAMP value accordingly.

❏ Alert Email for Success or Failure to Admin.

Page 11: Magento meetup  march-2017

Confidential

SAP TO MAGENTO

❏ ATP file will have the following format:

❏ Filename: atp.txt

❏ File format: txt (Text - flat file)

❏ Column headers: Included

❏ Column separator: Tabulation

❏ The ATP file is generated by SAP every 30 minutes and must be uploaded in Magento

with the same schedule.

❏ When the file is successfully uploaded to Magento, it will be relocated to an archive

folder in the FTP folder and remove from its original folder from the FTP folder (refer to

admin panel section).

❏ Magento will retrieve the ATP file and upload it to its own folder var/sap/atp/ and

rename it atp_YYYYMMDD_HHMMSS.txt.

❏ After the file is processed, it will be relocated locally to var/sap/atp/archived/

Page 12: Magento meetup  march-2017

Confidential

SAP TO MAGENTO

❏ Fields:

❏ SAP_ATP_FILE_ID: database ID, auto_increment

❏ START_TIMESTAMP: Timestamp when the script is triggered and Magento will start to

establish the connection to FTP server.

❏ NB_PRODUCTS: Integer, Nb products read from the ATP file

❏ NB_PRODUCTS_PROCESSED: Integer, Nb products successfully updated in Magento

❏ COMPLETION_TIMESTAMP: Timestamp of end processing for current ATP file

❏ SAP_ATP_FILE_LOG: Text. Will log the following event:

❏ FTP Connectivity:

■ [FTP Connection]: <IP_Address> - FAIL – <FTP error message>

❏ Incorrect file format:

■ [File Format]: Incorrect file format

Page 13: Magento meetup  march-2017

Confidential

SAP TO MAGENTO

❏ Fields SAP ATP DATA:

❏ SAP_ATP_DATA_ID: database ID, auto_increment

❏ SAP_ATP_FILE_ID: Foreign key from SAP_ATP_FILE

❏ ATP_FILE_LINE: line number in ATP file

❏ ARTICLE: Column article from ATP file

❏ BATCH: Column article from ATP file

❏ NET_MOVEMENT: Column article from ATP file

❏ PROCESSED_TIMESTAMP: Timestamp after the product inventory has been updated

successfully (empty until the product has been processed)

❏ SAP_ATP_DATA_LOG: Text. Will log the following event:

❏ Product not found in Magento:

■ [Product SKU <article>_<batch>]: Not found

Page 14: Magento meetup  march-2017

Confidential

SAP TO MAGENTO

❏ Email Alerts:

❏ If an issue is met during the FTP connectivity or file format verification, no product will be

uploaded in table SAP_ATP_DATA. An email will be sent to the ‘Email Alert’ configured in

Magento admin panel.

❏ If the file is processed correctly, but the number of products processed

(SAP_ATP_FILE.NB_PRODUCTS_PROCESSED) is less than the number of product uploaded

(SAP_ATP_FILE.NB_PRODUCTS) the following email will be sent to the ‘Email Alert’ configured

in Magento admin panel

❏ If the file is processed correctly and all products are updated, the following email will be sent to

the ‘Email Alert’ configured in Magento admin panel

Page 15: Magento meetup  march-2017

Confidential

SAP TO MAGENTO

❏ Process of Several Files:

❏ In case of manual amendment of the ATP file, it can be uploaded to the Magento folder

(following its naming convention), and the file will be dynamically process as soon as the script

will be executed by the cron job.

❏ Therefore, several files may be processed in a queue: The files will be processed one by one,

based on their name (oldest file first: atp_YYYYMMDD_HHMMSS.txt).

Page 16: Magento meetup  march-2017

Confidential

MAGENTO ADMIN

Page 17: Magento meetup  march-2017

Confidential

Thank You