2006 Mar 29 9:29 AM
Hi!
I'm using ALVGRDI and I have to siplay negative value.
My problem is that the negative sign '-' is alligned to the right:
then number -1923,7 is diplayed as | 1923,7 - |.
I wouldn't convert the number in string...
How can I solve?
2006 Mar 29 9:34 AM
2006 Mar 29 9:37 AM
Salvatore,
In the field catalog, there is a field NO_SIGN. Make sure that is NOT checked for the specific column that you are looking for.
Regards,
Ravi
Note : Please mark the helpful answers.
2006 Mar 29 9:39 AM
Hi salvatore,
1. Simple ! we have to use edit mask
2. in field catalogue,
there is one field EDIT_MASK.
3. make that '-______'.
(for that particular numeric field in question)
4. to get a taste of it, just copy paste in new program
REPORT abc.
data : m type i,
n type i.
m = -20.
n = -20.
write 😕 m.
write 😕 n using edit mask '-______'.
5.**************************
ANOTHER PROGRAM WITH ALV NEGATIVE VALUE
EG. -342
JUST COPY PASTE.
REPORT abc.
TYPE-POOLS : slis.
*----
Data
DATA : BEGIN OF itab OCCURS 0,
abc TYPE i.
INCLUDE STRUCTURE t001.
DATA : END OF itab.
DATA : alvfc TYPE slis_t_fieldcat_alv.
DATA : alvwa TYPE slis_fieldcat_alv.
*----
Select
SELECT * FROM t001 INTO CORRESPONDING FIELDS OF TABLE itab.
LOOP AT itab.
itab-abc = -342.
MODIFY itab.
ENDLOOP.
*------- Field Catalogue
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = sy-repid
i_internal_tabname = 'ITAB'
i_inclname = sy-repid
CHANGING
ct_fieldcat = alvfc
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
*----
IMPORTANT
<b>LOOP AT alvfc INTO alvwa.
IF alvwa-fieldname = 'ABC'.
alvwa-edit_mask = '-___'.
MODIFY alvfc FROM alvwa.
ENDIF.
ENDLOOP.</b>
*----
Display
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
it_fieldcat = alvfc
TABLES
t_outtab = itab
EXCEPTIONS
program_error = 1
OTHERS = 2.
regards,
amit m.
Message was edited by: Amit Mittal
2006 Mar 29 3:00 PM
Just a problem...
usign mask -_______ for curreny and quantity the number loose the comma: 1923,25 - Became -192325
and positive value are displyed as negative!
Whre I can found info to know how built a correct mask?
Message was edited by: Salvatore Volpe
2006 Mar 29 3:17 PM
Hi
I don't think it's easy because if you use the option EDIT MASK you have to indicate all characteristics of your format so if you have -1923,25
- for the sign
____ (length 4 char) for integers
__ (length 2 char) for decimal part
'-____,__'
Anyway use symbol V instead of -
'V____,__'
Max
2006 Mar 29 9:45 AM
Hi Volpe,
if you want that to be before then you will loose certain functionalities like totals and subtotals.
if you want the sign to be front then you need to make it char and use FM or some logic then you will get it.
but totals can't be done with that .
Regards
Vijay