sitemap
SapMaterial.com
Program to calculate modified mod 10 check digit

This tip has been copied from SearchSap.com
Tip submitted by: J. BALACHANDRAN

This program is stand-alone and can be incorporated in any program when you need to calculate modified mod
10 check digit as per UPS label requirements.

Code


REPORT Z_mod_check_digit.

*This program will calculate the modified mod 10 check digit as per
*UPS label requirements.
PARAMETERS: S_NUMBER(17)  TYPE C DEFAULT '1Z123X56031234820'.

DATA: WUPS_STR(15) TYPE C,
SUM_ODD      TYPE I,
SUM_EVEN     TYPE I,
SUM_TOTAL    TYPE I,
STEP         TYPE I,
W_CHAR(1)    TYPE C,
W_VAL(1)     TYPE C,

W_TEMP(1)    TYPE C,
MODX(2)      TYPE C,
MOD10(1)     TYPE C.
CLEAR: SUM_ODD, SUM_EVEN, SUM_TOTAL.
WUPS_STR = S_NUMBER+2(15).
STEP = 0.
WHILE STEP < 15.
W_CHAR = WUPS_STR+STEP(1).
PERFORM GET_VALUE USING W_CHAR W_VAL.
W_TEMP = STEP MOD 2.
IF ( W_TEMP = 0 ).
SUM_ODD = SUM_ODD + W_VAL.
ELSE.
SUM_EVEN = SUM_EVEN + W_VAL.
ENDIF.
STEP = STEP + 1 .
ENDWHILE.
SUM_TOTAL = SUM_ODD + 2 * SUM_EVEN.
MODX = 10 - ( SUM_TOTAL MOD 10 ).

IF MODX = 10.
MOD10 = MODX+1(1).
ELSE.
MOD10 = MODX+0(1).
ENDIF.
SKIP 2.
WRITE:/20 'The check digit is:  ', MOD10.
SKIP 1.
*---------------------------------------------------------------------*
*       FORM GET_VALUE                                                *
*---------------------------------------------------------------------*
*      Convert alpha numeric to numeric as per UPS Barcode specs      *
*---------------------------------------------------------------------*
FORM GET_VALUE USING W_CHAR W_VAL.
CASE W_CHAR.
WHEN '0' OR 'I' OR 'S'.
W_VAL = 0.
WHEN '1' OR 'J' OR 'T'.
W_VAL = 1.
WHEN '2' OR 'A' OR 'K' OR 'U'.
W_VAL = 2.
WHEN '3' OR 'B' OR 'L' OR 'V'.

W_VAL = 3.
WHEN '4' OR 'C' OR 'M' OR 'W'.
W_VAL = 4.
WHEN '5' OR 'D' OR 'N' OR 'X'.
W_VAL = 5.
WHEN '6' OR 'E' OR 'O' OR 'Y'.
W_VAL = 6.
WHEN '7' OR 'F' OR 'P' OR 'Z'.
W_VAL = 7.
WHEN '8' OR 'G' OR 'Q'.
W_VAL = 8.
WHEN '9' OR 'H' OR 'R'.
W_VAL = 9.
WHEN OTHERS.
ENDCASE.
ENDFORM.                   " get_value
All of the  product names here are trademarks of their respective companies.  The site
www.allsaplinks.com no way affiliated with SAP AG. We have made every effort for the content
integrity.  Information used on this site is at your own risk.
ABAP TECHNICAL

SAP Introduction

sap abap faq

sap Tables

SAP Transaction codes

Internal tables

data dictionary

performance tuning

transports & Requests

Sap scripts

Smartforms

lsmw

reports

sap Workflow

module pool/ dialog
programming

table control

user exits

sap memory

abap memory

alv reports

ABAP ADVANCED

IDOC

ALE

BAPI

BADI

RFC


FUNCTIONAL SIDE

Materials Management

FICO

Human Resources

BIW / BW / SEM


Free Documentation
Abap Material

Ale Material

BAPI Material

BC Material

IDOC Material

R/3 Database Management

SAP material

RFC

Transport

Sales & Distribution Material

Basic Data and Function
Material

Basis (BC) Material

Billing Material

CA Material

CATT : Computer Aided Test
Tool

Capacity Evaluation and
leveling Material

Capacity Planning Material

Cross Application Material

Countries

Customer Service Material

Enterpise  Material

Financial / Controlling (FICO)

Internet Time Sheet

Inspection Material

HR Material

Material Management
Material

Payments Material

Payroll Material

Pension Fund

Production Planning and
Control

Plant Maintenance

Quality Management Material

Real Estate Material

SAP material

Wage Types