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

SCMS_BINARY_TO_STRING

Former Member
0 Likes
8,554

Hi ABAP Experts,

Requirement :

Need to Convert Binary Data(PDF data or DOC data or TXT data) into String.

Procedure:

lt_phio_content is a binary table of Table Type SDOKCNTBIN

CALL FUNCTION 'SCMS_BINARY_TO_STRING'

      EXPORTING

        input_length  = v_fsize

      IMPORTING

        text_buffer   = lv_string

      TABLES

        binary_tab    = lt_phio_content

      EXCEPTIONS

        failed        = 1

        OTHERS        = 2.

Problem:

I am not able to retrieve exact content of RTF or DOC or PDF binary data(Table type SDOKCNTBIN) with this Function Module.

Following is the output string when RTF binary data is passed

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\froman\fcharset0 Times New Roman;}{\f1\fswiss\fcharset0 Arial;}{\f2\fswiss\fcharset0 Tahoma;}}##{\colortbl ;\red0\green0\blue0;\red255\green255\blue255;}##{\stylesheet{ Normal;}{\s1 heading 1;}{\s2 he

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

But I can able to get the correct string when binary data of text doc is passed with this function module.

Please provide me more details on this function module to retrieve correct string when RTF or DOC or PDF binary data is passed.

Thank You,

Swetha.C


7 REPLIES 7
Read only

amit_khare
Active Contributor
0 Likes
4,216

You may check this thread http://scn.sap.com/thread/2130257

Regards,

Amit Khare

Read only

Former Member
0 Likes
4,216

works for me when I upload via CL_GIU_FRONTEND_SERVICES - method GUI_UPLOAD using "BIN" and into a binary table described like itab type table of tbl1024.  Then I get the actual file size with another method of the class...

are you certain that you binary table is correct after your upload or import from apps server?

Read only

Ryan-Crosby
Active Contributor
0 Likes
4,216

Hi Swetha,

What exactly is incorrect with the RTF output that you are getting?  When I'm looking at that the only characters that look out of place are the '#' characters but I can say with 99.9% certainty that these represent carriage return/newline pairs because they are not displayable characters. 

Regards,

Ryan Crosby

Read only

Clemenss
Active Contributor
0 Likes
4,216

Hi,

"Convert Binary Data(PDF data or DOC data or TXT data) into String."

Binary is binary, String is character (character length depends on unicode).

You can convert binary data to XSTRING using class

cl_bcs_convert

Regards

Clemens

Read only

Former Member
0 Likes
4,216

Hi ABAP Experts,

I am using function module BBP_PROCDOC_GETDETAIL to retrieve attachments in PHIO_CONTENT table of ET_ATTACH exporting parameters.

PHIO_CONTENT is of table type BBPT_ATT_CONT(line type = SDOKCNTBIN)

Using FM SCMS_BINARY_TO_STRING,

1. We are able to convert the text document binary data retrieved from  PHIO_CONTENT to string exactly as it is in the document.

2. We are not able to convert the PDF binary data retrieved from PHIO_CONTENT to string exactly as it is in the PDF document.

Can any one please help me out of this problem to retrieve PDF data as string with this FM (SCMS_BINARY_TO STRING) other wise suggest me how to convert the PDF binary data retrieved from BBPT_ATT_CONT to string format.

Thank You,

Swetha.C

Read only

Former Member
0 Likes
4,216

I only deal with PDF in XSTRING and binary tables.  I don't know what you would get with converting to a string, but I doubt it would be readable or usable.

Read only

Former Member
0 Likes
4,216

Hi Break Point,

Yeah. You are correct that PDF deals with binary data.

But I need to display the PDF data in my adobe form(created in SFP Tcode).

Thank You,

Swetha.C