cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with SAP SCRIPT label Printing

Former Member
0 Kudos

Hi Friends,

I am facing one problem in scripts.i.e: i am working on scripts for Label printing. My page format is 4 IN width and 6 IN Height, I created the page by using <b>SPAT</b> and then created one Format.

I assigned this format to the Device <b>LBL_INT(LBL7).</b>

When i am displaying the output it's displaying fine and it's creating the spool request. It's processing successfully. But imy problem is it's not printing from the printer.

When i talked with client he's saying that you need to use conversion software to do this.

I worked on lot of scripts but Basically i am working on this type of requirment first time.

Can anyone please give me your tips and solutions regarding this issue.

Thanks,

Srinivas.

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member196280
Active Contributor
0 Kudos

CHeck with Basis team they may help you on this.. They may install some additional software on your printer ( go through the printer manual)

Regards,

SaiRam

Former Member
0 Kudos

Try this / Code :- Find the attachment which consists of an example how to build a label in

script. The same can be applied for Smartforms also using Templates.

LABELS:

Most of the products shipped from a company's warehouse will have big stickers in the cartons. These stickers hold the information such as product number, serial number and shipping address and many more information. These are used to easily identify what is packed inside that carton. So for these kind of usage we need to generate the labels or stickers.

Suppose if u want to print address of a student in a script.. like student no, name address etc ok.

This small request need only a small area in a page, suppose client don't want to waste the remaining page in that case, u will arrange the small windows with the same format in entire page. May be u can insert upto 99 main windows.

Most of the products shipped from a company's warehouse will have big stickers in the cartons. These stickers hold the information such as product number, serial number and shipping address and many more information. These are used to easily identify what is packed inside that carton. So for these kind of usage we need to use Thermal printers to generate the labels or stickers. Thermal printing is not possible using a normal printer. You need special printers for thermal printers.

You can use SAP script and Smartform to print labels.

To create labels in SAPSCRIPT, you will have to define multiple MAIN WINDOWS in the Page Window. Try the following steps:

Main windows in page windows allow you to format text in multiple columns. Define an area in the page window, in which to position the main windows.

1. Create a page window and assign it to a page.

2. Choose Edit --> Main windows.

A dialog box appears.

3. Enter values in the fields Area width and Area height in accordance with the input guidelines for main windows.

4. Enter values in the fields Spacing and Number in the Horizontal group if you want to use multiple columns. You can ignore the fields in the Vertical group.

5. Determine how many columns and line areas are required for label printing. Then enter the corresponding values in the fields in the Horizontal and Vertical groups.

Example:

1. Create a driver program to display the customer details as labels in script.

TYPES: BEGIN OF gty_kna1,

kunnr TYPE kna1-kunnr,

adrnr TYPE kna1-adrnr,

END OF gty_kna1.

TYPES: BEGIN OF gty_adrc,

addrnumber TYPE adrc-addrnumber ,

name1 TYPE adrc-name1,

city1 TYPE adrc-city1,

post_code1 TYPE adrc-post_code1,

END OF gty_adrc.

TYPES: BEGIN OF gty_final,

kunnr TYPE kna1-kunnr,

adrnr TYPE kna1-adrnr,

name1 TYPE adrc-name1,

city1 TYPE adrc-city1,

post_code1 TYPE adrc-post_code1,

END OF gty_final.

DATA: gt_kna1 TYPE TABLE OF gty_kna1,

gs_kna1 TYPE gty_kna1,

gt_adrc TYPE TABLE OF gty_adrc,

gs_adrc TYPE gty_adrc,

gt_final TYPE TABLE OF gty_final,

gs_final TYPE gty_final.

SELECT kunnr adrnr

FROM kna1

INTO TABLE gt_kna1

UP TO 6 ROWS.

IF sy-subrc = 0.

SELECT addrnumber name1 city1 post_code1

FROM adrc

INTO TABLE gt_adrc

FOR ALL ENTRIES IN gt_kna1

WHERE addrnumber = gt_kna1-adrnr.

ENDIF.

CLEAR gs_kna1.

LOOP AT gt_kna1 INTO gs_kna1.

CLEAR gs_adrc.

READ TABLE gt_adrc INTO gs_adrc WITH KEY addrnumber = gs_kna1-adrnr.

IF sy-subrc = 0.

CLEAR gs_final.

gs_final-kunnr = gs_kna1-kunnr.

gs_final-adrnr = gs_kna1-adrnr.

gs_final-name1 = gs_adrc-name1.

gs_final-city1 = gs_adrc-city1.

gs_final-post_code1 = gs_adrc-post_code1.

APPEND gs_final TO gt_final.

ENDIF.

ENDLOOP.

CALL FUNCTION 'OPEN_FORM'

EXPORTING

form = 'ZTEST_G'

language = sy-langu

device = 'PRINTER'

dialog = 'X'

EXCEPTIONS

canceled = 1

device = 2

form = 3

options = 4

unclosed = 5

mail_options = 6

archive_error = 7

invalid_fax_number = 8

more_params_needed_in_batch = 9

spool_error = 10

codepage = 11

OTHERS = 12.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

CALL FUNCTION 'START_FORM'

EXPORTING

form = 'ZTEST_G'

startpage = 'PAGE_01'

program = sy-repid

EXCEPTIONS

form = 1

format = 2

unended = 3

unopened = 4

unused = 5

spool_error = 6

codepage = 7

OTHERS = 8.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

LOOP AT gt_final INTO gs_final.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

element = 'ITEMS'

function = 'SET'

type = 'BODY'

window = 'MAIN'

EXCEPTIONS

element = 1

function = 2

type = 3

unopened = 4

unstarted = 5

window = 6

bad_pageformat_for_print = 7

spool_error = 8

codepage = 9

OTHERS = 10.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

ENDLOOP.

CALL FUNCTION 'END_FORM'.

CALL FUNCTION 'CLOSE_FORM'.

2. Design a script to display the customer details as labels.

Windows:

Pages:

Page Windows:

Paragraph Format:

Layout:

Window Header Editor:

Output:

Main window Editor:

Labels in Smartforms:

- Created a Smart form with only one page;

- Arranged the page in 24 rectangles by a Template: every cell in the template would be a label.

- Transfer the data to the Smart forms by internal table so Create a LOOP node and Decide in

which cell (label) of the template a record had to be written.

LOOP T_LABELS.

IF SY-TABIX = 1.

-


> CELL 1,1

ENDIF.

IF SY-TABIX = 2.

-


> CELL 1,2

ENDIF.

IF SY-TABIX = 3.

-


> CELL 1,2

ENDIF.

IF SY-TABIX = 4.

-


> CELL 2,1

ENDIF.

IF SY-TABIX = 5.

-


> CELL 2,2

ENDIF.

To create labels in SAPSCRIPT, you will have to define multiple MAIN WINDOWS in the Page Window.. try the following steps..

Main windows in page windows allow you to format text in multiple columns. Define an area in the page window, in which to position the main windows.

1. Create a page window and assign it to a page.

2. Choose Edit --> Main windows.

A dialog box appears.

3. Enter values in the fields Area width and Area height in accordance with the input guidelines for main windows.

4. Enter values in the fields Spacing and Number in the Horizontal group if you want to use multiple columns. You can ignore the fields in the Vertical group.

5. Determine how many columns and line areas are required for label printing. Then enter the corresponding values in the fields in the Horizontal and Vertical groups.

Supose if u want to print address of a student in a script.. like student no,name addres..etc ok.

this small req need only a small area in a page, suppose client dont want to wastethe remaning page in that case u will arange the small windows with the same format in entire page.may be u can insert upto 99 main windows.

Windows per page are limited in SF, in script ur wish.

u can do the same thing in SF also by useing template.

Most of the products shipped from a company's warehouse will have big stickers in the cartons. These stickers hold the information such as product number, serial number and shipping address and many more information. These are used to easily identify what is packed inside that carton. So for these kind of usage we need to use Thermal printers to generate the labels or stickers. Thermal printing is not possible using a normal printer. You need special printers for thermal printers.

believe, need a ABAPer... to work with SAPScripts. If someone has knowledge in ABAP can handle it well.

1. SE73.... create ZBARCODE

2. SMARTSTYLES : create character format, paragraph format under ZSTYLE. and assign the character format to ZBARCODE.

3.SMARTFORMS: In Output options TAB ... STYLE : ZSTYLE --> SAVE

in General attributes... Give the paragraph format given in ZSTYLE .

I hope u can see the Character formats by drop down in character format field.

4. in SAPSCRIPTS (SE71): go to character format page and give the barcode name and enable the check box.

and give in command prompt script editor..

PR < LI > &ITAB_MATNR& < / >

where PR is paragraph format and LI is character format

pls remove the spaces between < LI > and < / >

Reward points if find useful..........

Regards,

Minal