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: 

Negative values from internal table are not properly saved to Excel

Former Member
0 Kudos

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

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Convert data type to character for condition value before passing to FM.

9 REPLIES 9

Former Member
0 Kudos

Convert data type to character for condition value before passing to FM.

0 Kudos

Hi Elzkie,

Do you know which function module which I could use ?

Thanks,

Danny

0 Kudos

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.

0 Kudos

Have a look at below FM for amount to sting conversion,

HRCM_AMOUNT_TO_STRING_CONVERT

Hope this helps.

0 Kudos

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

pranay570708
Active Contributor
0 Kudos

Hi,

Try FM 'EXCEL_OLE_STANDARD_DAT'.

Former Member
0 Kudos

Hi All,

Thank you for your all suggestions.  I have resolved the issue.

Regards,

Danny

matt
Active Contributor
0 Kudos

And how did you solve it? This is a community - it's about giving as well as taking.

0 Kudos

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