Application Development 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: 

Convert a base64Binary file to PDF

Former Member
0 Kudos

Hi Gurus!

I want to convert a base64Binary file to PDF.

Could you please share your inputs.

I have started with function module SSFC_BASE64_DECODE.

Thanks & Regards

Tirumula

1 REPLY 1

former_member203305
Active Contributor
0 Kudos

Hello

Have a look what i did to convert base64 to PDF

  DATA: fic_binario TYPE xstring.

  DATA: string_binario TYPE string.

DATA: BEGIN OF lines OCCURS 100,

        tdline TYPE string.

  DATA: END OF lines.

 

  CALL FUNCTION 'SSFC_BASE64_DECODE'

    EXPORTING

      b64data = twebpdf    " contains the file on base64

    IMPORTING

      bindata = fic_binario.

 

  string_binario = fic_binario.

   DATA: li_contents         TYPE TABLE OF sdokcntbin,

        lw_contents         TYPE sdokcntbin,

        l_file_length       TYPE i,

        l_flag              TYPE c,

        l_off               TYPE i,

        l_len               TYPE i.

   TRY.

    l_len = XSTRLEN( fic_binario ).

    l_file_length = l_len.

     WHILE l_flag IS INITIAL.

       IF l_len LE 1022.

        lw_contents-line = fic_binario+l_off(l_len).

        l_flag = 'X'.

      ELSE.

        lw_contents-line = fic_binario+l_off(1022).

        l_off = l_off + 1022.

        l_len = l_len - 1022.

      ENDIF.

       APPEND lw_contents TO li_contents.

     ENDWHILE.

li_contents is the table on PDF.

Regards