Application Development and Automation 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: 
Read only

How to format string text

Former Member
0 Likes
2,876

I am passing my internal table as String into an excel sheet. But i need to Bold and change font etc for some values.

Is there any way i can use xml tags or anything else to get the output i want ?

Would appreciate some help on this.

10 REPLIES 10
Read only

Venkat_Sesha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,644

Is your Itab Data is displayed in SAP List. Or any CHAR255 field of ALV..?

or Do you just have the Data in the ITAB of type String/Char.

Read only

0 Likes
1,644

Sorry for the delayed reply,

The itab i populate while fetching data is a ztructure .

However, to populate the excel sheet, i pass the values to a new structure in this form

data: it_attach TYPE STANDARD TABLE OF solisti1 INITIAL SIZE 0

The structure solisti1 has one component of type SO_TEXT255

Looking forward to your expertise.

Read only

Former Member
0 Likes
1,644

yes you can play around with XML tags

Try doing an reverse engineering

save the excel sheet in the form of HTML and try identify the source

and try populating the tag with required values into internal table and then you can achieve it.

see this example, it is achieved in same way what is said

http://www.saptechnical.com/Tutorials/ABAP/email/Index.htm

Regards

S.Janagar

Read only

0 Likes
1,644

Okay Jenagar, I'll try and see

Read only

Former Member
0 Likes
1,644

Hi,

You can work with CL_IXML to do this or you can use OLE.

http://wiki.sdn.sap.com/wiki/display/Snippets/Formatted+Excel+as+Email+Attachment

You can find lot of articles for OLE here in SCN.

Thanks,

Shambu

Read only

0 Likes
1,644

Thanks Shambu but actually i think i cant use OLE cause my program needs to run in the background

Read only

0 Likes
1,644

All the more reason to use CL_IXML.

Read only

Former Member
0 Likes
1,644

Hello,

Befor moving your entries in structure, try using FORMAT INTENSIFIED. I am not sure about font change but you can hit n trial below for BOLD option

1.FORMAT INTENSIFIED INPUT.

  WRITE 5 'JOHN'. 

FORMAT INTENSIFIED OFF.

2. Addition 1

... COLOR n [ON] or ...COLOR OFF

Color of line background . n can have the following values:

OFF or COL_BACKGROUND Background

1 or COL_HEADING Headers (grayish blue)

2 or COL_NORMAL List body (bright gray)

3 or COL_TOTAL  Totals (yellow)

4 or COL_KEY  Key columns (bluish green)

5 or COL_POSITIVE Positive threshold value(green)

6 or COL_NEGATIVE Negative threshold value (red)

7 or COL_GROUP  Control levels (violet)

Regards,

Deepti

Read only

rosenberg_eitan
Active Contributor
0 Likes
1,644

Hi.

Since you mention solisti1 I am asuming that you are using fm SO_NEW_DOCUMENT_ATT_SEND_API1.


You can compose your mail using html with the full power of html in your hand.


Your user can copy and paste the content to Excel while retaining the fancy appearance...

You need to specify the "PACKING_LIST" entry as sopcklsti1-doc_type  = 'HTML'
You need to create a string that will contain the full html for the main message or attachment.

When you are done you have to chop the string to fit SOLISTI1-line:

DATA: big_string TYPE string ."Contain the html message

DATA: it_contents TYPE srm_t_solisti1 .
DATA: st_contents LIKE LINE OF it_contents .

    DO .

      st_contents-line = big_string .
      APPEND st_contents TO it_contents .
      SHIFT big_string LEFT BY 255 PLACES .
      IF big_string IS INITIAL.
        EXIT .
      ENDIF .

    ENDDO .
   
    big_string = '' .   

A test:

Read only

Former Member
0 Likes
1,644