Application Development and Automation 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: 
Read only

Replace amount in OOPS ALV

Former Member
0 Likes
594

hi all,

i am using OOPS ALV to display the report. requirment is that i need to dispaly * when the value of the amount coloumn is 0.

i changed that coloumn to character and displayed as "*", but now i am not able to used the summing option given by ALV.

so is there a way to put "*" insted of 0 without changing the data type of the coloumn ?

4 REPLIES 4
Read only

kesavadas_thekkillath
Active Contributor
0 Likes
566

ALV Sum is not allowed for character fields.

Read only

Former Member
0 Likes
566

It is not possible. Only thing you could do is maybe change the 0 back to a numeric value and use the ALV filter on the column to exclude any items from the report with a 0 qty and save the layout.

Regards

L Maryniuk

Read only

Former Member
0 Likes
566

Hi Jayakumar,

If you will change 0 to * , sum operation will stop working in ALV.

  • is character and hence sum not allowed.

Edited by: Harsh Bhalla on Jan 19, 2010 10:36 PM

Read only

Former Member
0 Likes
566

What you can do is create a custom conversion exit for the quantity field...they ALV sum will work....I have used this technique with FM based ALV, it will definitely work OOALV.

1) Create 2 FM :CONVERSION_EXIT_ZZERO_INPUT & CONVERSION_EXIT_ZZERO_OUTPUT.

2) The input should have a code like this..


FUNCTION CONVERSION_EXIT_ZQUAN_OUTPUT.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"  IMPORTING
*"     REFERENCE(INPUT)
*"  EXPORTING
*"     REFERENCE(OUTPUT)
*"----------------------------------------------------------------------
if input = '*'.
 output =  '0.00'.
else.
output = input.
endif.

ENDFUNCTION.

and the output FM


FUNCTION CONVERSION_EXIT_ZQUAN_OUTPUT.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"  IMPORTING
*"     REFERENCE(INPUT)
*"  EXPORTING
*"     REFERENCE(OUTPUT)
*"----------------------------------------------------------------------
if input = '0.00' or input is initial.
 output =  '*'.
else.
output = input.
endif.
ENDFUNCTION.

3) Copy the Data Element/Domain for the quantity field data type to a custom one and attach the Conversion Exit ZQUAN to the domain and use the custom Data Element for the Quantity field in the ALV output table. The sub-total/summation and "*" output will both work