Skip to Content
0

How to add BARCODE in HTML EMAIL body

Oct 20, 2017 at 08:38 PM

227

avatar image
Former Member

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.

10 |10000 characters needed characters left characters exceeded

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
Former Member
Sandra Rossi

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

0

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.

0
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Raymond Giuseppi
Oct 24, 2017 at 06:59 AM
0

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.

Share
10 |10000 characters needed characters left characters exceeded
Sandra Rossi Oct 24, 2017 at 05:43 AM
0

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.

Show 2 Share
10 |10000 characters needed characters left characters exceeded
Former Member

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

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.

0