01-15-2017 7:25 PM
Hi Experts,
I have a requirement to display '-' sign in left side of field value in ALV output, But the field refers to data type is Packed decimal. Earlier blogs are telling use data type char then it will work in this case we cannot use filter option for that column in ALV output, Any leads how to do this with refer to data type as a packed decimal.
Thanks,
01-15-2017 7:30 PM
Sorry there is a typo error, instead of filter we cannot apply summarize option for that column in ALV output.
01-15-2017 7:36 PM
See the following recent questions :
Use FM "CLOI_PUT_SIGN_IN_FRONT" to reposition the negative sign ...
01-16-2017 5:06 AM
Hi Ramesh,
Try this:
*******************************
data : lv_var1 type p VALUE '10-'.
data : lv_var2 type char5 .
lv_var2 = lv_var1.
CALL FUNCTION 'CLOI_PUT_SIGN_IN_FRONT'
CHANGING
value = lv_var2
.
WRITE : lv_var2.
*******************************
Regards
Ajeet Kumar
01-16-2017 5:36 AM
Hi Ajeet,
Thanks for replying my post but what you are suggesting already i tried . That is not my requirement.
my requirement is need to put '-' sign symbol in left side of field value and that field is referring to data type P.
Thanks.
,Hi Nic,
I saw your link's which was you sent, but there they are using char field for sign symbol, which i already mentioned in my post. Do you have any idea how to display '-' sign symbol in packed decimal field.
Thanks,
01-16-2017 7:17 AM
Did you try to add an EDIT_MASK in the field catalog? (Look for character "V" in USING EDIT MASK mask)
Regards,
Raymond
01-16-2017 10:31 AM
1) Create FM CONVERSION_EXIT_ZZZZZ_OUTPUT where you will call FM CLOI_PUT_SIGN_IN_FRONT to move sign to the left
2) Add edit mask for your column in ALV as ==ZZZZZ
01-16-2017 11:48 AM
Hello,
There's a string template formatting option which lets you position the SIGN. You don't need to use FM CLOI_PUT_SIGN_IN_FRONT.
BR,
Suhas
02-24-2020 8:03 AM
Hi all,
I've solved it by creating the new data Domain ZAMT and specific the ZSIGN "Conversion Routine".
Here are INPUT and OUTPUT functions.
1. INPUT format.
FUNCTION CONVERSION_EXIT_ZSIGN_INPUT.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" REFERENCE(INPUT)
*" EXPORTING
*" REFERENCE(OUTPUT)
*"----------------------------------------------------------------------
DATA:lv_str TYPE text30.
lv_str = input.
CONDENSE lv_str NO-GAPS.
IF strlen( lv_str ) > 1.
IF lv_str+0(1) = '-'.
SHIFT lv_str LEFT DELETING LEADING '-'.
CONCATENATE lv_str '-' INTO lv_str.
ENDIF.
ENDIF.
output = lv_str.
ENDFUNCTION.
2.OUTPUT format.
FUNCTION conversion_exit_zsign_output.
*"--------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" REFERENCE(INPUT)
*" EXPORTING
*" REFERENCE(OUTPUT)
*"--------------------------------------------------------------------
DATA:lv_str TYPE text30,
lv_len TYPE i.
lv_str = input.
WRITE input TO lv_str CURRENCY 'THB'."Assume only THB is supported
CONDENSE lv_str NO-GAPS.
lv_len = strlen( lv_str ).
lv_len = lv_len - 1. "back 1 position
IF lv_len > 1.
IF lv_str+lv_len(1) = '-'.
lv_str+lv_len(1) = space.
CONDENSE lv_str NO-GAPS.
CONCATENATE '-' lv_str INTO lv_str.
ENDIF.
ENDIF.
WRITE lv_str TO output RIGHT-JUSTIFIED.
ENDFUNCTION.