on 09-14-2009 6:39 PM
Hello:
I have a problem with printing a label, the output label is empty.
I created it in BarOne, copy the code to a sapscript then I made a printing programm, here the code of the print program, the print form is the one have the main code, then the subroutines.
The sapscript is active an with the lines that BarOne generated.
Please any comment is very helpfull because I don't find the reason for the label is empty.
FORM itab_user_command
USING whatcomm TYPE sy-ucomm whatrow TYPE slis_selfield.
IF whatcomm = 'PRTLBL'.
PERFORM print.
ENDIF.
ENDFORM. "ITAB_user_command
*---------------------------------------------------------------------*
* FORM Print *
*---------------------------------------------------------------------*
FORM print.
DATA: bc_anln1(12) TYPE c.
DATA: msg(100) TYPE c.
CLEAR bc_anln1.
NEW-PAGE PRINT ON
NO DIALOG
PARAMETERS pripar.
msg = 'Labels printed / Etiquetas impresas'.
LOOP AT it_out.
IF it_out-flag = 'X'.
bc_anln1 = it_out-anln1.
PERFORM open_form.
PERFORM start_form.
PERFORM print_label.
PERFORM end_form.
MESSAGE msg TYPE 'I'.
ENDIF.
ENDLOOP.
PERFORM CLOSE_FORM.
NEW-PAGE PRINT OFF.
ENDFORM. "Print
*-------------------------------------------------
* FORM PRINT_LABEL
*-------------------------------------------------
FORM print_label.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'ETIKETT'.
IF sy-subrc NE 0.
text_zeile = text-002.
REPLACE '$' WITH '''write_form''' INTO text_zeile.
MESSAGE i181(ds) WITH text_zeile.
ELSE.
PERFORM save_printdate.
ENDIF.
ENDFORM. "print_label
*---------------------------------------------------------------------*
* FORM open_form *
*---------------------------------------------------------------------*
FORM open_form.
itcpo-tddest = tsp03l-lname.
itcpo-tdimmed = 'X'.
itcpo-tddelete = 'X'.
CALL FUNCTION 'OPEN_FORM'
EXPORTING
form = 'ZFISSM_ASSETS'
device = 'PRINTER'
dialog = 'X'
OPTIONS = itcpo
EXCEPTIONS
OTHERS = 1.
IF sy-subrc NE 0.
text_zeile = text-002.
REPLACE '$' WITH '''open_form''' INTO text_zeile.
MESSAGE i181(ds) WITH text_zeile.
ENDIF.
ENDFORM. "open_form
*---------------------------------------------------------------------*
* FORM start_form *
*---------------------------------------------------------------------*
FORM start_form.
CALL FUNCTION 'START_FORM'
EXPORTING
startpage = 'PAGE1'
EXCEPTIONS
OTHERS = 1.
IF sy-subrc NE 0.
text_zeile = text-009.
REPLACE '$' WITH '''start_form''' INTO text_zeile.
MESSAGE i181(ds) WITH text_zeile.
ENDIF.
ENDFORM. "start_form
*---------------------------------------------------------------------*
* FORM end_form *
*---------------------------------------------------------------------*
FORM end_form.
CALL FUNCTION 'END_FORM'
EXCEPTIONS
unopened = 1
bad_pageformat_for_print = 2
OTHERS = 3.
IF sy-subrc NE 0.
text_zeile = text-009.
REPLACE '$' WITH '''end_form''' INTO text_zeile.
MESSAGE i181(ds) WITH text_zeile.
ENDIF.
ENDFORM. "end_form
*&---------------------------------------------------------------------*
*& Form SAVE_PRINTDATE
*&---------------------------------------------------------------------*
FORM save_printdate .
UPDATE anlv
SET vrsbg = sy-datum
WHERE bukrs = it_out-bukrs
AND anln1 = it_out-anln1
AND anln2 = it_out-anln2.
ENDFORM. " SAVE_PRINTDATE
*&---------------------------------------------------------------------*
*& Form CLOSE_FORM
*&---------------------------------------------------------------------*
form CLOSE_FORM .
CALL FUNCTION 'CLOSE_FORM'
EXCEPTIONS
unopened = 1
bad_pageformat_for_print = 2
OTHERS = 3.
IF sy-subrc NE 0.
text_zeile = text-009.
REPLACE '$' WITH '''close_form''' INTO text_zeile.
MESSAGE i181(ds) WITH text_zeile.
ENDIF.
ENDFORM. "close_form
I forgot, the printer is a zebra. And sorry for the mess but the marks didn't worked.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.