05-25-2016 5:24 AM
Hi ABAP Experts,
I wrote a report to extract condition value from billing documents. One of condition is discount so the value is negative when displaying in ALV.
I used the function SAP_CONVERT_TO_XLS_FORMAT to download the internal table to an excel file. However, the value and currency are not properly saved.
Would you please give me some advice ? How do I cleanse or format those data correctly before saving it to XLS ?
Thanks and regards,
Danny
05-25-2016 5:59 AM
Convert data type to character for condition value before passing to FM.
05-25-2016 5:59 AM
Convert data type to character for condition value before passing to FM.
05-25-2016 6:05 AM
Hi Elzkie,
Do you know which function module which I could use ?
Thanks,
Danny
05-25-2016 7:06 AM
You don't need any FM to do that. Just a simple move before passing the value into your internal table, instead of using currency type, move/convert it first to character type before appending to your output internal table.
05-25-2016 7:30 AM
Have a look at below FM for amount to sting conversion,
HRCM_AMOUNT_TO_STRING_CONVERT
Hope this helps.
05-27-2016 1:07 AM
Hi Elzkie,
Thank you for your hint. You are absolutely right. I have used TEXT type for those values in the internal table. Finally, they are properly saved in Excel.
Thanks and regards,
Danny
05-25-2016 7:00 AM
05-27-2016 1:08 AM
Hi All,
Thank you for your all suggestions. I have resolved the issue.
Regards,
Danny
05-28-2016 6:59 AM
And how did you solve it? This is a community - it's about giving as well as taking.
05-29-2016 2:35 PM
Hi Matthew,
I followed Elzkie's advice to solve the problem. I created a work area wa_xlsdata (see my screenshot above) which is similar to wa_alvdata (for output). The only difference is Condition Value and Currency columns I used TEXT. Then I used MOVE-CORRESPONDING wa_alvdata TO wa_xlsdata as Elzkie said ABAP will automatically convert data.
Regards,
Danny