วันศุกร์ที่ 24 กันยายน พ.ศ. 2553

I'm Abaper

สวัสดีครับเพื่อน Abaper

               เริ่มจากแนะนำตัวละกัน ผมเริ่มเข้าสู่วงการ  SAP ที่บริษัท Zygen ตั้งแต่ปี 2005 จนถึงทุกวันนี้ เข้ามาแรกๆ ก็เจองาน Interface เลยต้องทำ Web Java ทำ RFC เข้า BAPI  จนทุกวันนี้ก็วนไปเวียนมากับ Interface และ Enhancement มาตลอด สะสมความรู้ทั้งมีอาจารย์สอนและเรียนรู้เองมาเรื่อยๆจนรู้สึกว่าควรถึงเวลาแล้วที่ควรจะแบ่งบันความรู้ที่ได้รับมาให้กับคนอื่นบ้าง จึงเริ่มคิดจะทำ Blog สำหรับเผยแพร่สิ่งที่ผมคิดว่าน่าจะเป็นประโยชน์ให้กับผู้ที่สนใจ และจะเป็นการดีอย่างมากหากสามารถนำสิ่งที่ผมเผยแพร่ไปทำประโยชน์ต่อไปได้ หรือหากมีคำแนะนำ เสนอแนะ ติชม เพิ่มเติม ผมยินดีน้อมรับเพื่อปรับปรุงและพัฒนาครับ

เมนูแนะนำ

iPePPe
I'm Abaper

           

วันพฤหัสบดีที่ 23 กันยายน พ.ศ. 2553

ABAP Excel ฉึก ฉึก : Hello World Excel

สวัสดีเพื่อน Abaper

     สำหรับ Abaper การทำ report เหมือนเป็นวิถีชีวิตที่ต้องเจอแทบทุกวันการสู้รบกับ ALV , List , Grid เป็นเรื่องที่ต้องเจอกันบ่อยๆ ซึ่ง User ก็จะบ่นมั่งล่ะว่าไม่เห็นสวยเลย อยากได้ให้เป็น Excel สวยๆหน่อยซึ่งคำพูดนี้ทำให้ผมเริ่มนำไปคิดหาวิธีที่จะทำ ให้ Report มันออกเป็น Excel มาให้ User เลย วิธีที่คิดได้ก็มีอยู่หลายวิธีเช่น เขียน Abap ไป Call OLE ของ MS Excel , ทำเป็น ALV แล้ว Save List ออกมาเป็น HTML หรือ Excel มีหลายวิธีอยู่แต่ละวิธีก็จะมีข้อดีข้อเสียต่างกันไป สุดท้ายผมเลยลองใช้การเอา Excel มา Save as เป็น HTML แล้วทำ Function Generate Header ของ Excel ออกมา กำหนด CSS หรือ Style Sheet ไว้ใน Header นี้เลย ผูกเข้ากับ Constant เอาไว้จะได้ไม่ต้องจำชื่อ และอื่นๆอีกมากมาย ซึ่งผมขอสรุปคร่าวๆดังต่อไปนี้ครับ แต่ก็ต้องออกตัวดังๆก่อนว่ามันยังไม่สมบูรณ์นะครับ ถ้ามีเพื่อน abap ท่านใดสามารถพัฒนาต่อยอดไปได้อีกผมยินดีอย่างยิ่ง และขอรับคำแนะนำจากทุกท่านครับ


     วิธีใช้ก็ไม่ยุ่งยากเพียงแต่จะต้องมีพื้นฐานการเขียน HTML นิดหน่อยเพราะผมแกะจาก code Excel ที่ Save as มาเป็น HTML ดังนั้น option ส่วนใหญ่จึงเหมือนกับการเขียน HTML เลย และต้องขอออกตัวไว้ก่อนว่ามันยังไม่สมบูรณ์ในบาง option ดังนั้นหากเพื่อน Abap ท่านใดสามารถแก้ไขเพิ่มเติมเพื่อให้โปรแกรมทำงานได้สมบูรณ์ขึ้นต้องขอความกรุณาแนะนำด้วยครับ

     ขั้นแรกเอา Function ไปลงก่อน
  1. Create Function Group ขึ้นมาก่อนเลย ผมใช้ ZGEXCEL
  2. Create Function Module ZG_GENERATE_EXCEL_HEADER copy code ในแปะเลยนะครับ
  3. Create Text Symbols ใน Function ข้อ 2 download file ตาม link นี้ แล้วค่อยถึกๆ copy & paste จนหมด ใครใช้ Log in 2 ภาษาก็อย่าลืม Translate ด้วยนะครับ 
  4. Create Include Program  ZGEXCEL01 และ ZGEXCEL02
  5. Activate Function Group ซะ

     คราวนี้มาลองดูตัวอย่างวิธีการนำไปใช้ Start-Of-Selection

  1. สร้างโปรแกรม ZEXCEL_HELLOWORLD
  2. Include ZGEXCEL01 และ ZGEXCEL02 *----------------------------------------------------------------------*
    * INCLUDE DECLARATIONS
    *----------------------------------------------------------------------*
    include zgexcel01.
    include zgexcel02.
  3. เรียกใช้ Function ZG_GENERATE_EXCEL_HEADER เพื่อสร้าง Header ของ File ขึ้นมาก่อน    call function 'ZG_GENERATE_EXCEL_HEADER'
        tables
          excel = gi_excel.  
  4. ทีนี้ก็มาเริ่มเขียนข้อมูลกันเลยเริ่มจากเรียก  perform table. และปิดท้ายไว้ก่อนด้วย  perform endtable. ในเบื้องหลังของ perform 2 ตัวนี้ก็คือการใส่ code tag <table> และ </table> เข้าไปใน internal table gi_excel
  5. ต่อจากนั้นระหว่าง perform table. และ perform endtable. จะเป็น perform tr. และ perform endtr. ตามหลักการเขียน HTML tag TR คือการบอกให้รู้ว่าข้อมูลและหว่าง tr และ endtr จะเป็นข้อมูลที่อยู่บนบันทัดเดียวกัน
  6. สุดท้ายคือการใส่ข้อมูลแค่ละ column หรือ TD จะใช้ perform td ซึ่งผมเองทำไว้หลาย version ใน include zgexcel02. มีตั้งแต่ perform td , perform td2 , perform td3 , perform td3_1 , perform td3_2 , perform td3_3 สำหรับในโปรแกรมตัวอย่างนี้ผมใช้ TD3_3 ซึ่งเป็นตัวล่าสุด Option สำหรับ Perform นี้มีดังนี้

       perform td3_3 using   c_1111        "style



                     space              "align
                     space              "width
                     space              "column span
                     space              "row span
                     space              "background color
                     space              "Field Type
                     space              "Format
                     space           "Text
                     gw_font.
    • Style concept ของ option นี้เหมือน การใช้ css ใน HTML Style ในที่นี้ จะสามารถกำหนด ให้ TD นี้มีเส้นของ Field นี้เป็นแบบใด โดยผมได้กำหนดเป็น constant  ไว้ใน include ZGEXEL01 เ่ช่น c_1111 คือมี เส้นแบบปกติรอบ TD เลย หรือ c_0000 คือไม่มีเส้นเลย 0 และ 1 จะแทนด้วยเส้นรอบ TD โดย 1 ตัวแรกจะแทนด้วย เส้นด้านบน 1 ตัวที่ 2 แทนเส้นด้านขวาและเรียงตามเข็มนาฬิกาจนครบรอบ 
      • 0 = ไม่มีเส้น
      • 1 = เส้นปกติ
      • 2 = เส้นหนา
      • 3 = เส้นคู่
      • 4 = เส้นปะไข่ปลา
      • 5 = เส้นปะแบบขีด
    • Align การจัดตัวอักษร
      • Center
      • Left
      • Right
    • Width จุดประสงค์จะให้เป็นตัวกำหนดความกว้างของ column แต่ยังไม่ Work  ใครแก้ได้ช่วยบอกแนะนำด้วยนะครับ
    • Col การรวม TD เข้าด้วยกัน
    • Row การรวม TR เข้าด้วยกัน
    • BGColor ทำ Backgroup เป็นสีต่าง ตัวนี้ก็ยังไม่ work ครับ
    • FieldType  ระบุชนิดของตัวแปล
      • String  เป็น Default Type
      • Num สำหรับต้องการแสดงเป็นจำนวนเงินหรือตัวเลข ต้องระบุ Format ด้วย
      • Date สำหรับวันที่ input format เป็น yyyyMMdd ออกใน Excel เป็น dd.MM.yyyy
    • Format ใช้คู่กับ FieldType Num  ใช้กำหนด ว่าจะให้มีทศนิยมกี่ตำแหน่ง
    • Text รับค่าของข้อมูลที่จะนำไปแสดง
    • Font input ตัวนี้เป็น Structure อ้างอิงจาก ZFONT
      • Size ขนาดของตัวหนังสือ ยังไม่ work
      • Color สีของตัวหนังสือ ระบุได้เป็น red,green,blue หรือให้ code RGB
      • Face ชนิดของ Font ยังไม่ work อีกละ แหะๆ
      • Bold ใส่ค่า X จะทำให้เป็นตัวหนา
      • Italic ใส่ค่า X จะทำให้เป็นตัวเอง


    ตัวอย่าง Excel ที่ได้หลังจาก Run Program ZEXCEL_HELLOWORLD
    Excel Hello World


    ABAP Excel ฉึก ฉึก : Program ZEXCEL_HELLOWORLD

    *&---------------------------------------------------------------------*
    *& Report  ZEXCEL_HELLOWORLD
    *&
    *&---------------------------------------------------------------------*
    *&
    *&
    *&---------------------------------------------------------------------*

    REPORT  zexcel_helloworld.

    *----------------------------------------------------------------------*
    * INCLUDE DECLARATIONS
    *----------------------------------------------------------------------*
    INCLUDE zgexcel01.
    INCLUDE zgexcel02.

    *&---------------------------------------------------------------------*
    *& D A T A                                                             *
    *&---------------------------------------------------------------------*
    DATA : gw_font TYPE zfont.

    *&---------------------------------------------------------------------*
    *& S E L E C T I O N S                                                 *
    *&---------------------------------------------------------------------*

    PARAMETERS : p_file TYPE string DEFAULT 'C:\hello_world.xls'.

    *&---------------------------------------------------------------------*
    *& S T A R T  O F  S E L E C T I O N                                   *
    *&---------------------------------------------------------------------*
    START-OF-SELECTION.

      CALL FUNCTION 'ZG_GENERATE_EXCEL_HEADER'
        TABLES
          excel = gi_excel.

      PERFORM table.
      PERFORM tr.PERFORM endtr.
      PERFORM tr.

      PERFORM td3_3 USING c_0000        "style
                       space            "align
                       space            "width
                       space            "column span
                       space            "row span
                       space            "background color
                       space            "Field Type
                       space            "Format
                       'No border'      "Text
                       gw_font.

      PERFORM tr.PERFORM endtr.

      PERFORM tr.
      PERFORM td3_3 USING c_1111        "style
                     space              "align
                     space              "width
                     space              "column span
                     space              "row span
                     space              "background color
                     space              "Field Type
                     space              "Format
                     'border'           "Text
                     gw_font.


      PERFORM endtr.

      PERFORM tr.PERFORM endtr.

      PERFORM tr.
      PERFORM td3_3 USING c_1111        "style
                     space              "align
                     '200'              "width
                     space              "column span
                     space              "row span
                     space              "background color
                     space              "Field Type
                     space              "Format
                     'WIDTH not work'   "Text
                     gw_font.


      PERFORM endtr.

      PERFORM tr.PERFORM endtr.

      PERFORM tr.
      PERFORM td3_3 USING c_1111        "style
                     space              "align
                     space              "width
                     '2'                "column span
                     space              "row span
                     space              "background color
                     space              "Field Type
                     space              "Format
                     'col span'         "Text
                     gw_font.


      PERFORM endtr.
      PERFORM tr.
      PERFORM td3_3 USING c_1111        "style
                     space              "align
                     space              "width
                     space              "column span
                     space              "row span
                     space              "background color
                     space              "Field Type
                     space              "Format
                     'col span'         "Text
                     gw_font.
      PERFORM td3_3 USING c_1111        "style
                     space              "align
                     space              "width
                     space              "column span
                     space              "row span
                     space              "back ground color
                     space              "Field Type
                     space              "Format
                     'col span'         "Text
                     gw_font.

      PERFORM endtr.


      PERFORM tr.PERFORM endtr.

      PERFORM tr.
      PERFORM td3_3 USING c_1111        "style
                     space              "align
                     space              "width
                     space              "column span
                     '2'                "row span
                     space              "back ground color
                     space              "Field Type
                     space              "Format
                     'row span'         "Text
                     gw_font.

      PERFORM td3_3 USING c_1111        "style
                     space              "align
                     space              "width
                     space              "column span
                     space              "row span
                     space              "back ground color
                     space              "Field Type
                     space              "Format
                     'row span'         "Text
                     gw_font.

      PERFORM endtr.

      PERFORM tr.
      PERFORM td3_3 USING c_1111        "style
                     space              "align
                     space              "width
                     space              "column span
                     space              "row span
                     space              "back ground color
                     space              "Field Type
                     space              "Format
                     'row span'         "Text
                     gw_font.
      PERFORM endtr.


      PERFORM tr. PERFORM endtr.

      PERFORM tr.
      PERFORM td3_3 USING c_1111        "style
                     space              "align
                     space              "width
                     space              "column span
                     space              "row span
                     'FF0000'           "background color
                     space              "Field Type
                     space              "Format
                     'BGCOLOR not work' "Text
                     gw_font.
      PERFORM endtr.

      PERFORM tr. PERFORM endtr.

      PERFORM tr.
      PERFORM td3_3 USING c_1011        "style
                     space              "align
                     space              "width
                     space              "column span
                     space              "row span
                     space              "back ground color
                     space              "Field Type
                     space              "Format
                     'Format number'    "Text
                     gw_font.
      PERFORM td3_3 USING c_1110        "style
                     space              "align
                     space              "width
                     space              "column span
                     space              "row span
                     space              "back ground color
                     'NUM'              "Field Type
                      d_2               "Format
                     '10000'            "Text
                     gw_font.


      PERFORM endtr.

      PERFORM tr. PERFORM endtr.

      PERFORM tr.
      PERFORM td3_3 USING c_1011        "style
                     space              "align
                     space              "width
                     space              "column span
                     space              "row span
                     space              "back ground color
                     space              "Field Type
                     space              "Format
                     'Format date'      "Text
                     gw_font.
      PERFORM td3_3 USING c_1110        "style
                     space              "align
                     space              "width
                     space              "column span
                     space              "row span
                     space              "back ground color
                     'DATE'             "Field Type
                     space              "Format
                     '20100203'         "Text
                     gw_font.


      PERFORM endtr.


    *SIZE
      PERFORM tr. PERFORM endtr.
      CLEAR gw_font.
      gw_font-size = '50'.
      PERFORM tr.
      PERFORM td3_3 USING c_1111        "style
                     space              "align
                     space              "width
                     space              "column span
                     space              "row span
                     space              "background color
                     space              "Field Type
                     space              "Format
                     'Font size 50 not work'    "Text
                     gw_font.
      PERFORM endtr.
    *COLOR
      PERFORM tr. PERFORM endtr.
      CLEAR gw_font.
      gw_font-color = 'RED'.
      PERFORM tr.
      PERFORM td3_3 USING c_1111        "style
                     space              "align
                     space              "width
                     space              "column span
                     space              "row span
                     space              "background color
                     space              "Field Type
                     space              "Format
                     'Font color red'   "Text
                     gw_font.
      PERFORM endtr.
    *FACE
      PERFORM tr. PERFORM endtr.
      CLEAR gw_font.
      gw_font-face = 'EucrosiaUPC'.
      PERFORM tr.
      PERFORM td3_3 USING c_1111        "style
                     space              "align
                     space              "width
                     space              "column span
                     space              "row span
                     space              "background color
                     space              "Field Type
                     space              "Format
                     'Face EucrosiaUPC not work'    "Text
                     gw_font.
      PERFORM endtr.

    *BOLD
      PERFORM tr. PERFORM endtr.
      CLEAR gw_font.
      gw_font-bold = 'X'.
      PERFORM tr.
      PERFORM td3_3 USING c_1111        "style
                     space              "align
                     space              "width
                     space              "column span
                     space              "row span
                     space              "background color
                     space              "Field Type
                     space              "Format
                     'Bold'             "Text
                     gw_font.
      PERFORM endtr.

    *ITALIC
      PERFORM tr. PERFORM endtr.
      CLEAR gw_font.
      gw_font-italic = 'X'.
      PERFORM tr.
      PERFORM td3_3 USING c_1111        "style
                     space              "align
                     space              "width
                     space              "column span
                     space              "row span
                     space              "background color
                     space              "Field Type
                     space              "Format
                     'Italic'           "Text
                     gw_font.
      PERFORM endtr.

      PERFORM endtable.

      CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
    *     BIN_FILESIZE                    =
        filename                        = p_file
    *     FILETYPE                        = 'ASC'
    *     APPEND                          = ' '
    *     WRITE_FIELD_SEPARATOR           = ' '
    *     HEADER                          = '00'
    *     TRUNC_TRAILING_BLANKS           = ' '
    *     WRITE_LF                        = 'X'
    *     COL_SELECT                      = ' '
    *     COL_SELECT_MASK                 = ' '
    *     DAT_MODE                        = ' '
    *     CONFIRM_OVERWRITE               = ' '
    *     NO_AUTH_CHECK                   = ' '
    *     CODEPAGE                        = ' '
    *     IGNORE_CERR                     = ABAP_TRUE
    *     REPLACEMENT                     = '#'
    *     WRITE_BOM                       = ' '
    *     TRUNC_TRAILING_BLANKS_EOL       = 'X'
    *     WK1_N_FORMAT                    = ' '
    *     WK1_N_SIZE                      = ' '
    *     WK1_T_FORMAT                    = ' '
    *     WK1_T_SIZE                      = ' '
    *     WRITE_LF_AFTER_LAST_LINE        = ABAP_TRUE
    *     SHOW_TRANSFER_STATUS            = ABAP_TRUE
    *   IMPORTING
    *     FILELENGTH                      =
      TABLES
        data_tab                        = gi_excel
    *     FIELDNAMES                      =
     EXCEPTIONS
       file_write_error                = 1
       no_batch                        = 2
       gui_refuse_filetransfer         = 3
       invalid_type                    = 4
       no_authority                    = 5
       unknown_error                   = 6
       header_not_allowed              = 7
       separator_not_allowed           = 8
       filesize_not_allowed            = 9
       header_too_long                 = 10
       dp_error_create                 = 11
       dp_error_send                   = 12
       dp_error_write                  = 13
       unknown_dp_error                = 14
       access_denied                   = 15
       dp_out_of_memory                = 16
       disk_full                       = 17
       dp_timeout                      = 18
       file_not_found                  = 19
       dataprovider_exception          = 20
       control_flush_error             = 21
       OTHERS                          = 22
              .
      IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.

    ABAP Excel ฉึก ฉึก : Text Symbols

    Download Text Symbols

    001 "<html xmlns:o=""urn:schemas-microsoft-com:office:office"""
    002 "xmlns:x=""urn:schemas-microsoft-com:office:excel"""
    003 "xmlns=""http://www.w3.org/TR/REC-html40"">"
    004 <head>
    005 "<meta http-equiv=Content-Type content=""text/html; charset=windows-874"">"
    006 <meta name=ProgId content=Excel.Sheet>
    007 "<meta name=Generator content=""Microsoft Excel 11"">"
    008 <style>
    009 <!--table
    010 "{mso-displayed-decimal-separator:""\."";"
    011 "mso-displayed-thousand-separator:""\,"";}"
    012 @page
    013 {margin:1.0in .75in 1.0in .75in;
    014 mso-header-margin:.5in;
    015 mso-footer-margin:.5in;}
    016 tr
    017 {mso-height-source:auto;}
    018 col
    019 {mso-width-source:auto;}
    020 br
    021 {mso-data-placement:same-cell;}
    022 .style0
    023 {mso-number-format:General;
    024 text-align:general;
    025 vertical-align:bottom;
    026 white-space:nowrap;
    027 mso-rotate:0;
    028 mso-background-source:auto;
    029 mso-pattern:auto;
    030 color:windowtext;
    031 font-size:10.0pt;
    032 font-weight:400;
    033 font-style:normal;
    034 text-decoration:none;
    035 font-family:Arial;
    036 mso-generic-font-family:auto;
    037 mso-font-charset:222;
    038 border:none;
    039 mso-protection:locked visible;
    040 mso-style-name:Normal;
    041 mso-style-id:0;}
    042 td
    043 {mso-style-parent:style0;
    044 padding-top:1px;
    045 padding-right:1px;
    046 padding-left:1px;
    047 mso-ignore:padding;
    048 color:windowtext;
    049 font-size:10.0pt;
    050 font-weight:400;
    051 font-style:normal;
    052 text-decoration:none;
    053 font-family:Arial;
    054 mso-generic-font-family:auto;
    055 mso-font-charset:222;
    056 mso-number-format:General;
    057 text-align:general;
    058 vertical-align:bottom;
    059 border:none;
    060 mso-background-source:auto;
    061 mso-pattern:auto;
    062 mso-protection:locked visible;
    063 white-space:nowrap;
    064 mso-rotate:0;}
    065 .xl24
    066 {mso-style-parent:style0;}
    067 .xl25
    068 {mso-style-parent:style0;
    069 border-top:none;
    070 border-right:none;
    071 border-bottom:.5pt solid windowtext;
    072 border-left:none;}
    073 .xl26
    074 {mso-style-parent:style0;
    075 border-top:none;
    076 border-right:none;
    077 border-bottom:.5pt solid windowtext;
    078 border-left:.5pt solid windowtext;}
    079 .xl27
    080 {mso-style-parent:style0;
    081 border-top:.5pt solid windowtext;
    082 border-right:none;
    083 border-bottom:none;
    084 border-left:none;}
    085 .xl28
    086 {mso-style-parent:style0;
    087 border-top:none;
    088 border-right:.5pt solid windowtext;
    089 border-bottom:.5pt solid windowtext;
    090 border-left:none;}
    091 .xl29
    092 {mso-style-parent:style0;
    093 border-top:none;
    094 border-right:none;
    095 border-bottom:none;
    096 border-left:.5pt solid windowtext;}
    097 .xl30
    098 {mso-style-parent:style0;
    099 border-top:none;
    100 border-right:none;
    101 border-bottom:2.0pt double windowtext;
    102 border-left:.5pt solid windowtext;}
    103 .xl31
    104 {mso-style-parent:style0;
    105 border-top:none;
    106 border-right:.5pt solid windowtext;
    107 border-bottom:none;
    108 border-left:none;}
    109 .xl32
    110 {mso-style-parent:style0;
    111 border-top:none;
    112 border-right:.5pt solid windowtext;
    113 border-bottom:2.0pt double windowtext;
    114 border-left:none;}
    115 .xl33
    116 {mso-style-parent:style0;
    117 border:.5pt solid windowtext;}
    118 .xl34
    119 {mso-style-parent:style0;
    120 border-top:.5pt solid windowtext;
    121 border-right:none;
    122 border-bottom:2.0pt double windowtext;
    123 border-left:.5pt solid windowtext;}
    124 .xl35
    125 {mso-style-parent:style0;
    126 border:1.0pt solid windowtext;}
    127 .xl36
    128 {mso-style-parent:style0;
    129 border-top:.5pt solid windowtext;
    130 border-right:.5pt solid windowtext;
    131 border-bottom:2.0pt double windowtext;
    132 border-left:none;}
    133 .xl37
    134 {mso-style-parent:style0;
    135 border-top:none;
    136 border-right:none;
    137 border-bottom:2.0pt double windowtext;
    138 border-left:none;}
    139 .xl38
    140 {mso-style-parent:style0;
    141 border-top:none;
    142 border-right:none;
    143 border-bottom:1.0pt solid windowtext;
    144 border-left:.5pt solid windowtext;}
    145 .xl39
    146 {mso-style-parent:style0;
    147 border-top:none;
    148 border-right:none;
    149 border-bottom:1.0pt solid windowtext;
    150 border-left:none;}
    151 .xl40
    152 {mso-style-parent:style0;
    153 border-top:none;
    154 border-right:.5pt solid windowtext;
    155 border-bottom:1.0pt solid windowtext;
    156 border-left:none;}
    157 .xl41
    158 {mso-style-parent:style0;
    159 border-top:.5pt solid windowtext;
    160 border-right:none;
    161 border-bottom:.5pt solid windowtext;
    162 border-left:none;}
    163 .xl42
    164 {mso-style-parent:style0;
    165 border-top:.5pt solid windowtext;
    166 border-right:none;
    167 border-bottom:1.0pt solid windowtext;
    168 border-left:none;}
    169 .xl43
    170 {mso-style-parent:style0;
    171 border-top:.5pt solid windowtext;
    172 border-right:none;
    173 border-bottom:2.0pt double windowtext;
    174 border-left:none;}
    175 .xl44
    176 {mso-style-parent:style0;
    177 border-top:none;
    178 border-right:.5pt solid windowtext;
    179 border-bottom:none;
    180 border-left:.5pt solid windowtext;}
    181 .xl45
    182 {mso-style-parent:style0;
    183 border-top:.5pt solid windowtext;
    184 border-right:none;
    185 border-bottom:none;
    186 border-left:.5pt solid windowtext;}
    187 .xl46
    188 {mso-style-parent:style0;
    189 border-top:.5pt solid windowtext;
    190 border-right:.5pt solid windowtext;
    191 border-bottom:none;
    192 border-left:none;}
    193 .xl47
    194 {mso-style-parent:style0;
    195 border-top:.5pt solid windowtext;
    196 border-right:.5pt solid windowtext;
    197 border-bottom:none;
    198 border-left:.5pt solid windowtext;}
    199 .xl48
    200 {mso-style-parent:style0;
    201 border-top:none;
    202 border-right:none;
    203 border-bottom:none;
    204 border-left:none;}
    205 .xl49
    206 {mso-ignore:padding;
    207 border-top:none;
    208 border-right:none;
    209 border-bottom:.5pt hairline windowtext;
    210 border-left:none;}
    211 .xl50
    212 {mso-ignore:padding;
    213 border-top:none;
    214 border-right:.5pt solid windowtext;
    215 border-bottom:.5pt solid windowtext;
    216 border-left:.5pt solid windowtext;}
    217 .xl51
    218 {mso-ignore:padding;
    219 border-top:.5pt solid windowtext;
    220 border-right:.5pt solid windowtext;
    221 border-bottom:.5pt hairline windowtext;
    222 border-left:.5pt solid windowtext;}
    223 .xl52
    224 {mso-ignore:padding;
    225 border-top:.5pt hairline windowtext;
    226 border-right:none;
    227 border-bottom:none;
    228 border-left:none;}
    229 .xl53
    230 {mso-ignore:padding;
    231 border-top:none;
    232 border-right:.5pt solid windowtext;
    233 border-bottom:.5pt hairline windowtext;
    234 border-left:none;}
    235 .xl54
    236 {mso-ignore:padding;
    237 border-top:none;
    238 border-right:none;
    239 border-bottom:.5pt hairline windowtext;
    240 border-left:.5pt solid windowtext;}
    241 .xl55
    242 {mso-ignore:padding;
    243 border-top:none;
    244 border-right:.5pt solid windowtext;
    245 border-bottom:.5pt hairline windowtext;
    246 border-left:.5pt solid windowtext;}
    247 .xl56
    248 {mso-ignore:padding;
    249 border-top:none;
    250 border-right:none;
    251 border-bottom:.5pt dashed windowtext;
    252 border-left:none;}
    253 .xl57
    254 {mso-ignore:padding;
    255 border-top:.5pt dashed windowtext;
    256 border-right:none;
    257 border-bottom:none;
    258 border-left:none;}
    259 .xl58
    260 {mso-ignore:padding;
    261 border-top:none;
    262 border-right:.5pt solid windowtext;
    263 border-bottom:.5pt dashed windowtext;
    264 border-left:none;}
    265 .xl59
    266 {mso-ignore:padding;
    267 border-top:none;
    268 border-right:none;
    269 border-bottom:.5pt dashed windowtext;
    270 border-left:.5pt solid windowtext;}
    271 .xl60
    272 {mso-ignore:padding;
    273 border-top:none;
    274 border-right:.5pt solid windowtext;
    275 border-bottom:.5pt dashed windowtext;
    276 border-left:.5pt solid windowtext;}
    277 .xl61
    278 {mso-style-parent:style0;
    279 border-top:.5pt solid windowtext;
    280 border-right:none;
    281 border-bottom:.5pt solid windowtext;
    282 border-left:.5pt solid windowtext;}
    283 .xl62
    284 {mso-style-parent:style0;
    285 border-top:.5pt solid windowtext;
    286 border-right:.5pt solid windowtext;
    287 border-bottom:.5pt solid windowtext;
    289 border-left:none;}
    290 .xl63
    291 {mso-style-parent:style0;
    292 border-top:.5pt solid windowtext;
    293 border-right:none;
    294 border-bottom:1pt solid windowtext;
    295 border-left:.5pt solid windowtext;}
    296 .xl64
    297 {mso-style-parent:style0;
    298 border-top:.5pt solid windowtext;
    299 border-right:.5pt solid windowtext;
    300 border-bottom:1pt solid windowtext;
    301 border-left:none;}
    302 .xl65
    303 {mso-style-parent:style0;
    304 border-top:1pt solid windowtext;
    305 border-right:none;
    306 border-bottom:1pt solid windowtext;
    307 border-left:1pt solid windowtext;}
    308 .xl66
    309 {mso-style-parent:style0;
    310 border-top:1pt solid windowtext;
    311 border-right:1pt solid windowtext;
    312 border-bottom:1pt solid windowtext;
    313 border-left:none;}
    314 .xl67
    315 {mso-style-parent:style0;
    316 border-top:1pt solid windowtext;
    317 border-right:none;
    318 border-bottom:none;
    319 border-left:1pt solid windowtext;}
    320 .xl68
    321 {mso-style-parent:style0;
    322 border-top:.5pt solid windowtext;
    323 border-right:.5pt solid windowtext;
    324 border-bottom:2.0pt double windowtext;
    325 border-left:.5pt solid windowtext;}
    326 .xl69
    327 {mso-style-parent:style0;
    328 border-top:.5pt solid windowtext;
    329 border-right:.5pt solid windowtext;
    330 border-bottom:1.0pt solid windowtext;
    331 border-left:.5pt solid windowtext;}
    332 .xl70
    333 {mso-style-parent:style0;
    334 border-top:1.0pt solid windowtext;
    335 border-right:none;
    336 border-bottom:1.0pt solid windowtext;
    337 border-left:none;}
    338 .xl71
    339 {mso-style-parent:style0;
    340 border-top:.5pt solid windowtext;
    341 border-right:.5pt solid windowtext;
    342 border-bottom:.5pt solid windowtext;
    343 border-left:.5pt solid windowtext;
    344 background:yellow;
    345 mso-pattern:auto none;}
    346 -->
    347 </style>
    348 </head>
    T00 
    T01 <tr height=28 style='height:21.0pt'  background=>
    

    Structure : ZFONT

    FieldData elementData TypeLengthDecimalShort Description
    SIZE
    CHAR30Font Size
    COLOR
    CHAR100Font color
    FACE
    CHAR400Font name
    BOLD
    CHAR10Bold
    ITALIC
    CHAR10Italic

    ABAP Excel ฉึก ฉึก : Include ZGEXCEL02

    *&---------------------------------------------------------------------*
    *&  Include           ZGEXCEL02
    *&---------------------------------------------------------------------*
    form  table.
      gi_excel-line = '<table>'.
      append gi_excel.
    endform.                    "TR

    *&---------------------------------------------------------------------*
    *&      Form  endTABLE
    *&---------------------------------------------------------------------*
    *       text
    *----------------------------------------------------------------------*
    form  endtable.
      gi_excel-line = '</table>'.
      append gi_excel.
    endform.                    "TR

    *&---------------------------------------------------------------------*
    *&      Form  TR
    *&---------------------------------------------------------------------*
    *       text
    *----------------------------------------------------------------------*
    form  tr .
    *  <tr height=28 style='height:21.0pt'  >
      gi_excel-line = '<tr height=28>' .
      append gi_excel.
    endform.                    "TR
    *&---------------------------------------------------------------------*
    *&      Form  TR
    *&---------------------------------------------------------------------*
    *       text
    *----------------------------------------------------------------------*
    form  tr_h using hight .
    *  <tr height=28 style='height:21.0pt'  >
    *  GI_EXCEL-LINE = '<tr height=28>' .
      concatenate '<tr height=' hight '>' into gi_excel-line.
      append gi_excel.
    endform.                    "TR
    *&---------------------------------------------------------------------*
    *&      Form  ENDTR
    *&---------------------------------------------------------------------*
    *       text
    *----------------------------------------------------------------------*
    form endtr.
      gi_excel-line = '</tr>'.
      append gi_excel.
    endform.                    "ENDTR

    *&---------------------------------------------------------------------*
    *&      Form  TD_DESC
    *&---------------------------------------------------------------------*
    *       text
    *----------------------------------------------------------------------*
    form td using style align col row bgcolor ttype text
            font structure zfont. 
     
      data : lv_class type string,
             lv_align  type string,
             lv_col   type string,
             lv_row   type string,
             lv_bg    type string,
             lv_type type string,
             lv_text type string,
             lv_nnum type p decimals 2,
             lv_xnum type string,
             lv_date type string,
             lv_xdate type string.
      data : lv_size type string,
             lv_color type string,
             lv_face type string,
             lv_td type string,
             lv_etd type string.

      if not style is initial.
        concatenate 'class=' style into lv_class.
      endif.
      if not align is initial.
        concatenate 'style=text-align:' align into lv_align.
      endif.
      if not col is initial.
        concatenate 'colspan=' col into lv_col.
      endif.
      if not row is initial.
        concatenate 'rowspan=' row into lv_row.
      endif.
      if not bgcolor is initial.
        concatenate 'background=' bgcolor into lv_bg.
      endif.
    *  case TTYPE
      if ttype = 'NUM' or ttype = 'num'.
        lv_type = 'X:num'.
        lv_nnum = text.
        if lv_nnum < 0.
          lv_nnum = lv_nnum * -1.
          lv_xnum = lv_nnum.
    *    write: LV_NNUM TO LV_XNUM.
          concatenate  '-' lv_xnum  into lv_xnum.
        else.
          lv_xnum = lv_nnum.
          condense lv_xnum.
        endif.
        concatenate lv_type '=' text-t02 lv_xnum text-t02
        into lv_type.
        lv_text = lv_xnum.

      elseif ttype = 'date' or ttype = 'DATE'.
        lv_type = 'X:String'.
        lv_date = text.

        if lv_date is not initial.
          concatenate lv_date+6(2'.' lv_date+4(2'.' lv_date+0(4into lv_xdate.
        endif.
        if lv_xdate is initial or lv_xdate = '00.00.0000'.
          lv_text = '&nbsp;'.
        else.
          lv_text = lv_xdate.
        endif.
      else.
        lv_type = 'X:String'.
        if text is initial.
          lv_text = '&nbsp;'.
        else.
          lv_text = text.
        endif.
      endif.


      if not font is initial.
        if not font-size is initial.
          concatenate 'size=' font-size into lv_size.
        endif.
        if not font-color is initial.
          concatenate 'color=' font-color into lv_color.
        endif.
        if not font-face is initial.
          concatenate 'face=' font-face into lv_face.
        endif.
        if not font-italic is initial.
          concatenate '<I>' lv_text '</I>' into lv_text.
        endif.
        if not font-bold is initial.
          concatenate '<B>' lv_text '</B>' into lv_text.
        endif.


        concatenate '<font' lv_size lv_color lv_face '>' lv_text '</font>'
        into lv_text.
      endif.

      concatenate '<td' lv_class lv_align lv_col lv_row lv_bg lv_type '>' lv_text '</td>'
      into gi_excel-line separated by space.

      append gi_excel.
    endform.                    "TD_DESC


    *&---------------------------------------------------------------------*
    *&      Form  TD2
    *&---------------------------------------------------------------------*
    *       text
    *----------------------------------------------------------------------*
    *      -->STYLE      text
    *      -->ALIGN      text
    *      -->WIDTH      text
    *      -->COL        text
    *      -->ROW        text
    *      -->BGCOLOR    text
    *      -->TTYPE      text
    *      -->TEXT       text
    *      -->FONT       text
    *----------------------------------------------------------------------*
    form td2 using style align width col row bgcolor ttype text
            font structure zfont.



    *  <td class=xl49 align=left style='height:21.0pt'>ทดสอบ</td>
      data : lv_class type string,
             lv_align  type string,
             lv_col   type string,
             lv_row   type string,
             lv_bg    type string,
             lv_type type string,
             lv_width type string,
             lv_text type string,
             lv_nnum type p decimals 2,
             lv_xnum type string,
             lv_date type string,
             lv_xdate type string.
      data : lv_size type string,
             lv_color type string,
             lv_face type string,
             lv_td type string,
             lv_etd type string.



      if not style is initial.
        concatenate 'class=' style into lv_class.
      endif.
      if not align is initial.
        concatenate 'style=text-align:' align into lv_align.
      endif.
      if not width is initial.
        concatenate 'width=' width into lv_width.
      endif.
      if not col is initial.
        concatenate 'colspan=' col into lv_col.
      endif.
      if not row is initial.
        concatenate 'rowspan=' row into lv_row.
      endif.
      if not bgcolor is initial.
        concatenate 'background=' bgcolor into lv_bg.
      endif.
    *  case TTYPE
      if ttype = 'NUM' or ttype = 'num'.
        lv_type = 'X:num'.
        lv_nnum = text.
        if lv_nnum < 0.
          lv_nnum = lv_nnum * -1.
          lv_xnum = lv_nnum.

          concatenate  '-' lv_xnum  into lv_xnum.
        else.
          lv_xnum = lv_nnum.
          condense lv_xnum.
        endif.
        concatenate lv_type '=' text-t02 lv_xnum text-t02
        into lv_type.
        lv_text = lv_xnum.

      elseif ttype = 'date' or ttype = 'DATE'.
        lv_type = 'X:String'.
        lv_date = text.
        if lv_date is not initial.
          concatenate lv_date+6(2'.' lv_date+4(2'.' lv_date+0(4into lv_xdate.
        endif.
        if lv_xdate is initial or lv_xdate = '00.00.0000'.
          lv_text = '&nbsp;'.
        else.
          lv_text = lv_xdate.
        endif.

      else.
        lv_type = 'X:String'.
        if text is initial.
          lv_text = '&nbsp;'.
        else.
          lv_text = text.
        endif.
      endif.


      if not font is initial.
        if not font-size is initial.
          concatenate 'size=' font-size into lv_size.
        endif.
        if not font-color is initial.
          concatenate 'color=' font-color into lv_color.
        endif.
        if not font-face is initial.
          concatenate 'face=' font-face into lv_face.
        endif.
        if not font-italic is initial.
          concatenate '<I>' lv_text '</I>' into lv_text.
        endif.
        if not font-bold is initial.
          concatenate '<B>' lv_text '</B>' into lv_text.
        endif.


        concatenate '<font' lv_size lv_color lv_face '>' lv_text '</font>'
        into lv_text.
      endif.

      concatenate '<td' lv_class lv_align lv_width lv_col lv_row lv_bg lv_type '>' lv_text '</td>'
      into gi_excel-line separated by space.

      append gi_excel.
    endform.                    "TD_DESC

    *&---------------------------------------------------------------------*
    *&      Form  TD3
    *&---------------------------------------------------------------------*
    *       text
    *----------------------------------------------------------------------*
    *      -->STYLE      text
    *      -->ALIGN      text
    *      -->WIDTH      text
    *      -->COL        text
    *      -->ROW        text
    *      -->BGCOLOR    text
    *      -->TTYPE      text
    *      -->FORMAT     text
    *      -->TEXT       text
    *      -->FONT       text
    *----------------------------------------------------------------------*
    form td3 using style align width col row bgcolor ttype format text
            font structure zfont.



    *  <td class=xl49 align=left style='height:21.0pt'>ทดสอบ</td>
      data : lv_class type string,
             lv_align  type string,
             lv_col   type string,
             lv_row   type string,
             lv_bg    type string,
             lv_format type string,
             lv_type type string,
             lv_width type string,
             lv_text type string,
             lv_nnum(16type p decimals 2,
             lv_xnum type string,
             lv_date type string,
             lv_xdate type string,
             lv_time type string,
             lv_xtime type char10.
      data : lv_size type string,
             lv_color type string,
             lv_face type string,
             lv_td type string,
             lv_etd type string.



      if not style is initial.
        concatenate 'class=' style into lv_class.
      endif.
      if not align is initial.
        concatenate 'style=text-align:' align into lv_align.
      endif.
      if not width is initial.
        concatenate 'width=' width into lv_width.
      endif.
      if not col is initial.
        concatenate 'colspan=' col into lv_col.
      endif.
      if not row is initial.
        concatenate 'rowspan=' row into lv_row.
      endif.
      if not bgcolor is initial.
        concatenate 'style=background-color:' bgcolor into lv_bg.
      endif.
    *  case TTYPE
      if ttype = 'NUM' or ttype = 'num'.
        lv_type = 'X:num'.
        lv_nnum = text.
        if lv_nnum < 0.
          lv_nnum = lv_nnum * -1.
          lv_xnum = lv_nnum.
    *    write: LV_NNUM TO LV_XNUM.
          concatenate  '-' lv_xnum  into lv_xnum.
          condense lv_xnum.
        else.
          lv_xnum = lv_nnum.
          condense lv_xnum.
        endif.
        concatenate lv_type '=' '"' lv_xnum '"'
        into lv_type.
        lv_text = lv_xnum.

      elseif ttype = 'date' or ttype = 'DATE'.
        lv_type = 'X:String'.
        lv_date = text.
        concatenate lv_date+6(2'.' lv_date+4(2'.' lv_date+0(4into lv_xdate.
        if lv_xdate is initial or lv_xdate = '00.00.0000'.
          lv_text = '&nbsp;'.
        else.
          lv_text = lv_xdate.
        endif.
      elseif ttype = 'time' or ttype = 'TIME'.
        lv_type = 'X:Num'.
        lv_time = text.

        if lv_time is initial or lv_time = '000000'.
          lv_text = '&nbsp;'.
        else.
          write: lv_time to lv_xtime using edit mask '__:__:__'.
          lv_text = lv_xtime.
        endif.
      else.
        lv_type = 'X:String'.
        if text is initial.
          lv_text = '&nbsp;'.
        else.
          lv_text = text.
        endif.
      endif.
      if  not format is initial.
        concatenate 'style=mso-number-format:' format into lv_format.
      endif.

      if not font is initial.
        if not font-size is initial.
          concatenate 'size=' font-size into lv_size.
        endif.
        if not font-color is initial.
          concatenate 'style=color:' font-color into lv_color.
        endif.
        if not font-face is initial.
          concatenate 'face=' font-face into lv_face.
        endif.
    *    color:red;
        if not font-italic is initial.
          concatenate '<I>' lv_text '</I>' into lv_text.
        endif.
        if not font-bold is initial.
          concatenate '<B>' lv_text '</B>' into lv_text.
        endif.


        concatenate '<font' lv_size  lv_face '>' lv_text '</font>'
        into lv_text.
      endif.

      concatenate '<td' lv_class lv_align lv_width lv_col lv_row lv_bg lv_type lv_format lv_color'>' lv_text '</td>'
      into gi_excel-line separated by space.

      append gi_excel.
    endform.                    "TD_DESC

    *&---------------------------------------------------------------------*
    *&      Form  td3_1
    *&---------------------------------------------------------------------*
    *       text
    *----------------------------------------------------------------------*
    *      -->STYLE      text
    *      -->ALIGN      text
    *      -->WIDTH      text
    *      -->COL        text
    *      -->ROW        text
    *      -->BGCOLOR    text
    *      -->TTYPE      text
    *      -->FORMAT     text
    *      -->TEXT       text
    *      -->FONT       text
    *----------------------------------------------------------------------*
    form td3_1 using style align width col row bgcolor ttype format text
            font structure zfont.

      data : lv_class type string,
             lv_align  type string,
             lv_col   type string,
             lv_row   type string,
             lv_bg    type string,
             lv_format type string,
             lv_type type string,
             lv_width type string,
             lv_text type string,
             lv_nnum(16type p decimals 3,
             lv_xnum type string,
             lv_date type string,
             lv_xdate type string,
             lv_time type string,
             lv_xtime type char10.
      data : lv_size type string,
             lv_color type string,
             lv_face type string,
             lv_td type string,
             lv_etd type string.



      if not style is initial.
        concatenate 'class=' style into lv_class.
      endif.
      if not align is initial.
        concatenate 'style=text-align:' align into lv_align.
      endif.
      if not width is initial.
        concatenate 'width=' width into lv_width.
      endif.
      if not col is initial.
        concatenate 'colspan=' col into lv_col.
      endif.
      if not row is initial.
        concatenate 'rowspan=' row into lv_row.
      endif.
      if not bgcolor is initial.
        concatenate 'style=background-color:' bgcolor into lv_bg.
      endif.
    *  case TTYPE
      if ttype = 'NUM' or ttype = 'num'.
        lv_type = 'X:num'.
        lv_nnum = text.
        if lv_nnum < 0.
          lv_nnum = lv_nnum * -1.
          lv_xnum = lv_nnum.

          concatenate  '-' lv_xnum  into lv_xnum.
          condense lv_xnum.
        else.
          lv_xnum = lv_nnum.
          condense lv_xnum.
        endif.
        concatenate lv_type '=' '"' lv_xnum '"'
        into lv_type.
        lv_text = lv_xnum.

      elseif ttype = 'date' or ttype = 'DATE'.
        lv_type = 'X:String'.
        lv_date = text.
        concatenate lv_date+6(2'.' lv_date+4(2'.' lv_date+0(4into lv_xdate.
        if lv_xdate is initial or lv_xdate = '00.00.0000'.
          lv_text = '&nbsp;'.
        else.
          lv_text = lv_xdate.
        endif.
      elseif ttype = 'time' or ttype = 'TIME'.
        lv_type = 'X:Num'.
        lv_time = text.

        if lv_time is initial or lv_time = '000000'.
          lv_text = '&nbsp;'.
        else.
          write: lv_time to lv_xtime using edit mask '__:__:__'.
          lv_text = lv_xtime.
        endif.
      else.
        lv_type = 'X:String'.
        if text is initial.
          lv_text = '&nbsp;'.
        else.
          lv_text = text.
        endif.
      endif.
      if  not format is initial.
        lv_format = 'style=mso-number-format:"0\.0000"' .
      endif.

      if not font is initial.
        if not font-size is initial.
          concatenate 'size=' font-size into lv_size.
        endif.
        if not font-color is initial.
          concatenate 'style=color:' font-color into lv_color.
        endif.
        if not font-face is initial.
          concatenate 'face=' font-face into lv_face.
        endif.
    *    color:red;
        if not font-italic is initial.
          concatenate '<I>' lv_text '</I>' into lv_text.
        endif.
        if not font-bold is initial.
          concatenate '<B>' lv_text '</B>' into lv_text.
        endif.


        concatenate '<font' lv_size  lv_face '>' lv_text '</font>'
        into lv_text.
      endif.

      concatenate '<td' lv_class lv_align lv_width lv_col lv_row lv_bg lv_type lv_format lv_color'>' lv_text '</td>'
      into gi_excel-line separated by space.

      append gi_excel.
    endform.                    "TD_DESC
    *&---------------------------------------------------------------------*
    *&      Form  TD3
    *&---------------------------------------------------------------------*
    *       text
    *----------------------------------------------------------------------*
    *      -->STYLE      text
    *      -->ALIGN      text
    *      -->WIDTH      text
    *      -->COL        text
    *      -->ROW        text
    *      -->BGCOLOR    text
    *      -->TTYPE      text
    *      -->FORMAT     text
    *      -->TEXT       text
    *      -->FONT       text
    *----------------------------------------------------------------------*
    form td3_3 using style align width col row bgcolor ttype format text
            font structure zfont.



    *  <td class=xl49 align=left style='height:21.0pt'>ทดสอบ</td>
      data : lv_class type string,
             lv_align  type string,
             lv_col   type string,
             lv_row   type string,
             lv_bg    type string,
             lv_format type string,
             lv_type type string,
             lv_width type string,
             lv_text type string,
             lv_nnum(15type p decimals 3,
             lv_xnum type string,
             lv_date type string,
             lv_xdate type string.
      data : lv_size type string,
             lv_color type string,
             lv_face type string,
             lv_td type string,
             lv_etd type string.



      if not style is initial.
        concatenate 'class=' style into lv_class.
      endif.
      if not align is initial.
        concatenate 'style=text-align:' align into lv_align.
      endif.
      if not width is initial.
        concatenate 'width=' width into lv_width.
      endif.
      if not col is initial.
        concatenate 'colspan=' col into lv_col.
      endif.
      if not row is initial.
        concatenate 'rowspan=' row into lv_row.
      endif.
      if not bgcolor is initial.
        concatenate 'style=background-color:' bgcolor into lv_bg.
      endif.
    *  case TTYPE
      if ttype = 'NUM' or ttype = 'num'.
        lv_type = 'X:num'.
        lv_nnum = text.
        if lv_nnum < 0.
          lv_nnum = lv_nnum * -1.
          lv_xnum = lv_nnum.
    *    write: LV_NNUM TO LV_XNUM.
          concatenate  '-' lv_xnum  into lv_xnum.
          condense lv_xnum.
        else.
          lv_xnum = lv_nnum.
          condense lv_xnum.
        endif.
        concatenate lv_type '=' '"' lv_xnum '"'
        into lv_type.
        lv_text = lv_xnum.

      elseif ttype = 'date' or ttype = 'DATE'.
        lv_type = 'X:String'.
        lv_date = text.
        concatenate lv_date+6(2'.' lv_date+4(2'.' lv_date+0(4into lv_xdate.
        if lv_xdate is initial or lv_xdate = '00.00.0000'.
          lv_text = '&nbsp;'.
        else.
          lv_text = lv_xdate.
        endif.
      else.
        lv_type = 'X:String'.
        if text is initial.
          lv_text = '&nbsp;'.
        else.
          lv_text = text.
        endif.
      endif.
      if  not format is initial.
        concatenate 'style=mso-number-format:' format into lv_format.
      endif.

      if not font is initial.
        if not font-size is initial.
          concatenate 'size=' font-size into lv_size.
        endif.
        if not font-color is initial.
          concatenate 'style=color:' font-color into lv_color.
        endif.
        if not font-face is initial.
          concatenate 'face=' font-face into lv_face.
        endif.
    *    color:red;
        if not font-italic is initial.
          concatenate '<I>' lv_text '</I>' into lv_text.
        endif.
        if not font-bold is initial.
          concatenate '<B>' lv_text '</B>' into lv_text.
        endif.


        concatenate '<font' lv_size  lv_face '>' lv_text '</font>'
        into lv_text.
      endif.

      concatenate '<td' lv_class lv_align lv_width lv_col lv_row lv_bg lv_type lv_format lv_color'>' lv_text '</td>'
      into gi_excel-line separated by space.
      append gi_excel.
    endform.                    "TD_DESC