cancel
Showing results for 
Search instead for 
Did you mean: 

how to convert a image into xstring or string or byte format??????

Former Member
0 Kudos

hi all,

In my work i need to upload a photo of an employee into the infotype, for which i use f4_filename FM and get the location of the image from the local system, from there i'm not able to convert that image into any of the formats( XSTRING, STRING or BYTE) if i can convert it into any one of these formats, i can take it from there... i'd appreciate your help.

*- if any one can provide any other information on how to convert a image into other formats i'd appreciate your help.

thanks.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

upload your image, from the desktop, using CL_GUI_FRONTEND_SERVICES, method GUI_UPLOAD, with file type 'BIN' for binary, and put it into an internal table.  I use an internal table defined like:

data: bintab type table of tbl1024.

Once you have done the upload, look at the robust FM list in SCMS* function modules, like SCMS_BINARY_TO_XSTRING, which will convert your binary table to an xstring.  If you are using newer MSOffice files, like docx, etc., be sure to get the length of the file from the desktop and pass that through all your processes...this is critical.  You can get the actual length with method FILE_GET_SIZE of the frontend services class.

As you noted, once you have the xstring, you can do what is needed to archive, etc.

To retrieve, get it back into an internal binary table, and download that with the same class, GUI_DOWNLOAD, etc.

Answers (1)

Answers (1)

Former Member
0 Kudos

hi David, thank you so much for your response, i've been struggling for this for a long time, your answer helped me a lot