Skip to Content
0
Former Member
Jan 12, 2006 at 01:33 AM

Reading numbers/digits in Type C field

273 Views

Hi all, yesterday i opened a thread similar to this and also relating to the same type C field...have a look the following parts of my program:

TABLES: EBAN,                      "Purchase Requisition
        STXH.                      "STXD SAPscript text file header

DATA : BEGIN OF ITAB OCCURS 0,
       BANFN LIKE EBAN-BANFN,      "Purchase requisition number
       BADAT LIKE EBAN-BADAT,      "Requisition (request) date
       TXZ01 LIKE EBAN-TXZ01,      "Short text
       WAERS LIKE EBAN-WAERS,      "Currency Key
       BLCKT LIKE EBAN-BLCKT,      "Reason for Item Block
       SUBT TYPE I,                "Subtotal
       MENGE LIKE EBAN-MENGE,      "Purchase requisition quantity
       MEINS LIKE EBAN-MEINS,      "Purchase requisition unit of measure
       TOTAL TYPE I,               "Total amount
       WERKS LIKE EBAN-WERKS,      "Plant
       KNTTP LIKE EBAN-KNTTP,      "Account assignment category
       AFNAM LIKE EBAN-AFNAM,      "Name of requisitioner/requester
       END OF ITAB.

DATA: V_QUANTITY TYPE I.           "Hold ITAB-MENGE value
DATA: V_SUBTOTAL TYPE I.           "Hold ITAB-BLCKT value
DATA: V_TOTAL TYPE I.              "Hold ITAB-TOTAL value

SELECT BANFN BADAT TXZ01 WAERS BLCKT MENGE MEINS WERKS KNTTP AFNAM
  INTO CORRESPONDING FIELDS OF TABLE ITAB
  FROM EBAN
  WHERE BANFN = I_BANFN AND
        BSTYP = 'B' AND
        BLCKD <> ' '.

LOOP AT ITAB.

  V_QUANTITY = ITAB-MENGE.
  V_SUBTOTAL = ITAB-BLCKT.
  COMPUTE V_TOTAL = V_QUANTITY * V_SUBTOTAL.
  MOVE V_SUBTOTAL TO ITAB-SUBT.
  MOVE V_TOTAL TO ITAB-TOTAL.
  MODIFY ITAB.

ENDLOOP.

With the help i got yesterday, i managed to extract the numbers in that type c field (ITAB-BLCKT) in order to do my calculation...however, i would assume that would only work if the user keys in something like 10000...but what if some of the user might accidentally key in 10,000 (with the comma/"thousand" seperator) instead?