SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

ABAP Code WebViewer



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> ABAP Dictionary
View previous topic :: View next topic  
Author Message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1640

PostPosted: Sat Sep 08, 2007 7:30 pm    Post subject: ABAP Code WebViewer Reply with quote

ABAP Code WebViewer
Beta Version

Description:
As an ABAP developer, I found it difficult to read ABAP codes shared on web. This utility converts the ABAP Report / FM Code into an HTML file and downloads it on the chosen directory of your PC. Further,developers can share the code on websites by directly sending it in an HTML format.

Create a new ABAP Report and upload the text version of this program.
Create text elements for the new program.
Text Symbols :
001 Choose either a Report or a Function Module
002 Choose Output Directory on your PC
003 Make your code Search Engine Friendly on web.
Selection Text :
P_DESC Program Description
P_KEYW Keywords (Separated by comma)
P_OUTDIR Output Directory
P_PROG Report
P_PROGF Function Module
Check and activate.
Execute and enter selection parameters.

Code:
REPORT  Z_RMTIWARI_ABAP_CODE_WEBVIEWER            .

*----------------------------------------------------------------------*
*       ABAP Code WebViewer Beta Version - Date - 20.03.2005
*----------------------------------------------------------------------*
*       Written By: Ram Manohar Tiwari             
*----------------------------------------------------------------------*
*       Presented By:  http://www.rmtiwari.com 
*----------------------------------------------------------------------*
*  This utility tool converts the ABAP Report / FM Code into an html
*  file and downloads it on the chosen directory of your PC.
*  Further,developers can share the code on websites by directly
*  sending it in an HTML format.
*  The code downloaded by this utility is more readable on web for an
*  ABAP developer as:
*      1. It retains the blue color of comments and documentation with
*         the code and hence HTML version looks exactly like the ABAP
*         editor code.
*
*      2. The generated HTML will be search engine friendly as it will
*         have its own title and meta search keywords. This way search
*         engines can directly find the code on your site. Code Sharer
*         has the option of providing his own < title>  suitable for the
*         program and relevant meta keywords to find it on web.
*
*      3. Just like ABAP editor, viewers can click on a variable to
*         reach its directly at its DATA definition.
*
*      4. Similarly, viewers can click on PERFORM calls to reach
*         directly at the defined FORM routine.
*-----------------------------------------------------------------------
*  This utility is developed on MiniSAP and should be compatible with
*  SAP4.7 version. Though with slight modifications to remove
*  the value added aspects will make it compatible with any versions of
*  SAP.
*-----------------------------------------------------------------------

* SELECTION SCREEN
*-----------------------------------------------------------------------
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE TEXT-001.
PARAMETERS : P_PROG    TYPE TRDIR-name,
             P_PROGF   TYPE TFDIR-funcname.
SELECTION-SCREEN END OF BLOCK b1 .

SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-002.

SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS: P_OUTDIR LIKE rlgrap-filename obligatory.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK B2.

SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE TEXT-003.

PARAMETERS: P_DESC   TYPE PFELINE.

PARAMETERS: P_KEYW   TYPE PFELINE.

SELECTION-SCREEN END OF BLOCK b3 .

*----------------------------------------------------------------------*
* Table declaration
*----------------------------------------------------------------------*
TABLES: TFDIR,
        TRDIR.

*-----------------------------------------------------------------------

data : GV_DIRECTORY LIKE rlgrap-filename,
       GV_FILE_NAME TYPE STRING,
       GV_HTML_FILE_NAME TYPE TRDIR-name.
DATA : BEGIN OF GT_HTML OCCURS 0,
        REC(200) TYPE c,
       END OF GT_HTML.

DATA : GV_HTML_WA        like line of GT_HTML.

*----------------------------------------------------------------------*
* Type declaration
*----------------------------------------------------------------------*
* Type for report
TYPES: BEGIN OF TY_REPORT_WO_INDEX,
       LINE(300),
       END OF TY_REPORT_WO_INDEX.

* Type for Report with line index
TYPES: BEGIN OF TY_REPORT_WITH_INDEX,
       INDEX TYPE i,
       LINE(300),
       END OF TY_REPORT_WITH_INDEX.

*----------------------------------------------------------------------*
* CONSTANTS                                                            *
*----------------------------------------------------------------------*
CONSTANTS : GC_FALSE(1)     TYPE c VALUE ' ',
            GC_TRUE(1)      TYPE c VALUE 'X',
            GC_QUOTES1(1)   TYPE c VALUE '''',
            GC_ASTERIK(1)   TYPE c VALUE '*',
            GC_COMMA(1)     TYPE c VALUE ',',
            GC_QUOTES(1)    TYPE c VALUE '"',
            GC_PERCENT(1)   TYPE c VALUE '%'.

*----------------------------------------------------------------------*
* Data declaration
*----------------------------------------------------------------------*

DATA : GT_REP_TABLE    TYPE  STANDARD TABLE OF TY_REPORT_WO_INDEX WITH
                            NON-UNIQUE DEFAULT KEY INITIAL SIZE 500,
       GV_REP_WA       TYPE TY_REPORT_WO_INDEX,
       GV_REP_WA_NEXT  TYPE TY_REPORT_WO_INDEX.


DATA : GV_PROG_NAME    TYPE TRDIR-name.
*-----------------------------------------------------------------------
* ALV stuff
type-pools: slis.
data: GT_FIELDCAT type SLIS_T_FIELDCAT_ALV,
      GS_LAYOUT   type SLIS_LAYOUT_ALV,
      GT_SORT     type SLIS_T_SORTINFO_ALV.

*----------------------------------------------------------------------*
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_PROG.
  PERFORM GET_REPORT_NAME USING    'P_PROG'
                          CHANGING P_PROG.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_PROGF.
  PERFORM GET_REPORT_NAME USING    'P_PROGF'
                          CHANGING P_PROGF.


AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_OUTDIR.
  PERFORM GET_DIRECTORY_NAME USING    'P_OUTDIR'
                             CHANGING P_OUTDIR.

AT SELECTION-SCREEN.
  PERFORM SELECTION_SCREEN_VALIDATIONS.

START-OF-SELECTION.

* read the report code lines in an internal table
  READ REPORT GV_PROG_NAME INTO GT_REP_TABLE.
  IF SY-subrc < >  0.
    MESSAGE e001(AQ) WITH
           'Code is blank'.
    EXIT.
  ENDIF.


* Read the lines of report one by one and convert to HTML.
  PERFORM CONVERT_CODE_TO_HTML TABLES GT_REP_TABLE
                                      GT_HTML.



  PERFORM PREPARE_FILE_NAME   USING   P_OUTDIR
                                      GV_HTML_FILE_NAME
                           CHANGING   GV_FILE_NAME.

  PERFORM DOWNLOAD_HTML_FILE_ON_PC tables    GT_HTML
                                    using    GV_FILE_NAME.

  PERFORM SHOW_HTML_FILE using GV_FILE_NAME.



END-OF-SELECTION.

*&---------------------------------------------------------------------*
*&      Form  get_report_name
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->   p1        text
*  < --  p2        text
*----------------------------------------------------------------------*
 
FORM get_report_name using    X_REPORT_FIELD_NAME
                     changing Y_REPORT_NAME.


  PERFORM READ_SCREEN_VALUES USING    X_REPORT_FIELD_NAME
                             CHANGING Y_REPORT_NAME.

  IF X_REPORT_FIELD_NAME eq 'P_PROG'.

    CALL FUNCTION 'REPOSITORY_INFO_SYSTEM_F4'
      EXPORTING
        object_type           = 'PROG'
        object_name           = Y_REPORT_NAME
        suppress_selection    = 'X'
        without_personal_list = ' '
      IMPORTING
        object_name_selected  = P_PROG
      EXCEPTIONS
        cancel                = 01.

  ELSEIF X_REPORT_FIELD_NAME eq 'P_PROGF'.
    CALL FUNCTION 'REPOSITORY_INFO_SYSTEM_F4'
      EXPORTING
        object_type           = 'FUNC'
        object_name           = Y_REPORT_NAME
        suppress_selection    = ' '
        without_personal_list = 'X'
      IMPORTING
        object_name_selected  = P_PROGF
      EXCEPTIONS
        cancel                = 01.
  ENDIF.

ENDFORM.                    " get_directory_name

*&---------------------------------------------------------------------*
*&      Form  get_file_name
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->   p1        text
*  < --  p2        text
*----------------------------------------------------------------------*
 
FORM get_directory_name using    X_FILE_FIELD_NAME
                     changing    Y_DIRECTORY_NAME.

  class CL_GUI_FRONTEND_SERVICES definition load.
  data : LV_FILE_PATH type rlgrap-filename,
         LV_FILE_NAME type rlgrap-filename,
         LV_OUTDIR    type string,
         LV_DIRECTORY type string.

  CONSTANTS : LC_WINDOW_TITLE type string
                        value 'Select HTML download folder'.

  PERFORM READ_SCREEN_VALUES USING    X_FILE_FIELD_NAME
                             CHANGING Y_DIRECTORY_NAME.

  LV_DIRECTORY = Y_DIRECTORY_NAME.

  CALL METHOD CL_GUI_FRONTEND_SERVICES=> DIRECTORY_BROWSE
    EXPORTING
      WINDOW_TITLE         = LC_WINDOW_TITLE
      INITIAL_FOLDER       = LV_DIRECTORY
    CHANGING
      SELECTED_FOLDER      = LV_OUTDIR
    EXCEPTIONS
      CNTL_ERROR           = 1
      ERROR_NO_GUI         = 2
      NOT_SUPPORTED_BY_GUI = 3.



  if SY-subrc eq 0.
    P_OUTDIR = LV_OUTDIR.
  endif.
ENDFORM.                    " get_directory_name
*&--------------------------------------------------------------------*
*&      Form  read_screen_values
*&--------------------------------------------------------------------*
*       text
*---------------------------------------------------------------------*
*      --> P_FIELD    text
*      --> P_VALUE    text
*---------------------------------------------------------------------*
 
FORM read_screen_values USING    X_FIELD
                        CHANGING Y_VALUE.

  DATA: LV_DYNPNAME LIKE d020s-prog,
        LV_DYNPNUMB LIKE d020s-dnum.

  DATA: BEGIN OF LT_DYNPVALUETAB OCCURS 1.
          INCLUDE STRUCTURE dynpread.
  DATA: END   OF LT_DYNPVALUETAB.

  LV_DYNPNAME = SY-REPID.
  LV_DYNPNUMB = SY-dynnr.

  REFRESH LT_DYNPVALUETAB.
  LT_DYNPVALUETAB-fieldname = X_FIELD.
  APPEND LT_DYNPVALUETAB.

  CALL FUNCTION 'DYNP_VALUES_READ'
    EXPORTING
      dyname               = LV_DYNPNAME
      dynumb               = LV_DYNPNUMB
    TABLES
      dynpfields           = LT_DYNPVALUETAB
    EXCEPTIONS
      invalid_abapworkarea = 1
      invalid_dynprofield  = 2
      invalid_dynproname   = 3
      invalid_dynpronummer = 4
      invalid_request      = 5
      no_fielddescription  = 6
      invalid_parameter    = 7
      undefind_error       = 8
      double_conversion    = 9
      OTHERS               = 10.
  IF SY-subrc = 0.

    READ TABLE LT_DYNPVALUETAB INDEX 1.
    MOVE: LT_DYNPVALUETAB-fieldvalue TO Y_VALUE.

  ENDIF.

ENDFORM.                    " read_screen_values
*&---------------------------------------------------------------------*
*&      Form  selection_screen_validations
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->   p1        text
*  < --  p2        text
*----------------------------------------------------------------------*
 
FORM selection_screen_validations .
  IF NOT P_PROG  IS INITIAL AND
      NOT P_PROGF IS INITIAL.

    MESSAGE e001(AQ) WITH
    'Please use either program of function module'.
  ELSEIF P_PROG  IS INITIAL AND
         P_PROGF IS INITIAL.
    MESSAGE e001(AQ) WITH
  'Please provide any of the program or function module name'.
  ELSEIF NOT P_PROGF IS INITIAL.
    SELECT SINGLE *
    FROM   TFDIR
    WHERE  funcname = P_PROGF.
    IF SY-subrc EQ 0.
      CONCATENATE TFDIR-pname 'U'(793) tfdir-include INTO GV_PROG_NAME.
      GV_PROG_NAME = gv_prog_name+3(30).
      CONCATENATE P_PROGF '.html' into GV_HTML_FILE_NAME.
    ELSE.
      MESSAGE e001(AQ) WITH
    'Function module does not exit'.
    ENDIF.
  ELSE.
    SELECT SINGLE *
    FROM TRDIR
    WHERE name = P_PROG.
    IF SY-subrc NE 0.
      MESSAGE e001(AQ) WITH
     'This Report does not exist'.
    ELSE.
      GV_PROG_NAME = P_PROG.
      CONCATENATE P_PROG '.html' into GV_HTML_FILE_NAME.
    ENDIF.
  ENDIF.

ENDFORM.                    " selection_screen_validations

*&--------------------------------------------------------------------*
*&      Form  prepare_file_name
*&--------------------------------------------------------------------*
*       text
*---------------------------------------------------------------------*
*      --> x_directory    text
*      --> x_program_name text
*      --> y_file_name    text
*---------------------------------------------------------------------*
 
FORM prepare_file_name USING X_DIRECTORY
                             X_FILE
                    CHANGING Y_FILE_NAME.

  CONCATENATE X_DIRECTORY '\' X_FILE into Y_FILE_NAME.



ENDFORM.                    " prepare_file_name
*&---------------------------------------------------------------------*
*&      Form  download_html_file_on_pc
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->   p1        text
*  < --  p2        text
*----------------------------------------------------------------------*
 
FORM download_html_file_on_pc tables   YT_DOWNLOAD
                              using    X_OUTFILE type string.


* Use gui_download if file is located on the local PC.
* WS_download only works in foreground
  IF SY-batch EQ 'X'.
    MESSAGE e001(AQ) WITH
   'This program cannot be executed in background'.
*   ERROR: Unable to download locally stored files when running in
*   background
  ELSE.

    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
        FILENAME                = X_OUTFILE
        FILETYPE                = 'ASC'
      TABLES
        DATA_TAB                = YT_DOWNLOAD
      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.
* Status of download
    CASE SY-subrc.
      WHEN 0.
        MESSAGE I002(AQ) WITH
        'Code converted to HTML and downloaded as ' X_OUTFILE.

      WHEN OTHERS.
*        Upload unsuccessful - error message
        MESSAGE ID SY-MSGID TYPE 'E' NUMBER SY-MSGNO
           WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDCASE.
  ENDIF.

ENDFORM.                    " download_html_file_on_pc
*&---------------------------------------------------------------------*
*&      Form  convert_code_to_html
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      --> P_GT_REP_TABLE  text
*      --> P_GT_HTML  text
*----------------------------------------------------------------------*
 
FORM convert_code_to_html  TABLES XT_REP_TABLE
                                  YT_HTML.

  DEFINE add_html.
    YT_HTML = &1.
    APPEND YT_HTML.

  END-OF-DEFINITION.
  DATA : LV_NEXT_LINE_INDEX  type i.
  DATA : LV_REP_WA_CAPS      type TY_REPORT_WO_INDEX,
         LV_INLINE_COMMENT   type TY_REPORT_WO_INDEX,
         LV_FORM_COUNTER(4)  type n,
         LV_ANCHOR(4)        type n.

  DATA : LT_FORM_INDEX type standard table of TY_REPORT_WITH_INDEX,
         LT_FORM_INDEX_WA like line of lt_form_index,
         LV_FORM_NAME(72) type c,
         LV_STRING(72)    type c.


* Add Header to HTML
  add_html '< HTML> '.
  add_html '< head> '.
  add_html '< title> '.
  add_html 'ABAP Code WebViewer by www.rmtiwari.com'.
  add_html ' View :'.
  add_html GV_PROG_NAME.
  add_html '< /title> '.
  add_html ' '.
  add_html '< meta name="description"'.
  add_html ' content="'.
  add_html P_DESC.
  add_html '"> '.
  add_html '< meta name="keywords"'.
  add_html 'content="' .
  add_html 'www.rmtiwari.com,ABAP Code WebViewer,ABAP Code,'.
  add_html P_KEYW .
  add_html '"> '.

  add_html '< link type="text/css"> '.
  add_html '< /head> '.
  add_html '< BODY> '.
  add_html '< PRE> '.


  LOOP AT XT_REP_TABLE INTO GV_REP_WA.

*    TRANSLATE gv_rep_wa TO UPPER CASE.

*   Modify words in ABAP code which are tags for HTML.
    REPLACE '< ' with '< ' into GV_REP_WA.
    REPLACE '> ' with '> ' into GV_REP_WA.

*   For Comments
    IF GV_REP_WA(1) eq GC_ASTERIK.
      concatenate '< FONT COLOR="BLUE"> ' GV_REP_WA ''
             INTO YT_HTML.
      add_html YT_HTML.

*   For Code Lines.
    ELSE.

*     Remove inline comments
      SPLIT GV_REP_WA at '"' into LV_REP_WA_CAPS LV_INLINE_COMMENT.
      TRANSLATE LV_REP_WA_CAPS TO UPPER CASE.
      SHIFT LV_REP_WA_CAPS LEFT  DELETING LEADING  SPACE.
*     Replace Form routines and performs with anchors .
      if LV_REP_WA_CAPS(7) eq 'PERFORM'.

        SPLIT lv_rep_wa_caps+6 at SPACE
         into LV_INLINE_COMMENT
              LT_FORM_INDEX_WA-line LV_INLINE_COMMENT.
        REPLACE '.' with '' into LT_FORM_INDEX_WA-line.

        READ TABLE LT_FORM_INDEX into LT_FORM_INDEX_WA
        with key LINE = LT_FORM_INDEX_WA-line.
        if SY-subrc eq 0.
          LV_ANCHOR = LT_FORM_INDEX_WA-index.
        else.
*               Populate form index table
          LV_FORM_COUNTER = lv_form_counter + 1.
          LV_ANCHOR       = LV_FORM_COUNTER.
          LT_FORM_INDEX_WA-index =  LV_FORM_COUNTER.

          append LT_FORM_INDEX_WA to lt_form_index.
        endif.

        CONCATENATE '< A HREF=' '"#F' LV_ANCHOR '"> '
               INTO YT_HTML.

        CONCATENATE YT_HTML GV_REP_WA into yt_html.
        concatenate LT_FORM_INDEX_WA-line '< /A> ' into LV_STRING.
        replace LT_FORM_INDEX_WA-line in YT_HTML
           with LV_STRING IGNORING CASE .
        add_html YT_HTML.

      ELSE.
        IF LV_REP_WA_CAPS(4) eq 'FORM'.

          SPLIT lv_rep_wa_caps+3 at SPACE
          into LV_INLINE_COMMENT LV_FORM_NAME lv_inline_comment.

          READ TABLE LT_FORM_INDEX into LT_FORM_INDEX_WA
          with key LINE = LV_FORM_NAME.
          if SY-subrc eq 0.
            LV_ANCHOR = LT_FORM_INDEX_WA-index.
            CONCATENATE '< A NAME="F' LV_ANCHOR '">  '
                   INTO YT_HTML.
            add_html YT_HTML.
          endif.
        endif.


        add_html GV_REP_WA.

      endif.
    ENDIF.
  ENDLOOP.

* Close HTML Tags
  add_html '< /PRE> '.
  add_html '< /BODY> '.
  add_html '< /HTML> '.


*--------------------------------------------------------
* Write Anchors for Variables.

  DATA : LT_VAR_LIST type standard table of RSYMB with header LINE.
  DATA : LV_VAR_ANCHOR(200) type c,
         LV_VAR_NUMBER(4) type n,
         LV_VARIABLE(200)  type c.

* Type for Report with line index
  TYPES: BEGIN OF TY_VAR_INDEX,
         INDEX TYPE i,
         LINE(300),
         FIRST_TIME,
         END OF TY_VAR_INDEX.

  DATA : LT_VAR_INDEX type standard table of TY_VAR_INDEX,
         LT_VAR_INDEX_WA type TY_VAR_INDEX,
         LV_FIRST_TIME type C,
         LV_LENGTH     type i,
         LV_LINE_LENGTH     type i.

  LV_FIRST_TIME = 'X'.
* Get Variables list.
  LOAD REPORT GV_PROG_NAME  PART 'SYMB' INTO LT_VAR_LIST.

  LOOP AT YT_HTML INTO GV_REP_WA.
    LOOP AT LT_VAR_LIST.
      SEARCH LT_VAR_LIST-TXOF FOR '%'.
      if SY-subrc eq 0  or
         GV_REP_WA(5) eq '< FONT'.
        continue.
      endif.
      READ TABLE LT_VAR_INDEX into LT_VAR_INDEX_WA
      with key LINE = LT_VAR_LIST-TXOF.
      if SY-subrc eq 0.
        LV_FIRST_TIME = LT_VAR_INDEX_WA-first_time.
        LV_VAR_NUMBER = LT_VAR_INDEX_WA-index.
      else.
        LV_FIRST_TIME = 'X'.
        DESCRIBE TABLE LT_VAR_INDEX lines LV_VAR_NUMBER.
        LT_VAR_INDEX_WA-index = LV_VAR_NUMBER.
        LT_VAR_INDEX_WA-line  = LT_VAR_LIST-TXOF.
        LT_VAR_INDEX_WA-first_time  = 'X'.
        APPEND LT_VAR_INDEX_WA to lt_var_index.
      endif.

      if LV_FIRST_TIME eq 'X'.

        concatenate '< A NAME="' LV_VAR_NUMBER '"> ' LT_VAR_LIST-TXOF
        '< /A> '
        into LV_STRING.

      else.
        concatenate '< A HREF="#' LV_VAR_NUMBER '"> ' LT_VAR_LIST-TXOF
        '< /A> '
        into LV_STRING.
      endif.

      concatenate LT_VAR_LIST-TXOF ' ' into LV_VARIABLE
      separated by SPACE.

      SEARCH GV_REP_WA FOR LV_VARIABLE .
      IF SY-subrc eq 0.
        LV_LENGTH = SY-fdpos - 1.
        IF LV_LENGTH > = 0 .
          CHECK gv_rep_wa+lv_length(1) eq ' ' or
                gv_rep_wa+lv_length(1) eq ':'.
        ENDIF.

        LV_LENGTH = strlen( LV_VARIABLE ) + SY-fdpos.
        LV_LINE_LENGTH = strlen( GV_REP_WA ).
        IF LV_LENGTH le LV_LINE_LENGTH .
        CHECK gv_rep_wa+lv_length(1) eq ' ' or
              gv_rep_wa+lv_length(1) eq '.' or
              gv_rep_wa+lv_length(1) eq '(' or
              gv_rep_wa+lv_length(1) eq '-' or
              gv_rep_wa+lv_length(1) eq ','.
        ENDIF.

        CASE LV_VARIABLE.
          WHEN 'BLOCK' OR 'BEGIN' OR 'END'.
            SEARCH GV_REP_WA FOR 'OF BLOCK'.
            CHECK SY-subrc ne 0.

          WHEN 'WITH' OR 'FRAME' OR 'TITLE'..
            SEARCH GV_REP_WA FOR 'WITH FRAME TITLE'.
            CHECK SY-subrc ne 0.

          WHEN 'LINE' OR 'BEGIN' OR 'END'.
            SEARCH GV_REP_WA FOR 'OF LINE'.
            CHECK SY-subrc ne 0.
            SEARCH GV_REP_WA FOR 'LIKE LINE OF'.
            CHECK SY-subrc ne 0.

          WHEN 'PARAMETERS'.
            SEARCH GV_REP_WA FOR 'PARAMETERS'.
            CHECK SY-subrc ne 0.



        ENDCASE.

        REPLACE LT_VAR_LIST-TXOF in GV_REP_WA with LV_STRING
                IGNORING CASE .
        if SY-subrc eq 0.
          LT_VAR_INDEX_WA-FIRST_TIME = ' '.
          MODIFY LT_VAR_INDEX
          from LT_VAR_INDEX_WA transporting FIRST_TIME
          where LINE = LT_VAR_LIST-TXOF.

          Modify YT_HTML from GV_REP_WA.

        endif.
      endif.
    ENDLOOP.

  ENDLOOP.
*--------------------------------------------------------

ENDFORM.                    " convert_code_to_html
*&---------------------------------------------------------------------*
*&      Form  show_html_file
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      --> X_FILE_NAME  text
*----------------------------------------------------------------------*
 
FORM show_html_file  USING    X_FILE_NAME.

data : LV_URL(200) type c.

LV_URL = X_FILE_NAME.
CALL FUNCTION 'CALL_BROWSER'
  EXPORTING
    URL                          = LV_URL.


ENDFORM.                    " show_html_file
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> ABAP Dictionary All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG.
Every effort is made to ensure content integrity. Use information on this site at your own risk.