Skip to Content
author's profile photo Former Member
Former Member

Error while converting the image into xstring

Hi Gurus,

I am using the below code in portal to retrive the xstring data of image in debug mode when i am trying to save the xstring data in jpg format using (binary, binary with code page, ascii format) i am not getting the actual image. can anybody help me out to sort the problem

*"----------------------------------------------------------------------
*"*"Local Interface:
*"  IMPORTING
*"     VALUE(DOCUMENT_ID) LIKE  SOFOLENTI1-DOC_ID
*"     VALUE(FILTER) LIKE  SOFILTERI1 STRUCTURE  SOFILTERI1 DEFAULT
*"       'X '
*"     VALUE(OBJTP) TYPE  SO_OBJ_TP
*"     VALUE(OBJYR) TYPE  SO_OBJ_YR
*"     VALUE(OBJNO) TYPE  SO_OBJ_NO
*"  EXPORTING
*"     VALUE(DOCUMENT_DATA) LIKE  SOFOLENTI1 STRUCTURE  SOFOLENTI1
*"     VALUE(XSTRING_DATA) TYPE  XSTRING
*"     VALUE(V_LEN_NUM) TYPE  I
*"     VALUE(STRING_DATA) TYPE  STRING
*"  EXCEPTIONS
*"      DOCUMENT_ID_NOT_EXIST
*"      OPERATION_NO_AUTHORIZATION
*"      X_ERROR
*"----------------------------------------------------------------------
DATA: V_LEN TYPE SO_OBJ_LEN.
Data: OBJECT_HEADER type TABLE OF SOLISTI1,
      OBJECT_CONTENT TYPE TABLE OF SOLISTI1.
*BREAK-POINT.
*clearing the variables.
CLEAR: XSTRING_DATA, V_LEN,V_LEN_NUM.
*Reading object in binary
    CALL FUNCTION 'SO_DOCUMENT_READ_API1'
         EXPORTING
              DOCUMENT_ID                = DOCUMENT_ID
              FILTER                     = FILTER
         IMPORTING
              DOCUMENT_DATA              = DOCUMENT_DATA
         TABLES
              OBJECT_HEADER              = OBJECT_HEADER
              OBJECT_CONTENT             = OBJECT_CONTENT
         EXCEPTIONS
              DOCUMENT_ID_NOT_EXIST      = 999
              OPERATION_NO_AUTHORIZATION = 21
              COMMUNICATION_FAILURE      = 71
              SYSTEM_FAILURE             = 72
              OTHERS                     = 4.

*Determining length of the object.
SELECT SINGLE OBJLEN
       FROM SOOD INTO V_LEN
       WHERE OBJTP = OBJTP AND
             OBJYR = OBJYR AND
             OBJNO = OBJNO.
V_LEN_NUM = V_LEN.
*conversion to xstring from binary.
CALL FUNCTION 'SCMS_BINARY_TO_XSTRING'
  EXPORTING
    INPUT_LENGTH       = V_LEN_NUM
 IMPORTING
   BUFFER             = XSTRING_DATA
  TABLES
    BINARY_TAB         = OBJECT_CONTENT.
ENDFUNCTION.

Looking forward for your kind replies.

Regards

Rajesh

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on May 10, 2011 at 11:17 AM

    Hi Rajesh,

    check the link

    image [string] to xstring conversion

    Regards,

    Chinna

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on May 12, 2011 at 06:24 AM

    Hi Rajesh,

    Check this link

    byte length in xstring to binary conversion is not getting as expected

    and close this thread

    Regards

    S.Janagar

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.