Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gizemkaragozlu/abap_excel_to_pdf_converter
ABAP - A simple way to convert Excel to PDF :)
https://github.com/gizemkaragozlu/abap_excel_to_pdf_converter
abap abapgit converter excel pdf sap
Last synced: about 1 month ago
JSON representation
ABAP - A simple way to convert Excel to PDF :)
- Host: GitHub
- URL: https://github.com/gizemkaragozlu/abap_excel_to_pdf_converter
- Owner: Gizemkaragozlu
- License: mit
- Created: 2024-08-20T09:54:54.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2024-08-20T11:29:40.000Z (5 months ago)
- Last Synced: 2024-12-20T15:18:03.803Z (about 1 month ago)
- Topics: abap, abapgit, converter, excel, pdf, sap
- Language: ABAP
- Homepage:
- Size: 22.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ABAP Excel to PDF Converter
## Overview
This ABAP program converts an Excel file to a PDF format using OLE automation in SAP. It provides a class `ZCL_EXCEL_PDF_CONVERTER` with methods to perform the conversion. The class uses OLE (Object Linking and Embedding) to interact with Microsoft Excel, manipulate the spreadsheet, and export it as a PDF.
## Prerequisites
- SAP system with ABAP support
- Microsoft Excel installed on the system where this code runs
- Access to the Excel file and a destination path for the PDF## How It Works
1. **Initialize Excel Application**: The program creates an instance of the Excel application.
2. **Open Workbook**: It opens the specified Excel file.
3. **Adjust Formatting**: Sets up page layout and formatting options.
4. **Export as PDF**: Converts the Excel file to PDF format and saves it to the specified destination.
5. **Cleanup**: Closes the workbook without saving changes and quits the Excel application.## Parameters
- `p_source`: The path to the source Excel file (e.g., `C:\path\to\file.xlsx`).
- `p_dest`: The path where the PDF will be saved (e.g., `C:\path\to\output.pdf`).## Usage
To use this program, include the following ABAP code in your selection screen or report:
```abap
PARAMETERS: p_source TYPE string LOWER CASE. " Path to source Excel file
PARAMETERS: p_dest TYPE string LOWER CASE. " Path to output PDF fileSTART-OF-SELECTION.
zcl_excel_pdf_converter=>get_instance( )->convert(
EXPORTING
source = p_source
destination = p_dest ).
```## Class Definition
### `ZCL_EXCEL_PDF_CONVERTER`
#### Methods
- **`get_instance`**: Returns a singleton instance of the class.
- **`convert`**: Converts the specified Excel file to PDF.### Usage Example
```abap
data(lo_converter) = zcl_excel_pdf_converter=>get_instance( ).lo_converter->convert(
EXPORTING
source = 'C:\path\to\source.xlsx'
destination = 'C:\path\to\output.pdf' ).
```## Notes
- Ensure that the path to the Excel file and the destination PDF file are accessible and writable by the SAP system.
- This code uses OLE automation, which requires Microsoft Excel to be installed and configured properly on the machine where the SAP system is running.## License
This project is licensed under the [MIT License](LICENSE). See the LICENSE file for details.