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

Convert Rawstring to HTML

Former Member
0 Likes
1,944

Hi Gurus, I want to convert the RAWSTRING to HTML Format..  Is there any Function modules i can use ?  Or Using codes ?

i have tried using the below FM's

FPCOMP_CREATE_PDF_FROM_SPOOL (getting RAWSTRING)

then SCMS_XSTRING_TO_BINARY

then SCMS_BINARY_TO_STRING

thenVB_CP_CONVERT_STRING_2_ITF

then CONVERT_ITF_TO_HTML.. ( In this step i dont know how to pass the input for THEAD i.e i_header in Import Parameters.

Is it the right way that which i am proceeding? if any other easy way please post it!!!!

this is the code:

* * Function module to retrieve Spool attributes

      CALL FUNCTION 'RSPO_GET_ATTRIBUTES_SPOOLJOB'

      EXPORTING

        rqident           = rqident

*    RQIN              =

*    WITH_TOC          =

      IMPORTING

        rq                = tsp01attr

       TABLES

         attributes        = dummy

*  EXCEPTIONS

*    NO_SUCH_JOB       = 1

*    OTHERS            = 2

               .

        IF sy-subrc = 0.

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

*   *  Function module to retrieve part attributes from spool

          CALL FUNCTION 'RSTS_GET_ATTRIBUTES'

            EXPORTING

              client        = tsp01attr-rqo1clie

              name          = tsp01attr-rqo1name

            IMPORTING

              size          = spoolattr-tmssize

              stotyp        = spoolattr-temselocat

              noof_parts    = spoolattr-tmsparts

              charco        = spoolattr-codepage

              lang          = spoolattr-langu

            EXCEPTIONS

              fb_error      = 1

              fb_rsts_other = 2

              no_object     = 3

              no_permission = 4

              OTHERS        = 5.

            IF sy-subrc = 0.

*     * Assigning temporary variable - Data type conversion

              c_part = spoolattr-tmsparts.

              partnum = c_part.

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

*     * Converting Spool to PDF

              CALL FUNCTION 'FPCOMP_CREATE_PDF_FROM_SPOOL'

                EXPORTING

                  i_spoolid               = rqident

                  i_partnum               = partnum

               IMPORTING

                 e_pdf                   = e_pdf

*        E_RENDERPAGECOUNT       =

*        E_PDF_FILE               = e_pdf_file

*      EXCEPTIONS

*        ADS_ERROR               = 1

*        USAGE_ERROR             = 2

*        SYSTEM_ERROR            = 3

*        INTERNAL_ERROR          = 4

*        OTHERS                  = 5

                        .

*

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

** HTML Conversion

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

data : output_length TYPE i.

             CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'

               EXPORTING

                 buffer                = E_PDF

*               APPEND_TO_TABLE       = ' '

              IMPORTING

                OUTPUT_LENGTH         = output_length

               tables

                 binary_tab            = binary_tab

           .

*******************************************************************************

data : TEXT_BUFFER TYPE  STRING,

        oup_length TYPE i .

CALL FUNCTION 'SCMS_BINARY_TO_STRING'

   EXPORTING

     input_length        = output_length

*   FIRST_LINE          = 0

*   LAST_LINE           = 0

*   MIMETYPE            = ' '

*   ENCODING            =

  IMPORTING

    TEXT_BUFFER         = TEXT_BUFFER

    OUTPUT_LENGTH       = oup_length

   tables

     binary_tab          = binary_tab

* EXCEPTIONS

*   FAILED              = 1

*   OTHERS              = 2

           .

******************************************************************************

data et_table TYPE STANDARD TABLE OF tline.

CALL FUNCTION 'VB_CP_CONVERT_STRING_2_ITF'

   EXPORTING

     i_string       = text_buffer

   tables

     et_table       = et_table

           .

******************************************************************************

data : f_oup_table TYPE STANDARD TABLE OF HTMLLINE,

        e_html_text TYPE xstring.

CALL FUNCTION 'CONVERT_ITF_TO_HTML'

   EXPORTING

*   I_CODEPAGE               =

     i_header                 = ????? Don know What to pass ????   

*   I_PAGE                   = ' '

*   I_WINDOW                 = ' '

*   I_SYNTAX_CHECK           = ' '

*   I_REPLACE                = 'X'

*   I_PRINT_COMMANDS         = ' '

*   I_HTML_HEADER            = 'X'

*   I_FUNCNAME               = ' '

*   I_TITLE                  = ' '

*   I_BACKGROUND             = ' '

*   I_BGCOLOR                = ' '

*   I_UNESCAPE_FORMATS       =

*   I_ESCAPE_SPACES          = ' '

*   I_ENCODING               = ' '

  IMPORTING

    E_HTML_TEXT              = e_html_text

   tables

     t_itf_text               = et_table

     t_html_text              = f_oup_table

*   T_CONV_CHARFORMATS       =

*   T_CONV_PARFORMATS        =

* EXCEPTIONS

*   SYNTAX_CHECK             = 1

*   REPLACE                  = 2

*   ILLEGAL_HEADER           = 3

*   OTHERS                   = 4

           .

IF sy-subrc <> 0.

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

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

ENDIF.

4 REPLIES 4
Read only

Former Member
0 Likes
1,214

hello

can you please also explain the requirement, as to what you are doing or need ?

best regards,

swanand

Read only

0 Likes
1,214

Requirement is Converting the RAWSTRING to HTML

Using - FPCOMP_CREATE_PDF_FROM_SPOOL (getting RAWSTRING in the output E_PDF )

Want to convert this Output into HTML...

Thanks for the Interest!!! Swanand Lakka..

Read only

0 Likes
1,214

please check if this FM helps.

WWW_ITAB_TO_HTML

regards,

swanand

Read only

0 Likes
1,214

To use the above FM i need to populate the data into ITAB.. but not able to retrieve the data content of the spool request number into ITAB..

Need suggestions!