- NUMC data type can be used to maintain positive numbers with leading Zeros
- Most of SAP's important numbers like Sales Order numbers, Customer numbers, Delivery documents,
- Material numbers, Sales Org, Division, Company Codes, Distribution Channel are CHARs only
- But if their Data is containing only digits, SAP Transactions will automatically add Leading zeros for them and store in the database as Raw data.
- If those SAP numbers contains at least one non-digit character, then leading zeros will not be added.
- Example: if 54 is assigned to BUKRS it will be stored in DB as 0054
if 5A is assigned to BUKRS it will be stored in DB as 5A only
- Leading zero concept is very useful for Date and Time calculations.
- Month, Day, hours etc., must be declared as NUMC for better calculations
Example:
PARAMETERS p_year TYPE I. "instead of Integer we can use type N LENGTH 4 also here
DATA v_month TYPE N LENGTH 2.
DATA v_day TYPE N LENGTH 2.
DATA v_year TYPE N LENGTH 4. then calculations will be easy
DATA FDATE TYPE D.
v_year = p_year.
v_day = 1. "1st day of Month
DO 12 TIMES.
v_month = sy-index. "Leading zero will be added automatically
CONCATENATE v_year v_month v_day INTO FDATE.
WRITE / FDATE. "Every month 1st day of selected year
ENDDO.
Example: Customer number contains uneven digits. It should be converted to a 10 digit number
with "C" as 1st Character. Logic will be
PARAMETERS custno TYPE I.
DATA v1 TYPE N LENGTH 10.
DATA str_custno TYPE C LENGTH 11.
v1 = custno. "customer number will be converted to 10 digit number
CONCATENATE 'C' V1 INTO str_custno.
please correct me, if I am wrong
Thanks and Regards
Nagababu Tubati