Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to shift Negative sign from Right to left in ALV if data type is P

former_member244346
Participant
0 Kudos

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,

8 REPLIES 8

former_member244346
Participant
0 Kudos

Sorry there is a typo error, instead of filter we cannot apply summarize option for that column in ALV output.

NTeunckens
Active Contributor
0 Kudos

See the following recent questions :


Use FM "CLOI_PUT_SIGN_IN_FRONT" to reposition the negative sign ...

ajeet_kumar1992
Explorer
0 Kudos

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

former_member244346
Participant
0 Kudos

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,

raymond_giuseppi
Active Contributor

Did you try to add an EDIT_MASK in the field catalog? (Look for character "V" in USING EDIT MASK mask)

Regards,
Raymond

former_member210008
Active Participant
0 Kudos

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

SuhaSaha
Advisor
Advisor
0 Kudos

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

Sayan_C
Explorer
0 Kudos

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.