Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to add BARCODE in HTML EMAIL body

0 Kudos

Hi experts,

I want to add BARCODE in email body. I have maintained HTML texts in S010 and generating email but now I want to add BARCODE.

Please suggest me how to add BARCODE in the Email body.

FYI; I am using CL_BCS to send the email.

Thanks.

7 REPLIES 7

Sandra_Rossi
Active Contributor
0 Kudos

which barcode symbology? (not all symbologies are supported natively by SAP, i.e. you may need to use an external software)

Note that if you want to display the barcode in the body, either you generate the barcode as an image and you embed it in the html body, or you generate it using html borders (see www javascript libraries), or you use SVG, etc.

0 Kudos

Is there any way to generate Barcode Image from sales document number?. Do we have any FM or class?

Sandra_Rossi
Active Contributor
0 Kudos

It is possible to generate a few barcode symbologies with SAP, but not all, by using the SAPscript/smartform barcode generation internal subroutines. It has already been answered in the forum. So, if you want C128A for instance, I posted an answer.

Sandra_Rossi
Active Contributor
0 Kudos

To generate C128A barcode into a bitmap file, by using the SAPscript/smartform barcode generation internal subroutines, see this answer:

https://archive.sap.com/discussions/message/16628158

You can easily embed the image into the HTML body using

<img src="data:image/bmp;base64,XXX"> by replacing XXX with the bitmap content converted into base 64 (this has been discussed in the forum too).

EDIT:

Caution: if the customer's barcode reader cannot read the C128A barcodes, i.e. he wants another barcode symbology like PDF417, this one is not supported by SAP (by those internal routines), so you'll need to use an external software (not SAP). List of supported barcode symbologies are shown in transaction SE73.

0 Kudos

Hi Sandra,

Thanks for your reply.

I have created the Barcode in Xstring format and then successfully converted it to base64(I downloaded it and it is generating proper image when I convert it into Image format in local system) and attached in the HTML using below html code.

<img src="data:image/bmp;base64,XXX"> (replaced XXX with Base64 string value)

but still image not displayed in the email body.

Did I miss any step here? or need correction in HTML code?

0 Kudos

Try with the HTML file attached which contains such a <img src="data:image/bmp;base64,XXX"> (replaced XXX with Base64 string value) to show a small circle :

small-circle-bmphtm.txt

If it works, then it means you've got an error in your code : extract the HTML, read it carefully with a text editor to dectect where the error is, then debug the program.

raymond_giuseppi
Active Contributor
0 Kudos

You can find some Javascript code on the internet to generate some html/css code to display barcode in html.

<SPAN style="BORDER-LEFT: black 0.02in solid; DISPLAY: inline-block; HEIGHT: 1in"></SPAN>
<SPAN style="BORDER-LEFT: white 0.06in solid; DISPLAY: inline-block; HEIGHT: 1in"></SPAN>
<SPAN style="BORDER-LEFT: black 0.02in solid; DISPLAY: inline-block; HEIGHT: 1in"></SPAN>
<SPAN style="BORDER-LEFT: white 0.02in solid; DISPLAY: inline-block; HEIGHT: 1in"></SPAN>

Perform some googling on "html code for barcode generator" and if you have the time convert the javascript to abap... Of course, feel free to post your code in the forum.