Registration

Dear SAP Community Member,
In order to fully benefit from what the SAP Community has to offer, please register at:
http://scn.sap.com
Thank you,
The SAP Community team.
Skip to end of metadata
Go to start of metadata

 

Author: Girish Kumar Loganathan
Submitted: June 11, 2007

Error rendering macro 'code': Invalid value specified for parameter 'lang'
*Move minus sign from end to begining of number value
*i.e. from 100.00- to -100.00

* check if negative amount
IF p_amount LT 0.
   SHIFT p_amount RIGHT DELETING TRAILING '-'.
   SHIFT p_amount LEFT DELETING LEADING ' '.
   CONCATENATE '-' p_amount INTO p_amount.
ELSE.
  SHIFT p_amount LEFT DELETING LEADING ' '.
ENDIF.
Error rendering macro 'code': Invalid value specified for parameter 'lang'
*Same thing can be achieved by using the FM CLOI_PUT_SIGN_IN_FRONT.
*Ex:
REPORT  z_demo_jg1.

PARAMETERS p_amount(10) TYPE c OBLIGATORY DEFAULT '100.15-'.

WRITE:/ 'BEFORE:', p_amount.

CALL FUNCTION 'CLOI_PUT_SIGN_IN_FRONT'
  CHANGING
    value = p_amount.

WRITE:/ 'AFTER:', p_amount.

Author: Alexey Tveritinov

Error rendering macro 'code': Invalid value specified for parameter 'lang'
data: p_value(10) type c  value '100.15-'.

replace all OCCURRENCES OF regex '(^[^\-]*)([\-])' in p_value with '$2$1'.

WRITE:/ 'AFTER regex:', p_value.
Error rendering macro 'code': Invalid value specified for parameter 'lang'
* For values stored in string variables it`s simplier to use circular shift
DATA: tmp_str type string value '100.15-'.

WRITE:/ 'BEFORE:', tmp_str.
* check if negative amount
IF tmp_str LT 0.
   SHIFT tmp_str RIGHT CIRCULAR .
ENDIF.
WRITE:/ 'AFTER:', tmp_str.