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: 

Print label using BarTender

Former Member
0 Kudos

Hello, experts! I want to print label using BarTender. And the layout is designed in BarTender, what I need to do is send data in XML to BarTender. How can I make it?

1 ACCEPTED SOLUTION

rosenberg_eitan
Active Contributor
0 Kudos


Hi,

I am using the "Commander" that come with bar tender:


I write from SAP two simple files (not XML)


A trigger file that the Commander intercept
Content:
BTW% /AF="<path to the btw file>"/PRN="<printer name>" /DD /PD /D=<path to the data>


A Data file (Tab seperated value) with heading for reference
It contain only two lines.


From the bar tender help:


Commander is a software utility, available with the Automation Edition of BarTender, that enables you to perform automatic printing using BarTender in situations where using command line or ActiveX automation is either not possible or not cost-effective. Commander can run as an application or as a Windows service.
How Commander Works
When a system needs to print, it simply performs a triggering action, such as placing a file in a location of your choosing on the network, transmitting an e-mail, sending data via RS-232 (a serial port), or sending information through a TCP/IP sock connection. Commander detects the arrival or occurrence of these "triggers" and then "wakes up" BarTender so it can merge your data into templates and automatically execute a BarTender print job.
A trigger file or message may be empty, where it serves only as a mechanism for starting a print job. Alternatively, it can contain data and/or script commands that will later by used by BarTender, Commander, or another application that Commander launches. Because applications creating triggers can include different content in the triggers they produce, Commander allows you to dynamically define BarTender documents, print settings, data sources, and much more using Commander variables.
For example, an in-house order fulfillment application enters data about an order into a database and saves an empty file named NewOrder.dat in a directory being watched by Commander. After Commander detects the trigger file, it will open a document in BarTender that is configured to query the database about orders entered after a specified time. Once BarTender has read the data, it will use the contents of the data file to print the document. Commander then deletes the NewOrder.dat and resumes monitoring the directory.
In all Windows environments, Commander can be configured to operate as a Windows service that runs whenever your computer is on, whether or not anyone is actually logged into the machine. You can also run multiple BarTender processes for better performance.

Regards.

9 REPLIES 9

rosenberg_eitan
Active Contributor
0 Kudos


Hi,

I am using the "Commander" that come with bar tender:


I write from SAP two simple files (not XML)


A trigger file that the Commander intercept
Content:
BTW% /AF="<path to the btw file>"/PRN="<printer name>" /DD /PD /D=<path to the data>


A Data file (Tab seperated value) with heading for reference
It contain only two lines.


From the bar tender help:


Commander is a software utility, available with the Automation Edition of BarTender, that enables you to perform automatic printing using BarTender in situations where using command line or ActiveX automation is either not possible or not cost-effective. Commander can run as an application or as a Windows service.
How Commander Works
When a system needs to print, it simply performs a triggering action, such as placing a file in a location of your choosing on the network, transmitting an e-mail, sending data via RS-232 (a serial port), or sending information through a TCP/IP sock connection. Commander detects the arrival or occurrence of these "triggers" and then "wakes up" BarTender so it can merge your data into templates and automatically execute a BarTender print job.
A trigger file or message may be empty, where it serves only as a mechanism for starting a print job. Alternatively, it can contain data and/or script commands that will later by used by BarTender, Commander, or another application that Commander launches. Because applications creating triggers can include different content in the triggers they produce, Commander allows you to dynamically define BarTender documents, print settings, data sources, and much more using Commander variables.
For example, an in-house order fulfillment application enters data about an order into a database and saves an empty file named NewOrder.dat in a directory being watched by Commander. After Commander detects the trigger file, it will open a document in BarTender that is configured to query the database about orders entered after a specified time. Once BarTender has read the data, it will use the contents of the data file to print the document. Commander then deletes the NewOrder.dat and resumes monitoring the directory.
In all Windows environments, Commander can be configured to operate as a Windows service that runs whenever your computer is on, whether or not anyone is actually logged into the machine. You can also run multiple BarTender processes for better performance.

Regards.

0 Kudos

Thank you, Eitan! It is really helpful to understad 'Commander'!

And could you share your data file and BarTender templete file with me?

0 Kudos

Hi,

The file are created on a network server using "OPEN DATASET" and are tab seperated values.

Files included:

Triger file:
Bar_0187043236_700830_trig.txt

Data file:
Bar_0187043236_700830_data.txt

Pictures of the commander setup (with some censorship).

Use the built in help it is very good.

Regards.

former_member184569
Active Contributor
0 Kudos

You must be having a folder in Bartender folder on your local PC, from where it takes the XML file or the Excel file as the source to populate the label whose layout is designed.

First convert ABAP to XML. For this you can  using FMs

CALL FUNCTION 'SDIXML_DATA_TO_DOM'

CALL FUNCTION 'SDIXML_DOM_TO_XML'

Refer this code.

http://wiki.scn.sap.com/wiki/display/Snippets/ABAP+TO+XML

Then send this xml output to the source folder used in Bartender using FM like WS_DOWNLOAD

IF r_local = 'X'.

    CALL FUNCTION 'WS_DOWNLOAD'

         EXPORTING

              bin_filesize = w_size

              filename     = p_file " File name in local PC.

              filetype     = 'BIN'

         TABLES

              data_tab     = xml_tab

         EXCEPTIONS

              OTHERS       = 10.

* Instead of XML, you may also have the option to take data from Excel file in the Bartender software. In that case, you just need to move the abap data as Excel sheet to local file using

* Convert to excel file and send it to the input of Codesoft software for printing labels.
     CALL FUNCTION 'SAP_CONVERT_TO_XLS_FORMAT'
       EXPORTING
         i_filename     = p_file
       TABLES
         i_tab_sap_data = i_data.
   ENDIF.

In the Bartender layout, edit the configuration such that it uses the same file that is exported from SAP to populate the information in the layout.



0 Kudos

Hi,

There is no need for XML .

No need to make it more complex the necesery

Regards.

0 Kudos

Hi, Eitan!

Coud you tell me how the data in data file match with templete file?

Thank you!

0 Kudos

Hi,

When you design the label there is an option to define your input so you specify a file that is the same format as the file you will be producing from SAP.

You use the header as a reference to position the data on the label see the data file .

At run time the trigger file contain the actual file names to be used the /AF= and /D= parameters.

%BTW% /AF="\\server\BarTenderP\btwDoc\700830.btw" /PRN="Zebra TLP2844-Z" /PD /D="\\server\BarTenderP\OutDoc\Bar_0187043236_700830_data.txt" /DD /Close

I have an option in the program to produce a data file only and I give it to the label designer (End user)

The file names that I create from the sap are different each time (delivery number + label code)

Regards.

0 Kudos

Thank you very much for your help, Eitan!

0 Kudos

Hi,

You are welcome.

Regards.