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

Read PDF file into xstring variable

Former Member
0 Likes
8,830

Hi all,

i would like to read a PDF file on application server and put binary data into a xstring variable.

Ok to read the file with OPEN DATASET instruction, but after how can i concatenate the data into the xstring variable ?

¨

The goal of the following code is to fill the variable lv_xstring with binary data of the PDF file :


DATA: lw_fname   TYPE string VALUE '\\MANSFGRA02\IN\972835_5.PDF',

       lv_length  TYPE i VALUE 100,

       wa_bin     TYPE solix,

       lv_xstring TYPE xstring.

FIELD-SYMBOLS <hex_container> TYPE x.

OPEN DATASET lw_fname FOR INPUT IN BINARY MODE.

DO.

   ASSIGN wa_bin TO <hex_container> CASTING.

   READ DATASET lw_fname INTO <hex_container> LENGTH lv_length.

   IF sy-subrc EQ 0.

* TO DO - PLEASE HELP

   ELSE.

     EXIT.

   ENDIF.

ENDDO.

Thanks for your help.

1 ACCEPTED SOLUTION
Read only

rosenberg_eitan
Active Contributor
3,520

Hi,

Some code:

PARAMETERS: p_file_s TYPE localfile .

DATA: big_string TYPE xstring .

DATA: mess TYPE string .

  OPEN DATASET p_file_s FOR INPUT IN BINARY MODE MESSAGE mess .

  READ DATASET p_file_s INTO big_string .

  CLOSE DATASET p_file_s .

  big_string can be very big.....

   

Regards .

3 REPLIES 3
Read only

rosenberg_eitan
Active Contributor
3,521

Hi,

Some code:

PARAMETERS: p_file_s TYPE localfile .

DATA: big_string TYPE xstring .

DATA: mess TYPE string .

  OPEN DATASET p_file_s FOR INPUT IN BINARY MODE MESSAGE mess .

  READ DATASET p_file_s INTO big_string .

  CLOSE DATASET p_file_s .

  big_string can be very big.....

   

Regards .

Read only

0 Likes
3,520

Oh my God, i'm so stupid...

Thanks for that

Read only

0 Likes
3,520

Hi,

No you are not....

I am older.....

Regards.