Hello Experts,
I created a very simple ALV grid having a column MSEG-MENGE (defined as type mseg-menge in itab). I created manual fieldcatalog and don't pass any other field in the fcatalog table for this field other than COLTEXT. Some menge values in itab are negative.
When used REUSE_ALV_GRID_DISPLAY :
In output ALV grid, signs and values are displayed correctly. If I download in a file using Export>Local File>Unconverted, the signs and values in the file are correct.
When used cl_salv_table=>factory (nothing done for columns explicitly):
In output ALV grid, signs and values are displayed correctly. If I download in a file using Export>Local File>Unconverted, the negative signs are NOT COMING with the values, all the values are positive. Why ??
Hope my problem is clear. I guess it is something to do with the data type of this field but how different behaviour using 2 separate functions.
Regards,
Diwakar
Edited by: Diwakar Aggarwal on Nov 1, 2011 5:58 PM
Hello Diwakar,
Are you using the SET_SIGN method as below to set your column to allow negatives within the fieldcatalog?
TRY. lo_column ?= lo_columns->get_column( columnname = 'MENGE' ). lo_column->set_sign( abap_true ). CATCH cx_salv_not_found. ENDTRY.
Also, when you download the file using Export
>Local File
>Unconverted, make sure to use the default format which is .txt
Hope this helps.
Cheers,
Sougata.
Also, another method lo_column->set_quantity_column might be required for your column to set it as qty column.
Edited by: Sougata Chatterjee on Nov 2, 2011 6:43 AM
Did you notice that MSEG has field SHKZG, the positive/negative indicator? This would indicate to me that MSEG currency values would always be shown as positive and that to get the "correct" value, I'd have to multiply the value by '-1' when the SHKZG indicator is 'H'. Check to see if that is the cause of your positive numbers only.
Dear Diwakar,
After experiencing this behavior first hand, I have made a post to raise this again for discussion and review and referenced your discussion here. If you have any further insight into the matter, please feel free to check out the post and comment.
CL_SALV_TABLE->FACTORY method, no negative symbols on ALV export.
Kind Regards,
James
Add a comment