Skip to Content
0
Former Member
Aug 10, 2016 at 07:01 AM

String _to_Solix =>Email send

939 Views

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