Additional Blogs by SAP
cancel
Showing results for 
Search instead for 
Did you mean: 
thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

Introduction

Earlier this week Eddy De Clercq posted a Dreaming of a perfect SDN web log editor describing how he created a template in Macromedia Dreamweaver for creating his weblogs. I found this ironic because I just did receive a copy of Dreamweaver MX 2004. In fact this is just my second weblog created with this tool.

     


Now I didn't just order Dreamweaver for blogging on SDN. I had two ideas in mind. First I wanted to begin to explore development using Flash. More imediately I wanted a tool that would help speed up the design and layout of my BSP applications. I have been using only SE80 to build my BSP applications, which is great for working the BSP extensions, but not so great for heavy JavaScript or plain HTML.


So far I really like the tool for BSP development. But the other day I was exploring and I saw that it had a nice feature for inserting tags. These tags encompass many different environments - ASP, JSP, PHP, etc. But of course my favorite environment, BSP wasn't represented. Well that's exactly what I set out to do. I wanted to create an ABAP program that would download all the available information about BSP extensions in the format the Dreamweaver was expecting. The following is a screen shot of what the end result looks like.


 






















!https://weblogs.sdn.sap.com/weblogs/images/1918/spacer.gif|height=1|alt=|width=416|src=https://weblo...!

!https://weblogs.sdn.sap.com/weblogs/images/1918/spacer.gif|height=1|alt=|width=456|src=https://weblo...!

!https://weblogs.sdn.sap.com/weblogs/images/1918/spacer.gif|height=1|alt=|width=1|src=https://weblogs...!

!https://weblogs.sdn.sap.com/weblogs/images/1918/BSPTags_r1_c1.jpg|id=BSPTags_r1_c1|height=304|alt=|w...!

!https://weblogs.sdn.sap.com/weblogs/images/1918/BSPTags_r1_c2.jpg|id=BSPTags_r1_c2|height=304|alt=|w...!

!https://weblogs.sdn.sap.com/weblogs/images/1918/spacer.gif|height=304|alt=|width=1|src=https://weblo...!

!https://weblogs.sdn.sap.com/weblogs/images/1918/BSPTags_r2_c1.jpg|id=BSPTags_r2_c1|height=190|alt=|w...!

!https://weblogs.sdn.sap.com/weblogs/images/1918/BSPTags_r2_c2.jpg|id=BSPTags_r2_c2|height=190|alt=|w...!

!https://weblogs.sdn.sap.com/weblogs/images/1918/spacer.gif|height=190|alt=|width=1|src=https://weblo...!





The ABAP Program

The program coding of the ABAP program is really quite simply and only requires an understading of the file layout that Dreamweaver is expecting. Our program will start off my asking the user what directory they want to write the output files to. I suggest not writting these directly into the Dreamweaver directories. I only write a partial TagLibraries.vtm file. The contents of the file I create need to be cut and pasted into the original, to avoid losing the delivered tag information.


The ABAP program will then read the information for all the BSP Extensions stored in tables o2taglib, o2tag, and o2tagatt. This will give us all the Extensions, Elements, and Element Attributes. I then create a subdirectory for each Extension. Now we need one file called TagLibraries.vtm. This file serves as sort of index or directory for all the tag libraries. In it we will create a reference for each Extension and every element that extension contains. This entry will point Dreamweaver to the directory and file that contains the detailed information (such as attributes) for each element.


Next up we need to create a vtm file for each BSP element. It is in this file that we will define all the attributes for each element and also link to an HTML page that will contain the attribute input dialog.


Finally for each element we need to create an HTML page. The logic for this page is copied from the templates provided in Dreamweaver. We are just going to parse in our Element and Attribute IDs and set the Required flag.


Once your ABAP program is finished running you should have output in the directory selected that looks like the following:


The Dreamweaver Setup

This part is really quite simply. I went and found my directory where Dreamweaver stores the Tag Library information. The delivered information was in C:Program FilesMacromediaDreamweaver MX 2004ConfigurationTagLibraries. However we don't want to overwrite this information. We want to put our information in the following area: C:Documents and Settings     jungApplication DataMacromediaDreamweaver MX 2004ConfigurationTagLibraries - where tjung is my user account on this machine. In the TagLibaries directory there should be a file called TagLibraries.vtm. We want to take the information that our download program generated by the same name and cut and paste it into the bottom of this file. This will create the "directory entries" for our BSP elements. Then you can cut and paste all the SubDirectories generated for the BSP elements into your TagLibraries directory.


ABAP Source Code

I will end this weblog with the complete source code for the download program that I wrote. Please note that it was developed on 640, but should run on 620 with perhaps only a few modifications. The only thing that I can think of that might cause a problem would be next exceptions added to the CL_GUI_FRONTEND_SERVICES methods. That should be easy to correct in 620.


&----


*& Report  ZESU_BSP_EXT_DOWNLOAD

*&

&----


*&

*&

&----


REPORT  zesu_bsp_ext_download.

DATA: taglib TYPE TABLE OF o2taglib.

FIELD-SYMBOLS: directory_browse

  • EXPORTING

  •    WINDOW_TITLE         = WINDOW_TITLE

  •    INITIAL_FOLDER       = INITIAL_FOLDER

    CHANGING

      selected_folder      = selected_folder

    EXCEPTIONS

      cntl_error           = 1

      error_no_gui         = 2

      not_supported_by_gui = 3

      OTHERS               = 4.

  IF sy-subrc <> 0.

  ENDIF.

  CHECK selected_folder IS NOT INITIAL.

  SELECT * FROM o2taglib INTO TABLE taglib.

  SELECT * FROM o2tag    INTO TABLE tag.

  SELECT * FROM o2tagatt INTO TABLE attrib.

  PERFORM create_directories_for_tags.

  PERFORM create_tab_lib_vtm.

  PERFORM create_tab_vtm.

  PERFORM create_tab_htm.

&----


*&      Form  create_directories_for_tags

&----


  •       text

----


  • -->  p1        text

  • <--  p2        text

----


FORM create_directories_for_tags .

  DATA: directory TYPE string.

  DATA: rc TYPE i.

  LOOP AT taglib ASSIGNING  0.

    ENDIF.

  ENDLOOP.

ENDFORM.                    " create_directories_for_tags

&----


*&      Form  create_tab_lib_vtm

&----


  •       text

----


  • -->  p1        text

  • <--  p2        text

----


FORM create_tab_lib_vtm .

  DATA: output TYPE string_table.

  FIELD-SYMBOLS: gui_download

    EXPORTING

  •      BIN_FILESIZE              = BIN_FILESIZE

      filename                  = filename

  •      FILETYPE                  = 'ASC'

  •      APPEND                    = SPACE

  •      WRITE_FIELD_SEPARATOR     = SPACE

  •      HEADER                    = '00'

  •      TRUNC_TRAILING_BLANKS     = SPACE

  •      WRITE_LF                  = 'X'

  •      COL_SELECT                = SPACE

  •      COL_SELECT_MASK           = SPACE

  •      DAT_MODE                  = SPACE

  •      CONFIRM_OVERWRITE         = SPACE

  •      NO_AUTH_CHECK             = SPACE

  •      CODEPAGE                  = SPACE

  •      IGNORE_CERR               = ABAP_TRUE

  •      REPLACEMENT               = '#'

  •      WRITE_BOM                 = SPACE

  •      TRUNC_TRAILING_BLANKS_EOL = 'X'

  •    IMPORTING

  •      FILELENGTH                = FILELENGTH

    CHANGING

      data_tab                  = output

    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

      not_supported_by_gui      = 22

      error_no_gui              = 23

      OTHERS                    = 24.

  IF sy-subrc <> 0.

  •   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  •              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

  ENDIF.

ENDFORM.                    " create_tab_lib_vtm

&----


*&      Form  create_tab_vtm

&----


  •       text

----


  • -->  p1        text

  • <--  p2        text

----


FORM create_tab_vtm .

  DATA: filename TYPE string.

  DATA: output TYPE string_table.

  FIELD-SYMBOLS: gui_download

        EXPORTING

  •      BIN_FILESIZE              = BIN_FILESIZE

          filename                  = filename

  •      FILETYPE                  = 'ASC'

  •      APPEND                    = SPACE

  •      WRITE_FIELD_SEPARATOR     = SPACE

  •      HEADER                    = '00'

  •      TRUNC_TRAILING_BLANKS     = SPACE

  •      WRITE_LF                  = 'X'

  •      COL_SELECT                = SPACE

  •      COL_SELECT_MASK           = SPACE

  •      DAT_MODE                  = SPACE

  •      CONFIRM_OVERWRITE         = SPACE

  •      NO_AUTH_CHECK             = SPACE

  •      CODEPAGE                  = SPACE

  •      IGNORE_CERR               = ABAP_TRUE

  •      REPLACEMENT               = '#'

  •      WRITE_BOM                 = SPACE

  •      TRUNC_TRAILING_BLANKS_EOL = 'X'

  •    IMPORTING

  •      FILELENGTH                = FILELENGTH

        CHANGING

          data_tab                  = output

        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

          not_supported_by_gui      = 22

          error_no_gui              = 23

          OTHERS                    = 24.

      IF sy-subrc <> 0.

  •   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  •              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

      ENDIF.

    ENDLOOP.

  ENDLOOP.

ENDFORM.                    " create_tab_vtm

&----


*&      Form  create_tab_htm

&----


  •       text

----


  • -->  p1        text

  • <--  p2        text

----


FORM create_tab_htm .

  DATA: filename TYPE string.

  DATA: output TYPE string_table.

  FIELD-SYMBOLS: gui_download

        EXPORTING

  •      BIN_FILESIZE              = BIN_FILESIZE

          filename                  = filename

  •      FILETYPE                  = 'ASC'

  •      APPEND                    = SPACE

  •      WRITE_FIELD_SEPARATOR     = SPACE

  •      HEADER                    = '00'

  •      TRUNC_TRAILING_BLANKS     = SPACE

  •      WRITE_LF                  = 'X'

  •      COL_SELECT                = SPACE

  •      COL_SELECT_MASK           = SPACE

  •      DAT_MODE                  = SPACE

  •      CONFIRM_OVERWRITE         = SPACE

  •      NO_AUTH_CHECK             = SPACE

  •      CODEPAGE                  = SPACE

  •      IGNORE_CERR               = ABAP_TRUE

  •      REPLACEMENT               = '#'

  •      WRITE_BOM                 = SPACE

  •      TRUNC_TRAILING_BLANKS_EOL = 'X'

  •    IMPORTING

  •      FILELENGTH                = FILELENGTH

        CHANGING

          data_tab                  = output

        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

          not_supported_by_gui      = 22

          error_no_gui              = 23

          OTHERS                    = 24.

      IF sy-subrc <> 0.

  •   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  •              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

      ENDIF.

    ENDLOOP.

  ENDLOOP.

ENDFORM.                    " create_tab_htm

</textarea></p>

4 Comments