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: 

Converting XSTRING into PDF

Former Member
0 Kudos

I have a function module called ZL_CONVERT_OTF (its a custom built one) It has an output importing parameter of type XSTRING, in which the data, comes up from the smartform that's in question, into a variable of type xstring.

Any idea on how to print this XSTRING into a pdf document?

12 REPLIES 12

former_member188685
Active Contributor
0 Kudos

Hi,

i am storing the Binary string in application server.

  open dataset l_in_file for output in binary mode.
  if sy-subrc <> 0.
    raise file_open_output_error.
  endif.
  transfer l_binarystring to l_in_file.
  close dataset l_in_file.

or else you can download the Binary data to PC using download with .pdf extension. filetype as BIN.

Regards

vijay

0 Kudos

what is the string format or type of the variable l_in_file.

0 Kudos

is there any way to convert the xstring to pdf format, not using an intermediate binary format.

0 Kudos

Hi,

l_in_file is of type rlgrap-filename, it is application server filepath.

i am opening the file, and transfering the binary data to application server.the same way you can use GUI_DOWNLOAD the binary string to pdf file.

Regards

vijay

0 Kudos

That's totally deviating from my question...sorry Vijay

But my requirement is completely different. Have u worked with XSTRINGs specifically...

Message was edited by: vijay srikanth

0 Kudos

Hi Vijay,

i am also talking about XSTRINGS only, i did one such. i converted otf to pdf and then pdf to string and then string to binary string .

for otf to pdf

<b>CONVERT_OTF_2_PDF</b>

and from pdf to string

<b>CONVERT_TABLE_TO_STRING</b>

and then string to BINARY STRING

<b>SCMS_STRING_TO_XSTRING</b>

after i get the XSTRING data i am storing the data in application server in binary string format.

Regards

vijay

0 Kudos

also i downloaded the binarystring(xstring) to pc as pdf file , i am able to open it with acrobat reader.

Regards

vijay

0 Kudos

Ok. So u mean the XSTRING is nothing but Binary String?

0 Kudos

Vijay just one more query, what are your parameters to the GUI_DOWNLOAD FM. what parameter ar u passsing as the table. GUI_DOWNLOAD FM needs tables parameter mandatorily, what are you passing in as the tables parameter.

Message was edited by: vijay srikanth

0 Kudos

Hi,

      DATA: BEGIN OF xstring occurs 0,
               xs TYPE Xstring,
            END OF xstring.

DATA: length TYPE I.
 CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
      FILENAME                         = path
      FILETYPE                         = 'BIN'
    IMPORTING
      FILELENGTH                       = length
    TABLES
      DATA_TAB                         = xstring
   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.

Regards

vijay

0 Kudos

the acrobat file wouldn't open up for me properly. also one thing I was unable to find the CONVERT_TABLE_TO_STRING function module. Which version of SAP are you running?

0 Kudos

hI,

I AM WORKING on 4.7 version.

FUNCTION CONVERT_TABLE_TO_STRING.
*"----------------------------------------------------------------------
*"*"Local interface:
*"  IMPORTING
*"     VALUE(I_TABLINE_LENGTH) TYPE  I
*"  EXPORTING
*"     REFERENCE(E_STRING) TYPE  STRING
*"  TABLES
*"      IT_TABLE TYPE  TABLE
*"----------------------------------------------------------------------

  data: l_length type i,
        l_space  type flag.

  loop at it_table.

    if l_space = 'X'.
      concatenate e_string it_table into e_string separated by ' '.
      clear l_space.
    else.
      concatenate e_string it_table into e_string.
    endif.

    l_length = i_tabline_length - 1.
    if it_table+l_length = ' '.
      l_space = 'X'.
    endif.
  endloop.

ENDFUNCTION.

what abt you///

regards

vijay