cancel
Showing results for 
Search instead for 
Did you mean: 

UCC-128 SSCC Check Digit Calculation- SAP FM

former_member193460
Contributor
0 Kudos

Hi,

Is there any standard function module in SAP EWM system to calculate check digit for SSCC (EAN 128). i am aware of the logic behind the calculation but why to re-invent the wheel if it exist already.

The logic to calculate:

(00)00872150999000002


Disregard the application identifier:
(00)
The UCC SSCC barcode uses a function code 1. Therefore, 1 is the first digit in the string to evaluate.
Therefore, the string to evaluate is:
100872150999000002

  1. Starting from position 2 of the number, add up the values in even numbered positions.
    0 + 8 + 2 + 5 + 9 + 9 + 0 + 0 + 2 = 35
  2. Multiply the result of step 1 by 3.
    35 x 3 = 105
  3. Starting from position 3 of the number, add up the values of the digits in odd-numbered positions:
    0 + 7 + 1 + 0 + 9 + 0 + 0 + 0 = 17
  4. Add up the results of steps 2 and 3.
    105 + 17 = 122
  5. The check character is the smallest number that when added to the result obtained in Step 4 gives a number that is a multiple of 10.
    122 + x = 130 (multiple of 10)

    Eight is the number that when added to 122 results in a multiple of 10. Therefore, the check character is 8.

Let me know if anyone is aware of standard FM to do the task for me

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member193460
Contributor
0 Kudos

i wrote an FM for this as i couldnot find any standard FMs.

DATA: length TYPE i.

   DATA: lv_temp       TYPE n,

         lv_sum_first  TYPE int4,

         lv_sum_second TYPE int4,

         lv_final_res  TYPE int4.

   DATA: work_string(50) TYPE c.

   DATA: lv_first  TYPE int4 VALUE 1,

         lv_second TYPE int4 VALUE 2.

   work_string = iv_number.

   length = strlen( work_string ).

   SHIFT work_string LEFT DELETING LEADING space.

   DO length TIMES.

     WRITE work_string+lv_first(1) TO lv_temp.

     lv_sum_first = lv_sum_first + lv_temp.

     WRITE work_string+lv_second(1) TO lv_temp.

     lv_sum_second = lv_sum_second + lv_temp.

     lv_first = lv_first + 2.

     lv_second = lv_second + 2.

   ENDDO.

   lv_final_res = ( lv_sum_first * 3 ) + lv_sum_second.

*Logic to calculate the smallest number to add the the final result

*which is a multiple of 10

   lv_final_res = 10 - ( lv_final_res MOD 10 ).