Mistři v programování na #hovnokod

Jiné #1648

ABAP - přiřazení decimal do char(12)

"data: CASTKA               Type      CHAR12,
"        ayeyblpo-blpbube. Type decimal(13,2)

CLEAR hlp_ca.     

  CLEAR: hlp_ca, hlp_c1, hlp_c2, hlp_c3, hlp_c4, hlp_c5.    "Častka

  hlp_ca = ayeyblpo-blpbube.
  hlp_c1 = hlp_ca+15(2).
  hlp_c2 = hlp_ca+11(3).
  hlp_c3 = hlp_ca+8(3).
  hlp_c4 = hlp_ca+5(3).
  hlp_c5 = hlp_ca+2(3).

  CLEAR hlp_ca.
  IF NOT hlp_c5 IS INITIAL.
    CONCATENATE hlp_c5 hlp_c4 hlp_c3 hlp_c2 INTO hlp_ca.
  ELSEIF NOT hlp_c4 IS INITIAL.
    CONCATENATE hlp_c4 hlp_c3 hlp_c2 INTO hlp_ca.
  ELSEIF NOT hlp_c3 IS INITIAL.
    CONCATENATE hlp_c3 hlp_c2 INTO hlp_ca.
  ELSE.
    hlp_ca = hlp_c2.
  ENDIF.
  CONDENSE hlp_ca NO-GAPS.
  MOVE hlp_ca TO zetvakus-castka.

Anonymous,