Skip to Content
author's profile photo Former Member
Former Member

String _to_Solix =>Email send

Hi guys,

I am creating an excel file as attachment with the email,but the values(separators i,e ',and .') tend to change depending on client settings.

SO i need to convert the numbers in excel to string after the file is being created so that the value remains same on all systems.

In excel there is a functionality to add apostrophe'

and then the number converts to a string.

Can we achieve this via ABAP coding?

I tried to concatenate apostrophe' with my rates but it does not work as the value is not converted and the ' appears with the numbers in the excel file.

Example: 1.02125 is noted as '1.02125.

Attaching the code snippet for the above code:

* Variables Declarations

TYPES: BEGIN OF ty_me_mail,

rate_type TYPE kurst_curr,

from_curr TYPE fcurr_curr,

to_currncy TYPE tcurr_curr,

valid_from TYPE gdatu_cur,

exch_rate TYPE p LENGTH 16 DECIMALS 5,"string,

from_factor TYPE ffact_curr,

to_factor TYPE tfact_curr,

exch_rate_v TYPE p LENGTH 16 DECIMALS 5,"string,

from_factor_v TYPE ffact_curr,

to_factor_v TYPE tfact_curr,

END OF ty_me_mail.

DATA: gv_str1 TYPE char4,

gv_str2 TYPE string,

gv_str3 TYPE string,

gv_str4 TYPE string,

gv_str5 TYPE string,

gv_str6 TYPE string,

gv_str7 TYPE string,

gv_str8 TYPE string,

gv_me_mail TYPE string,

gt_me_mail TYPE STANDARD TABLE OF ty_me_mail.

IF NOT gt_me_mail IS INITIAL.

CONCATENATE 'Rate Type' gc_tab 'From-Currency' gc_tab 'To-Currency'

gc_tab 'Direct Exchage Rate' gc_tab 'Indirect Exchange Rate'

gc_tab 'Valid From' gc_tab 'From-Factor' gc_tab 'To-Factor' gc_crlf

INTO gv_me_mail.

LOOP AT gt_me_mail INTO gw_me_mail.

gv_str1 = gw_me_mail-rate_type.

gv_str2 = gw_me_mail-from_curr.

gv_str3 = gw_me_mail-to_currncy.

IF NOT gw_me_mail-exch_rate IS INITIAL.

gv_str4 = gw_me_mail-exch_rate.

ELSE.

gv_str8 = gw_me_mail-exch_rate_v.

ENDIF.

gv_str5 = gw_me_mail-valid_from.

IF NOT gw_me_mail-from_factor IS INITIAL.

gv_str6 = gw_me_mail-from_factor.

ELSE.

gv_str6 = gw_me_mail-from_factor_v.

ENDIF.

IF NOT gw_me_mail-to_factor IS INITIAL.

gv_str7 = gw_me_mail-to_factor.

ELSE.

gv_str7 = gw_me_mail-to_factor_v.

ENDIF.

CONCATENATE gv_me_mail

gv_str1 gc_tab

gv_str2 gc_tab

gv_str3 gc_tab

gv_str4 gc_tab

gv_str8 gc_tab

gv_str5 gc_tab

gv_str6 gc_tab

gv_str7 gc_crlf

INTO gv_me_mail.

CLEAR: gv_str1, gv_str2, gv_str3, gv_str3, gv_str4, gv_str5,

gv_str6 ,gv_str7,gw_me_mail,gv_str8.

ENDLOOP.

ENDIF.

* Attachment for E-mail

IF NOT gv_me_mail IS INITIAL.

TRY.

cl_bcs_convert=>string_to_solix(

EXPORTING

iv_string = gv_me_mail

iv_codepage = gc_4103

iv_add_bom = gc_x

IMPORTING

et_solix = gt_binary4

ev_size = gv_size1 ).

CATCH cx_bcs.

MESSAGE e445(so).

ENDTRY.

ENDIF

Thanks & Regards in Advance.

Sunit Kelkar

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Posted on Aug 10, 2016 at 07:15 AM

    You may also try with a text as a formula: =314159/100000 for getting 3.14159 or 3,14159 depending on client setting.

    Add a comment
    10|10000 characters needed characters exceeded

    • By the way, did you get a chance to have a look at the wiki, it shows that "=15522/100" is displayed (when the CSV file is saved with character encoding UTF-16LE with BOM, and with tab as delimitation character) as "155,22" for French systems, and as "155.22" for English systems.

  • author's profile photo Former Member
    Former Member
    Posted on Aug 10, 2016 at 09:01 AM

    Hi Sunil,

    I have not tried any of the below options, it might not work at all but you can give it a try:

    1. Before assigning exchange rate to string variable, do another assignment to a char variable. Then assign character variable to string.

    2. In the character variable, concatenate a space to the exchange rate before assigning to string.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Aug 11, 2016 at 10:21 AM

    Hi Sunit,

    I have also faced the same problem, and I have resolved it by converting number in String in ABAP code itself.

    Use Function Module 'HRCM_AMOUNT_TO_STRING_CONVERT' to convert number to string.

    Sample code :

    CALL FUNCTION 'HRCM_AMOUNT_TO_STRING_CONVERT'

    EXPORTING

    betrg = ld_number

    IMPORTING

    string = ld_string.

    Then you can concatenate this ld_string in your final string.

    Hope this helps.😊

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.