on 2020 Apr 21 10:18 AM
Hi Experts,
We have used jsPDF in SAPUI5(UI5 Version 1.65.8) to generate the PDF document and we have binded the data into the jsPDF which is coming from oData results. We have generated the pdf successfully with the required fields.
Now our requirement is
1. To send an email with the pdf attachment which is generated using jsPDF without downloading the pdf.
2. Is there any option to store the generated pdf in the Z* tables of the SAP backend system.
Kindly provide your suggestion or valuable inputs.
Thanks & Regards,
Manimaran R.
Request clarification before answering.
Hi there.
You can pass the PDF data via oData. In your SEGW entity, have a field, e.g. "Screenshot" that is of ABAP datatype STRING (Edm.String.with Precision/Scale/Max. length = 0).
Create the jsPDF document and add it to your oData object.:
var oPdfDoc = new jspdf("l", "pt", "a2"); // Whatever suits you
oPdfDoc.addHTML($("#viewCreate").get(0), { pagesplit: true },
function () {
// oNew is what you'll pass to the oData service.
oNew.Screenshot = oPdfDoc.output("datauristring");
oNew.Screenshot = oNew.Screenshot.replace("data:application/pdf;base64,", "");
// Trigger the oData call using oNew
}
);
In you oData service, in your DPC_EXT class (_CREATE_ENTITY for example) you convert the incoming (the oNew.Screenshot) to binary:
CALL FUNCTION 'SSFC_BASE64_DECODE'...
And, for example, add it to a workflow:
CALL FUNCTION 'SAP_WAPI_ATTACHMENT_ADD'...
Hope this points you in the right direction!
Regards,
Thomas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
53 | |
8 | |
6 | |
6 | |
5 | |
5 | |
5 | |
4 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.