1. need to create barcode label using t-code se73 . click on system barcode and create new barcode label which will be use on smartsyles to print barcode.
2. use below parameter for creating barcode label--
supported Bar code symboligies = code 128
barcode alignment = normal
put lenght and weight
code128 mode = N
""" code for SAMRTFORMS""""""
1. in smartforms ->
need to copy below routines in the SAMRTFORMS -> FORM ROUTINES
*&---------------------------------------------------------------------*
*& Form STREAMLINE_BARCODE
*&---------------------------------------------------------------------*
* Convert the barcode string that is passed in, into a barcode that uses
* the best subsets (B or C) to make the smallest possible barcode. Subset
* C provides the most compact barcode, but will only handle numeric digits,
* subset B will handle Alpha Characters as well.
*----------------------------------------------------------------------*
form streamline_barcode using pa_add_fnc1_to_start type c
changing pa_barcode_str.
*----------------------------------------------------------------------*
* CONSTANTS used by the CODE128 Barcodes in SMARTFORMS
*----------------------------------------------------------------------*
constants:
c_start_code_a(2) type c value '>9',
c_start_code_b(2) type c value '>:',
c_start_code_c(2) type c value '>;',
c_fnc1(2) type c value '>8',
c_switch_a_to_b(2) type c value '>6',
c_switch_a_to_c(2) type c value '>5',
c_switch_b_to_a(2) type c value '>7',
c_switch_b_to_c(2) type c value '>5',
c_switch_c_to_a(2) type c value '>7',
c_switch_c_to_b(2) type c value '>6'.
* declare local variables
data:
input_str(80) type c,
output_str(80) type c,
mode type c,
ofs type i,
len type i,
restlen type i,
c2(2) type c,
c4(4) type c,
2digits type c,
4digits type c.
* store the barcode string in a local variable for processing
move pa_barcode_str to input_str.
************************
* determine the starting mode
************************
* work out the length of the string
len = strlen( input_str ).
* initialise the offset to zero
ofs = 0.
* initialise the remaining length of the string
restlen = len - ofs.
* default the mode to B
mode = 'B'.
* if the remaining length of the string is at least 4 characters then ...
if restlen ge 4.
* default the 4 Digits flag to false
clear 4digits.
* if the first 4 characters are all numeric digits then ...
if input_str(4) co '1234567890'.
* set the 4 digits flag to true
4digits = 'X'.
endif.
* if the 4 digits flag is set then ...
if 4digits = 'X'.
* default the starting mode to C
mode = 'C'.
else.
* default the starting mode to B
mode = 'B'.
endif.
endif.
* depending on the starting mode
case mode.
* subset C
when 'C'.
* add the starting mode to the output string
output_str = c_start_code_c.
* subset B
when 'B'.
* add the starting mode to the output string
output_str = c_start_code_b.
endcase.
* if the flag is set to add an FNC1 character onto the start of the barcode then ...
if pa_add_fnc1_to_start eq 'X'.
* add an FNC1 character after the mode selection string
concatenate output_str
c_fnc1
into output_str.
endif.
************************
* process the string
************************
* while the character offset is less than the length of the string ...
while ofs < len.
* work out the remaining length of the string
restlen = len - ofs.
* if there is at least two characters remaining in the string
if restlen ge 2.
* grab the next two characters
c2 = input_str+ofs(2).
* if these are a BARCODE control string (Starts with a >) then ...
if c2(1) = '>'.
* copy the string into the output string
concatenate output_str
c2
into output_str.
* increment the offset by two characters
add 2 to ofs.
endif.
endif.
* work out the remaining length of the string
restlen = len - ofs.
* depending on the mode we are currently operating in
case mode.
* subset C
when 'C'.
* default the 2 Digits flag to false
clear 2digits.
* if there is at least 2 characters remaining in the string ...
if restlen ge 2.
* grab the next 2 characters from the string
c2 = input_str+ofs(2).
* if the 2 characters are all numeric digits then ...
if c2 co '1234567890'.
* set the 2 digits flag to true
2digits = 'X'.
endif.
endif.
* if the 2 digits flag is set then ...
if 2digits = 'X'.
* add the two digits into the output string
concatenate output_str
c2
into output_str.
* increment the offset by 2
add 2 to ofs.
else.
* switch the mode to subset B
concatenate output_str
c_switch_c_to_b
into output_str.
mode = 'B'.
endif.
* subset B
when 'B'.
* default the 4 Digits flag to false
clear 4digits.
* if there is at least 4 characters remaining in the string ...
if restlen ge 4.
* grab the next 4 characters from the string
c4 = input_str+ofs(4).
* if the 4 characters are all numeric digits then ...
if c4 co '1234567890'.
* set the 4 digits flag to true
4digits = 'X'.
endif.
endif.
* if the 4 digits flag is set then ...
if 4digits = 'X'.
* switch the mode back to subset C and add the
* data into the string
concatenate output_str
c_switch_b_to_c
c4
into output_str.
mode = 'C'.
* increment the offset by 4
add 4 to ofs.
else.
* if the next character is a BARCODE control string (Starts with a >) and
* it is not the last character in the string then ...
if input_str+ofs(1) = '>' and
restlen >= 2.
* do nothing
else.
* add the character into the output string
concatenate output_str
input_str+ofs(1)
into output_str.
* increment the offset by one
add 1 to ofs.
endif.
endif.
endcase.
endwhile.
* update the barcode string
move output_str to pa_barcode_str.
endform. " STREAMLINE_BARCODE
2. use below parameter for creating barcode label--
supported Bar code symboligies = code 128
barcode alignment = normal
put lenght and weight
code128 mode = N
""" code for SAMRTFORMS""""""
1. in smartforms ->
need to copy below routines in the SAMRTFORMS -> FORM ROUTINES
*&---------------------------------------------------------------------*
*& Form STREAMLINE_BARCODE
*&---------------------------------------------------------------------*
* Convert the barcode string that is passed in, into a barcode that uses
* the best subsets (B or C) to make the smallest possible barcode. Subset
* C provides the most compact barcode, but will only handle numeric digits,
* subset B will handle Alpha Characters as well.
*----------------------------------------------------------------------*
form streamline_barcode using pa_add_fnc1_to_start type c
changing pa_barcode_str.
*----------------------------------------------------------------------*
* CONSTANTS used by the CODE128 Barcodes in SMARTFORMS
*----------------------------------------------------------------------*
constants:
c_start_code_a(2) type c value '>9',
c_start_code_b(2) type c value '>:',
c_start_code_c(2) type c value '>;',
c_fnc1(2) type c value '>8',
c_switch_a_to_b(2) type c value '>6',
c_switch_a_to_c(2) type c value '>5',
c_switch_b_to_a(2) type c value '>7',
c_switch_b_to_c(2) type c value '>5',
c_switch_c_to_a(2) type c value '>7',
c_switch_c_to_b(2) type c value '>6'.
* declare local variables
data:
input_str(80) type c,
output_str(80) type c,
mode type c,
ofs type i,
len type i,
restlen type i,
c2(2) type c,
c4(4) type c,
2digits type c,
4digits type c.
* store the barcode string in a local variable for processing
move pa_barcode_str to input_str.
************************
* determine the starting mode
************************
* work out the length of the string
len = strlen( input_str ).
* initialise the offset to zero
ofs = 0.
* initialise the remaining length of the string
restlen = len - ofs.
* default the mode to B
mode = 'B'.
* if the remaining length of the string is at least 4 characters then ...
if restlen ge 4.
* default the 4 Digits flag to false
clear 4digits.
* if the first 4 characters are all numeric digits then ...
if input_str(4) co '1234567890'.
* set the 4 digits flag to true
4digits = 'X'.
endif.
* if the 4 digits flag is set then ...
if 4digits = 'X'.
* default the starting mode to C
mode = 'C'.
else.
* default the starting mode to B
mode = 'B'.
endif.
endif.
* depending on the starting mode
case mode.
* subset C
when 'C'.
* add the starting mode to the output string
output_str = c_start_code_c.
* subset B
when 'B'.
* add the starting mode to the output string
output_str = c_start_code_b.
endcase.
* if the flag is set to add an FNC1 character onto the start of the barcode then ...
if pa_add_fnc1_to_start eq 'X'.
* add an FNC1 character after the mode selection string
concatenate output_str
c_fnc1
into output_str.
endif.
************************
* process the string
************************
* while the character offset is less than the length of the string ...
while ofs < len.
* work out the remaining length of the string
restlen = len - ofs.
* if there is at least two characters remaining in the string
if restlen ge 2.
* grab the next two characters
c2 = input_str+ofs(2).
* if these are a BARCODE control string (Starts with a >) then ...
if c2(1) = '>'.
* copy the string into the output string
concatenate output_str
c2
into output_str.
* increment the offset by two characters
add 2 to ofs.
endif.
endif.
* work out the remaining length of the string
restlen = len - ofs.
* depending on the mode we are currently operating in
case mode.
* subset C
when 'C'.
* default the 2 Digits flag to false
clear 2digits.
* if there is at least 2 characters remaining in the string ...
if restlen ge 2.
* grab the next 2 characters from the string
c2 = input_str+ofs(2).
* if the 2 characters are all numeric digits then ...
if c2 co '1234567890'.
* set the 2 digits flag to true
2digits = 'X'.
endif.
endif.
* if the 2 digits flag is set then ...
if 2digits = 'X'.
* add the two digits into the output string
concatenate output_str
c2
into output_str.
* increment the offset by 2
add 2 to ofs.
else.
* switch the mode to subset B
concatenate output_str
c_switch_c_to_b
into output_str.
mode = 'B'.
endif.
* subset B
when 'B'.
* default the 4 Digits flag to false
clear 4digits.
* if there is at least 4 characters remaining in the string ...
if restlen ge 4.
* grab the next 4 characters from the string
c4 = input_str+ofs(4).
* if the 4 characters are all numeric digits then ...
if c4 co '1234567890'.
* set the 4 digits flag to true
4digits = 'X'.
endif.
endif.
* if the 4 digits flag is set then ...
if 4digits = 'X'.
* switch the mode back to subset C and add the
* data into the string
concatenate output_str
c_switch_b_to_c
c4
into output_str.
mode = 'C'.
* increment the offset by 4
add 4 to ofs.
else.
* if the next character is a BARCODE control string (Starts with a >) and
* it is not the last character in the string then ...
if input_str+ofs(1) = '>' and
restlen >= 2.
* do nothing
else.
* add the character into the output string
concatenate output_str
input_str+ofs(1)
into output_str.
* increment the offset by one
add 1 to ofs.
endif.
endif.
endcase.
endwhile.
* update the barcode string
move output_str to pa_barcode_str.
endform. " STREAMLINE_BARCODE
Serkan AKKAVAK
Computer Engineer BSc
SAP Department Deputy Manager
Contact : serkurumsal@yandex.com
0 Comments